Blockchain building: Snake runtime modules and learning Rust

Starting your first full-time dev role in the blockchain is surely a nerve-racking experience. Especially when your team casually hands you the task of topping up your Rust skills by building a showcase protocol level runtime module within your first few months!

But this wasn’t enough to phase Jason Tulp. Our newest Junior software engineer at the CENNZnet project grabbed the task with both hands and stunned us with his version of Snake on the blockchain!

We learnt a bit more about how Jason tackled his first dive into developing in the blockchain space and what’s next for CENNZnet snake.

What did you build?

As a relatively new member of the team, I’ve been frantically learning the basics of Rust as well as tackling the intricacies of blockchain development. To help solidify my knowledge Jordy (CENNZnet CTO) and I decided it would be cool if I had a stab at building my own runtime module.

For the last few weeks, I’ve been creating a Snake game as a runtime module for the CENNZnet blockchain. It’s pretty much your classic snake game, but all on-chain. So it works like this:

  1. You select a command to move the snake. This is read as a transaction by the blockchain.
  2. The runtime module holds logic to process the transaction and stores updated position values of the snake in persistent storage.
  3. If the transaction is successful it will create an event that contains the new data and can be read by a Dapp
  4. The Dapp reads the data from the event and draws the output to a webpage

So at the end of each block finalisation, the snake will move based on the new command.

So, why a snake game?

Actually, it’s a bit of a personal tradition, whenever I try to learn a new programming language, once I have gone through basic examples ...

-----
To keep reading, please go to the original article at:
Centrality - Medium

Comments (No)

Leave a Reply