# Local Testnet

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.

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

Now run the node via `amadeusd`

```bash
#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)>`

```elixir
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

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

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ama.one/testnet/local-testnet.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
