Creating and starting your first Testnet
Prerequisitesβ
Create your first projectβ
You need to create your own project. Follow the instructions here to do so.
Configure your credentialsβ
Follow the instructions in the manage your credentials page to configure your keys.
Creating your Testnet configurationβ
Clone the Harbor start-testnet
repository. Follow the instructions in the README.md to get it set-up.
Before starting your Testnet, you can optionally edit your Testnet configuration to add chains and off-chain actors.
Start your Testnetβ
If youβve successfully created your Testnet config file, you should be able to run your first Testnet using the commands below in the sample-test
that you cloned.
Apply configurationβ
Don't forget to compile your contracts first:
npx hardhat compile
After you are done modifying your configuration file, run the below command to apply it:
harbor apply <testnet-name> --config harbor.config.json
Where <testnet-name>
is the same name as the Testnet you'd like to update.
You should see logs where Harbor is registering the containers in the cloud (this is reflected in the config file you provided above):
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 [4s]
Constructing chain...
π Testnet create/update in progress... [1m33s]
###### 1 Chains
Chain = βοΈethereum
Status = β RUNNING
Endpoint = π http://54.81.226.241:4000
###### 0 Off-chain actors
You can now interact with these chains and off-chain actors by the endpoints listed in the above log.
Add chain(s) (optional)β
If you are in the same directory as your configuration, you can add a chain by running:
harbor configure add chain <flags>
You can add the following flags:
artifacts-path
: the path to the chain's smart contract artifactschain-id
the id to be used for the chaindepends-on
the dependencies for the chaindeploy-path
the path to the chain's smart contract deploy folderconfig
specifies the location of the config file you want to modifyinclude-paths
the paths to be included while building the chainname
the name of the chain. Accepted names are:tag
the string that identifies the current version of the off-chain actor- If we are updating the actor, then we must add a new
tag
value and runharbor apply <testnet-name>
- Only
+ - = . _ : / @
are allowed as special characters
- If we are updating the actor, then we must add a new
wallet
the number of walletstoken
the symbol(s) of coins needed. Examples are:ETH
DAI
amount
the number of tokens, respectively according to the order of thetoken
symbols provided.
The artifacts-path
, deploy-path
, name
, and tag
are all mandatory flags.
Exampleβ
To add a simple chain:
harbor configure add chain --name polygon --artifacts-path ./artifacts/ --deploy-path ./deploy --tag v1 --config harbor.config.json
If you don't add the config
flag, it will assume that you are updating the harbor.config.json
file, if it is available. If the harbor.config.json
file is not available and you don't add the flag, it'll create the file with the configuration for you. Otherwise, if the file exists, then it will just update the configuration.
This will give you a config file with the output:
{
"chains": [
{
"chain": "polygon",
"config": {
"artifactsPath": "./artifacts",
"deploy": { "scripts": "./deploy" }
},
"tag": "v1"
}
]
}
Add off-chain actor(s) (optional)β
To add an off-chain actor, run the command:
harbor configure add off-chain-actor <flags>
The accepted flags are:
build-path
the build path pointing towards the Dockerfile directory for our off-chain actorcommand
the command to be used for the off-chain actorconfig
specifies the location of the config file you want to modifydepends-on
is the array of dependencies for the off-chain actordocker-file
the path to the Dockerfile of the off-chain actorenv
array containing environment variables to be setimage
the public image that the off-chain actor will be based offname
the name of the actorports
the array of specified ports for the actorschedule-exp
thecron schedule
expression for the off-chain actor which determines the frequency with which the actor has to be invoked.- i.e:
rate (1 minute)
as a value ofschedule-exp
means that the off-chain actor is invoked every 1 minute
- i.e:
tag
the string that identifies the current version of the off-chain actor- If we are updating the actor, then we must add a new
tag
value and runharbor apply <testnet-name>
- Only
+ - = . _ : / @
are allowed as special characters
- If we are updating the actor, then we must add a new
The image
(if public image actor) or docker-file
/build-path
(if locally built actor), name
, ports
, and tag
are all mandatory flags.
Exampleβ
To add a simple off-chain actor:
harbor configure add off-chain-actor --name ipfs --image ipfs/go-ipfs:v0.4.23 --ports 5000 --tag v1 --config harbor.config.json
The name
of an off-chain actor cannot be more than 20 characters!
If you don't add the config
flag, it will assume that you are updating the harbor.config.json
file, if it is available. If the harbor.config.json
file is not available and you don't add the flag, it'll create the file with the configuration for you. Otherwise, if the file exists, then it will just update the configuration.
This will give you the configuration:
{
"offChainActors": [
{
"name": "ipfs",
"image": "ipfs/go-ipfs:v0.4.23",
"ports": [5000],
"tag": "v1"
}
]
}