It's here! Soroban smart contracts have launched on Stellar mainnet on 20 Feb 2024 at 17:00 UTC.
The validators cast their votes at 17:00 UTC, and the first ledger after that (50457424) was running on protocol 20.
And within seconds, the first smart contract was deployed: CDGFGODCSQQQFFBUEJGS7NIDUA5OQKBRFQ57IOKZAZIEJDNQNHS3RV5O
But then.. quiet!? No other contract calls. Why is that?
First of all, Soroban is in phase 0 for the first week, with very low limits on resources contracts can use.
But another thing that perhaps caught devs by surprise was the lack of RPC servers.
See, you need an RPC server to interact with Soroban. And for testnet and futurenet, the SDF has made their RPC server publicly availabe. Not so on mainnet though.
So what's a dev to do?
The docs have a list of public RPC providers you can have a look at.
There are paid and free plans, and even no-signup options.
But you can also run one yourself. It's not very hard, I managed to do it.
There is a page in the Soroban docs, but I found myself needing more info.
And I've compiled that info and steps into a bite-size guide here!
You will need:
- ~ 80GB of disk space
- ~ 1 hour for initial sync
- ~ 1o minutes for re-sync when you re-start it
- An internet connection
- At least some CPU and RAM, I run it comfortably on my laptop with (i5 12450h CPU and 16 GB RAM.
The below is for Linux, see my other post for Windows.
I give you my
10 easy steps to run Soroban-RPC
1) Docker
First, you'll need to install docker on your PC.
I followed this guide
2) Set up a folder
Create a folder in your home/user dir, called soroban-rpc
For me, that is at /home/row-bear/soroban-rpc
(Or whatever you like, just remember the name)
3) Get the Docker image
In a new terminal window: docker pull stellar/soroban-rpc image
4) Configure
The RPC image will need a stellar-core.toml file.
The best practice is to craft one yourself, so you can evaluate which validators you want to include or exclude in your trust set.
I use this one.
Place that file in the folder you made in step 2.
For me, it's at /home/row-bear/soroban-rpc/stellar-core.toml
5) Start it up!
Replace 'row-bear' in the below command with your username (or the whole path with whichever directory you made) and in a new terminal window, run:
docker run -p 8001:8001 -p 8000:8000 \
--name sorobanrpc \
-v /home/row-bear/soroban-rpc:/config stellar/soroban-rpc \
--captive-core-config-path="/config/stellar-core.toml" \
--captive-core-storage-path="/var/lib/stellar/captive-core" \
--stellar-core-binary-path="/usr/bin/stellar-core" \
--db-path="/var/lib/stellar/soroban-rpc-db.sqlite" \
--stellar-captive-core-http-port=11626 \
--network-passphrase="Public Global Stellar Network ; September 2015" \
--history-archive-urls="https://history.stellar.org/prd/core-live/core_live_001" \
--admin-endpoint="0.0.0.0:8001" \
--endpoint="0.0.0.0:8000"
(Edited to add the --name parameter, as suggested by Alex in the comments. Much easier than fiddling with the ID later on!)
You may need to use sudo
, depending on your system config.
If you want it to run on testnet or futurenet, adjust the passphrase in the command (and modify your stellar-core.toml !).
It will start and start to sync. This can take up to an hour, for the first time.
6) Find the container ID
To make sure you can stop and restart the image without doing the full sync again (and eating your disk space in the process!) we'll need to find the container id.
In a new terminal, run docker container ls -a
Remember the -a flag. Else, it will only show running containers. One might assume the container is gone, and keep creating new ones.. 1/10 would not recommend.
If it does happen to you: docker container prune
will remove the stopped containers
Note down the ID of the container that is running. For me, it's 929de777dddc.
Alternatively, you can use the name we supplied when starting it.
7) Stopping and starting it
In a terminal window, run
sudo docker stop <id>
and then
sudo docker start <id>
So, for me: sudo docker stop 929de777dddc
Or: sudo docker stop sorobanrpc
8) Monitor the logs
After restarting, you won't see the log output in your terminal window. If you want that, run:
sudo docker logs -f sorobanrpc
9) Check the status
Again in a terminal, you can run:
curl --location 'http://localhost:8000' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc":"2.0",
"id":2,
"method":"getHealth"
}'
10) Now let's use it!
It's up and running, and hopefully synced.
If you use soroban-cli, you can now add a network to use your RPC: soroban network add local_rpc --rpc-url http://localhost:8000 --network-passphrase "Public Global Stellar Network ; September 2015"
Then, in your next soroban contract invoke
, you can use your very own RPC with --network local_rpc
If you have any practical tips for others, please share them in the comments :-)
As always, join the Stellar Dev discord to discuss the technical stuff, and the Stellar Global discord for everything Stellar.
Happy coding!