Tezos Hands-on Kit

In the last week of August 2019, I have done 2 summer class courses about “Blockchain and Formal verification” in Tokyo and Taipei.

The course consisted of 4 hours of lecture and 2 hours of “Tezos hands-on”. Blockchain is a live technology, and I believe we should provide some real experience – hands-on – if we teach something about it. I have done 4 Tezos hands-on including the above 2 already in this year and each time provided a hands-on kit, so that the attendants can play with Tezos as easy as possible. And there is no point to keep it secret. Here it is:

Standalone Tezos Hands-on Kit


and slides are here:

Network is always the main problem

The first 2 Tezos hands-on I have done in 2019 Q2 used Alphanet, Tezos’s test net: the participants connected to Alphanet and create their accounts and played with them. The node used for the hands-ons was prepared beforehand by myself, with its RPC port opened (with the IP of the node is protected by ngrok). This is since Tezos nodes need to be synchronized with its network and it is unrealistic to ask the participants to prepare their own nodes few days before the events.

This worked fine for these events. But it was very stressful for the organizer: The WiFi of the venue might not be working. Its bandwidth could be seriously limited. The local ISP could be down. My Tezos node could not handle all the incoming requests from the participants in real time. Alphanet might be upgraded to a new protocol. Alphanet itself might be down (it should not, of course). Etc, etc… If any of these things would happen, the people would waste their time.

Sandbox based environmment

For the last 2 hands-ons at the summer schools, we got 70 and 40 participants and eduroam WiFi environment was ready for the venues. These were big numbers compared to the first 2 events, where we had at most 15 people. Worrying about the risk of bandwidth issue (and the other risks written above), I changed the hands-on kit to a sandboxed environment, which is standalone and does not require any internet connection once installed.

Tezos has its sandboxed environment, but hard to use for newcomers, since it is designed to be generic:

  • When launched, the node runs the genesis protocol, which does not talk blockchain protocol.
  • The user must upgrade the protocol from the genesis to Alpha manually, which understands blockchain protocol.
  • Each time the sandboxed node process stops (or get killed), all the works done on the sandboxed node are lost.
  • There is no baker (Tezos’ block miner) running. You have to build a block manually by tezos-client bake.

These characteristics are useful for core developers but just makes the barrier for new people higher.

To lower the entrance barrier and give the similar interface feeling as connected to Alphanet, I have modified this sandboxed setting:

  • The activation to Alpha protocol is automatic.
  • The blockchain state is persistent: killing the node does not remove the data and you can restart the node with the same state.
  • The state is easily resettable by removing the node data directory.
  • With 2 ICO commitments: you can simulate fundraiser account activation.
  • There is a baker process running behind and produces blocks on demand.

I personally think the last item, the automatic baking on demand is a small but nice hack. I added a process for a baker which builds blocks, but it does only when unprocessed operations are injected to the node. This minimizes the number of empty blocks produced while the user is reading documents and writing his smart contracts.

The kit is designed for hands-on events, but at the same time an interesting option to Tezos developers. With the kit they are now freed from initializations of sandboxed nodes everytime, and the state is persistent.

This kit seems to work fine for the most of the summer school participants. I am even thinking that it gave them a feeling that the hands-on was a piece of cake… Maybe from the next time, I should prepare tougher challenges for them. Anyway, skipping the bothering initialization and troubleshooting at the event venue gave me precious time for more interesting stuffs, such as new smart contract examples.

Future work

The kit is not completed. At each hands-on, I have got quite important feedbacks from the participants, which should improve it further. For example, I just learned there are some Linux distributions which do not define localhost in its /etc/hosts. I changed scripts to use instead.

If the network permits, using the real (but test) blockchain network is always much better than simulated sandboxed environments at hands-on events, since we can observe what the other participants do by monitoring the network. The kit should support the both: Alphanet and sandboxed, and easily switchable between two, depending on the network status.

The next big step of the kit will be adding web based interface. There is a project in a Tezos core development to compile the core part of Tezos protocol and client layers into JavaScript.

Portability is not exciting but an important improvement to be done. The kit uses Docker images of Tezos. I have overtrusted on Docker and misunderstood things work ubiquitously on all the platforms, but it was not true: it worked perfectly for my Mac OS X laptop, but had some glitches in Linux: mainly around its file permissions and AppArmor. Support of Windows seems to be even trickier: Windows Home users cannot install Docker for Windows but must use a legacy Docker toolbox. I really have no time to test these environments. I will keep using Docker as the first solution since it is way too easier for me, but also have to prepare a backup: a VirtualPC or VMWare player image for environments which have incompatibilities.

Conclusion and big thanks!

It was a tough challenge, but really a good experience to me, and I enjoyed it. If you are interested in learning Tezos using this kit, or want to held a hands-on using this, please go on! Also, feel free to contact me at jun.furuse at dailambda.jp, if you want me to do the similar class.

Finally, I really thank people who helped me doing these classes. Without you I could not make it!