Skip to main content

Deploy to Futurenet

If you have Docker installed, you can run a local node with the Stellar Quickstart Docker image that joins the Futurenet network, and then use that local node to deploy.

info

It's also possible to run a contract in the local sandbox environment without a network using just the soroban-cli. See Run on Sandbox for more details.

To run a local node for the Futurenet network with the Stellar Quickstart Docker image, run the following command.

docker run --rm -it \
--platform linux/amd64 \
-p 8000:8000 \
--name stellar \
stellar/quickstart:[email protected]:0993d3350148af6ffeab5dc8f0b835236b28dade6dcae77ff8a09317162f768d \
--futurenet \
--enable-soroban-rpc

Once the image is started you can check its status by querying the Horizon API:

curl http://localhost:8000

It takes sometime to join a remote network. Monitor the output of that endpoint until you see the core_latest_ledger become a number above zero.

Generate a key by going to the Stellar Laboratory. Make note of both the G... and S... keys. The G... key is the public key and will also be the account ID. The S... key is the secret key and is that you use to control the account.

tip

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 ever using them for other purposes.

Create an account on the Futurenet network by making a request to the Friendbot. Specify as the addr the G... key of your account.

curl "https://friendbot-futurenet.stellar.org/?addr=G..."

Once you have an account on the network, we'll use the code we wrote in Write a Contract and the resulting .wasm file we built in Build as our contract to deploy. Run the following commands to deploy the contract to the network. Use the S... key as the secret key.

soroban deploy \
--wasm target/wasm32-unknown-unknown/release/[project-name].wasm \
--secret-key S... \
--rpc-url http://localhost:8000/soroban/rpc \
--network-passphrase 'Test SDF Future Network ; October 2022'
tip

It's good practice to avoid entering secret keys on the command line. You can also specify the secret key by setting the environment variable SOROBAN_SECRET_KEY. The soroban-cli is still in development and in the future there will be other secure ways to provide a secret key, such as via hardware keys.

A contract ID will be outputted.

cd4dae2c409c433b1e1d83994a20214d3e5f60bdd3a817978d8aa7c797864313

Using the contract ID that was outputted, use the soroban-cli to invoke the hello function with a single argument friend.

soroban invoke \
--id cd4dae2c409c433b1e1d83994a20214d3e5f60bdd3a817978d8aa7c797864313 \
--secret-key S... \
--rpc-url http://localhost:8000/soroban/rpc \
--network-passphrase 'Test SDF Future Network ; October 2022' \
--fn hello \
--arg friend

The following output should appear.

["Hello","friend"]