Closed Liao1 closed 3 years ago
https://github.com/hicommonwealth/edgeware-documentation/blob/master/docs/edgeware-runtime/evm/evm-balances.md According to the document above, actaully we can do EVM - Substrate bidirectional fund transfer now
scenario 1: someone want to send transactions to contracts deployed in our testnet
scenario 2: the person don't want to do anything more with contracts, but there are still some token in evm address D, he wants to transfer these tokens back to B
But the process above is a little complex, to simply it, we will add support 2 extrinsics: transferToSubstrate
and transferToEVM
, which support directly transfer between EVM and Substrate account
We can use
subkey
to generate a sr25519 key pair, we will get theSecret Seed
andAccount ID
,Account ID
is thesubstrate address
(let us call it asaddressA
), and you can genarate the private key using this secret seed. Besides, we can import the generated private key into Metamask and get a correspondingevm address
(call itaddressB
), but actually these 2 addresses are address of 2 different account. We can do a experimentation:Then you can use code below to calculate a substrate address from the evm address,
<evm address>
is the address in Metamask without leading0x
you will get a string like
65f5fbd10250447019bb8b9e06f6918d033b2feb6478470137b1a552656e2911
by running code above, then come back to blockchain explorer, paste the string here(we will get a another address, call it addressC ) and call account function: you will find that balance of this account is 10 ATA(or 10 BATA) The result verifies that actuallyaddressA
andaddressB
are 2 different account in our chain,addressB
andaddressC
are same account in our chain. Currently, assume that someone have some ata in his evm address account, and he want to interact(send extrinsics) with our chain, it is impossible because he doesn't know the private key of corresponding substrate address. So maybe we need to change the mapping methods in evm pallet, take the previous example, we should mappingaddressA
toaddressB