Development
For local development, we recommend downloading and running a local instance via Docker Quickstart and running a local network or communicating with a live development Testnet.
We don't recommend running the Quickstart image in production. See the deploy your own RPC instance section.
Standalone
To run a local standalone network with the Stellar Quickstart Docker image, run the following command:
docker run --rm -it \
-p 8000:8000 \
--name stellar \
stellar/quickstart:testing \
--local \
--enable-stellar-rpc
Once the image is started, you can check RPC's status by querying the health check endpoint:
curl --location 'http://localhost:8000/rpc' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"id":2,
"method":"getHealth"
}'
You can interact with this local node using the Stellar CLI. First, add it as a configured network:
stellar network add local \
--rpc-url "http://localhost:8000/rpc" \
--network-passphrase "Standalone Network ; February 2017"
Then generate a unique identity (public/private keypair) and to fund it using:
stellar keys generate alice
It's a good practice to never use the same keys for testing and development that you use for the public Stellar network. Generate new keys for testing and development and avoid using them for other purposes.
Now that you have a configured network and a funded identity, you can use these within other Stellar CLI commands. For example, deploying a contract:
stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/[project_name].wasm \
--source alice \
--network local
Or invoking a contract:
stellar contract invoke \
--id C... \
--source alice \
--network local \
-- \
hello \
--to friend
When you're done with your local node, you can close it with ctrlc (not cmd). This will fully remove the container (that's what the --rm
option to the docker
command does), which means you will need to re-deploy your contract and re-fund your identity the next time you start it. If you work with local nodes often, you may want to create scripts to make these initialization steps easier. For example, see the example dapp's initialize.sh
.