Filecoin
Filecoin API is available on Web3 API platform.
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 protocol, which is a peer-to-peer distributed storage network that leverages content addressing 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 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.
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 innblocksinclepochs.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— returns the number of sectors in a miner’s sector set and proving set.Filecoin.StateMinerSectors— returns info about the given miner’s sectors.Filecoin.StateNetworkName— returns the name of the network the node is synced to.Filecoin.StateNetworkVersion— returns the network version at the given tipset.Filecoin.StateReadState— returns the indicated actor’s state.Filecoin.StateReplay— replays a given message, assuming it was included in a block in the specified tipset.Filecoin.StateSearchMsg— searches for a message in the chain, and returns its receipt and the tipset where it was executed.Filecoin.StateSearchMsgLimited— looks back up to limit epochs in the chain for a message, and returns its receipt and the tipset where it was executed.Filecoin.StateSectorExpiration— returns epoch at which given sector will expireFilecoin.StateSectorGetInfo— returns the on-chain info for the specified miner’s sector.Filecoin.StateSectorPartition— finds deadline/partition with the specified sector.Filecoin.StateSectorPreCommitInfo— returns the PreCommit info for the specified miner’s sector.Filecoin.StateVMCirculatingSupplyInternal— returns an approximation of the circulating supply of Filecoin at the given tipset.Filecoin.StateVerifiedClientStatus— returns the data cap for the given address.Filecoin.StateVerifiedRegistryRootKey— returns the address of the Verified Registry’s root key.Filecoin.StateVerifierStatus— returns the data cap for the given address.Filecoin.StateWaitMsg— looks back in the chain for a message.Filecoin.StateWaitMsgLimited— looks back up to limit epochs in the chain for a message.
Wallet:
Filecoin.WalletBalance— returns the balance of the given address at the current head of the chain.Filecoin.WalletValidateAddress— validates whether a given string can be decoded as a well-formed address.Filecoin.WalletVerify— takes an address, a signature, and some bytes, and indicates whether the signature is valid.
Permissions
Each method has specific permissions that must be met before you can receive a response from a Filecoin node. Methods with the read permission can be called by anyone at anytime, without the need for a token. All other permissions require you to send an authentication along with you request.
read: Read node state, no private data.write: Write to local store / chain, and read permissions.sign: Use private keys stored in wallet for signing, read and write permissions.admin: Manage permissions, read, write, and sign permissions.
Methods
Methods, Chain
web3_clientVersionnet_versionnet_listeningeth_protocolVersioneth_gasPriceeth_accountseth_blockNumbereth_getBalanceeth_getStorageAteth_getTransactionCounteth_getBlockTransactionCountByHasheth_getBlockTransactionCountByNumbereth_getCodeeth_sendRawTransactioneth_calleth_estimateGaseth_getBlockByHasheth_getBlockByNumbereth_getTransactionByHasheth_getTransactionReceipteth_getLogsFilecoin.ChainGetBlockFilecoin.ChainGetBlockMessagesFilecoin.ChainGetGenesis
Chain, Client, Gas, Mpool, State
Filecoin.ChainGetMessageFilecoin.ChainGetParentMessagesFilecoin.ChainGetParentReceiptsFilecoin.ChainGetPathFilecoin.ChainGetTipSetFilecoin.ChainGetTipSetByHeightFilecoin.ChainHasObjFilecoin.ChainHeadFilecoin.ChainReadObjFilecoin.ChainStatObjFilecoin.ChainTipSetWeightFilecoin.ClientQueryAskFilecoin.GasEstimateFeeCapFilecoin.GasEstimateGasLimitFilecoin.GasEstimateGasPremiumFilecoin.GasEstimateMessageGasFilecoin.MpoolGetNonceFilecoin.MpoolPendingFilecoin.MpoolPushFilecoin.MpoolSubFilecoin.StateAccountKeyFilecoin.StateAllMinerFaultsFilecoin.StateCallFilecoin.StateChangedActorsFilecoin.StateCirculatingSupply
State, Wallet
Filecoin.StateComputeFilecoin.StateDealProviderCollateralBoundsFilecoin.StateDecodeParamsFilecoin.StateGetActorFilecoin.StateGetReceiptFilecoin.StateListActorsFilecoin.StateListMessagesFilecoin.StateListMinersFilecoin.StateLookupIDFilecoin.StateMarketBalanceFilecoin.StateMarketDealsFilecoin.StateMarketParticipantsFilecoin.StateMarketStorageDealFilecoin.StateMinerActiveSectorsFilecoin.StateMinerAvailableBalanceFilecoin.StateMinerDeadlinesFilecoin.StateMinerFaultsFilecoin.StateMinerInfoFilecoin.StateMinerInitialPledgeCollateralFilecoin.StateMinerPartitionsFilecoin.StateMinerPowerFilecoin.StateMinerPreCommitDepositForPowerFilecoin.StateMinerProvingDeadlineFilecoin.StateMinerRecoveriesFilecoin.StateMinerSectorAllocatedFilecoin.StateMinerSectorCountFilecoin.StateMinerSectorsFilecoin.StateNetworkNameFilecoin.StateNetworkVersionFilecoin.StateReadStateFilecoin.StateReplayFilecoin.StateSearchMsgFilecoin.StateSearchMsgLimitedFilecoin.StateSectorExpirationFilecoin.StateSectorGetInfoFilecoin.StateSectorPartitionFilecoin.StateSectorPreCommitInfoFilecoin.StateVMCirculatingSupplyInternalFilecoin.StateVerifiedClientStatusFilecoin.StateVerifiedRegistryRootKeyFilecoin.StateVerifierStatusFilecoin.StateWaitMsgFilecoin.StateWaitMsgLimitedFilecoin.WalletBalanceFilecoin.WalletValidateAddressFilecoin.WalletVerify