Skip to main content

Create Testnet with wallets

At Harbor, we have the option to create our Testnets with wallets on each chain that we add. A single Testnet can contain a single or multiple chain(s), each containing up to 3 wallets.

Besides the usual flags needed to successfully add a chain, we need 3 extra flags to add wallets:

  • wallet the number of wallets in a chain
  • token the symbol(s) of coins needed. Examples are:
    • MATIC
    • DAI
    • USDC
  • amount the number of tokens, respectively according to the order of the token symbols provided.
caution

As of November 29th, 2022:

  • If you are adding non-base tokens for anything other than the Ethereum chain, we don't support that yet
  • If you are trying to set the amount of the base token (ETH for Ethereum, AVAX for Avalanche, MATIC for Polygon, etc.), then Harbor will just automatically set the amount to the default 10,000 tokens

To see the list of all tokens supported in Ethereum, check them out here.

Add wallet via config​

info

This only updates the configuration! To directly update your Testnet(s) with wallets, head over to the next section.

1 wallet with matic​

If you'd like to add a chain that has 1 wallet with 1000 MATIC tokens, run the following command:

harbor configure add chain --name ethereum --token matic --wallet 1 --amount 1000 --artifacts-path /path/to/artifacts/ --deploy-path /path/to/deploy --tag v1

Don't forget to add the mandatory flags along with their values: artifacts-path, deploy-path, and tag.

This will create the config:

{
"chains": [
{
"chain": "ethereum",
"config": {
"artifactsPath": "./artifacts",
"deploy": { "scripts": "./deploy" }
},
"wallets": [
{
"tokens": [{ "symbol": "MATIC", "amount": 1000 }]
}
],
"tag": "v1"
}
]
}

If you are satisfied with this configuration, then you can run it as a Testnet.

1 wallet with MATIC and DAI​

To add a chain with 1 wallet containing 1000 MATIC and 10000 DAI, run the following command:

harbor configure add chain --name ethereum --token matic,dai --wallet 1 --amount 1000,10000 --artifacts-path /path/to/artifacts/ --deploy-path /path/to/deploy --tag v1

Always remember to add the artifacts-path, deploy-path, and tag flags since they are always mandatory.

This will give you the config:

{
"chains": [
{
"chain": "ethereum",
"config": {
"artifactsPath": "./artifacts",
"deploy": { "scripts": "./deploy" }
},
"wallets": [
{
"tokens": [
{ "symbol": "MATIC", "amount": 1000 },
{ "symbol": "DAI", "amount": 10000 }
]
}
],
"tag": "v1"
}
]
}

If you are satisfied with this configuration, then you can run it as a Testnet.

3 wallets with MATIC​

Let's say we'd like to add a chain that has 3 wallets with 1000 MATIC tokens each. To do this, run the following command:

harbor configure add chain --name ethereum --token matic --wallet 3 --amount 1000 --artifacts-path /path/to/artifacts/ --deploy-path /path/to/deploy --tag v1

Don't forget to add the mandatory flags along with their values: artifacts-path, deploy-path, and tag.

This will create the config:

{
"chains": [
{
"chain": "ethereum",
"config": {
"artifactsPath": "./artifacts",
"deploy": { "scripts": "./deploy" }
},
"wallets": [
{
"tokens": [{ "symbol": "MATIC", "amount": 1000 }]
},
{
"tokens": [{ "symbol": "MATIC", "amount": 1000 }]
},
{
"tokens": [{ "symbol": "MATIC", "amount": 1000 }]
}
],
"tag": "v1"
}
]
}

If you are satisfied with this configuration, then you can run it as a Testnet.

3 wallets with MATIC and DAI​

To add a chain that has 3 wallets with 1000 MATIC and 10000 DAI tokens each, run the following command:

harbor configure add chain --name ethereum --token matic,dai --wallet 3 --amount 1000,10000 --artifacts-path /path/to/artifacts/ --deploy-path /path/to/deploy --tag v1

Don't forget to add the mandatory flags along with their values: artifacts-path, deploy-path, and tag.

This will create the config:

{
"chains": [
{
"chain": "ethereum",
"config": {
"artifactsPath": "./artifacts",
"deploy": { "scripts": "./deploy" }
},
"wallets": [
{
"tokens": [
{ "symbol": "MATIC", "amount": 1000 },
{ "symbol": "DAI", "amount": 10000 }
]
},
{
"tokens": [
{ "symbol": "MATIC", "amount": 1000 },
{ "symbol": "DAI", "amount": 10000 }
]
},
{
"tokens": [
{ "symbol": "MATIC", "amount": 1000 },
{ "symbol": "DAI", "amount": 10000 }
]
}
],
"tag": "v1"
}
]
}

If you are satisfied with this configuration, then you can run it as a Testnet.

Run the Testnet​

If you are satisfied with the configuration, then you can go ahead and apply the configuration to a Testnet. To do so, run the command:

harbor apply <testnet-name>

Where <testnet-name> is a custom Testnet name you can provide.

You should see this log:

Doing preflight checks...
Creating smart contracts...
Preparing your ethereum deployment...
Building chain image... 100% |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| | (0/1, 0 it/hr) [0s:0s]
β ’ Pushing images to container repository [1s]
Constructing chain...
🌍 Testnet create/update in progress... [1m40s]

###### 1 Chains

Chain = ⛓️ethereum
Status = βœ” RUNNING
Endpoint = 🌎 http://3.111.187.140:4000


###### 0 Off-chain actors

When it is running, you should see a card in the UI that represents the number of blockchains added and the wallets being used.

tn_card

If you navigate to the Testnet page, you can see the wallets contained in each Blockchain section. This will give you greater details on the type of tokens each wallet contains and the amount of the token.

Add wallet(s) on an existing Testnet​

What if you had a running Testnet and wanted to add a new chain with wallets? That's also possible!

Let's assume you have a running Testnet, wallet-test. If you wanted to add a Polygon chain that contains 3 wallets with 200 MATIC each, then run the command:

harbor edit wallet-test add polygon --wallet 3 --token MATIC --amount 200 --artifacts-path /path/to/artifacts/  --deploy-path /path/to/deploy/ --tag polygon-v1

If we already had Polygon running on the wallet-test Testnet, we can update Polygon to add a wallet by running:

harbor edit wallet-test  add polygon --wallet 3 --token MATIC --amount 200 --artifacts-path /path/to/artifacts/  --deploy-path /path/to/deploy/ --tag polygon-v1

This will give us:

🌏 Testnet create/update in progress...  [1s]

Until the Testnet is fully updated.