Run SUAVE Locally
Our first goal is to start a "Kettle". Kettles house all components necessary to perform confidential compute and are the main protocol actor in the SUAVE protocol.
Here is the architecture of a node on the Rigil Testnet. We'll be running all the stuff within the purple square.
You can read more about exactly what a Kettle contains in architecture section of the Technical Specs.
Get Startedβ
There are two different approaches you can take to local setup:
Clone the suave-geth repositoryβ
git clone git@github.com:flashbots/suave-geth.git
cd suave-geth
Building from sourceβ
We recommend that you use Golang v1.21 or above.
Build the binary:
make suave
Now you have a suave
binary in ./build/bin
. You can check this by running:
./build/bin/suave --version
Start the local devnet with:
./build/bin/suave --suave.dev
Missing packages
If you have set up a new machine to run through this, you'll also need to install Make and Go:
sudo apt install make golang-go
Using Dockerβ
Spin up the local devnet with docker-compose:
make devnet-up
You can check that the containers are running with:
docker ps
And you can stop the local devnet with:
make devnet-down
On MacOS, the above should work out of the box with Docker Desktop. If you're using Linux, you may run into some of the issues below:
1. Docker permission errors
On Linux, it is best to create a new user group for Docker, rather than run the above command as sudo. You can do by running:
sudo usermod -aG docker $USER newgrp docker
2. Docker not running
Make sure that Docker is running. On most Linux machines, you can do this with:
sudo systemctl start dockerYou can check the current status with:
sudo systemctl status dockerIf you installed Docker and still run into issues with docker-compose, you can try:
sudo apt install docker-compose
3. Unsupported version
If you're running an older version of Docker, you may get a message that looks like this:
ERROR: Version in "././suave/devenv/docker-compose.yml" is unsupported.
Go to the file in "/suave/devenv/docker-compose.yml" and change the first line to use 3.3 rather than 3.8.
Testing the devnetβ
Compile the example contracts:
What is Forge?
forge
is a part of the smart contract development toolchain we use in our examples, which you can learn more about in our next tutorial. If you do not have it installed, you can do so quickly with:
curl -L https://foundry.paradigm.xyz | bash
cd suave && forge build
Create a few example transactions:
go run devenv/cmd/main.go
Execute a RPC request with curl like this:
curl 'http://localhost:8545' --header 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"eth_blockNumber", "params":[], "id":83 }'
If you built from source (but not if you're running Docker), you can attach to the usual Geth javascript console to get any interactive data you need with:
suave attach /tmp/geth.ipc
IPC not found
It may be the case, especially if you have a custom GOPATH, that the geth.ipc is somewhere else. You can either force the path using the --ipcpath
flag whens tarting SUAVE, or find the path in the logs (it could look something like /System/Volumes/Data/private/var/folders/rt/gq5bhvy17wz5z5dl32_x83dw0000gp/T/geth.ipc
, for instance).
From within the console, you can run:
eth.accounts[0]
This should return "0xb5feafbdd752ad52afb7e1bd2e40432a485bbb7f"
- the default funded account for local development.
eth.getBalance(eth.accounts[0])
Should return a really large number 1.1579...e+77
. If you try eth.getBalance("<your_new_address>")
instead, you should see 0
.
If you try:
web3.eth.blockNumber
It should tell you the block height of your local network.