Can we deploy same ERC20-token on different blockchains?
Asked Answered
A

1

7

I want to deploy my own ERC-20 token on different blockchains, so is there any possibility to deploy the same token contract on different blockchains. If we do that we can't give the same name and symbol for three blockchains. can anybody tell me what is the solution for this problem? Or can we deploy the contract with the same contract address on three blockchains?

Ashton answered 16/8, 2021 at 12:19 Comment(0)
C
8

can we deploy the contract with same contract address on three blockchains.

It depends on the network that you're deploying to and the address that you're deploying from. Assuming that the networks of your choice have the same 1) address format and 2) calculation of deployed contract address - then yes, you'll be able to deploy your contract on the same address on multiple networks.

For example Ethereum and BSC do have both of these features. But even though Tron network supports EVM-compatible smart contracts, it has a different way to calculate its addresses, so it won't be possible to deploy your contract on Tron network with the same address as on Ethereum or BSC.

The key to deploy the contract to the same address on multiple networks, is to deploy from the same address, and using the same params:

  1. In case of the regular CREATE opcode, the transaction deploying the contract needs to have the same nonce (and the same from) value across all networks.

  2. Or if you're using the CREATE2 opcode, you need to pass the same contract bytecode, the same salt (to the CREATE2), and again, you need to send the deploying transaction from the same address.


If we do that we can't give the same name and symbol for three blockchains

It is technically possible, so I'm assuming it's "just" a limitation of your business case or some tool that you're using, or a possible simple misunderstanding of how the ERC-20 standard works.

pragma solidity ^0.8;

contract MyToken {
    string public constant name = "MyToken";
    string public constant symbol = "MyT";
    
    // TODO rest of your token contract source code
}
Carpetbagger answered 16/8, 2021 at 15:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.