=================
In the ocean business it is pretty common to have "Uncontrolled Shipments" where the shipper instructs the LSP (Logistics Service Provider) to use the carrier of the shipper choice. In these cases for the LSP it becomes an uncontrolled shipment. The shipper chooses the LSP from an operations point of view only.
Here the LSP would have to use the contract that has been negotiated between the shipper and the carrier and charge the shipper.
In the traditional approach the shipper maintains a copy of the contract that exists between the shipper and carrier. This approach has the following limitations:
- The contract in the LSP system is often out of sync due to the negotiations that happen between the shipper and the carrier
- When the LSP, without the knowledge of the change in contract, bills the shipper with a outdated contract, causes disputes and dispute resolution here is a manual and time consuming effort
The idea is to have a blockchain network comprising of the shipper, carrier and LSP and have the contracts stored in a distributed database so that all parties in the network have access to the updated contract.
This project has three main sections:
- Blockchain network for SAP TM
- B2B contract chaincode
- Spring boot based REST endpoints to interact with the chaincode deployed on the blockchain network
We have the following organizations in the network:
Organization name | Node Type | Number of Peers |
---|---|---|
Orderer.saptm.com | Orderer | NA |
Shipperorg.saptm.com | Peer | 1 |
Carrierorg.saptm.com | Peer | 1 |
LSPorg.saptm.com | Peer | 1 |
In order to bring up the network you can use the delivered script file. You need to ensure that you have the following pre-requisites mentioned in the following link
Steps to follow to bring up the network:
- Clone the project
git clone https://github.com/sudhi-git/contract-blockchain.git
- Navigate to the "network" folder
cd network
- If on Mac give the execute rights to the following files
chmod 755 saptmn.sh
chmod 755 scripts/script.sh
- Now run
./saptmn.sh -m up
In the chaincode folder the chaincode for the above scenario is placed.
The chaincode implements the shim interface of hyperledger. With the implementation of the shim interface one can initialize the ledger and invoke the ledger with:
- Put the state of an asset into the ledger (POST Operation)
- Query the state of an asset in the ledger (GET Operation)
- Update the state of an asset in the ledger (PUT Operation)
For the testing of the chaincode it is suggested to run the chaincode in the docker image of chaincode. This chaincode is installed and instantiated in the peers of the network mentioned above.
The Spring Boot application leverages the Blockchain SDK for Java. For details on the SDK refer to the following [link]https://github.com/hyperledger/fabric-sdk-java
The Spring Boot application provides a swagger enabled APIs for seamless testing. Once you clone the repository:
- Build the project
mvn clean package
- Run the Spring Boot application
mvn spring-boot:run
- Access the Swagger UI by typing
http:localhost:8080/swagger-ui.html
in your favorite browser