Local Testnet

How to create a wallet

Remember: Do not use your mainnet keys to interact with the testnet.

The quickest way to build and debug without deploying contracts over and over is to test locally.

A testnet can be run fully local to your PC with validators and block production, mimicking real timings, finality and more.

Local testnet spawns with 10 validators that each have 10m AMA.

Follow the `Connect to Testnet0` guide first, but replace the redirected host to localhost or 127.0.0.1

This way things like the RPC or Wallet now will use your locally running testnet node as the source for the RPC.

You might run into some problems so lets just outline how to run the node first, one thing if you are not root is you wont be allowed to listen on ports below 1024, to fix this, grant permission to bind port 80 and 443 for RPC.

#allow listening on port 80 and 443
sudo sysctl -w net.ipv4.ip_unprivileged_port_start=80

Now run the node via amadeusd

#run the local testnet
TESTNET=true WORKFOLDER=/tmp/testnet HTTP_IPV4=127.0.0.1 HTTP_PORT=80 ./amadeusd

Confirm its working by submitting a transaction between validators using the REPL iex(1)>

key0 = Application.fetch_env!(:ama, :keys) |> Enum.at(0)
key1 = Application.fetch_env!(:ama, :keys) |> Enum.at(1)
Testnet.call(key0.seed, "Coin", "transfer", [key1.pk, "1", "AMA"])

Result

%{
  entry_hash: "7ELicUfkqo69cdJcTsbinpKyQEbuS5raAHgSHmVknYPk",
  error: :ok,
  hash: "DhzK2FGMsSLFiqHujSzkeo1s7nKKqqWAHnydRShMPn5G",
  result: %{error: "ok", exec_used: "10000000"}
}


Last updated