-
Notifications
You must be signed in to change notification settings - Fork 113
Aion pending state and the transaction pool
The Aion transaction pool is a container for storing the unconfirmed transaction (Not been sealed on the network) and storing the pending state of the Aion accounts. Every transaction comes from the network or the kernel API server will be put into the transaction pool if the transaction is valid.
Pending State src
The Pending State is an component to coordinate the most important components in the blockchain kernel, such as database, transaction pool, virtual machine, p2p,and blockchain protocol(consensus). Usually an Aion transaction processing logic follows by these steps:
- The Aion transaction comes from the p2p network(through the transaction broadcast) or the API server(The user send transaction through the API service to reach the Aion kernel).
- Validate every data field in the transaction to make sure the transaction is in the transaction specifications. The Pending State will drops the transaction if it is invalid.
- Check the nonce of transaction is in the correct order. If the transaction nonce is not in the correct order, it will be rejected or put into the transaction cache pool.
- If the transaction nonce is in the exactly right number, the Pending State will invokes the VMs(depends on the transaction types and actions) to execute the transaction and get the transaction result. If the transaction result is not reject(usually due to insufficient balances of the sender), The transaction will be put into the transaction pool and wait the network validators to pick it up.
- The network validators(could be miner or staker) will ask the transaction pool to pick up the pending transactions for creating new block. The transaction pool pick up transactions by the nonce order and the energy price of transaction and give it to the validator. Then the validator can create a new block with picked transactions.
- When the kernel received a new block from the network or the API server submitted by mining pool software or staking signing tool. It will pass the block information to the Pending State and then update the transaction pool by removing the transaction has been sealed on the network, dropping the outdated transactions, and updating the new temporary state of the Aion accounts.
Transaction pool src
The Aion transaction pool stores verified transactions(See step 4 in the previous section) and sorting by the transaction nonce order in each account and the transaction energy price. The transaction pool(V1) will pick the transaction has Highest energy price in the pool with the correct nonce order first and then go lower energy price transaction until the total transaction energy consumption hit the block limitation (usually 15M energy). Once the transaction has been sealed on to the block. The Pending State will plush the transaction pool to sync up the latest state of the kernel.
Once the transaction has been put into the transaction pool(V1). The pool will keep the transaction to the timestamp of the transaction plus one hour. Meaning you cannot stamp the transaction one hour below the current system time, otherwise, the pool will drop the transaction.
Sometimes the transaction stay in the transaction pool a while didn't be picked up by the validator, one of the reason might be the transaction energy fee is too low. User can resend the transaction with at least double energy price compare with the transaction in the pool. The transaction in the pool will be replaced with the new one has higher energy price to increase the sorting ranka of the transaction pool.
Basics
Kernel Configuration
- Build Aion kernel from source
- Installation & Configuration
- Command Line Interface
- Graphical Interface
- Database
- Internal Miner
- Genesis Block
- Aion Seed Nodes
- JSON-RPC API Docs
For Developers
- How to load/debug project to IntelliJ IDEA
- Aion Code Conventions
- Migrating from Ethereum
- Precompiled contract details
- Troubleshooting the kernel
- Aion P2p Specifications
- Aion transaction Specifications
- Aion pending state and the transaction pool
Tutorials
- Importing Accounts
- Kernel Deployment Examples
- Reverting to Previous Blocks
- Application Development
- Enabling-HTTPS-for-JSONRPC
- Enabling Secure connection for Aion Java API
Modules