Consensus

A fault-tolerant mechanism to achieve agreement, assurance, and security in the blockchain system across the decentralized network.

Basics

An easy way to interpret the notion of our consensus is to imagine it as a prevalent record-keeping mechanism in the crypto space that helps keep all contributing nodes (or you may call them participants or transactors as you like) in the network honest.

Hundreds of thousands of users work on authentication/verification of transactions on the blockchain every day and with such a dynamically changing status of the blockchain, it is then essential for these publicly-shared ledgers to have a secure and real-time consensus algorithm to ensure that all the trade happening on our network are genuine and all participants agree on a consensus on the status of the ledger. Thus, we brought about this consensus to determine the legitimacy of contributions made by the users on the chain.

Consensus is playing an important role in the protocol security of users' funds in cross-chain transactions. There will be two roles involved in our consensus mechanism:

Executor: the one that executes the target chain transaction ➋ Validator: the one that validates the data of the executor's target transaction and signs/approves

Roles

Executor

For the time being, there will be only one executor within our consensus, which will continually check and process transactions according to the set routine as follows. However, in the future, we plan to open up to more verified partners and institutions to become executors. This will help enhance the stability of the entire system and further diversify risks.

➀ Parse and check the request information from the source blockchain

The executor keeps monitoring cross-chain swaps on each of our supported blockchains, and then parses and validates the events with regard to the transactions. Events in the transactions contain the source and the target chain swap information, which includes the amount of the bridge token, the amount being swapped, the minimum of target tokens to be received, etc.

It is also responsible for checking the validity of the orders of the events, and whether the desired amount (the quoted price) within the event tallies with users' funds on the source chain. If the events within transactions are found invalid, the executor will require the validators to sign a refund request and submit a source chain refund transaction to refund the swap request from users along with their assets.

➁ Execute swap transaction on the target chain

Once the events are validated and with the prerequisite that the liquidity on the target chain is sufficient, the executor will apply the best route on the target chain to swap bridge tokens to the target tokens. If liquidity is insufficient to underpin the swap, the executor might require the validators to sign the refund request and submit a source chain refund transaction for the swap request from users along with their assets.

Validator

Within our consensus, there will be multiple validators, predominantly sourced from investors of XY Finance currently. They will support and constantly validate the data of the requests from the executors where necessary. In return, each validator will receive corresponding rewards at each cycle.

➀ Validate requests from source chain and transactions

The validators will continue to validate the executor's requests to ensure they meet the requirements of users, such as the target-chain token amount for closing or the amount of bridge token given to users in case of a failed swap.

➁ Put signatures to transactions for the executors

Upon validating transactions, the validators are responsible for providing signatures to the executor for executing transactions on the destination chain

Validators ensure to only listen to specific events from our particular contract, ensuring the correctness of user requests before issuing the corresponding signature, to avoid exposure to false events and maintain the system's security

Prospect

In the future, we will further optimize our consensus based on the following plans to maintain and enhance overall stability and security

  1. We plan to invite 1-2 external executors to enhance system stability, throughput, and mitigate risks

  2. We will dynamically adjust the number of reliable validators based on system transaction volume and user count to mitigate the risk of single validator failure or dysfunction, ensuring uninterrupted operation.

Last updated