XY Finance


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


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 and claims the funds from the source chain. ➋ Validator: the one that validates the data of the executor's target transaction and signs/approves the asset-claiming request from the executor.


The flow chart that demonstrates the roles involved in the proof of consensus


There will be only one executor within our consensus for the time being, and it will constantly check and process transactions according to the set routine as follows.

➀ 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 rejecting request and submit a new transaction to reject 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 canceling request and submit a new transaction to cancel the swap request from users along with their assets.

➂ Claim the credit (funds) from the source chain

Upon closing a swap, yBridge sends out both swap and closeSwap transactions to the validators, where the two transactions will be checked as to whether or not users have received their legitimate share of tokens. Once they are verified, the validators will consign a signature to yBridge to allow the Protocol to claim the assets for users.
Let's suggest a worst-case scenario in which yBridge attempted to steal a client's assets by swapping only a small portion of their tokens and taking possession of the rest of the assets, the validators were delicately designed not to put the signature to the deal that enables yBridge to claim the funds which do not belong to the Protocol itself. Instead, the validators would sanction a refund signature whereby the assets would be transferred back to the client on the source chain.


There will be multiple validators within our consensus, and it will support and constantly validate the data of the requests from the executors where necessary.

➀ Validate transactions on the target chain

The validators will keep validating the executor's transactions on the target chain and check if the transactions meet the requirements of users, such as the closing target-chain token amount or the amount of bridge token given to users instead should a swap fail.

➁ 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


As implied in our Roadmap section, there will be improved versions of consensus to come, and we intend to combine the two roles into one as a Node. There will be numerous "self-sustained" nodes within our consensus, and every node has the capability to effect transactions and validate the data and trading information of other nodes' requests, which makes our consensus operate more of a decentralized, self-regulating system that works on a global scale without any single authority.