Plasma (XPL)
Plasma wallet structure
The Plasma wallet has the following structure.
- Main address
- Fee address
- Child address
TIP The fee address is used to recharge child addresses with the fee (XPL) required to gather tokens. In a centralized wallet, the fee address is used to recharge child addresses with the fee (XPL) required to gather tokens, or to recharge child addresses with the fee (XPL) as needed.
Deposit
Deposit status
When an asset from the outside arrives at the main address, Octet recognizes it as a deposit. When an asset is sent to the main address but has not arrived, that transaction is not recognized. Therefore, there is no FAILED status for the deposit transaction.
| Status name | Description |
|---|---|
FINALIZED | Deposit is completed |
Gathering
Gathering is only available for centralized wallets.
Gathering process and fees
Assets stored in child addresses don't move to the main address unless gathering is requested. Therefore, gatherings should be made regularly to avoid a deficit in the main address.
When gathering of a specific asset is requested, all XPL or tokens stored in every child address get transferred to the main address. At this point, one transaction occurs per child address. For example, if XPL is stored in 10 child addresses, 10 transactions will occur in total.
1. Gathering XPL
An XPL gathering fee occurs once per transaction, and it is deducted from the asset to be gathered. Gathering will not be made for child addresses with assets less than the estimated fees. The gathering process is as follows.
- Request gathering.
- Generate a transaction for each child address to be gathered.
- Calculate the optimal fees and propagate the transactions.
- Gathering is completed when the transactions are confirmed in the blocks.
2. Gathering tokens
A token gathering fee occurs once per transaction. When there is no XPL in the child address to pay the fee, XPL is recharged from the fee address to the child address. A fee (fee-recharging cost) occurs for this process as well. The child address pays the fee with the transferred XPL and proceeds with the gathering. The gathering process is as follows.
- Request gathering.
- Recharge XPL to be used as the gathering fee from the fee address to the child address.
- Generate a transaction for each child address to be gathered.
- Calculate the optimal fees and propagate the transactions.
- Gathering is completed when the transactions are confirmed in the blocks.
Gathering status
Gathering status can be specified into seven types, depending on the process. The asset stored in the child address is in AWAITING_GATHERING status.
When a fee injection is needed at the time of the gathering request, the status of the asset changes to AWAITING_FEE_INJECTION. When the fee injection transaction is generated, the status of the asset changes to FEE_INJECTING. When the fee injection fails, the status of the asset is processed to FEE_INJECTION_FAILED.
When the fee injection is successful and a gathering transaction is generated, the status of the asset changes to GATHERING. When the transaction is included in the blocks, the status of the asset is processed to COMPLETED and the gathering is finished.
When a gathering is tried and the transaction failed, the status of the asset remains as GATHERING_FAILED. Assets in fee injection failed or gathering failed status are included in the gathering target again. When a gathering is tried but failed to generate a transaction due to insufficient fees, it remains in AWAITING_GATHERING status.
| Status name | Description |
|---|---|
AWAITING_GATHERING | Awaiting gathering |
AWAITING_FEE_INJECTION | Awaiting fee injection |
FEE_INJECTING | Processing fee injection |
FEE_INJECTION_FAILED | Failed fee injection |
GATHERING | Generate gathering transaction |
COMPLETED | Complete gathering transaction |
GATHERING_FAILED | Failed gathering transaction |
Withdrawal
Withdrawal status
Unlike a deposit, a withdrawal is finalized (FINALIZED) at the moment when the transaction is included in the blocks.
| Status name | Description |
|---|---|
AWAITING_DECISION | Awaiting withdrawal approval |
REJECTED | Withdrawal is rejected |
AWAITING_WITHDRAWAL | Approved and awaiting withdrawal |
PENDING | Withdrawal transaction is generated |
FINALIZED | Withdrawal transaction is included in the blocks |
FAILED | Withdrawal transaction failed |
Balance lookup criteria
You can check the balance of the asset stored in a specific address by calling the Get Address Balance API. The accessed balances are divided into total balance and liquid balance.
- Total balance means all assets with a confirmation of 1 or above.
- Liquid balance means the assets that can be gathered or withdrawn. The liquid balance of a child address represents the assets that can be gathered, while the liquid balance of the main address represents the assets that can be withdrawn.
Fees
Estimated fees
Estimated fees are calculated by multiplying the gas price and the gas limit.
Estimated Fees = Gas Limit x Max Fee Per Gas
- Gas Limit is the maximum gas usage. Octet sets the Plasma gas limit to 21,000, and the gas limit for tokens is set to 100,000 since it varies depending on how the tokens are implemented. The actual gas usage could be less than that, and the fees are charged only for the actual gas usage.
- Max Fee Per Gas is the maximum fee per gas. You can access the value by calling the Get Fee API. The actual fee per gas could be less than that.
Transaction fees
Transaction fees are calculated by multiplying the gas price and the amount of gas used.
Transaction Fees = Usage by Txn x Gas Price
- Gas Price includes the fee paid to the miner, Max Priority Fee Per Gas. Octet sets the value to 1 Gwei on the testnet and 1 Gwei on the mainnet.