BNB Smart Chain (BNB)
BNB Smart Chain wallet structure
A BNB Smart Chain wallet has the following structure.
- Main address
- Fee address
- Child address
TIP The fee address is used to inject the fee (BNB) required for gathering tokens in a centralized wallet into child addresses, or to inject the fee (BNB) into child addresses as needed.
Deposit
Deposit status
When an asset sent from the outside arrives at the main address or a child address, Octet recognizes it as a deposit. However, the deposit is not processed as completed even if the deposit transaction is included in a block. To ensure the finality of the transaction, additional blocks must be generated before the transaction is processed as completed (FINALIZED). When an asset is sent from the outside but has not arrived at the main address or a child address, that transaction is not recognized. Therefore, there is no failed (FAILED) status for deposit transactions.
| Status name | Description |
|---|---|
UNFINALIZED | Deposit transaction is included in a block |
FINALIZED | Deposit transaction is included in a block and the next block is generated |
Gathering
Gathering is only available in centralized wallets.
Gathering process and fees
Assets stored in child addresses do not move to the main address until gathering is requested. Therefore, you should gather regularly to avoid a deficit in the main address.
When gathering of a specific asset is requested, the BNB or tokens stored in every child address are transferred to the main address. At this point, one transaction occurs per child address. For example, if BNB is stored in 10 child addresses, 10 transactions occur in total.
1. Gathering BNB
A BNB gathering fee occurs once per transaction, and it is deducted from the assets to be gathered. Gathering does not proceed for child addresses whose assets to be gathered are less than the estimated fee. The gathering process is as follows.
- Request gathering.
- A transaction is created for each child address to be gathered.
- The optimal fee is calculated and the transaction is propagated.
- The gathering is completed when the transaction is included in a block.
2. Gathering tokens
A token gathering fee occurs once per transaction. At this point, if the child address has no BNB to pay the fee, BNB is injected from the fee address into the child address. A fee (fee injection cost) occurs in this process as well. The child address pays the fee with the received BNB and proceeds with the gathering. The gathering process is as follows.
- Request gathering.
- BNB to be used as the gathering fee is injected from the fee address into the child address.
- A transaction is created for each child address to be gathered.
- The optimal fee is calculated and the transaction is propagated.
- The gathering is completed when the transaction is included in a block.
Gathering status
Gathering status is divided into seven statuses depending on the gathering process. Assets stored in child addresses are in awaiting gathering (AWAITING_GATHERING) status.
If a fee injection is required when gathering is requested, the asset status changes to awaiting fee injection (AWAITING_FEE_INJECTION). When the fee injection transaction is created, the asset status changes to fee injecting (FEE_INJECTING). If the fee injection fails, the asset status is processed as fee injection failed (FEE_INJECTION_FAILED).
When the fee injection succeeds and a gathering transaction is created, the asset status changes to gathering (GATHERING). When the transaction is included in a block, the asset status is processed as gathering completed (COMPLETED) and the gathering is finished.
When gathering is attempted but the transaction fails, the asset status remains as gathering failed (GATHERING_FAILED). Assets in fee injection failed or gathering failed status are included in the gathering targets again. When gathering is attempted but the transaction could not be created due to insufficient fees, it remains in awaiting gathering (AWAITING_GATHERING) status.
| Status name | Description |
|---|---|
AWAITING_GATHERING | Awaiting gathering |
AWAITING_FEE_INJECTION | Awaiting fee injection |
FEE_INJECTING | Fee injecting |
FEE_INJECTION_FAILED | Fee injection failed |
GATHERING | Gathering transaction created |
COMPLETED | Gathering transaction completed |
GATHERING_FAILED | Gathering transaction failed |
Withdrawal
Withdrawal status
Unlike deposits, a withdrawal is processed as withdrawal completed (FINALIZED) as soon as the transaction is included in a block.
| Status name | Description |
|---|---|
AWAITING_DECISION | Awaiting withdrawal approval |
REJECTED | Withdrawal is rejected |
AWAITING_WITHDRAWAL | Withdrawal is approved and awaiting withdrawal |
PENDING | Withdrawal transaction is created |
FINALIZED | Withdrawal transaction is included in a block |
FAILED | Withdrawal transaction failed |
Balance lookup criteria
You can check the balance of the assets stored in a specific address by calling the Get Address Balance API. The balance returned is divided into total balance and liquid balance.
- Total balance means all assets with a confirmation of 1 or more.
- Liquid balance means the assets that can be gathered or withdrawn. The liquid balance of a child address means the assets that can be gathered, and the liquid balance of the main address means the assets that can be withdrawn.
Fees
Estimated fees
The estimated fee is calculated by multiplying the FASTEST value of the gas price by the gas limit. Octet sets the BNB gas limit to 21,000. Since the gas limit for tokens varies depending on how they are implemented, the gas limit for tokens is set to 100,000. The gas limit is a maximum value, so the actual gas usage may be less than this, and the fee is charged only for the actual gas used.
Estimated fee = Gas Limit x Gas Price
Transaction fees
You can get the real-time gas price by calling the Get Fee API. The fee used for a transaction is calculated by multiplying the FASTEST value of the gas price by the amount of gas used.
Transaction fee = Usage by Txn x Gas Price