Hedera -> Projected Hedera (EVM)
Overview
The transfer of assets from Hedera to the EVM chain is described by the following sequence diagram.
Steps
1. Initiating the transaction
Alice uses the hashport Portal to transfer HBAR or HTS token from Hedera to the EVM chain. She uses a software crypto wallet (e.g. MetaMask) or wallet directly loaded into hashport to send the assets to the Portal Account. The memo of the transaction contains an EVM address, which will receive the projected asset on the EVM chain.
2. Picking up the transaction
Validator nodes listen for new incoming transactions to the Portal Account. After receiving Alice's transaction, the nodes verify the state proof
and validate that the memo
contains a valid EVM address.
3. Paying out fees
3.1 Each validator node creates a Schedule Transaction (ScheduleCreate
) that transfers the service fee amount from the Fee Account to the list of validators equally.
3.2 Only one of these schedule transactions will be successfully submitted, creating a schedule entity. All other scheduled transactions will fail with IDENTICAL_SCHEDULE_ALREADY_CREATED
error, and the transaction receipt will include the ScheduleID
of the successfully submitted transaction.
3.3 All validators, except for the one that successfully submitted the transaction, will need to submit a ScheduleSign
transaction. Once n out of m
validators have signed the scheduled transaction, the scheduled transaction will be executed and the service fee will be sent out of the Fee Account.
You can learn more about Scheduled Transactions here.
4. Providing authorization signatures
Each validator node will need to sign the following authorization message: {hedera-tx-id}{router-address}{projected-token}{receiver}{amount}
using their EVM-compatible private key. The message is then submitted to a topic in the Hedera Consensus Service.
5. Waiting for supermajority
Alice's hashport Portal waits for a supermajority of signatures, which is checked by watching the topic messages stream or fetched directly from the validator nodes.
6. Submitting the EVM transaction
Once a supermajority is reached, Alice submits a transaction to the EVM chain to claim her projected assets. The transaction contains the raw data signed in the message: {hedera-tx-id}{router-address}{projected-token}{receiver}{amount}
.
7. Verifying the transaction
The EVM chain smart contract verifies that no replay attack is being executed by checking the hedera-tx-id
and verifies the provided signatures against the raw data that was signed.
You can learn more about replay attacks here.
8. Receiving the projected tokens
If consensus is reached, the Router
contract mints
the projected token to Alice's EVM address.