Part 3: Deploying (originating) to a sandbox
Tezos provides a Docker image that contains the Octez client, which allows you to interact with Tezos from the command line. In this section, you use this image to run a sandbox Tezos environment to deploy the Smart Rollup to.
Setting up the sandbox
The hello-world-kernel repository includes a script that configures the Octez sandbox environment for the Smart Rollup, including importing bootstrap keys and setting up bakers.
It's better to run this script in a Docker container to avoid interfering with your local environment.
-
Make sure that Docker desktop is running.
-
Pull the most recent Tezos Docker image, which contains the most recent version of Octez:
docker pull tezos/tezos:latest -
Make sure that you are in the
hello-world-kernelfolder, at the same level as theCargo.tomlandsandbox_node.shfiles. -
Run this command to start the Docker image, open a command-line terminal in that image, and mount the
hello-world-kernelfolder in it:docker run -it --rm --volume $(pwd):/home/tezos/hello-world-kernel --entrypoint /bin/sh --name octez-container tezos/tezos:latestYour command-line prompt changes to indicate that it is now inside the running Docker container. This image includes the Octez command-line client and other Tezos tools. It also uses the docker
--volumeargument to mount the contents of thehello-world-kernelfolder in the container so you can use those files within the container. -
Verify that the container has the necessary tools by running these commands:
octez-node --version
octez-smart-rollup-node --version
octez-client --versionEach of these commands should print a version number. The specific version number is not important as long as you retrieved the latest image with the
docker pull tezos/tezos:mastercommand.Don't close this terminal window or exit the Docker terminal session, because Docker will close the container. If you accidentally close the container, you can run the
docker run ...command again to open a new one.
Now the application is built and you have an environment that you can debug it in. For the rest of the tutorial, you must be aware of whether you are running commands inside or outside of the Docker container. The container has Octez but not Rust, so you run Rust commands outside of the container and Octez commands inside the container.
Deploying the Smart Rollup to the sandbox
Deploying (originating) a Smart Rollup is similar to deploying smart contracts.
Instead of running the octez-client originate contract command, you run the octez-client originate smart rollup command.
This command creates an address for the Smart Rollup and stores a small amount of data about it on layer 1.
-
In the Docker container, in the
hello-world-kernelfolder, run this command to start the sandbox:./sandbox_node.shThis command starts a Tezos testing environment, including a baking node running in sandbox mode and a group of test accounts. The console shows repeated messages that show that the node is baking blocks. For more information about sandbox mode, see Sandboxed mode.
If you see an error that says "Unable to connect to the node," you can ignore it because it happens only once while the node is starting.
-
Leave that terminal instance running for the rest of the tutorial.
-
Open a new terminal window.
-
In the new terminal window, enter the Docker container by running this command:
docker exec -it octez-container /bin/shNow the second terminal window is running inside the container just like the first one.
-
In the new terminal window, go to the folder with the Smart Rollup code:
cd hello-world-kernel -
In the second terminal window, run this command to verify that the sandbox is running with the correct protocol:
octez-client rpc get /chains/main/blocks/head/metadata | grep protocolThe response shows the protocol that the sandbox is running with the alpha protocol, as in this example:
{ "protocol": "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK",
"next_protocol": "ProtoALphaALphaALphaALphaALphaALphaALphaALphaDdp3zK",If you don't see a message that looks like this one, check for errors in the first terminal window.
Now the sandbox is running in the Docker container and you can use it to test the rollup.
-
Run this command to deploy the installer kernel to the Tezos sandbox:
octez-client originate smart rollup \
"test_smart_rollup" from "bootstrap1" \
of kind wasm_2_0_0 of type bytes \
with kernel file:hello_world_kernel_installer.hex --burn-cap 3If you need to open a new terminal window within the Docker container, run the command
docker exec -it octez-container /bin/sh.Like the command to originate a smart contract, this command uses the
--burn-capargument to allow the transaction to take fees from the account. Also like deploying a smart contract, the response in the terminal shows information about the transaction and the address of the originated Smart Rollup, which starts withsr1.
Now layer 1 is aware of the Smart Rollup and nodes can run the kernel. Continue to Part 4: Running and interacting with the Smart Rollup node to start a Smart Rollup node and interact with the kernel.