Skip to main content

Deploy Smart Contract

Now you can deploy a smart contract on the Quickstart local network. If you already have a smart contract, you can deploy your existing smart contract, otherwise, you can follow this guide to create a smart contract and build it.

Create Identity

Before you can deploy and invoke a smart contract, you need to create an identity on the local network. The identity is a required parameter, referred to as source-account or source. This is how you can create an identity on the local network called bob:

stellar keys generate --global bob --network local --fund

The identity will have a private and a public key, and can be called by the name bob for convenience.

Deploy contract

Deploying a smart contract to Quickstart testnet is not very different from deploying a smart contract to the public testnet. Specify the RPC URL to be Quickstart’s and you can deploy it:

stellar contract deploy \
--wasm target/wasm32-unknown-unknown/release/hello_world.wasm \
--source bob \
--network local \
--alias hello_world

Invoke contract

Now you have deployed the smart contract to the Quickstart testnet, you can also invoke it:

stellar contract invoke \
--id hello_world \
--source bob \
--network local \
-- \
hello \
--to RPC

That’s it!

Now you can dive into some of the benefits of running your own local node with Quickstart. Some benefits are that it’s faster to invoke a contract, you get better debugging options, etc.