Transport Tutorial

Motivation

Blockchain has the ability to massively benefit both the supply chain and transport industries, by introducing a new level of data transparency and responsiveness that helps to improve processes and attract potential clients. Applying blockchain to certain supply chains can benefit the the primary producer right down to the end consumer, including all other ancillary parties in between; and furthermore also providing enhanced insights into the entire process.

The blockchain network is the decentralised database layer, that stores all relevant information about both the supply chain and the products; and furthermore ensures that the data cannot be manipulated once it is stored on the blockchain.

Blockchain Supply Chain

Idea

The goal is to create a simple decentralized supply chain tracking system. The participants of the network can send, transport and receive packets with each other.

For the transportation of the packet, a simple trust system is implemented, that enables the sender to set certain requirements for the carrier of the packet. The packet will be an active participant in the transportation process, as it will track itself with sensors during the transportation. This is done to ensure that it has not been manipulated during the transport.

The carrier will be rewarded upon the successful transportation, and penalized if the transportation has failed for some reason.

For convenient usage of the system, a client application will be provided that visualizes all relevant information regarding the supply chain tracking system; and this in turn enables the users to interact with the system by posting custom transactions.

General procedure

The diagram shown below describes the general workflow of the supply chain tracking system. A detailed description of each step can be seen here.

Flow chart of Lisk Transport

Initialize packet account

Before registering the packet on the network, the sender needs to create a new account for the packet and store the passphrase on the IoT device inside the packet. This is necessary because the packet needs to sign the transactions it sends to the network, in order to communicate with it.

Register packet

The packets are registered on the blockchain network by the packet sender.

When creating the RegisterPacketTransaction, the sender defines the following:

  • packetId: The ID of the packet that has been initialized in the previous step.

  • postage: This amount will be paid to the carrier for the transport of the packet.

  • security: The security is the amount of tokens that will be locked in the carrier’s account, when the carrier receives the packet form the sender.

  • minTrust: The minimum amount of trust a carrier requires in order to to transport this packet.

  • recipientId: The ID of the desired recipient of the packet. Only the recipient can send the FinishTransaction later, which will complete the transport.

This transaction will:

  • Add the above data to the packet account.

  • Set the status of the packet to pending.

  • Transfer the postage from the sender’s account to the packet account.

Start transport

The next step would be for the carrier to go to the packet sender’s address, then receive the packet and start the delivery to the recipient. The carrier needs to sign a transaction StartTransportTransaction, that verifies that the packet has been passed on to the carrier.

When creating the StartTransportTransaction, the carrier defines the following:

  • packetID: The ID of the packet that the carrier is going to transport.

This transaction will perform the following:

  • Lock the specified security of the packet in the carrier’s account. This security cannot be accessed by the carrier, unless the transport has been successfully completed.

  • Add the carrier to the packet account.

  • Set the status of the packet from pending to ongoing.

Light alarm

During the transportation of the packet, it will track itself with different sensors in order to check if it is manipulated during the transportation phase. If this occurs, the packet will send a self-signed alarm transaction to the network.

This LightAlarmTransaction will perform the following:

  • Change the packet’s status to alarm.

  • Add the current timestamp to the list asset.alarms.light inside of the packet account.

Finish transport

When reaching the recipient of the packet, the carrier passes the packet to the recipient. The recipient needs to sign the FinishTransportTransaction. This verifies that the packet has been passed on to the recipient.

When sending the transaction, the recipient needs to specify the following:

  • packetID: The ID of the packet that the recipient received.

  • status: The status of the transport, which has 2 options: "success" or "fail"

This transaction will perform the following:

  • If status="success"

    • Send postage to carrier account.

    • Unlock security in carrier account.

    • Increase trust of carrier +1.

    • Set packet status to success.

  • If status="fail"

    • Send postage to sender account.

    • Add security to the sender account, and nullify lockedSecurity from the account for the carrier.

    • Decrease trust of carrier by -1.

    • Set packet status to fail.