Using CLI to Run a Local Testnet
USING SOURCE OR DOCKER RUN A LOCAL TESTNET
If you want to use Docker or Jin-core
source to start and run a local testnet, see Run a Local Testnet with Validator.
You can run a local testnet of the Jinblockchain. This local testnet will not be connected to the Aptos devnet. It will run on your local machine, independent of other Aptos networks. You can use this local testnet for testing and development purposes. A local testnet is a great tool for doing local development against a known version of the codebase without having to interact with a live network or deal with the real world costs of a live network.
JinCLI DOCUMENTATION
If you are new to Jin CLI, then see this comprehensive Jin CLI documentation.
Starting a local testnet with a faucet
You can start a local testnet using the following JinCLI command:
The above command will start a local validator node and will display a terminal output similar to the following:
The above command will use the default configuration for the validator node.
DO NOT USE TWO INSTANCES OF THE SAME COMMAND AT THE SAME TIME
Note that two instances of the same command cannot run at the same time. This will result in a conflict on ports for the validator node.
Test with your local testnet
You can use the JinCLI for a full range of local testnet operations. See below for how to configure the CLI first.
Configuring your Jin CLI to use the local testnet
You can add a separate profile, as shown below:
and you will get an output like below. At the Enter your private key...
command prompt press enter to generate a random new key.
This will create a new account and fund it with the default amount of coins, as shown below:
From now on you should add --profile local
to the commands to run them on the local testnet.
Creating and funding accounts
To create new accounts on the local testnet, we recommend using the above instructions with different profile names:
To fund accounts:
To create resource accounts:
Publishing modules to the local testnet
You can run any command by adding the --profile $PROFILE
flag. In this case, we also use $PROFILE
as the named address in the HelloBlockchain
example.
Resetting the local state
If you updated your codebase with backwards incompatible changes, or just want to start over, you can run the command with the --force-restart
flag:
It will then prompt you if you really want to restart the chain, to ensure that you do not delete your work by accident.
FAQ
I'm getting the error address already in use
, what can I do?
address already in use
, what can I do?If you're getting an error similar to this error:
This means you are either already running a node, or you have another process running on that port.
On macOS and Linux, you can run the following command to get the name and PID of the process using the port:
Where can I get more information about the run-local-testnet command?
More CLI help can be found by running the command:
which will provide information about each of the flags for the command.
Last updated