Actors
- Users - end-users that want to transfer HBAR or HTS tokens from Hedera to EVM-based chain or Wrapped HBAR and Wrapped Tokens from EVM-based chain to Hedera
- Token Developers - the developers of HTS tokens
- Validators - parties/entities that are running the Validator node. They are providing authorisation for the minting and burning of wrapped tokens on the EVM-based chain, as well as transferring wrapped tokens back to Hedera.
Assets
- WHBAR - ERC20 token issued and operated by Bridge validators. The token represents a "wrapped" HBAR on the EVM-based chain. In other words we can say that Hbar is the
native
asset andWHBAR
is thewrapped
asset. - WHTS - ERC20 token issued and operated by Bridge validators. The token represents a "wrapped" HTS token on the EVM-based chain. In this case,
HTS
token is thenative
asset andWHTS
token is thewrapped
asset.
Accounts
- Bridge Account - Hedera threshold account (
n/m
), wherem
is the number of validators. Each validator has a Hedera compatible private key - 1 out ofm
that has1/m
control over this threshold account. The funds transferred through the bridge (Hedera -> EVM) are sent to the Bridge account. The funds transferred back to Hedera (EVM -> Hedera) are sent from the Bridge account to the recipient's account. - Fee Account - Hedera threshold account (
n/m
), wherem
is the number of validators. Each validator has a Hedera compatible private key - 1 out ofm
that has1/m
control over this threshold account. The account is being used to pay for the transaction fees for transferring Assets from the bridge account to the recipient account.
The setup on the EVM chain is the same - Gnosis MultiSig is to be used with the same n/m
threshold configuration. Each validator has an EVM compatible private key - 1 out of m
that as 1/m
control over the threshold account.
The Gnosis Multisig is configured as owner of:
- Wrapped tokens deployed on the EVM chain (f.e. WHBAR / WHTS tokens)
- The Router smart contract
Validators can add new members or remove members from the validator set. We expect validators to have an off-chain communication channel where validators can discuss the current setup, vote on removing validators or adding new ones.
Two transactions must be executed in order for the Validator set to change:
- On Hedera,
Crypto Update
transaction that modifies then/m
threshold accounts (Bridge
andFees
) - On the EVM chain,
updateMember
transaction that modifies the list of members in theRouter
contract (it may add or remove a member)
Note: Once a new validator is added, he can safely run a validator node with the correct credentials configured, and he will be authorising bridge transfers and accruing fees.
The main incentive for becoming a Validator is the service fee paid by users. The fee is a percentage of the transferred amount, paid on the native asset. For example transferring 100 HBAR from Hedera to the EVM chain (WHBAR) is going to have 1% service fee (1 HBAR) transferred to the Bridge Validators.
Note: The Service fee is configurable property and determined by the validators
The transfer of assets from Hedera to the EVM chain is described in the following sequence diagram.
-
Initiating the transfer Alice wants to transfer
HBAR
/HTS token
from Hedera to the EVM chain. She opens any UI that integrates the Bridge and sends the asset to theBridge
Account. The memo of the transfer contains theevm-address
, which is going to be the receiver of the wrapped asset on the other chain. -
Picking up the Transfer The Bridge validator nodes listen for new incoming transfers to the
Bridge
Account. Once they pick up the new transaction, they verify thestate proof
and validate that thememo
contains a valid EVM address configured as receiver of the wrapped asset. -
Paying out fees
3.1 Each of the Validators create a Schedule Create transaction transferring the
service fee
amount from theBridge
account to the list of validators equally (f.e. if the service fee is7 HBAR
and there are7
validators, the Schedule Create Transfer will contain Transfer list crediting1 HBAR
to each of the validators.)3.2 Due to the nature of Scheduled Transactions, only one will be successfully executed, creating a scheduled Entity and all others will fail with
IDENTICAL_SCHEDULE_ALREADY_CREATED
error, and the transaction receipt will include theScheduleID
of the first submitted transaction. All validators, except the one that successfully created the Transaction executeScheduleSign
and oncen out of m
validators execute the Sign operation, the transfer of the fees will be executed. -
Providing Authorisation Signature Each of the Validators sign the following authorisation message:
{source-chain-id}{target-chain-id}{hedera-tx-id}{wrapped-token}{receiver}{amount}
using their EVM-compatible private key. The authorisation is then submitted to a topic in Hedera Consensus Service -
Waiting for Supermajority Alice's UI or API waits for a supermajority of the signatures. She can either watch the topic messages stream or fetch the data directly from Validator nodes.
-
Submitting the EVM Transaction Once supermajority is reached, Alice submits the transaction to the EVM chain, claiming her wrapped asset. The transaction contains the raw data signed in the message:
{source-chain-id}{target-chain-id}{hedera-tx-id}{wrapped-token}{receiver}{amount}
-
Mint Operation The smart contract verifies that no reply attack is being executed (by checking the
hedera-tx-id
and verifies the provided signatures against the raw data that was signed. If supermajority is reached, theRouter
contractmints
the wrapped token to thereceiving
address.
The transfer of assets from the EVM chain to Hedera is described in the following sequence diagram.
-
Initiating the Transfer Alice wants to transfer her
WHBAR
/WHTS
tokens from the EVM chain to Hedera. She opens any UI that integrates the Bridge and sendsburn
transaction to theRouter
contract. As parameter of theburn
function, she specifies the Hedera account to receive the native fungible token. -
Burn Operation The smart contract transfers the wrapped tokens from Alice's address and burns them. At the end of the process, a
Burn
event is emitted, containing the information about the burned token, the amount and the receiver. -
Picking up the Transfer Validator nodes watch for
Burn
events and once such occurs, they prepare and submitScheduleCreate
operation that transfers theservice fee
amount from theBridge
account to the list of validators equally. Due to the nature of Scheduled Transactions, only one will be successfully executed, creating a scheduled Entity and all others will fail withIDENTICAL_SCHEDULE_ALREADY_CREATED
error, and the transaction receipt will include theScheduleID
and theTransactionID
of the first submitted transaction. All validators, except the one that successfully created the Transaction executeScheduleSign
and oncen out of m
validators execute the Sign operation, the transfer of the fees will be executed. -
Unlocking the Asset Each Validator performs a
ScheduleCreate
operation that transfersamount-serviceFee
Hbar
to the receiving Hedera Account. All validators that got theirScheduleCreate
rejected, submit an equivalentScheduleSign
. Oncen out of m
validators execute the Sign operation, the transfer is completed.
In order for an EVM native asset to be bridged to Hedera and mapped ot HTS token, the Governance mechanism must:
- Deploy the corresponding HTS token
- Map the EVM token to the HTS token
- Whitelist the EVM asset in the contract and specify the service fee
The HTS token mapped to EVM token has the following configuration:
- The name and symbol of the Token is the same as the EVM one
- Decimals of the token are set to
8
due to HTS <> EVM compatibility issues - The
bridge account
is used as atreasury
for the Token. This enforces the "owner" of the token to be the shared Hedera account that is governed by the Validator set. - The
supplyKey
for the Token is aThresholdKey
equivalent to thebridge account
, meaning that in order for tokens to be minted or burned,n/m
validators must sign themint/burn
transactions.
Once the steps above are performed, a given EVM asset can be transferred through the bridge in both directions.
The following sequence diagram demonstrates the process of transferring ERC20 Token from EVM chain to Hedera:
- Lock - Performed by the User
Alice calls the
lock
function of theRouter
contract specifying theaddress
of the Token, theamount
she wants to bridge and the recipientHedera Account
that will receive the tokens. The contract verifies that the specified token is supported, transfers the Token fromAlice
s account, charges a service fee (% of the token amount), distributes the fee to all validators of the Bridge and emits alock
-ing event with all of the required metadata. - Event Monitoring - Ongoing process performed by Validator nodes
Validator nodes are monitoring the
router
contract forlock
events. Once such event is emitted, each validator computes the correspondingHedera HTS
tokenID
of the bridged asset. - Minting the Tokens - Performed by Validators
Validators create
Scheduled Mint
transactions. Once the requiredn/m
keys have executed eitherScheduleCreate
orScheduleSign
operation, the specified in theEVM
transaction tokens, are minted to thetreasury
. (Note:TokenMint
operation can mint tokens only to the treasury). - Transferring the Tokens - Performed by Validators
Validators create
ScheduleTransfer
transactions that transfer the newly minted tokens from theTreasury
to Alice'sHedera Account
.
The following sequence diagram demonstrates the process of transferring HTS Tokens mapped to ERC20 Tokens from Hedera to the source EVM chain:
- Initiate the transfer - Performed by the User
Alice executes a
CryptoTransfer
operation sending the mapped HTS tokens (that she wants to transfer back to the EVM chain) to the correspondingtreasury
account of the HTS tokens. In thememo
of the transaction, she encodes the following information:{chainId}-{receiving-address}
, wherechainId
is the chain ID used in EVM based chains and{receiving-address}
is the EVM address that will receive the EVM native tokens. - Transfers Monitoring - Ongoing process performed by Validators
Validator nodes are monitoring new incoming transfers towards the configured
treasury
(reused for all Bridge supported tokens). Once such transfer is picked up, Validators are executing state proof verification and proceed with the bridging. - Burning the tokens - Performed by Validators
Validators creates scheduled
TokenBurn
operation that removes theamount
sent to the treasury from the treasury account. Oncen/m
keys (validators) have executed eitherScheduleCreate
orScheduleSign
operation, the specified amount of tokens gets burned and the total supply of theHTS
token is reduced. - Providing authorisation signature - Performed by Validators
Each of the Validators sign the following authorisation message:
{source-chain-id}{target-chain-id}{hedera-tx-id}{wrapped-token}{receiver}{amount}
using their EVM-compatible private key. The signature is then submitted to a topic in Hedera Consensus Service. - Waiting for Supermajority Alice waits for a supermajority of the signatures. She can either watch the topic messages stream or fetch the data directly from Validator nodes.
- Unlocking the EVM native tokens - Performed by the User
Once supermajority is reached, Alice submits
unlock
transaction to the EVM chain. The transaction contains the raw data signed in the authorisation signatures, as-well as the signatures. The smart contract verifies the authenticity of the signatures, chargesservice
fee and transfers the requested token to the specifiedrecipient
address.
The transfer of NFT assets from Hedera to the EVM chain is described in the following sequence diagram.
-
Initiating the transfer
1.1 Alice wants to transfer
HTS NFT
from Hedera to the EVM chain. She opens any UI that integrates the Bridge.1.2 Alice sends
CryptoApproveAllowance
transaction for the given NFT, specifying the spender to bePayer Account
of the bridge configuration.1.3 Alice sends the flat fee and all the necessary Royalty (fallback fee) for the NFT asset to the
Bridge
Account. The memo of the transfer contains the otherchain-Id
, theevm-address
which is going to be the receiver of the wrapped ERC-721 (NFT) asset and the Hedera NFT IDserial@token-id
. -
Picking up the Transfer The Bridge validator nodes listen for new incoming transfers to the
Bridge
Account. Once they pick up the new transaction, they validate that thememo
contains a valid EVM address configured as receiver of the wrapped asset and the NFT ID of the Native asset is valid. -
Transferring the NFT to the Bridge Account
3.1 Each of the Validators create a Schedule Create transaction, which transfers the
NFT
to theBridge
account.3.2 Due to the nature of Scheduled Transactions, only one will be successfully executed, creating a scheduled Entity and all others will fail with
IDENTICAL_SCHEDULE_ALREADY_CREATED
error, and the transaction receipt will include theScheduleID
of the first submitted transaction. -
Paying out fees
4.1 Each of the Validators create a Schedule Create transaction transferring the
flat NFT transfer fee
amount from theBridge
account to the list of validators equally.4.2 Due to the nature of Scheduled Transactions, only one will be successfully executed, creating a scheduled Entity and all others will fail with
IDENTICAL_SCHEDULE_ALREADY_CREATED
error, and the transaction receipt will include theScheduleID
of the first submitted transaction. All validators, except the one that successfully created the Transaction executeScheduleSign
and oncen out of m
validators execute the Sign operation, the transfer of the fees will be executed. -
Providing Authorisation Signature Each of the Validators sign the following authorisation message:
{source-chain-id}{target-chain-id}{hedera-tx-id}{wrapped-token}{token-id}{metadata}{receiver}
using their EVM-compatible private key. The authorisation is then submitted to a topic in Hedera Consensus Service -
Waiting for Supermajority Alice's UI or API waits for a supermajority of the signatures. She can either watch the topic messages stream or fetch the data directly from Validator nodes.
-
Submitting the EVM Transaction Once supermajority is reached, Alice submits the transaction to the EVM chain, claiming her wrapped asset. The transaction contains the raw data signed in the message:
{source-chain-id}{target-chain-id}{hedera-tx-id}{wrapped-token}{token-id}{metadata}{receiver}
-
Mint Operation The smart contract verifies that no reply attack is being executed by verifying the provided signatures against the raw data that was signed. If supermajority is reached, the
Router
contractmints
the wrapped ERC-721 (NFT) to thereceiving
address.
The transfer of ERC-721 (NFT) assets from the EVM chain to Hedera is described in the following sequence diagram.
-
Alice wants to transfer her wrapped
NFT
from the EVM chain back to Hedera. Before initiating the actual transfer, Alice needs to:1.1 Approve flat fee Alice submits an approve ERC-20 transaction, which approves the flat fee amount to the
Router
contract.1.2 Approve ERC-721 (NFT) Alice submits an approve ERC-721 (NFT) transaction, which approves the NFT to be burnt by the
Router
contract. -
Initiating the Transfer Alice sends
burn
transaction to theRouter
contract. As parameter of theburn
function, she specifies the NFT and the Hedera account to receive the Hedera native NFT. -
Burn Operation The smart contract transfers the flat fee from Alice's address, and burns the NFT. At the end of the process, a
Burn
event is emitted, containing the information about the NFT and the receiver. -
Picking up the Transfer Validator nodes watch for
Burn
events and once such occurs, they prepare and submitScheduleCreate
operation ofCryptoApproveAllowance
that specifies thespender
of theNFT
as the receiver. Due to the nature of Scheduled Transactions, only one will be successfully executed, creating a scheduled Entity and all others will fail withIDENTICAL_SCHEDULE_ALREADY_CREATED
error, and the transaction receipt will include theScheduleID
and theTransactionID
of the first submitted transaction. All validators, except the one that successfully created the Transaction executeScheduleSign
and oncen out of m
validators execute the Sign operation, the transfer of the fees will be executed. -
Unlocking the Asset After the NFT has been approved for the user, he can then submit a transfer transaction, taking it back in his account.