In this section, we will describe how IBax nodes interact with each other from a technical perspective.
The server daemon needs to run on every network node, which executes various server functions and supports IBax's blockchain protocol. In the blockchain network, the daemon distributes blocks and transactions, generates new blocks, and verifies blocks and transactions received, and it can avoid the fork issue.
A honor node runs the following server daemons:
-
Generating new blocks.
-
Downloading new blocks from other nodes.
-
Confirming that blocks on the node also exist on most other nodes.
-
Distributing transactions and blocks to other honor nodes.
-
QueueParserBlocks daemon
Blocks in the queue, which contains blocks from other nodes.
Block processing logic is the same as BlockCollection daemon.
-
QueueParserTx daemon
Verifying the transactions in queue.
-
Scheduler daemon
Running contracts as scheduled.
A guardian node runs the following server daemons:
- BlockCollection daemon
- Confirmations daemon
- Disseminator daemon
- QueueParserTx
- Scheduler
This daemon downloads blocks and synchronizes the blockchain with other network nodes.
This daemon synchronizes the blockchain by determining the maximum block height in the blockchain network, requesting new blocks, and solving the fork issue in the blockchain.
This daemon sends requests from the current block ID to all honor nodes.
If the current block ID of the node running the daemon is less than the current block ID of any honor node, the blockchain network node is considered out of date.
The node that returns the largest current block height is considered the latest node. The daemon downloads all unknown blocks.
If a fork is detected in the blockchain, the daemon moves the fork backward by downloading all blocks to a common parent block. When found the common parent block, a blockchain rollback is performed on the node running the daemon, and the correct block is added to the blockchain until the latest one is included.
The BlocksCollection daemon uses the following tables:
- block_chain
- transactions
- transactions_status
- info_block
The BlockCollection daemon sends the following requests to other daemons:
- Type 10 points to the largest block ID among all honor nodes.
- Type 7 points to the data with the largest block ID.
The BlockGenerator daemon generates new blocks.
The BlockGenerator daemon analyzes the latest blocks in the blockchain to make new block generation plans.
If the following conditions are met, a new block can be generated:
- The node that generated the latest block is in a node within the honor node list and runs the daemon.
- The shortest time since the latest unverified block was generated.
A new block generated by the daemon contains all new transactions, which can be received from the Disseminator daemon of other nodes or generated by the node running the daemon. The block generated is stored in the node database.
The BlockGenerator daemon uses the following tables:
- block_chain (saves new blocks)
- transactions
- transactions_status
- info_block
The BlockGenerator daemon does not make any request to other daemons.
The Disseminator daemon sends transactions and blocks to all honor nodes.
When working on a guardian node, the daemon sends transactions generated by its node to all honor nodes.
When working on a honor node, the daemon sends blocks generated and transaction hashes to all honor nodes.
Then, the honor node responds to transaction requests unknown to it. The daemon sends the complete transaction data as a response.
The Disseminator daemon uses the following tables:
- transactions
The Disseminator daemon sends the following requests to other daemons:
- Type 1 Send transactions and block hashes to the honor node.
- Type 2 Receive transaction data from the honor node.
The Confirmations daemon checks whether all the blocks in its node exist on most other nodes.
A block confirmed by multiple node in the network is considered as a confirmed block.
The daemon confirms all blocks one by one starting from the first that is currently not confirmed in the database.
Each block is confirmed in the way as follows:
- Sending a request containing the ID of the block being confirmed to all honor nodes.
- All honor nodes respond to the block hash.
- If the hash responded matches the hash of the block on the daemon node, the confirmation counter value is increased. If not, the cancellation counter value is increased.
The Confirmations daemon uses the following tables:
- confirmation
- info_block
The Confirmations daemon sends the following requests to other daemons:
- Type 4 Request block hashes from the honor node.
The TCP service protocol works on honor nodes and guardian nodes, which uses the binary protocol on TCP to requests from the BlocksCollection, Disseminator, and Confirmation daemons.
Each request has a type defined by the first two bytes of the request.
This request is sent by the Disseminator daemon.
Hashes of the transaction and block.
The block hash is added to the block queue.
Analyzes and verifies the transaction hashes, and select transactions that have not yet appeared on the node.
No. After processing the request, a Type 2 request is issued.
This request is sent by the Disseminator daemon.
The transaction data, including the data size:
-
data_size (4 bytes)
-
Size of the transaction data, in bytes.
-
data (data_size bytes)
The transaction data.
Verifies the transaction and add it to the transaction queue.
No.
This request is sent by the Confirmations daemon.
Block ID.
Block hash.
Returns 0
if not having a block with this ID.
This request is sent by the BlockCollection daemon.
Block ID.
- block_id (4 bytes)
The block data, including data size.
-
data_size (4 bytes)
-
Size of the block data, in bytes.
-
data (data_size bytes)
The block data.
The connection is closed if not having a block with this ID.
This request is sent by the BlockCollection daemon.
No.
Block ID.
- block_id (4 bytes)