Exchange integration
This page lists the general steps and workflows you need to follow to offer FIL on an exchange.
Last updated
This page lists the general steps and workflows you need to follow to offer FIL on an exchange.
Last updated
If you plan to offer FIL on your exchange, you will need to run a Filecoin node. is the reference implementation node for the Filecoin network, and as such, is currently the most production-ready implementation available.
Follow the to properly install the Lotus applications and launch node. The basic steps are:
Prepare your hardware by meeting the minimal requirements.
Install dependencies.
Start the Lotus daemon and sync the chain by either:
Syncing from scratch: in your lotus directory run lotus daemon
Syncing from a full snapshot.
Syncing from minimal snapshot
A snapshot only has the state trees from the recent tipset (2000 epochs) onward and nothing before that tipset, which means it does not have all the historical states of the network. In addition, only a full snapshot has full state trees from a certain tipset.
You can check the sync status by running lotus sync status
. You are fully synced when the Height
difference is 0
. Lotus will output any sync error.
You can run lotus sync wait
to wait for the sync to be complete. Lotus will output Done!
once your node is fully synced.
Filecoin uses an account-based model. There are 4 types of account prefixes:
f0
for ID address
f1
for Secp256k1 wallets
f3
for BLS wallets
f1
, f2
, and f3
prefixed addresses are called account addresses. An account address is activated when it first receives a transaction. f0
prefixed addresses are mapped to each active account address.
Testnet addresses Within a testnet, the address prefix is t
. So ID addresses become t0
, Secp256k1 wallets become t1
, etc.
Filecoin currently uses two types of signatures:
ECDSA signatures over the Secp256k1 elliptic curve
BLS signatures over the BLS12-381 group of curves.
There are two message types:
Messages are fully irreversible at 900 epochs. Waiting 200 epochs for message confirmation is acceptable.
An ExitCode
of 0
in the message receipt indicates that the message was sent successfully.
When a user sends a transaction to the network, it gets placed into the mempool queue. If a transaction doesn’t have enough gas, it stays in the mempool and doesn’t go anywhere. To new users, it looks like this transaction is lost forever. However, users can update the transaction with an updated GasLimit
, GasFeeCap
, and/or GasPremium
. As long as you don’t change anything else in the transaction (nonse
, to
, from
, value
), then the transaction that is sat in the mempool will get updated with the new gas allowance.
Expiration
There is no limit for how long a message can spend in the mempool. However, the mempool does get cleaned when there are too many messages in it, starting with the messages with the least gas.
When GasFeeCap
, GasPremium
and MaxFee
are set to 0
, Lotus will do the gas estimation for the message with 25% overestimation for the gas limit based on the current network condition.
Some JavaScript libraries attempt to estimate the gas fees before sending the transaction to the Filecoin network. However, they sometimes underestimate, leading to transactions getting stuck in the mempool. If you are noticing your transactions getting stuck in the mempool after sending them to the network using a JavaScript library, try GasFeeCap
, GasPremium
, and MaxFee
to 0
.
Here are some Curl examples for connecting to a Lotus node using the JSON-RPC API:
bafy2bzacecxm6lhhzem3wshktatwzrcqbvc3k3jepzz7a6wqyc7w3fvav256i
is the block CID. This field is nullable.
bafy2bzacedplsg3tqrv7e3v5rssvq3qwbd3c6g3en55zpqnyrymexhynz6ixu
is the block CID. You can pass in any one of the block CIDs included in the desired tipset.
1
for Secp2561K account and 2
for BLS account.
f1d7x4euqwtlk2bqzhclr6gubkufezgddkqftsnky
is the account address.
Method
ID of 0
with null Params
is a balance transfer transaction. When the GasFeeCap
, GasPremium
and MaxFee
is 0
, Lotus will do the gas estimation for the message with a 25% overestimation for the gas limit based on the current network condition. You can change this value via the GasLimitOverestimation
field.
The Lotus RPC method to retrieve the list of transactions waiting on the mempool is Filecoin.MpoolPending
. The RPC call is:
If you are using a JavaScript library, the method you need is mpoolPending
.
The Filecoin network uses a + consensus algorithm. Time in the Filecoin network is dissected into set to 30 seconds. A new set of blocks is produced for every epoch for a . The hard finality of the Filecoin network is 900 epochs.
f2
for accounts
Details and reference implementations can be found .
.
There are multiple gas fees associated with each message. Refer to the for details.
You can interact with the network by using Lotus CLI or using the . Follow the to set up API tokens on your node and grant necessary permissions. To find all CLI usage, run lotus -h
in your lotus folder.
You can find some other API client libraries developed by the Filecoin community .
Use to sign the message and send the signed message using .
You may also use this .
Call and look up the GasCost
in the response.
You can estimate the gas cost of a message by calling . This API estimates the gas limit with a 25% overestimation based on the network condition under the given tipset key. You can change this value via the GasLimitOverestimation
field.
Call or and go through all the transactions in the execution trace. Whenever the value !=0 && exit code == 0
, it indicates a balance transfer has occurred.
Join the and post any questions you have in there.
- the reference implementation for the Filecoin network