Trustless Work | API Documentation
It enables trustless payments via smart contracts, securing funds in escrow until milestones are approved by clients. Stablecoins like USDC are used to ensure stability and ease of use.
Maintainers | Telegram
Tech Rebel | Product Manager techrebelgit Telegram |
Joel Vargas | Frontend Developer JoelVR17 Telegram |
Armando Murillo | Full Stack Developer armandocodecr Telegram |
Caleb Loría | Smart Contract Developer zkCaleb-dev Telegram |
- Installing Rust
- Install the Stellar CLI
- Configuring the CLI for Testnet
- Configure an idenity
- Deploy project on Testenet
If you're using macOS, Linux, or any other Unix-like system, the simplest method to install Rust is by using rustup
. Install it with the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
On Windows, download and run rustup-init.exe
. You can proceed with the default setup by pressing Enter
.
You can also follow the official Rust guide here.
After installing Rust, add the wasm32-unknown-unknown
target:
rustup target add wasm32-unknown-unknown
There are a few ways to install the latest released version of Stellar CLI.
The toolset installed with Rust allows you to use the cargo
command in the terminal to install the Stellar CLI.
cargo install --locked stellar-cli --features opt
cargo install --locked cargo-binstall
cargo binstall -y stellar-cli
brew install stellar-cli
Stellar has a test network called Testnet that you can use to deploy and test your smart contracts. It's a live network, but it's not the same as the Stellar public network. It's a separate network that is used for development and testing, so you can't use it for production apps. But it's a great place to test your contracts before you deploy them to the public network.
To configure your CLI to interact with Testnet, run the following command:
stellar network add \
--global testnet \
--rpc-url https://soroban-testnet.stellar.org:443 \
--network-passphrase "Test SDF Network ; September 2015"
stellar network add `
--global testnet `
--rpc-url https://soroban-testnet.stellar.org:443 `
--network-passphrase "Test SDF Network ; September 2015"
Note the --global
flag. This creates a file in your home folder's ~/.config/soroban/network/testnet.toml
with the settings you specified. This means that you can use the --network testnet
flag in any Stellar CLI command to use this network from any directory or filepath on your system.
If you want project-specific network configurations, you can omit the --global
flag, and the networks will be added to your working directory's .soroban/network
folder instead.
When you deploy a smart contract to a network, you need to specify an identity that will be used to sign the transactions.
Let's configure an identity called alice
. You can use any name you want, but it might be nice to have some named identities that you can use for testing, such as alice
, bob
, and carol
.
stellar keys generate --global alice --network testnet
You can see the public key of alice
with:
stellar keys address alice
You can use this link to verify the identity you create for the testnet.
Once you have fully set up the contract in your local environment, installed all the necessary tools, and properly configured your user for the testnet, you will be ready to perform the initial deployment to the Testnet and run tests directly on the contract.
The first step is to compile the contract and generate the .wasm
file, which can be done using the following command:
stellar contract build
Before deploying the contract, you must first install it. This means uploading a version of your code to the Stellar network, which you can later use for deployment.
When you execute the following command with the parameters specific to your local environment, it will return a hash. You will need to save this hash, as it will be required in the next step.
stellar contract install \
--network <network> \
--source <source_account> \
--wasm <path_to_wasm_file>
stellar contract install `
--network <network> `
--source <source_account> `
--wasm <path_to_wasm_file>
Where:
<network>
is the name of the network you are working on (e.g., testnet).<source_account>
is the account from which the installation will be made (you need to provide your own account).<path_to_wasm_file>
is the path to the.wasm
file generated when compiling the contract."
Response:
d36cd70c3b9c999e172ecc4648e616d9a49fd5dbbae8c28bef0b90bbb32fc762
Finally, to deploy the contract, you will need to use the output from the previous command as the input parameter for this command.
Once you execute this command, you will receive another hash, which will be the contract ID. With this ID, you can query platforms such as https://stellar.expert/explorer/testnet and continuously monitor the interactions made with the deployed contract.
stellar contract deploy \
--wasm-hash <wasm_hash> \
--source <source_account> \
--network <network>
stellar contract deploy `
--wasm-hash <wasm_hash> `
--source <source_account> `
--network <network>
Where:
<wasm_hash>
is the hash of the.wasm
file generated during the contract installation.<source_account>
is the account from which the deployment will be made.<network>
is the network you are working on (e.g., testnet).