This demo project showcases the capabilities of blockchain technologies for the spheres of logistics, transportation, and delivery
Business goals: Automation of internal operations and collaboration, connection of existing business processes under a single decentralized and transparent system
Product: Blockchain-based platform for autonomous delivery tracking, comprising a back end, an IoT component, mobile and Web applications
Applied technologies: Blockchain (Hyperledger Sawtooth), Proof of Elapsed Time, Flutter, React.js, Node.js, Caddy, IoT (Raspberry Pi + Python), Docker stack (including Swarm and Compose)
Blockchain is a distributed computing technology. Each of the multiple participants has a personal copy of all data and is able to communicate with others to achieve consensus on adding new records. The basis of blockchain is formed by distributed ledgers – sets of communication protocols between replicated databases, with no centralized data storage or administration. These ledgers facilitate efficient and secure infrastructures for issuance, exchange, and reliable storage of digital assets.
Blockchain use cases spread across multiple industries. This technology can have a transformational impact on the Internet of Things, FinTech, global trading, energy market, retail, warehousing and supply chain management, gaming—the list can be really long.
What do these businesses get with blockchain? Most importantly, it’s security and auditability. Blockchain provides a shared, immutable log of every activity within a decentralized system, enabling easy and transparent monitoring. Another essential feature is broad automation; smart contracts are capable of connecting existing business processes and disparate systems. Finally, it helps achieve specific business goals, such as maximizing liquidity in retail.
As for our today’s demo, it will show the business use of blockchain in logistics. Delivery companies—such as TNT or FedEx—that explore blockchain technologies to pursue their business goals, operating and even collaborating with each other on cross-company activities.
Video Demo
If you have a hard time finding blockchain in action, here it is, concise for your convenience.
As you can see, customers and couriers—depending on the user role—can monitor deliveries on the map, scan QR codes, change statuses, and see delivery statistics updated in real time. Below you will find the structure and the technologies we applied.
Product Structure
Components & Applied Technologies
1. Blockchain: Hyperledger Sawtooth
Hyperledger Sawtooth is a popular modular framework for building distributed ledgers for Blockchain applications, providing digital records—deliveries in our case—that are maintained without centralized authority or implementation. It is stable in production, having excellent documentation and SDKs for multiple programming languages: Go, Java, JavaScript, Python, and Rust.
Our blockchain consists of 3 subcomponents: API, Validator, and Transaction Processor. The first two are standard components, while the third one is a custom component that allows to manage deliveries and their states, which are encoded using protocol buffers. The history of transactions is available for each delivery.
2. Consensus algorithm: Proof of Elapsed Time (POET)
Consensus is a decision-making process in which members of a group agree to develop and support fair decisions, considering mutual interests. The mechanism we used in this blockchain demo is POET, based on the principles of a fair lottery system across the largest possible number of network participants.
3. Flutter-based mobile application
There is a cross-platform application for couriers, compatible with iOS and Android and based on Google’s Flutter, one of the most promising app development frameworks. It sends data about delivery status via an API based on Node.js. QR/barcode scanning (with planned addition of NFC) is used to identify deliveries.
4. Single page Web application
This logistics demo also includes a React-based Web app for regular users. It communicates with Node.js API through a secure Caddy-based proxy server, which is used to route requests to internal components of the system. In addition, Google Maps API is used to display delivery routes.
5. Raspberry Pi + Python
Raspberry Pi is connected to this blockchain with in order to retrieve GPS data from AI-Thinker A7 GPRS/GSM module and send it to Node.js API through the Caddy server. We applied Python SDK and CLI tools for these purposes, while Sawtooth REST API is used to update delivery states with new geolocation. Any other IoT devices can be connected to the system.
6. Node.js API
The Node.js component of our blockchain demo acts as additional business logic layer between clients and Hyperledger Sawtooth. It serializes requests using the protocol buffers mechanism, validates inputs and provides endpoints to the Web application. The requests are then forwarded to Sawtooth Rest API.
7. Docker
The Docker stack (including Swarm and Compose) is used to simplify local development and production deployment, ensuring high scalability in the future. The entire logistics platform is currently hosted on DigitalOcean Cloud.
This demo of blockchain in logistics uses one of the most popular and production ready Hyperledger frameworks called Sawtooth. This allowed us to quickly resolve such business issues as integrating digital assets into existing processes—which means there’s much less paper work and everything is transparently verified in blockchain. We also managed to increase proof-ability and monitoring effectiveness.