Kommerce Trade Smart Contract is Live on the Ropsten Testnet

Kommerce
KommerceTF
Published in
5 min readJan 17, 2019

As reported in this post, Kommerce has completed its first cargo shipment in Central Africa.

This post documents the simulation of Kommerce’s first trade on the Ropsten Testnet for our draft Smart Contract. We expect the draft Smart Contract to evolve based on feedback from our on-ground operations team.

Mirroring Reality onto the Chain

The monetary transactions, paperwork, ownership transfers and on-ground checks executed on the paper trade were recorded in order to be accurately entered in the Trade Smart Contract to represent the flow of funds and movement of cargo as per the diagram below.

Diagram representing fund flow and cargo movement in the Kommerce Trade Flow Smart Contract

How the Kommerce Platform works

This video demonstrates the end to end workflow of running a trade through the Kommerce Platform.

Video demonstration of a trade running through the Kommerce Platform

Simulating the First Trade’s Values on the Smart Contract

To simulate the first trade on the Smart Contract, we had to use the following values as recorded where

  • A is the price of the shipment as quoted by the Exporter
  • B is the Deposit required from the Importer
  • C is the Logistics fee
  • D is the Platform fee
  • E is the Financing fee

State Diagram

The values above are critical for calculating the required inputs for the Smart Contract, and the full state transitions can be seen in this State Diagram.

The values calculated below determine the input values for the Trade Smart Contract

Trade Parameters:

The agreed price for the container of rice was US$16128.00.

For the purposes of this initial trade, Kommerce’s token (KTF) will be pegged to 0.01EUR.

As the trade was initiated on 15 November 2018, we used the USD/EUR rate (0.8830167401) from xe.com on that date as the strike price for USD/KTF.

Goods Value Calculation

Simulated KTF strike price = 88.30167401 KTF per USD

Original trade price: US$16,128.00 = 1,424,129.39843328 KTF ( A )

Importer’s Deposit + Fees

Importer’s deposit percentage: 18.4685%

18.4685% deposit: US$2,978.60 = 263,015.3379496503 KTF ( B )

Logistics fee: 0 ( C )*

Platform fee: US$247.00 = 21,810.51348047 KTF ( D )

Financing fee: 0 ( E )*

Importer upfront payment = B + C + D + E = US$3,225.60 = 284,825.85143012 KTF

  • Logistics and Financing fees were waived for this first trade
The Importer needs to pay the Deposit, Logistics, Platform and Financing fees.

Financier’s Copayment

= A-B
= US$16128.00 — US$2978.60
= 1,424,129.39843328–263,015.3379496503
= 1,161,114.0604836297 KTF

The Financier copays the remaining amount.

Trade Steps

Step 1: Exporter Sets Price

Exporter sets the price for the cargo in the Private Chain

Exporter offers 1 container of rice at US$16,128.00 = 1,424,129.39843328 KTF

Step 2: Offer Discovery and Acceptance by Importer

The Importer accepts the offer and purchases 1 container

Original trade price: 1,424,129.39843328 KTF
Deposit: 263,015.3379496503 KTF
Platform fee: 21,810.51348047 KTF
Logistics fee: 0
Financing Fee:0
Importer upfront payment: 284,825.85143012 KTF

Step 3: Hyperledger Backend Initialises Ethereum Smart Contract

https://ropsten.etherscan.io/tx/0x5e98fca48b4a583e39feb365925530d47a0ce10226f5c3362176f803b23921f1

Step 4: Importer Purchases KTF Tokens from platform-owner

This simulates the Importer purchasing KTF from an exchange or OTC desk.

https://ropsten.etherscan.io/tx/0xbc59cadc6cb7d631feea665db8d5a39d868c63d2a676a8e797d1dedcc5d5411a

Step 5: Importer Pays Deposit

The Importer pays the required Deposit to the Smart Contract

Importer approves 284,825.85143012 KTF to Smart Contract
https://ropsten.etherscan.io/tx/0x82159e2bbbc8202061f8f1ebed315941e8ca8e1237bc930e872381a0ac5049f6

Smart Contract receives 284,825.85143012 KTF as Deposit
https://ropsten.etherscan.io/tx/0x8205cc80ee64bf51936f5410ba9d4783563ea762f59d934b0935ce3f2f6a227c

Step 6: Financier Finances Trade

The Financier copays the remaining amount

Financier approves 1,161,114.06048363 KTF to Smart Contract
https://ropsten.etherscan.io/tx/0xb5248feb14f1353c8f3b5b86adfba0dd1701f386753b931817d7fe45212ba474

Smart Contract receives 1,161,114.06048363 KTF as 81.5315% financing
https://ropsten.etherscan.io/tx/0x4efa33e7e21eaef1e3a98d0b3d8db00868b9c49cc4ebc644b58caf42f79071e2

Step 7: Inspector Uploads Inspection Documents and Approves the Goods for Departure

The Inspector uploads the relevant inspection documents at the departure port

https://ropsten.etherscan.io/tx/0x7e110c9fe16b0d50d392d9a12b4031f72a6b5ec6a2bf2e949c842a243b272fef

Step 8: Platform Confirms Receipt of Bill of Lading, and Approves Payment to Exporter

The Kommerce Platform approves payment for the Exporter when the Bill of Lading is transferred to Kommerce

https://ropsten.etherscan.io/tx/0x3daa2072e4d67ad13abefe164bacb7387d02e80edb12ed11c796bcc1a97650b6

Step 9: Arrival Inspector Uploads Pictures and Approves Incoming Shipment

The Arrival Inspection role uploads relevant documentation and proof of an unbroken seal
A serialised tamper evident single use container seal

Step 10: importer Purchases Token from platform-owner

This simulates the Importer purchasing KTF from an exchange or OTC desk.

https://ropsten.etherscan.io/tx/0x7639a5406f1f60784df985dc551232f080cef7e1cdee85103b7bb501285d3209

Step 11: Importer Makes Final Payment

The Importer makes the balance payment to trigger Final Settlement

Importer approves 1,161,114.06048363 KTF to Smart Contract
https://ropsten.etherscan.io/tx/0xd3f87043d842509d54ca0095c846a7413ffd3e700c09d30c049b08bd9f9f14f9

Smart Contract takes 1,161,114.06048363 KTF as final payment
https://ropsten.etherscan.io/tx/0xbb5ccebbb02c8a332decc984460644771e9ca6e6e993f9337fea8f1aa556d95a

Step 12: Platform Makes Final Confirmation and Pays Out to Financier, Logistics and Platform Fee

The Kommerce Platform triggers Final Settlement.

https://ropsten.etherscan.io/tx/0x11a5919a761ed882715a8b69a94d69fa1cbcfaa095a8b2b0e24da81a21e0c0c5

Final Settlement pays the Logistics Company and Financier.
Final Settlement transitions to the transaction_completed state.

This marks the completion of a successful trade.

Appendix

Smart Contract Addresses:

KTF contract address:

https://ropsten.etherscan.io/address/0xcb14f401e1454ef6b9bebb06428ce6a7dc6746f3

Trade contract address:

https://ropsten.etherscan.io/address/0xd8062baebd65bf962e21b161e6be5a3126a4683e

Addresses of Roles:

platform-owner

https://etherscan.io/address/0x08bce3a5d45f4f14d0df71249470efcb1a97c408

platform-backend

https://etherscan.io/address/0x68e913321cd2dde56828a121abbc365a7ff76bf6

Financier

https://etherscan.io/address/0x93b4ebdc6477a9bc756fe3c623c39765b2eda767

Exporter

https://etherscan.io/address/0x021621e75b0526b763c3664cf0758702333efdde

Importer

https://etherscan.io/address/0xfc73f1ea2b3b62c4fce67ebf39c42431b82f9f68

Logistics

https://etherscan.io/address/0xfd7bd04c8520e5a2bf33ba421a69cb78f0e34c5d

platformAccount

https://etherscan.io/address/0x8a30549890f8e1437bb71bd0571ba1aee9e77e05

freezeAccount^

https://etherscan.io/address/0x9e9170c15cca1f24a6d0fa80aed187078fe6ca92

^This account functions as escrow for states in the Smart Contract which require manual intervention. An example of this would be if goods are damaged on-route and an insurance claim is required.

For more details about the architecture of the Kommerce platform, please view our Technical White Paper.

To understand more about the macro factors and the problems Kommerce is trying to solve, please read our White Paper.

--

--