Filecoin.ChainGetMessage - Filecoin

This method returns a single on-chain message by its CID, including the sender, recipient, value in attoFIL, gas parameters, and the actor method invoked.

Parameters

ParameterTypeRequiredDescription
cidobjectYesMessage CID, as an object with a / key

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{"jsonrpc": "2.0", "method": "Filecoin.ChainGetMessage", "params": [{"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"}], "id": "getblock.io"}'

example.js

javascriptconst 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.ChainGetMessage',
        params: [{"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"}],
        id: 'getblock.io'
    })
});

const data = await response.json();
console.log(data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'Filecoin.ChainGetMessage',
        'params': [{"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"}],
        'id': 'getblock.io'
    }
)

print(response.json()['result'])

Response

json{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "Version": 0,
        "To": "f1ne72cbn6r55wea7ifjv4ypyti7t2df5dumsjhzq",
        "From": "f3ukhj6tpkgxjknu54opiaej2vrjz7nh7gzodkqlhpfphc6gxkogzmojv2cnlpgcuwkvnyhloctnc6lmlvceuq",
        "Nonce": 42,
        "Value": "1000000000000000000",
        "GasLimit": 2200000,
        "GasFeeCap": "101520",
        "GasPremium": "100178",
        "Method": 0,
        "Params": null
    }
}

Response Parameters

FieldTypeDescription
TostringRecipient address
FromstringSender address
ValuestringAmount transferred, in attoFIL (1 FIL = 10^18 attoFIL)
GasLimitintegerMaximum gas units the message may consume
MethodintegerActor method number invoked (0 for a plain send)

Use Cases

  • Transaction Views: Render a message's parties and value
  • Payment Confirmation: Read a transfer's amount and recipient
  • Gas Analysis: Inspect a message's gas parameters
  • Actor Calls: Read which actor method a message invoked

Error Handling

Error CodeMessageDescription
-32602Invalid paramsA parameter is missing or has the wrong type or format
1Actor not foundThe address or actor does not exist in the requested tipset
-32603Internal errorThe node failed to process the request