Two-step deployment
It’s worth knowing thatdeploy is actually a two-step process.
- Upload the contract bytes to the network. Soroban currently refers to this as installing the contract—from the perspective of the blockchain itself, this is a reasonable metaphor. This uploads the bytes of the contract to the network, indexing it by its hash. This contract code can now be referenced by multiple contracts, which means they would have the exact same behavior but separate storage state.
- Instantiate the contract. This actually creates what you probably think of as a Smart Contract. It makes a new contract ID, and associates it with the contract bytes that were uploaded in the previous step.
If the contract has not been build yet, run the build command
stellar contract build from the contract’s root directory.- macOS/Linux
- Windows (PowerShell)
6ddb28e0980f643bb97350f7e3bacb0ff1fe74d846c6d4f2c625e766210fbb5b. Now you can use --wasm-hash with deploy rather than `—wasm. Make sure to replace the example wasm hash with your own.
- macOS/Linux
- Windows (PowerShell)
CACDYF3CYMJEJTIVFESQYZTN67GO2R5D5IUABTCUG3HXQSRXCSOROBAN), and you can use it to invoke the contract like we did in previous examples.
- macOS/Linux
- Windows (PowerShell)
Run your own network/node
Sometimes you’ll need to run your own node:- Production apps! Stellar maintains public test RPC nodes for Testnet and Futurenet, but not for Mainnet. Instead, you will need to run your own node, and point your app at that. If you want to use a software-as-a-service platform for this, various providers are available.
- When you need a network that differs from the version deployed to Testnet.