We traveled to New York City this week to attend the Consensus 2017 conference from Monday to Wednesday. The previous weekend was the Consensus hackathon, a great chance for us to gain some hands-on experience with blockchain technologies, meet fellow blockchain developers and get inspired.
Our flights were booked weeks ahead of time, before the hackathon was announced, so we missed the entire Saturday. We had only a few hours on Sunday to go from idea to implementation. We picked an idea that William has some domain knowledge about: warehouse management systems (WMS). We also strengthened our team by joining forces with Natasha, whom we met in the pantry while grabbing bagels and coffee at the Deloitte offices at 30 Rockefeller Plaza, the site of the hackathon.
A WMS is part of a larger supply chain system, and focuses on tracking items in a warehouse. Separate systems would track items as they are produced in a factory, or placed on shelves for sale in a retail store. A WMS would know what item arrive in the warehouse, where they are located, where they go, which staff should do what and when, etc. In theory they work great, but in practice they fall apart in all sorts of fun ways: people forget to scan or double scan inventory; the wrong item is picked up or the right item is put away in the wrong location; an item is simply lost (or stolen).
There are other structural complexities to consider too. Unsold product at a retail store could be transferred back to a warehouse and then sent to a secondary market retailer. A retail store could source product from multiple upstream distributors with multiple WMS’. Items could even be broken down and reconstituted. For example, a palette of merchandise being split up and sent to different stores.
Every idea needs a name and we chose Dewmast, short for DEcentralized Warehouse MAnagement SysTem.
The vision: each item as a smart contract, the smart contract is the business logic
There’s an overarching concept of item ownership transfer between different parties according to some kind of business logic. Our idea was to represent each item by a smart contract that would track item ownership and contain metadata about the item. Business logic would be embedded within the smart contract. For example, calling a Palette.Decompose() method could spawn additional Item smart contracts.
Every good hackathon starts with a whiteboarding session.
For the hackathon we hoped to:
Setup a local Ethereum test network with three client nodes, a bootnode and a few externally owned accounts (EOAs) and contract accounts. For simplicity we decided to run all of these on one of our laptops.
Write simple smart contracts to represent Items, Owners and Locations with business logic to handle operations like transferring ownership of an Item from one Owner to another, or changing the Location of an Item.
Build a simple web UI in Bootstrap to create, update and view Items. A responsive web UI like this should function equally well on desktop/laptop or mobile, the latter of which would “simulate” a barcode scanning handheld in a warehouse or retail store.
Connect the web UI and the blockchain together with web3.js. This would involve running web3.js on the same system (one of our laptops) as the Ethereum test network, giving local access to one of the Ethereum client nodes.
The implementation: Bootstrap and local Ethereum test nets
In the end we were only able to get the front-end mock up and Ethereum test network setup. We had been playing around with Ethereum test networks on the plane over, setting them up manually according to the instructions on the go-ethereum wiki. It turned out to be fairly involved, and we had thought that the gethcluster script could help us streamline things, but we only just got the test network up and running when we ran out of time. In hindsight we should have just continued with our manual Ethereum test network setup from the plane rather than trying to start over with a new approach.
Dewmast front-end working mockup
Getting an Ethereum test network up and running
The presentation and the surprise
We presented to a packed room and a panel of about ten judges from the various hackathon sponsor organizations, including hackathon hosts Deloitte, ConsenSys, and others. We heard many great ideas presented, including smart vehicle auditing, blockchain exploit detection and micro-insurance for smallhold farmers in Africa. We presented our vision and what we had managed to build, and noted that none of the three of us had been working with blockchain for more than two weeks.
We were therefore surprised and humbled to be awarded the ConsenSys Academy prize!
Judge Jeremy Millar cited the fact that he thought our team could benefit from the intensive, developer-focused blockchain training that Consensys Academy can provide. We’re excited to participate and take our Ethereum knowledge to the next level.
Updating a WMS is typically done by scanning barcodes on items with a handheld scanner. For speed, updates are usually cached locally and synchronized back to the WMS in batches. Conflicts are often not caught at the point of scanning and resolved later. As a future idea, we envisioned an app running on a handheld scanner with a copy of the blockchain that could run the smart contract locally and validate with reasonable certainty if a given transaction was likely to succeed or not.
However, in practice the blockchain ledger would likely not fit on a handheld device (the Bitcoin ledger is currently 110 GB) so we had the idea to have a way to shard off only the relevant portion of the blockchain onto the device for immediate confirmation. Kind of like a sidechain.
Even though we did not finish the prototype to the degree we hoped, we learned a lot in the process, made some new friends, and had a great time participating. We plan on finishing the work we started in the hackathon, so watch this space for further updates.