Closed rakeshgohel01 closed 5 years ago
Hi @mocha384, thank you for submitting the proposals. Could you please change the AIP indices so that they are aligned with issue indices? For example, for this AIP, change it to AIP #006.
This AIP is accepted.
Title: Bidirectional Bridge Operator Standard Author(s): Rakesh Gohel Type: ASC (Aion Standards and Conventions) Status: Accepted Creation Date: September 23th, 2018 Contact Information: rakesh@mavennet.com
Summary
A standard to meet the functionality requirements of a bidirectional bridge operator to support a two way flow of tokens or assets.
Value Proposition
To enable the movement of tokens/assets beyond the boundary of a connected blockchain to AION and similarly in the opposite direction. Most of the tokens are tied to the network they have been created in. If a similar token is available on Aion, they can be benefited from the Aion ecosystem. Moreover, there is a value proposition to create a split ICO token to receive the benefits of two different blockchain networks.
Motivation
The primary motivation for the proposol is to enable tokens available on other blockchain networks to be able to participate and receive the benefits of Aion blockchain. The exchange route to move the tokens across the network could be expensive and a lot more complexity involved for the user. The bridge operator helps user to move their tokens to Aion with ease. Secondly the token supply can be split on two different networks to get the best out of two networks.
Non-Goals
The scope of this standard is limited to on-chain functionality for token transfer on two different networks. This standard does not address how cross-chain token movements should be reflected on third party services or tools such as blockchain explorers, wallets or exchanges.
Success Metrics
There are two key indicators of success for this standard: 1) Number of contract deployments with bridge functionality 2) Number of Bridge operator contracts deployed for cross-chain movements
Description
Fungible tokens have proven to be one of the core building blocks of the current decentralized web era. Most of the tokens are tied up in the network they have been issued.
The bridge operator provides a core ability to perform cross chain token transfer across a different blockchain network of which ecosystem allows to reap the benefits not available on source chain. The Aion token standard or ERC-20 controller achieve this function by maintaining security and stable token supply and choosing whom to appoint as bridge operator.
This standard aims to provide a reliable interface that can be implemented by any token issuer if they want to act as bridge operator by themselves or any trusted 3rd party looking to support bridge functionalities.
High-Level Architecture
This diagram provides a high-level overview of the proposed bridge operator contract architecture related to tokens to enable cross-chain movements.
Note: The scope of this AIP is limited to the bridge operator contract highlighted. In the diagram.
Specification
Definitions
bridgeId
, Bridge Contracts andnetworkId
Methods
Validator Interface
The
constant
functions detailed below MUST be implemented.isValidator
functionReturns true/false for a validator's address.
validatorCount
functionReturns the number of validators participating in bridge operation.
minimumValidatorApproval
functionGet the minimum number of validators required to thaw tokens on destination network.
initializeValidatorGroup
functionBridge operator decides the number of independent validators and initializes the bridge.
NOTE:
initializeValidatorGroup(address[])
should be accessed when a bridge operator contract does not have any validators assigned, otherwise fails.The following rules MUST be applied regarding the initializeValidatorGroup:
addValidator
functionThe bridge operator adds additional validator after initializing the bridge.
The following rules MUST be applied regarding the addValidator:
removeValidator
functionThe bridge operator can remove validator in case of they do not want to participate in process or cannot be trusted further.
The following rules MUST be applied regarding the removeValidator:
Solidity Interface
Bridge Operator
A
bridge operator
is an address which is allowed to thaw tokens on destination network when an independent validator confirms that the token holder has frozen her token on the source network.The following rules apply to any bridge operator:
Thaw
event with the correct values when a token contract successfully executes thaw [Thaw
Event].Distributed
event with the correct values when a token contract successfully able to execute thaw [Distributed
Event].ProcessedBundle
event with the correct values when a bridge operator makes the token contract to thaw for all transfer transactions as defined in the [ProcessedBundle
Event].NOTE: A token contract MAY have multiple operators at the same time.
NOTE: A token contract MAY configure additional operator. A
BridgeOperatorSet
MUST be emitted each time.NOTE: A token contract MAY remove an already removed operator. A
BridgeOperatorUnset
MUST be emitted each time.processBundle
functionBridge operator
verifies that the required minimum validators have confirmed the bundle containing all token transfer transactions. The function iterates over all the signature parameters and decides whether to thaw from the token contact. If the bundle is successfully verified, it emitsProcessedBundle
event with its correct parameters. If a bundle has already been previously verified and exist, it emitsSuccessfulTransactionHash
event with its correct parameter.NOTE: These events MUST NOT be emitted elsewhere in the process.
setBundle
functionSet a destination chain transaction hash in case of bundle is successfully processed. When a bundle is being processed, the solidity function does not have access to the transaction hash, so the relay can set the transaction hash after processing the bundle.
NOTE: The only bridge operator should be able to set the transaction hash.
getBundle
functionGiven the hash of a bundle, retrive the transaction hash on destination network.
Distributed
eventIndicate a distribution of
amount
of tokens torecipient
address on destination chain.ProcessedBundle
functionThis event is emitted at the end of processing the bundle without an error.
NOTE: MUST emit
ProcessedBundle
event.NOTE: MUST revert if not enough balance in bridge opeartor account.
SuccessfulTransactionHash
functionCalled by an operator to move tokens to destination chain on behalf of token holder.
NOTE: MUST emit
SuccessfulTransactionHash
event if the bundle has already been processed.Solidity Interface
Logic
Cross Chain Functionality
To send a cross chain token transfer from the source chain to the destination chain, the sender must freeze the token on source chain and specify the destination chain and destination token receiver address using the
freeze
oroperatorFreeze
functions. The Bridge Contract then relays the transaction to the destination chain and thaws the appropriate token amount from destination chain token contract.To send a cross chain token transfer from a destination chain to source chain, the sender must first freeze their destination tokens by sending them to the token contract and emitting an event which specifies the destination address on the source chain and the Bridge Contract to use. The Bridge Contract then relays the transaction to the source chain and calls the
thaw
function.Risks & Assumptions
[ERC20] compatibility notes:
This standard assumes that token contract has cross chain functions available in ATS. In case of existing ERC20 tokens without this functions, a control contract must be created which adds cross chain functions.
Test Cases
N/A
Implementations
Reference Implementation
Dependencies
The implementation of token contract supporting cross chain functionality is mentioned in AIP-04.
Copyright
All AIP’s are public domain. Copyright waiver: https://creativecommons.org/publicdomain/zero/1.0/