Filecoin.ChainGetBlockMessages - Filecoin
Example code for the Filecoin.ChainGetBlockMessages JSON RPC method. Complete guide on how to use Filecoin.ChainGetBlockMessages JSON RPC in GetBlock Web3 documentation.
This method returns the messages contained in a block, split into BLS-signed and secp256k1-signed messages, along with their CIDs.
Parameters
cid
object
Yes
Block CID, as an object with a / key
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc": "2.0", "method": "Filecoin.ChainGetBlockMessages", "params": [{"/": "bafy2bzacecdkonmhngylnnhrk4azkg2wkgcm6cnm5qn5sk4ww5cszjlvkgkd6"}], "id": "getblock.io"}'const response = await fetch('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'Filecoin.ChainGetBlockMessages',
params: [{"/": "bafy2bzacecdkonmhngylnnhrk4azkg2wkgcm6cnm5qn5sk4ww5cszjlvkgkd6"}],
id: 'getblock.io'
})
});
const data = await response.json();
console.log(data.result);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'Filecoin.ChainGetBlockMessages',
'params': [{"/": "bafy2bzacecdkonmhngylnnhrk4azkg2wkgcm6cnm5qn5sk4ww5cszjlvkgkd6"}],
'id': 'getblock.io'
}
)
print(response.json()['result'])Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": {
"BlsMessages": [
{
"Version": 0,
"To": "f3ukhj6tpkgxjknu54opiaej2vrjz7nh7gzodkqlhpfphc6gxkogzmojv2cnlpgcuwkvnyhloctnc6lmlvceuq",
"From": "f3ukhj6tpkgxjknu54opiaej2vrjz7nh7gzodkqlhpfphc6gxkogzmojv2cnlpgcuwkvnyhloctnc6lmlvceuq",
"Nonce": 42,
"Value": "1000000000000000000",
"Method": 0
}
],
"SecpkMessages": [],
"Cids": [
{
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
}
]
}
}Response Parameters
BlsMessages
array
BLS-signed messages in the block
SecpkMessages
array
secp256k1-signed messages in the block
Cids
array
CIDs of all messages in the block
Use Cases
Message Indexing: Read all messages in a block
Transfer Tracking: Scan a block for FIL transfers
Method Analysis: Classify messages by their actor method
Explorers: List a block's messages
Error Handling
-32602
Invalid params
A parameter is missing or has the wrong type or format
1
Actor not found
The address or actor does not exist in the requested tipset
-32603
Internal error
The node failed to process the request
Was this helpful?