Part 5: Running and interacting with the rollup node
Now that the Smart Rollup is originated on layer 1, anyone can run a Smart Rollup node for it. Smart Rollup nodes are similar to baking nodes, but they run the Smart Rollup kernel instead of baking Tezos blocks. In these steps, you start a Smart Rollup node, but note that anyone can run a node based on your kernel, including people who want to verify the rollup's behavior.
Running a Smart Rollup node
-
Copy the contents of the
preimages
folder to a folder that the rollup node can access by running these commands:mkdir -p ~/.tezos-rollup-node/wasm_2_0_0
cp preimages/* ~/.tezos-rollup-node/wasm_2_0_0/ -
In the second terminal window, in the Docker container, start the rollup node:
octez-smart-rollup-node-alpha run operator for "test_smart_rollup" \
with operators "bootstrap2" --data-dir ~/.tezos-rollup-node/ \
--log-kernel-debug --log-kernel-debug-file hello_kernel.debugNow the node is running and writing to the log file
hello_kernel.debug
. Leave this command running in the terminal window just like you left the first terminal window running the Tezos sandbox.
Interacting with the rollup node
Now you can add messages to the inbox and see the rollup node receive and respond to them.
-
Open a third terminal window and enter the Docker container again:
docker exec -it octez-container /bin/sh
-
In the container, go to the
hello_world_kernel
folder. -
Print the contents of the log file:
tail -f hello_kernel.debug
Now, each time a block is baked, the Smart Rollup node prints the contents of the messages in the Smart Rollup inbox, as in this example:
# Hello, kernel!
# Got message: Internal(StartOfLevel)
# Got message: Internal(InfoPerLevel(InfoPerLevel { predecessor_timestamp: 2023-06-07T15:31:09Z, predecessor: BlockHash("BLQucC2rFyNhoeW4tuh1zS1g6H6ukzs2DQDUYArWNALGr6g2Jdq") }))
# Got message: Internal(EndOfLevel) -
Stop the command by pressing Ctrl + C.
-
Run this command to watch for external messages to the rollup:
tail -f hello_kernel.debug | grep External
No output appears at first because the rollup has not received any messages aside from the internal messages that indicate the beginning and end of the inbox.
Leave this command running.
-
Open a fourth terminal window, enter the Docker container with the command
docker exec -it octez-container /bin/sh
, and go to thehello_world_kernel
folder. -
In this fourth terminal window, run this command to simulate adding a message to the Smart Rollup inbox:
octez-client send smart rollup message '[ "test" ]' from "bootstrap3"
-
Go back to the third terminal window.
This window shows the message that you sent in the fourth window, which it received in binary format, with the numbers representing the letters in "test."
Got message: External([116, 101, 115, 116])
Now you can send messages to this rollup via Tezos layer 1 and act on them in the rollup code.
Next steps
To continue your work with Smart Rollups, you can you can explore examples from the kernel gallery or create your own.