Filecoin
Filecoin API is available on Web3 API platform (opens in a new tab).
Filecoin is a peer-to-peer network that stores files, with built-in economic incentives and cryptography to ensure files are stored reliably over time.
Filecoin is built on top of the same software powering IPFS (opens in a new tab) protocol, which is a peer-to-peer distributed storage network that leverages content addressing (opens in a new tab) to allow permanent references to the data, and avoids relying on specific devices or cloud servers for addressing the content. Filecoin is different from IPFS because it has an incentive layer on top to incentivize contents to be reliably stored and accessed.
In order for your Web3 application to interact with Filecoin — either by reading blockchain data or sending transactions to the network — it must connect to a Filecoin node. Developers interact with the blockchain using the methods provided by the API.
The API interaction follows the JSON-RPC (opens in a new tab) which is a stateless, light-weight remote procedure call (RPC) protocol. It defines several data structures and the rules around their processing. It is transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in other message-passing environments. It uses JSON (RFC 4627) as data format.
Filecoin API supports interaction via the following methods:
Filecoin EVM methods
web3_clientVersion
— returns the current client version.net_version
— returns the current network ID.net_listening
— returns true if client is actively listening for network connections.eth_protocolVersion
— returns the current protocol version.eth_gasPrice
— returns the current price per gas in wei.eth_accounts
— returns a list of addresses owned by client.eth_blockNumber
— returns the number of most recent block.eth_getBalance
— returns the balance of the account specified by address.eth_getStorageAt
— returns the value from a storage position at an address specified.eth_getTransactionCount
— returns the number of transactions sent from an address.eth_getBlockTransactionCountByHash
— returns the number of transactions in a block specified by block hash.eth_getBlockTransactionCountByNumber
— returns the number of transactions in the block specified by number.eth_getCode
— returns code at an address specified.eth_sendRawTransaction
— creates a new message call transaction or a contract creation for signed transactions.eth_call
— executes a new message call immediately without creating a transaction on the blockchain.eth_estimateGas
— generates and returns an estimate of how much gas is necessary to allow the transaction to complete.eth_getBlockByHash
— returns information for the block specified by block hash.eth_getBlockByNumber
— returns information for the block specified by block number.eth_getTransactionByHash
— returns information on a transaction specified by transaction hash.eth_getTransactionReceipt
— returns the receipt of a transaction by transaction hash.eth_getLogs
— returns logs matching the parameters specified.
web3_clientVersion
Returns the current client version.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<string>
: the current client version.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "web3_clientVersion",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "1.20.3+mainnet+git.04ad31148",
"id": 1
}
net_version
Returns the current network ID.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<string>
: the current network ID.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "net_version",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "314"
}
net_listening
Returns
true
if client is actively listening for network connections.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<boolean>
:true
when listening, otherwisefalse
.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "net_listening",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": true
}
eth_protocolVersion
Returns the current Ethereum protocol version.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<string>
: the current Ethereum protocol version.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_protocolVersion",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0x12",
"id": 1
}
eth_gasPrice
Returns the current price per gas in wei.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<string>
(quantity): the current gas price in wei.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_gasPrice",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x2caad377"
}
eth_accounts
Returns a list of addresses owned by client.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<array>
(string; data, 20 bytes): addresses owned by the client.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_accounts",
"params": [],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": [
"0x407d73d8a49eeb85d32cf465507dd71d507100c1"
]
}
eth_blockNumber
Returns the number of most recent block.
Parameters
id
(integer; required): a request ID (example: 1).jsonrpc
(string; required): a JSON RPC spec used (example: 2.0).method
(string; required): a method used for the request.params
(array; required): None.
Returns
<string>
(quantity): the current block number the client is on.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x2910f9"
}
eth_getBalance
Returns the balance of the account specified by address.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 20 bytes): an address to check for balance.<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(quantity): the current balance in wei.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBalance",
"params": ["0xff00000000000000000000000000000000193b86", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0x27d6e22a612335c27",
"id": 1
}
eth_getStorageAt
Returns the value from a storage position at an address specified.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<string>
(data, 20 bytes): an address of the storage (hex encoded). -
<string>
(quantity): a slot position in the storage (hex encoded unsigned integer). -
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(data): the value at this storage position.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getStorageAt",
"params": ["0xff00000000000000000000000000000000193b86", "0x0", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
eth_getTransactionCount
Returns the number of transactions sent from an address.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<string>
(data, 20 bytes): an address. -
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(quantity): the number of transactions send from this address.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionCount",
"params": ["0xff00000000000000000000000000000000193b86", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0x44d2",
"id": 1
}
eth_getBlockTransactionCountByHash
Returns the number of transactions in a block specified by block hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a block hash.
Returns
<string>
(quantity): the number of transactions in this block.
Request example:
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByHash",
"params": ["0xa5a4ed12caffde7ff39b505d229759a193da11f4a5a087929df1973f3671b895"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0x49",
"id": 1
}
eth_getBlockTransactionCountByNumber
Returns the number of transactions in the block specified by number.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): the hex value of a block number:
Returns
<string>
(quantity): the number of transactions in this block.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockTransactionCountByNumber",
"params": ["0x2910AA"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0xc0",
"id": 1
}
eth_getCode
Returns code at a given address.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 20 bytes): an address to get the code from.<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
Returns
<string>
(data): the code from the given address.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getCode",
"params": ["0xff00000000000000000000000000000000193b86", "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0x",
"id": 1
}
eth_sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data): the signed transaction data.
Returns
<string>
(data, 32 bytes): the transaction hash, or the zero hash if the transaction is not yet available.
Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],
"id": 1
}'
Response example
{
"id": 1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
eth_call
Executes a new message call immediately without creating a transaction on the blockchain.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
<object>
(hex encoded): the transaction object:from
(string; data, 20 bytes; optional): the address the transaction is sent from.to
(string; data, 20 bytes): the address the transaction is directed to.gas
(string; quantity; optional): the gas provided for the transaction execution.eth_call
consumes zero gas, but this parameter may be needed by some executions.gasPrice
(string; quantity; optional): the gas price willing to be paid by the sender in wei.value
(string; quantity; optional): the value sent with this transaction, in wei.data
(string; data; optional): the hash of the method signature and encoded parameters.
-
<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
-
Returns
<string>
(hex encoded bytes): the return value of executed contract.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_call",
"params": [{"from":null,"to":"0x6b175474e89094c44da98b954eedeac495271d0f","data":"0x70a082310000000000000000000000006E0d01A76C3Cf4288372a29124A26D4353EE51BE"}, "latest"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": "0x",
"id": 1
}
eth_estimateGas
Generates and returns an estimate of how much gas is necessary to allow the transaction to complete.
The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<object>
(hex encoded): the transaction object:from
(string; data, 20 bytes; optional): the address the transaction is sent from.to
(string; data, 20 bytes; optional): the address the transaction is directed to.gas
(string; quantity; optional): the gas provided for the transaction execution.eth_call
consumes zero gas, but this parameter may be needed by some executions.gasPrice
(string; quantity; optional): the gas price willing to be paid by the sender in wei.value
(string; quantity; optional): the value sent with this transaction, in wei.data
(string; data; optional): the hash of the method signature and encoded parameters.
Returns
<string>
(quantity): the amount of gas used.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_estimateGas",
"params": [{"from":"0xcc84a1423537d7ac00b22d4a3ebc0fec5ff42205", "to":"0x7b90337f65faa2b2b8ed583ba1ba6eb0c9d7ea44"}],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x53b8"
}
eth_getBlockByHash
Returns information for the block specified by block hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): the block hash.<boolean>
: iftrue
it returns the full transaction objects, iffalse
— only the hashes of the transactions.
Returns
<object>
: a block object, or null when no block was found:number
(string; quantity): the block number; null when it's a pending block.hash
(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash
(string; data, 32 bytes): the hash of the parent block.nonce
(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles
(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom
(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot
(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot
(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot
(string; data, 32 bytes): the root of the receipts trie of the block.miner
(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty
(string; quantity): the difficulty for this block.totalDifficulty
(string; quantity): the total difficulty of the chain until this block.extraData
(string; data): the extra data field of this block.size
(string; quantity): the size of this block in bytes.gasLimit
(string; quantity): the maximum gas allowed in this block.gasUsed
(string; quantity): the total used gas by all transactions in this block.timestamp
(string; quantity): the unix timestamp for when the block was collated.transactions
(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles
(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": ["0x1115a2c6e2ab432630f3da5f666fc0cdf21e3b71de6c2e2b1850f9e63a7309a7", false],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"hash": "0x1115a2c6e2ab432630f3da5f666fc0cdf21e3b71de6c2e2b1850f9e63a7309a7",
"parentHash": "0x8f2f702031ecc7b6481558a00f8e329083b06b9076ef7f28c0fe1a7920f2631f",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"miner": "0x0000000000000000000000000000000000000000",
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"difficulty": "0x0",
"totalDifficulty": "0x0",
"number": "0x2910eb",
"gasLimit": "0x2540be400",
"gasUsed": "0x360744e48",
"timestamp": "0x641433ea",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"baseFeePerGas": "0x31ed7402",
"size": "0x0",
"transactions": [
"0x4060116f4dc21836c694f7a7c3113a3449db4800648b53330b62d7e2acb728ca",
"0x95773ad43e3ee47fb72425ed5882b1e81e88e65808cfb8a3857bd8ffc7ad95d2",
"0x3cda7c03632521df07450953bfc4dbed3e47cc81981b5d0b452161aa57cc2f54",
"0x5b005f19aa04b5e10bdf179efc502f59051acd1725546f90ece3162a72f4e371",
"0x7d21a229bf22fe7835c02a5ca33fa9d0c843e66d63eece968297922b2d26d8d6",
"0xb443b4c8d736e45aac0136a46370d44ffa7dc0d81b5c6c0f92ad91a65fc15d1c",
"0x6fb559a195599d2813621dba1d982c75857b184109cbeaedc8c8b80456a74763"
],
"uncles": []
},
"id": 1
}
eth_getBlockByNumber
Returns information for the block specified by block number.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(quantity|tag): either the hex value of a block number or one of the following block tags:earliest
: the lowest numbered block available on the client.finalized
: the most recent crypto-economically secure block; cannot be re-orged outside of manual intervention driven by community coordination.safe
: the most recent block that is safe from re-orgs under honest majority and certain synchronicity assumptions.latest
: the most recent block in the canonical chain observed by the client; this block can be re-orged out of the canonical chain even under healthy/normal conditions.pending
: a sample next block built by the client on top of thelatest
and containing the set of transactions usually taken from local mempool. In other words, it is the block that has not been mined yet.
<boolean>
: iftrue
it returns the full transaction objects, iffalse
— only the hashes of the transactions.
Returns
<object>
: a block object, or null when no block was found:number
(string; quantity): the block number; null when it's a pending block.hash
(string; data, 32 bytes): the hash of the block; null when it's a pending block.parentHash
(string; data, 32 bytes): the hash of the parent block.nonce
(string; data, 8 bytes): the hash of the generated proof-of-work; null when it's a pending block.sha3Uncles
(string; data, 32 bytes): SHA3 of the uncles data in the block.logsBloom
(string; data, 256 bytes): the bloom filter for the logs of the block. null when its pending block.transactionsRoot
(string; data, 32 bytes): the root of the transaction trie of the block.stateRoot
(string; data, 32 bytes): the root of the final state trie of the block.receiptsRoot
(string; data, 32 bytes): the root of the receipts trie of the block.miner
(string; data, 20 bytes): the address of the beneficiary to whom the mining rewards were given.difficulty
(string; quantity): the difficulty for this block.totalDifficulty
(string; quantity): the total difficulty of the chain until this block.extraData
(string; data): the extra data field of this block.size
(string; quantity): the size of this block in bytes.gasLimit
(string; quantity): the maximum gas allowed in this block.gasUsed
(string; quantity): the total used gas by all transactions in this block.timestamp
(string; quantity): the unix timestamp for when the block was collated.transactions
(array of strings): an array of transaction objects, or 32 bytes transaction hashes depending on the last given parameter.uncles
(array of strings): an array of uncle hashes.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["0x2908F9", false],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"hash": "0xa6d88d748662760651aeda021375dea2fc8da8276e0b9eb661e85bb15b6253b6",
"parentHash": "0x57074e1d45989f2063985f7f517c59cbd6ba714e144d2a2f946c0ef25567028d",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"miner": "0x0000000000000000000000000000000000000000",
"stateRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"transactionsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"receiptsRoot": "0x0000000000000000000000000000000000000000000000000000000000000000",
"logsBloom": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"difficulty": "0x0",
"totalDifficulty": "0x0",
"number": "0x2908f9",
"gasLimit": "0x2540be400",
"gasUsed": "0x3192b0549",
"timestamp": "0x6413458e",
"extraData": "0x",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"baseFeePerGas": "0x1d158e1b",
"size": "0x0",
"transactions": [
"0x8845248f560f7d02ba15a582e8da76c4dc5965d520dd2178306e502bf7f7e394",
"0x080689e635a1248e36abf7c3e3dbc4190fa5a630739cfa957e216acb42210e8f",
"0x1a89e7518275b7391fb45fd1dda061686f1d056857913349deba11d9b179fc23",
"0xa1165df42cbe49926f871c40847fb10e7de71970023cd83ecc7308fd80e1afe4",
"0x8873ece640d6007b731ef87e0bf2b4f26bcf3d52fc8a4459dda403666b0b061d",
"0x35722a849b14c72aa501ae5fbe0899dbfcde63e3df8e8398770c3b588f6c0c8a",
"0x956202e10917af43f32a3a0db44357636107eb0f2ac88d26fd04064858825c8c",
"0xa4852ebc83b6e4f5f5db2c2411a56057149286da4ac0a8f2b45dbfa32f60e963",
"0x26fb436430e539d411e34e92051e239a9b76f3f172f04e6b20ec7a2bfd4b6e7b",
"0x4af52d5d7f3eb5dfbed0029916865e739a848e2962b99be46f170a9a725c9cb6",
"0x15602585d7b4a18383f26774c4a270c3dc2e86496e7dcfd04a92dcd45f2d73a0"
],
"uncles": []
},
"id": 1
}
eth_getTransactionByHash
Returns information on a transaction specified by transaction hash.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a transaction hash.
Returns
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction; null when it's pending.blockNumber
(string; quantity): a number of the block containing the transaction; null when it's pending.from
(string; data, 20 bytes): an address of the sender.gas
(string; quantity): the gas provided by the sender.gasPrice
(string; quantity): the gas price provided by the sender in wei.hash
(string; data, 32 bytes): the hash of the transaction.input
(string; data): the data send along with the transaction.nonce
(string; quantity): the number of transactions made by the sender prior to this one.to
(string: data, 20 bytes): an address of the receiver: null when it's a contract creation transaction.transactionIndex
(string; quantity): the transaction index position in the block; null when it's pending.value
(string; quantity): the value transferred in wei.v
(string; quantity): ECDSA recovery ID.r
(string; quantity): ECDSA signature r.s
(string; quantity): ECDSA signature s.
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionByHash",
"params": ["0x32388f6f06d525b77c881f6a7f5a139d859e8438f6d25d6460f0a10ce2fccc9a"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"chainId": "0x13a",
"nonce": "0x26",
"hash": "0x32388f6f06d525b77c881f6a7f5a139d859e8438f6d25d6460f0a10ce2fccc9a",
"blockHash": "0xa5a4ed12caffde7ff39b505d229759a193da11f4a5a087929df1973f3671b895",
"blockNumber": "0x29111a",
"transactionIndex": "0x31",
"from": "0xcc84a1423537d7ac00b22d4a3ebc0fec5ff42205",
"to": "0x7b90337f65faa2b2b8ed583ba1ba6eb0c9d7ea44",
"value": "0x0",
"type": "0x2",
"input": "0xee1fe2ad000000000000000000000000cc84a1423537d7ac00b22d4a3ebc0fec5ff422050000000000000000000000009dfa970c5c985edec5795eb63921406e46c213cd",
"gas": "0xbebc200",
"maxFeePerGas": "0x63dafb8c",
"maxPriorityFeePerGas": "0x1388",
"accessList": [],
"v": "0x0",
"r": "0xe5e69359c36fb38aeff1bb8df275bc933ece12c7936ca90344cfa6c4f783811b",
"s": "0x73e059244a4109dd40ce90187a402be33e61eb1726975a9b8a6102bdff1d6cb"
},
"id": 1
}
eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
The receipt is not available for pending transactions.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):<string>
(data, 32 bytes): a hash of the transaction.
Returns
-
object
: a transaction receipt object, or null when no receipt was found:-
transactionHash
(string; data, 32 bytes): a hash of the transaction. -
transactionIndex
(string; quantity): the transactions index position in the block. -
blockHash
(string; data, 32 bytes): a hash of the block containing the transaction. -
blockNumber
(string; quantity): a number of the block containing the transaction. -
from
(string; data, 20 bytes): an address of the sender. -
to
(string; data, 20 bytes): an address of the receiver; null when it's a contract creation transaction. -
cumulativeGasUsed
(string; quantity): the total amount of gas used when this transaction was executed in the block. -
effectiveGasPrice
(string; quantity): the sum of the base fee and tip paid per unit of gas. -
gasUsed
(string; quantity): the amount of gas used by this specific transaction alone. -
contractAddress
(string; data, 20 bytes): the contract address created, if the transaction was a contract creation, otherwise null. -
logs
(array): an array of log objects, which this transaction generated. -
logsBloom
(string; data, 256 bytes): a bloom filter for light clients to quickly retrieve related logs. -
type
(string; data): the transaction type,0x00
for legacy transactions,0x01
for access list types,0x02
for dynamic fees. It also returns either of the following:root
(string; data, 32 bytes): a post-transaction stateroot (pre Byzantium).status
(string; quantity): either 1 (success) or 0 (failure).
-
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": ["0x32388f6f06d525b77c881f6a7f5a139d859e8438f6d25d6460f0a10ce2fccc9a"],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"result": {
"transactionHash": "0x32388f6f06d525b77c881f6a7f5a139d859e8438f6d25d6460f0a10ce2fccc9a",
"transactionIndex": "0x31",
"blockHash": "0xa5a4ed12caffde7ff39b505d229759a193da11f4a5a087929df1973f3671b895",
"blockNumber": "0x29111a",
"from": "0xcc84a1423537d7ac00b22d4a3ebc0fec5ff42205",
"to": "0x7b90337f65faa2b2b8ed583ba1ba6eb0c9d7ea44",
"root": "0x0000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"contractAddress": null,
"cumulativeGasUsed": "0x0",
"gasUsed": "0x72a953b",
"effectiveGasPrice": "0x36d6a389",
"logsBloom": "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
"logs": [
{
"address": "0x7b90337f65faa2b2b8ed583ba1ba6eb0c9d7ea44",
"data": "0x0000000000000000000000000000000000000000000054b40b1f852bda000000",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000cc84a1423537d7ac00b22d4a3ebc0fec5ff42205"
],
"removed": false,
"logIndex": "0x0",
"transactionIndex": "0x31",
"transactionHash": "0x32388f6f06d525b77c881f6a7f5a139d859e8438f6d25d6460f0a10ce2fccc9a",
"blockHash": "0xa5a4ed12caffde7ff39b505d229759a193da11f4a5a087929df1973f3671b895",
"blockNumber": "0x29111a"
},
{
"address": "0x7b90337f65faa2b2b8ed583ba1ba6eb0c9d7ea44",
"data": "0x000000000000000000000000000000000000000000016410589935ea3de00000",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000009dfa970c5c985edec5795eb63921406e46c213cd"
],
"removed": false,
"logIndex": "0x1",
"transactionIndex": "0x31",
"transactionHash": "0x32388f6f06d525b77c881f6a7f5a139d859e8438f6d25d6460f0a10ce2fccc9a",
"blockHash": "0xa5a4ed12caffde7ff39b505d229759a193da11f4a5a087929df1973f3671b895",
"blockNumber": "0x29111a"
}
],
"type": "0x2"
},
"id": 1
}
eth_getLogs
Returns an array of all logs matching a given filter object.
Parameters
-
id
(integer; required): a request ID (example: 1). -
jsonrpc
(string; required): a JSON RPC spec used (example: 2.0). -
method
(string; required): a method used for the request. -
params
(array; required):-
object
: the filter options:-
fromBlock
(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest
: for the last mined block.earliest
: for the lowest numbered block available on the client.pending
: for not yet mined transactions.
-
toBlock
(string; quantity|tag; optional; default: "latest"): either the block number or one of the following block tags:latest
: for the last mined block.earliest
: for the lowest numbered block available on the client.pending
: for not yet mined transactions.
-
address
(array of strings; data, 20 bytes; optional): a contract address or a list of addresses from which logs should originate. -
topics
(array of strings; data; optional): an array of 32 bytes data topics. Topics are order-dependent. Each topic can also be an array of data with "or" options. -
blockhash
(string; data, 32 bytes; optional; future): with the addition of EIP-234,blockHash
will be a new filter option which restricts the logs returned to the single block with the 32-byte hash blockHash. Using blockHash is equivalent tofromBlock = toBlock = the block
number with hash blockHash. IfblockHash
is present in the filter criteria, then neitherfromBlock
nortoBlock
are allowed.
-
-
Returns
removed
(string; tag):true
when the log was removed, due to a chain reorganization;false
if it's a valid log.logIndex
(string; quantity): the log index position in the block; null when it's a pending log.transactionIndex
(string; quantity): the transactions index position log was created from; null when it's a pending log.transactionHash
(string; data, 32 bytes): a hash of the transactions this log was created from; null when it's a pending log.blockHash
(string; data, 32 bytes): a hash of the block containing the log; null when it's pending; null when it's a pending log.blockNumber
(string; quantity): the number of the block containing the log; null when it's pending; null when it's a pending log.address
(string; data, 20 bytes): an address from which this log originated.data
(string; data): contains one or more 32 bytes non-indexed arguments of the log.topics
(array of strings; data): an array of 0 to 4 32 bytes data of indexed log arguments. (In solidity: The first topic is the hash of the signature of the event (e.g. Deposit(address,bytes32,uint256)), except you declared the event with the anonymous specifier.)
Request example
curl -X POST https://rpc.ankr.com/filecoin \
-H 'Content-Type: application/json' \
-d '{
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{"address": "0x7b90337f65faa2b2b8ed583ba1ba6eb0c9d7ea44"}],
"id": 1
}'
Response example
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000009acbb72cf67103a30333a32cd203459c6a9c3311",
"0x000000000000000000000000994871e1103c5da4be270365fa62771ea4525520"
],
"data": "0x000000000000000000000000000000000000000000000000000000001ec39aa0",
"blockNumber": "0xf6289d",
"transactionHash": "0xc7ed73c9b219d4243872e5993ad2950c8ea87d15af28562d33b0c05d46a90cee",
"transactionIndex": "0x1e",
"blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
"logIndex": "0x13",
"removed": false
},
{
"address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x0000000000000000000000005879975799597392c031f10b6eff282cb7974ac8",
"0x0000000000000000000000006d52ab66340f3f78d0c1007bec484268876b5948"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000",
"blockNumber": "0xf6289d",
"transactionHash": "0x0118499f7be4c3510bd60fe3a3aee5f5f316743b6cc13a8cb0528d784f962aec",
"transactionIndex": "0x20",
"blockHash": "0x1e12377f0357320c0e5cfcadc2dfbc9c75fc339be668e118c34e4333f835ef31",
"logIndex": "0x14",
"removed": false
}
]
}
Filecoin native methods
Chain:
Filecoin.ChainGetBlock
— returns the block specified by the given CID.Filecoin.ChainGetBlockMessages
— returns messages stored in the specified block.Filecoin.ChainGetGenesis
— returns the genesis tipset.Filecoin.ChainGetMessage
— reads a message referenced by the specified CID from the chain blockstore.Filecoin.ChainGetParentMessages
— returns messages stored in parent tipset of the specified block.Filecoin.ChainGetParentReceipts
— returns receipts for messages in parent tipset of the specified block.Filecoin.ChainGetPath
— returns a set of revert/apply operations needed to get from one tipset to another.Filecoin.ChainGetTipSet
— returns the tipset specified by the given TipSetKey.Filecoin.ChainGetTipSetByHeight
— looks back for a tipset at the specified epoch.Filecoin.ChainHasObj
— checks if a given CID exists in the chain blockstore.Filecoin.ChainHead
— returns the current head of the chain.Filecoin.ChainReadObj
— reads ipld nodes referenced by the specified CID from chain blockstore and returns raw bytes.Filecoin.ChainStatObj
— returns statistics about the graph referenced by ‘obj’.Filecoin.ChainTipSetWeight
— computes weight for the specified tipset.
Client:
Filecoin.ClientQueryAsk
— returns a signed StorageAsk from the specified miner.
Gas:
Filecoin.GasEstimateFeeCap
— estimates gas fee cap.Filecoin.GasEstimateGasLimit
— estimates gas used by the message and returns it.Filecoin.GasEstimateGasPremium
— estimates what gas price should be used for a message to have high likelihood of inclusion innblocksincl
epochs.Filecoin.GasEstimateMessageGas
— estimates gas values for unset message gas fields.
Mpool:
Filecoin.MpoolGetNonce
— gets next nonce for the specified sender.Filecoin.MpoolPending
— returns pending mempool messages.Filecoin.MpoolPush
— pushes a signed message to mempool.Filecoin.MpoolSub
State:
Filecoin.StateAccountKey
— returns the public key address of the given ID address.Filecoin.StateAllMinerFaults
— returns all non-expired Faults that occur within lookback epochs of the given tipset.Filecoin.StateCall
— runs the given message and returns its result without any persisted changes.Filecoin.StateChangedActors
— returns all the actors whose states change between the two given state CIDs.Filecoin.StateCirculatingSupply
— returns the exact circulating supply of Filecoin at the given tipset.Filecoin.StateCompute
— applies the given messages on the given tipset.Filecoin.StateDealProviderCollateralBounds
— returns the min and max collateral a storage provider can issue.Filecoin.StateDecodeParams
— attempts to decode the provided params, based on the recipient actor address and method number.Filecoin.StateGetActor
— returns the indicated actor’s nonce and balance.Filecoin.StateGetReceipt
— returns the message receipt for the given message or for a matching gas-repriced replacing message.Filecoin.StateListActors
— returns the addresses of every actor in the state.Filecoin.StateListMessages
— looks back and returns all messages with a matching to or from address, stopping at the given height.Filecoin.StateListMiners
— returns the addresses of every miner that has claimed power in the Power Actor.Filecoin.StateLookupID
— retrieves the ID address of the given address.Filecoin.StateMarketBalance
— looks up the Escrow and Locked balances of the given address in the Storage Market.Filecoin.StateMarketDeals
— returns information about every deal in the Storage Market.Filecoin.StateMarketParticipants
— returns the Escrow and Locked balances of every participant in the Storage Market.Filecoin.StateMarketStorageDeal
— returns information about the indicated deal.Filecoin.StateMinerActiveSectors
— returns info about sectors that a given miner is actively proving.Filecoin.StateMinerAvailableBalance
— returns the portion of a miner’s balance that can be withdrawn or spent.Filecoin.StateMinerDeadlines
— returns all the proving deadlines for the given miner.Filecoin.StateMinerFaults
— returns a bitfield indicating the faulty sectors of the given miner.Filecoin.StateMinerInfo
— returns info about the indicated miner.Filecoin.StateMinerInitialPledgeCollateral
— returns the initial pledge collateral for the specified miner’s sector.Filecoin.StateMinerPartitions
— returns all partitions in the specified deadline.Filecoin.StateMinerPower
— returns the power of the indicated miner.Filecoin.StateMinerPreCommitDepositForPower
— returns the pre-commit deposit for the specified miner’s sector.Filecoin.StateMinerProvingDeadline
— calculates the deadline at some epoch for a proving period and returns the deadline-related calculations.Filecoin.StateMinerRecoveries
— returns a bitfield indicating the recovering sectors of the given miner.Filecoin.StateMinerSectorAllocated
— checks if a sector is allocated.Filecoin.StateMinerSectorCount
â