You won't want to miss out on the world-class speakers at TNW Conference this year 🎟 Book your 2 for 1 tickets now! This offer ends on April 22 →

This article was published on January 24, 2019

Dutch hacker puts his kid’s LEGO train on the blockchain

It's literally a STEEM train


Dutch hacker puts his kid’s LEGO train on the blockchain

Blockchains are everywhere, we get it. But did you know blockchain is now powering a little toy train?

Dutch hacker/dad Roeland P Lanparty has turned his son’s LEGO Duplo toy into a literal STEEM train. It’s been modified to be driven by streaming the STEEM cryptocurrency in real-time.

Even cooler, the number of transactions in each block has an effect on its speed. The bigger the size of the blocks, the faster it goes. If less people are using the blockchain, it will go slower.

But wait, it gets better. Lanparty is an active STEEM block producer, and he’s hacked the STEEM train to make a little “choo-choo” noise when he signs a block to celebrate receiving the reward.

Quick, get on, we’re decentralizing!

In light of this revolutionary application of distributed ledger technology, we spoke with Lanparty to explore what inspired him to decentralize control of his child’s playtoy.

The <3 of EU tech

The latest rumblings from the EU tech scene, a story from our wise ol' founder Boris, and some questionable AI art. It's free, every week, in your inbox. Sign up now!

First we take the Bluetooth, then we get the power

“So, we gave our son a Duplo trainset recently. Later, when I was inspecting the package, I noticed it had Bluetooth – Bluetooth LE to be precise,” Lanparty told Hard Fork. “I was curious if I would be able to ‘reverse engineer’ the train’s commands and started to research.”

He found there were many other hacker dads out there, and luckily a kindred spirit had already released a custom Node-js library built specifically for the Duplo train.

Duplo trains come with an app to issue certain commands to the train via Bluetooth, like speeding up and slowing down. By replacing the official app with the modified library, Lanparty took control of the Bluetooth, aswell as the freedom to decide when, and in what capacity, the train would move.

“I started to experiment with what commands I could send, it was a matter of hooking up a data-source which could power these commands autonomously,” explained Lanparty. “For this part I chose the STEEM blockchain, as I already knew that codebase, and it’s easy to develop on it due to the availability of tools.”

STEEM also adds blocks to its chain way more often than Bitcoin – roughly every three seconds. This makes using its data as a power-source more appropriate, as it’s more of a steady flow than a periodic update.

As a result, the STEEM train will be continuously powered, as long as blocks keep getting added. It also allows Lanparty to modulate its speed depending on how many people use the blockchain.

The STEEM train that couldn’t slow down

The differences in speed are calculated using the “average transactions per block” of the blockchain.

“The first block received by the script sets the initial ‘average transactions per block.’ Sequential blocks modify that average,” said Roeland. “Then every block received by the script compares the ‘current transactions in this block’ with the average.”

The speed of the train depends on the percentage increase (or decrease) from block to block, multiplied by the default Duplo speed.

But, due to limits imposed by the train’s manufacturers, if that number goes either too high or too low, the train would actually stop. This forced Roeland to impose upper and lower limits to the train’s speed.

So, while its speed is certainly affected by blockchain traffic, a random empty block won’t stop the train from chugging along.

“If there is a block which modifies the speed below 50 percent, I cap it at 50 percent. Anything higher than 100 percent is capped at 100 percent – however, the train will just not go faster than 100. You can’t ‘overclock’ it,” noted Lanparty.

This also means it’s technically impossible for the STEEM train to crash and burn a melty, plasticy death if the blockchain was suddenly flooded with transactions.

“No, there would not be an absolute number of dangerous transactions for the train, as the script normalises from the first block it receives onwards,” reported Lanparty. “That said, I found that the Duplo speed is instructed from 0-100 percent. Speeds lower than 50 percent really give the train a weird sound as if it might be burning.”

That STEEM train goes great with your squirting whale

This isn’t the first zany blockchain project from Lanparty. Hard Fork reported on his previous creation – a giant, remote-controlled whale that squirts for STEEM donations.

The idea is to allow users to pledge between one and 100 STEEM ($0.38 – $38) to make a whale squirt over the internet. Genius.

“Yes, the SteemWhale is definitely around, albeit being winter here in the Netherlands, it’s currently in hibernation,” Lanparty confirmed. “The SteemWhale fountain is a whole lot bigger project: with all the pressurised canisters, salt water, occasional floods.”

2cold2squirt

When quizzed about which of these projects was hardest to put together, Lanparty said: “Definitely the whale, as it not only involved connecting it to the blockchain, but also building foolproof onsite connectivity, and the hardware for triggering sprays.”

But even though it’s more maintenance intensive, the SteemWhale should be back in the spring as planned, in all its glory.

Check below for a video of the STEEM train, and behold the power of blockchain technology.

And for those keen on trying to hack LEGO Duplo trains on their own – Lanparty uploaded the script that switches its power source to the STEEM blockchain – just copy paste and run it.

(Edit: This post has been updated to properly describe the process of validating transactions on the STEEM blockchain, which uses a consensus method called Delegated Proof-of-Stake (DPoS). This is different to Bitcoin’s Proof-of-Work (PoW). Validators on DPoS blockchains are called “block producers,” while PoW blockchains like Bitcoin refer to them as “miners.”)

Get the TNW newsletter

Get the most important tech news in your inbox each week.

Also tagged with