1

I want to create a local testnet on which I can move USDT (test coins) between wallets.

I managed to create a ETH testnet inside Docker. In the docker-compose.yml below, the lines between # ETH testnet setup (start) and # ETH testnet setup (end) are responsible for that.

version: '3'

services:
#
# BTC testnet setup (start)
#
  node:
    image: ulamlabs/bitcoind-custom-regtest:latest
  electrumx:
    image: lukechilds/electrumx:latest
    links:
      - node
    ports:
      - "51001:50001"
      - "51002:50002"
    environment:
      - NET=regtest
      - COIN=BitcoinSegwit
      - DAEMON_URL=http://test:test@node:19001
  explorer:
    image: ulamlabs/btc-rpc-explorer:latest
    links:
      - node
      - electrumx
    ports:
      - "3002:3002"
    environment:
      - BTCEXP_HOST=0.0.0.0
      - BTCEXP_BITCOIND_URI=http://test:test@node:19001
      - BTCEXP_ELECTRUMX_SERVERS=tls://electrumx:50002
      - BTCEXP_ADDRESS_API=electrumx
#
# BTC testnet setup (end)
#


#
# ETH testnet setup (start)
#
  geth:
    image: ulamlabs/geth-poa-testnet:latest
    environment:
      - ETH_PASSWORD=QfdxTYxkwASj
      - ETH_PRIVATE_KEY=0d0b4c455973c883bb0fa584f0078178aa90c571a8f1d40f28d2339f4e757dde
      - ETH_ADDRESS=0c56352F05De44C9b5BA8bcF9BDEc7e654993339
    ports:
      - 8178:8178
      - 8546:8546
    volumes:
      - ./genesis.json:/app/genesis.json

  postgres:
    image: postgres:12
    command: postgres -c 'max_connections=500'
    environment:
      - POSTGRES_HOST_AUTH_METHOD=trust

  blockscout:
    image: ulamlabs/blockscout:latest
    links:
      - geth
      - postgres
    ports:
      - 4000:4000
    environment:
      - DATABASE_URL=postgresql://postgres:@postgres:5432/postgres?ssl=false
      - ETHEREUM_JSONRPC_VARIANT=geth
      - ETHEREUM_JSONRPC_HTTP_URL=http://geth:8178
      - ETHEREUM_JSONRPC_WS_URL=ws://geth:8546
      - MIX_ENV=prod
      - BLOCKSCOUT_HOST=localhost
      - COIN=eth
      - NETWORK=POA
      - SUBNETWORK=Local Testnet

#
# ETH testnet setup (end)
#

The file ./genesis.json:/app/genesis.json contains the following:

{
    "config": {
        "chainId": 5555,
        "clique": {
            "period": 60,
            "epoch": 30000
        },
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "eip155Block": 0,
        "eip158Block": 0,
        "byzantiumBlock": 0,
        "constantinopleBlock": 0,
        "petersburgBlock": 0,
        "istanbulBlock": 0,
        "muirGlacierBlock": 0
    },
    "extraData": "0x00000000000000000000000000000000000000000000000000000000000000000c56352F05De44C9b5BA8bcF9BDEc7e6549933390000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "alloc": {
        "411167FeFecAD12Da17F9063143706C39528aa28": {
            "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
        }
    },
    "nonce": "0x0",
    "timestamp": "0x5eaa7b09",
    "gasLimit": "0x47b760",
    "difficulty": "0x1",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}

As far as I understand,

  • no USDT test coins are being mined in this testnet and
  • in order to have USDT test coins I need to add ERC20 support to the ETH (geth) testnet.

How do I need to modify the above docker-compose.yml and/or genesis.json files in order to add ERC20/USDT support to my ETH testnet?

0

1 Answer 1

4
+50

I will try to answer as best as I can, although the question is not 100% clear to me.

Eth transfer

Transfer of Ether between accounts is handled natively by the blockchain. You do not need to deploy any smart contract to do so.

ERC-20 transfer

USDT and other ERC-20 tokens do not exist natively on the blockchain. Each ERC-20 token is a smart contract that was deployed by someone. For instance, this is the USDT contract address. You can also read the USDT contract code here.

USDT on testnet

To answer your question, you can test USDT on a testnet by deploying an exact copy of the USDT contract (linked above) on that testnet, then calling some functions like transfer() on the smart contract.

Note that you do not need to create your own testnet. You could use a public testnet like Ropsten, Kovan, Rinkeby, etc. You could also do a local fork of Ethereum mainnet using a tool like ganache-cli. With the latter, the USDT contract is already deployed and you can test it on your local fork of Ethereum mainnet. Ganache-cli also allows you to create a local testnet very easily.

4
  • I have a list of 10 accounts in Ganache. Can you explain how I transfer USDT to one of them? Commented Mar 19, 2022 at 0:59
  • This is the USDT contract source code even though the word usdt is not mentioned at all? Commented Apr 2, 2022 at 15:11
  • 1
    Yes. Etherscan shows that this is the USDT token address
    – Undead8
    Commented Apr 2, 2022 at 16:27
  • To elaborate the contract name is tether which is USDT, also the USDT name and symbol were passed in constructor therefore you don't see it in the contract itself function TetherToken(uint _initialSupply, string _name, string _symbol
    – Ali
    Commented Jan 3, 2023 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.