Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
906 lines (822 sloc) 43.3 KB

Trade Finance

Primechain Technologies TRADE-Chain brochure

The market for trade finance is above US$ 12 trillion annually. TRADE-Chain is a permissioned "global trade finance" blockchain for the world’s banks and financial institutions. TRADE-Chain nodes are available to banks, financial institutions and large exporters, importers, shippers and investors.

Letter of credit

Table of contents

1. Introduction and overview
1.1 Sandbox blockchain
1.2 Production blockchain
1.3 System requirements for nodes
1.4 Information Security issues
1.5 API keys for sandbox
1.6 Default address for a node
1.7 Additional addresses

2. Data Streams and permissions to write to them
2.1 Create a new data stream
2.2 Grant write permissions
2.3 Revoke write permissions

4. Publish data to a Data Stream
4.1 Encrypt, sign and publish data
4.2 Publish an invoice
4.3 Publish a bank guarantee
4.4 Publish a letter of credit
4.5 Publish a bill of lading
4.6 Publish GPS data

5. Decrypt, verify and retrieve data from the blockchain

6. Invoice discounting
6.1 Process flow
6.2 Publishing a new invoice
6.3 Viewing invoices
6.4 Bidding by investors
6.5 Cancelling of bids by investors
6.6 Viewing bids
6.7 Rejection of bids
6.8 Acceptance of bids
6.9 Buyback of the invoice upon maturity of invoice
6.10 Retiring the invoice

7. Settle accounts in real-time

1. Introduction and overview

TRADE-Chain is a permissioned multi-framework blockchain powered by Primechain APIs. TRADE-Chain nodes are available to banks, financial institutions and large exporters, importers, shippers and investors.

The pain points of today’s trade finance processes are:

  1. Delays and errors due to manual document creation and distribution.
  2. Invoice factoring risk.
  3. Delayed timeline.
  4. Manual AML review.
  5. Fraud risk due to multiple disconnected platforms.
  6. Fraud risk due to duplicate bills of lading.

Core benefits of TRADE-Chain:

  1. Real-time review and approval of documents.
  2. Real-time, transparent view of invoices for discounting and factoring.
  3. Eliminating the need for correspondent banks and other intermediaries.
  4. Elimination of fraud by providing real-time, transparent view of bills of lading.
  5. Transparency in terms of ownership and location of goods.
  6. Real-time, automated settlements without the need for reconciliation.
  7. Real-time view to regulators leading to complete regulatory transparency.
  8. Reducing the letter of credit issue process from several days to a few hours.
  9. Reducing the time of delivery for trade documents from several days to a few hours.
    10.Increased transparency by sharing transaction details with all parties.

1.1 Sandbox blockchain

To access the TRADE-Chain sandbox, email us on info@primechain.in

1.2 Production blockchain

Nodes on the commercial / production TRADE-Chain are available free to all Bankchain members and at an annual subscription fee for non-members. Email us on info@primechain.in for details.

1.3 System requirements for nodes

2 virtual machines / physical servers with the following details are required:

  • Ubuntu 16.04 machine with 32 GB RAM, 4 core processor, 100 GB SSD disk with ports 22, 15590 and 61172 open.
  • Ubuntu 16.04 machine with 32 GB RAM, 8 core processor, 25 GB SSD disk with ports 22 and 2512 open.

1.4 Information Security issues

  • Symmetric and asymmetric cryptography ensures confidentiality of data.
  • Hash functions ensure integrity of data.
  • Multiple blockchain nodes ensure availability of data.
  • Blockchain technology ensures provable immutability of data.
  • Digital signatures ensure non-repudiation.
  • Blockchain Security Controls provide the security controls and information security framework.

1.5 API keys for sandbox

API keys authenticate access to the TRADE-Chain sandbox. To generate an API key, use get api/v1/get_api_key. An API key must be passed in the authorization header. (See example)

Sample API key

k3wq1TdYcEGb7sqX&Es8-xVR$ocdw5ICLtIh5rT661UDaZoKmLV!12X01ce!GnEW

1.6 Default address for a node

When a node connects to TRADE-Chain, it is provided a default primechain address with relevant permissions.

1.7 Additional addresses

If required, additional addresses can be created on a node using get /api/v1/create_entity. The following are generated:

  1. public key
  2. private key
  3. primechain address

The output will be the primechain address of the newly created signer. The private key is automatically stored in your node. This will not be visible to other nodes. This address will have permissions to send and receive assets e.g. invoices, fiat currency backed tokens, etc.

Sample output

{
  "status": 200,
  "primechain_address": "1VCeqGYXLaqMtAFtxTNeTzfW8T714us2t3uwYM"
}

2. Data Streams and permissions to write to them

A data stream enables TRADE-Chain to be used as a general purpose append-only database, with TRADE-Chain providing timestamping, notarization and immutability. Storing all the data relating to a transaction, shipment or event in a dedicated data stream enables quick and efficient data retrieval and processing.

2.1 Create a new data stream

To create a new data stream use post /api/v1/create_data_stream and provide these 4 parameters:

  1. primechain_address - your node's default primechain address
  2. stream_name - the stream name. This must be unique across the blockchain and can contain a maximum of 32 characters including blank spaces.
  3. details - a short description of the data stream
  4. open: true or false - whether the stream is open or not. If open is set to true, write permissions need not be explicitly provided. All addresses can write to the stream. If open is set to false, write permissions need to be explicitly provided. It is recommended to keep the stream as closed and to provide write permissions on an address basis.

Sample input

{
  "primechain_address": "1VUid7fZaiFnNXddiwfwvk8idyXixkFKRSQvMp",
  "stream_name": "200_tons_xyz_Jan_2019",
  "details": "This stream is for the consignment of 200 tons of xyz material",
  "open":false
}

The output is the transaction id of the transaction creating the stream - tx_id. Sample output

{
 "status": 200,
 "tx_id": "d84f84849431d5a5c5565530021d4c8bc37bf7180c58a116bd42295f90b434e2"
}

2.2 Grant write permissions

To grant an entity write permission to a stream, use post /api/v1/grant_write_permission_to_stream and provide 3 parameters:

  1. primechain_address_stream_writer - the primechain address of the entity to be granted write permission.
  2. stream_name - the name of the relevant data stream.
  3. primechain_address_stream_creator - the primechain address of the creator of the data stream.

Note: This must be run on the node containing the private key of the stream creator.

Sample input

{
  "primechain_address_stream_writer": "125LHLRKDDdaJSWXbVdaAGG7pGRT9dWPjjF7aG",
  "stream_name": "200_tons_xyz_Jan_2019",
  "primechain_address_stream_creator": "1VUid7fZaiFnNXddiwfwvk8idyXixkFKRSQvMp"
}

Sample output

{
  "status": 200,
  "tx_id": "94179d61270f24acc208b8647e735cb54307c4ccbfece64ebae0e9539c37b2bf"
}

2.3 Revoke write permissions

To revoke an entity's write permission to a stream, use post /api/v1/revoke_write_permission_to_stream and provide 3 parameters:

  1. primechain_address_stream_writer - the primechain address of the entity whose write permission is to be revoked.
  2. stream_name - the name of the relevant data stream.
  3. primechain_address_stream_creator - the primechain address of the creator of the data stream.

Note: This must be run on the node containing the private key of the stream creator.

Sample input

{
  "primechain_address_stream_writer": "125LHLRKDDdaJSWXbVdaAGG7pGRT9dWPjjF7aG",
  "stream_name": "200_tons_xyz_Jan_2019",
  "primechain_address_stream_creator": "1VUid7fZaiFnNXddiwfwvk8idyXixkFKRSQvMp"
}

Sample output

{
  "status": 200,
  "tx_id": "83fd7c73360cc80a4bc89c3fa3de956deb145882219bcce3b5631a916b15b97a"
}

4. Publish data to a Data Stream

4.1 Encrypt, sign and publish data

To encrypt, sign and publish data to a Data Stream, use post /api/v1/publish_data and pass 4 parameters:

  1. primechain_address - the primechain address of the signer.
  2. keys - the keys to enable quick searching of the data.
  3. data - the data.
  4. stream_name - the name of the data stream.

Sample input

{
  "primechain_address": "1VUid7fZaiFnNXddiwfwvk8idyXixkFKRSQvMp",
   "keys": 
    [
      "key1",
      "key2"
    ],
   "data": "This is the data that will be encryptd and stored.",
   "stream_name": "200_tons_xyz_Jan_2019"
}

This is what happens:

  1. The SHA-512 hash of the data is computed.
  2. The hash is signed using the private key of the provided primechain address (using ECDSA).
  3. The digital signature, hash and the primechain address of the signer are stored in the data stream.
  4. The data is encrypted using the AES (Advanced Encryption Standard) algorithm and the following are generated:
    • the encrypted version of the data
    • the AES password
    • the Initialization Vector (IV)
    • the Authentication Tag (tag)
  5. The encrypted data and the tag are published to the data stream.

The following is the output:

  1. tx_id_enc_data - the id of the transaction in which the encrypted data and tag were published to the data stream.
  2. tx_id_signature - the id of the transaction in which the digital signature, hash and the signer's primechain address were published to the the data stream.
  3. signature - the digital signature
  4. aes_password - the AES password
  5. aes_iv - the Initialization Vector (IV)
  6. stream_name - the data-stream name

Sample output

{
"status": 200,
"response": {
"tx_id_enc_data": "7e94282014b2b73bc17ac163e24b2538b6174ba96a4a27f4f2e2333e94346b96",
"tx_id_signature": "f2d3f1954064b12d3f434cee8d68ed6f08960f7a400a41946c972680abdbaef2",
"signature": "INfKjUiGDpMQ68K4GlTwh3Z3LDXrWpiJ4L2Qvn1wSqSxd0zauOZDn292E32GAQk6fsNvPl1G9ty1iRfXJWJDW0w=",
"aes_password": "ScX56ZWKuqYsMpINcXScyfgSL0Ihc05c",
"aes_iv": "lSr9HJqWN1eA",
"stream_name": "200_tons_xyz_Jan_2019"
}
}

4.2 Publish an invoice

Sample input

  "primechain_address": "1N9VtvZvP3rsw5Rf4Qpi12TWBaDoEwM2BAEsv2",
  "data": 
    {
      "INVOICE_NUMBER": "Invoice number assigned by the exporter.",
      "SELLER": "Name and address of principal party responsible for effecting export.",
      "SOLD_TO": "The name and address of the person / company to whom the goods are shipped to for the designated end use",
      "SHIP_TO": "If different than (Sold To), the intermediate consignee – that is the name and address of the party who effects delivery of the merchandise to the ultimate consignee, or the party so named on the export license of the forwarding agent. The name and address of the duly authorized forwarder acting as agent for the exporter. ",
      "CUSTOMER_REFERENCE_NUMBER": "Oversees customer’s reference number.",
      "TERMS_OF_SALE": "Delivery and terms of sale agreement.",
      "TERMS_OF_PAYMENT": "Terms, conditions, and currency of settlement as agreed upon by the vendor and purchaser per the pro forma invoice, customer purchase order and / or the letter of credit.",      
      "CURRENCY_OF_SETTLEMENT": "Currency agreed upon between seller and buyer as payment.",
      "MODE_OF_SHIPMENT": "Indicate air, ocean, and surface. ",
      "ITEMS":
        {
          "ITEM_1": 
            {
               "ITEM_QUANTITY": "Record total number of units of this item",
               "ITEM_DESCRIPTION": "Record description of this item",
               "ITEM_UNIT_PRICE": "Record the unit price of the merchandise per unit of measure.",
               "ITEM_UNIT_OF_MEASURE": "Record total net weight and total gross weight in kilograms (1 kilogram = 2.2 pounds) for this item.",
               "ITEM_TOTAL_PRICE": "Record the extended value of this item"
            },
           "ITEM_2": 
            {
               "ITEM_QUANTITY": "Record total number of units of this item",
               "ITEM_DESCRIPTION": "Record description of this item",
               "ITEM_UNIT_PRICE": "Record the unit price of the merchandise per unit of measure.",
               "ITEM_UNIT_OF_MEASURE": "Record total net weight and total gross weight in kilograms (1 kilogram = 2.2 pounds) for this item.",
               "ITEM_TOTAL_PRICE": "Record the extended value of this item"
            },
        }
      "DESCRIPTION": "Provide full description of items shipped, the type of container, (carton, box, etc.) the gross weight per container, and the quantity and unit of measure of the merchandise.",
      "TOTAL_COMMERCIAL_VALUE": "Total value of the invoice.",
      "PACKAGE_MARKS": "Record in this field and on each package number (for example, “1 of 7,””3 of 7”) shippers company name, country of origin (e.g., Made in USA), destination port of entry, package weight in kilograms, package size (length x width x height) and shipper’s control number (optional). ",
      "MISCELLANEOUS_CHARGES": "Charges (packing, insurance, etc. Record any miscellaneous charges that are to be paid by customer, such as export transportation, insurance, export packaging inland freight to peer, etc.).",
      "CERTIFICATIONS": "Any certifications or declarations required of the shipper regarding any information recorded on the commercial invoice.",      
    }
}

4.3 Publish a bank guarantee

Sample input

{
  "primechain_address": "1N9VtvZvP3rsw5Rf4Qpi12TWBaDoEwM2BAEsv2",
  "data": 
    {
      "GUARANTEE_NUMBER": "ASDRE76464",
      "guarantee_currency": "USD",
      "guarantee_amount_words": "Twenty Two million",
      "guarantee_amount_figures": "22,000,000.00",
      "guarantee_date_of_issue": "17-December-2018",
      "guarantee_date_of_maturity": "16-March-2019",
      "guarantee_beneficiary": "Nicole Corporation",
      "guarantee_details": "On behalf of our client, Nicole Corporation, for value received, we, Global Bank, hereby irrevocably and unconditionally and without protest or notification, promise to pay against this, our irrevocable bank guarantee, to the order of Nicole Corporation, as beneficiary, on the maturity date, the sum of Twenty Two million United States Dollars ($22,000,000.00 USD), upon their first written demand for payment hereunder. Such payment shall be made without set-off, free and clear of any deductions, charges, fees, levies, taxes or withholdings of any nature. This bank guarantee is transferable, without payment of any transfer fees. This bank guarantee is issued in accordance with the uniform customs and practices for bank guarantees, as set forth by the International Chamber of Commerce, Paris, France, latest revision of ICC 500 publication. This bank guarantee shall be governed by and construed in accordance with the laws of the Republic of India and is free and clear of any lien and encumbrances and is of non-criminal origin.",
      "authorized_bank_officer_name": "Nicole Kidman",
      "authorized_bank_officer_title": "Vice President",
      "authorized_bank_officer_telephone": "230950934545",
      "authorized_bank_officer_facsimile": "367645455624",
      "authorized_bank_officer_email": "nicole@example.com",
      "STAMP_PAPER_CERTIFICATE_NUMBER": "IN-KA56448168201790P",
      "STAMP_PAPER_STATE": "KARNATAKA",
      "STAMP_PAPER_CERTIFICATE_ISSUE_DATE": "12-03-2018",
      "GUARANTEE_VERSION": "1.0"      
    }
}

4.4 Publish a letter of credit

Sample input

{
  "primechain_address": "1N9VtvZvP3rsw5Rf4Qpi12TWBaDoEwM2BAEsv2",
  "data": 
    {
      "LOC_FORM": "IRREVOCABLE",
      "LOC_NUMBER": "32453675864534",
      "LOC_DATE_OF_ISSUE": "17-DECEMBER-2018",
      "LOC_DATE_OF_EXPIRY": "16-MARCH-2019",
      "LOC_PLACE_OF_EXPIRY": "MUMBAI, INDIA",
      "LOC_APPLICANT_BANK": "GLOBAL BANK, GENEVA, SWITZERLAND",
      "LOC_APPLICANT": "NICOLE CORPORATION",
      "LOC_BENEFICIARY": "KIDMAN INC, ADELAIDE, AUSTRALIA",
      "LOC_CURRENCY": "USD",
      "LOC_AMOUNT_WORDS": "TWO MILLION",
      "LOC_AMOUNT_FIGURES": "2,000,000.00",
      "LOC_MAX_CREDIT_AMOUNT": "NOT EXCEEDING",
      "LOC_AVAILABLE_WITH": "ANY BANK",
      "LOC_AVAILABLE_BY": "BY NEGOTIATION",
      "LOC_DRAFTS_AT": "SIGHT",
      "LOC_DRAWEE": "INTERNATIONAL BANK, NEW YORK, USA",
      "LOC_PARTIAL_SHIPMENTS": "ALLOWED",
      "LOC_TRANSHIPMENT": "NOT ALLOWED",
      "LOC_FOR_TRANSPORTATION_TO": "MUMBAI, INDIA",
      "LOC_LATEST_DATE_OF_SHIPMENT": "17-JANUARY-2018",
      "LOC_DESCRIPTION_GOODS_SERVICES": "PLATINUM RODS",
      "LOC_QUANTITY_GOODS_SERVICES": "2000",
      "LOC_UNIT_PRICE_GOODS_SERVICES": "1000",
      "LOC_TRADE_TERMS": "CIF MUMBAI",
      "LOC_ORDER_NUMBER": "435346453",
      "LOC_DOCUMENTS_REQUIRED": "1.BENEFICIARY'S DRAFT AT SIGHT DRAWN ON BUYER'S BANK NAME, ADDRESS, MARKED 'DRAWN UNDER BUYER'S BANK NAME IRREVOCABLE LETTER OF CREDIT NO.XXX DATED XXX'. 2. SIGNED COMMERCIAL INVOICE IN TRIPLICATE. 3. PACKING LIST IN TRIPLICATE, INDICATING WEIGHT AND MEASUREMENT. 4. FULL SET (3 ORIGINALS AND 3 COPIES) OF CLEAN ON BOARD BILLS OF LADING MADE OUT TO ORDER OF SHIPPER AND BLANK ENDORSED MARKED 'FREIGHT PREPAID' AND NOTIFY APPLICANT. 5. INSURANCE POLICY IN DUPLICATE ENDORSED IN BLANK FOR 110 PERCENT OF THE INVOICE VALUE INCLUDING ALL RISKS, WAR CLAUSES AND S.R.C.C. 6. CERTIFICATE OF ORIGIN IN 3 ORIGINALS AND 2 COPIES ISSUED BY CHAMBER OF COMMERCE.",
      "LOC_ADDITIONAL_CONDITIONS": "THE COMPLETE SET OF ORIGINAL DOCUMENTS TO BE SENT IN ONE LOT BY THE COURIER SERVICE TO APPLIANT BANK.",
      "LOC_CHARGES": "ALL BANKING CHARGES ARE FOR BENEFICIARY'S ACCOUNT.",
      "LOC_PERIOD_FOR_PRESENTATION": "DOCUMENTS MUST BE PRESENTED WITHIN THE VALIDITY OF THIS CREDIT.",
      "LOC_CONFIRMATION_INSTRUCTIONS": "CONFIRM",
      "LOC_ADVISING_THROUGH_BANK": "STATE BANK OF ZIMBLIA, WOODFORD, ZIMBLIA",
      "LOC_SENDER_TO_RECEIVER_INFORMATION": "THIS CREDIT IS SUBJECT TO UNIFORM CUSTOMS AND PRACTICE FOR DOCUMENTARY CREDIT, 2007 REVISION, INTERNATIONAL CHAMBER OF COMMERCE PUBLICATIONS NO.600."        
    }
}

4.5 Publish a bill of lading

Sample input

{
  "primechain_address": "1N9VtvZvP3rsw5Rf4Qpi12TWBaDoEwM2BAEsv2",
  "data": 
    {
      "SHIPPER": "Enter the company name and address of the shipper (consignor).",
      "POINT_OF_ORIGIN": "Enter the city, state and country of the actual shipping point.",
      "DATE_OF_SHIPMENT": "Enter the date of the shipment, the date the carrier took control of the merchandise.",
      "SHIPMENT_MODE": "Enter truck, rail, ship etc as relevant",
      "SHIPPERS_NUMBER": "Enter a unique control number to reference the shipment with the carrier.",
      "CARRIER": "Enter the name of the company that will take initial control of the shipment and cause its delivery to the consignee.",
      "AGENT_NUMBER": "Enter carrier’s control number, if known or required.",
      "CONSIGNED_TO": "Enter the full name of the final recipient of the shipment, the ultimate consignee; also enter the mailing or street address of the ultimate consignee, if different than destination, for carrier notification purposes.",
      "DESTINATION": "Enter the street address, city, zip / pin code, state and country where the carrier will make delivery to the Consignee",
      "ROUTE": "If applicable, enter the route the carrier will take to the consignee. This Field may also be used to specify docks, warehouses, etc., and to specify any intermediate carriers.",
      "DELIVERING_CARRIER": "If applicable, specify the carrier that will deliver the shipment to the ultimate consignee at the destination, but only if different than the carrier entered in CARRIER Field",
      "VEHICLE_NUMBER": "Enter any vehicle identifying numbers or initials, if applicable.",      
       "ITEMS":
        {
          "ITEM_1": 
            {
               "ITEM_NUMBER_OF_PACKAGES": "Enter the total number of packages per line item; if the packages are consolidated on a pallet or in an outer container, note this information. For example: 112 PKGS 3 Pall.",
               "ITEM_DESCRIPTION": "Enter the description of each item, noting the type of package (carton, barrel, etc.) and the quantity per package. Since the correct freight classification is essential in describing an item, there must be a separate line item for each different freight classification description. If more than one type of packaging is used per freight classification, a separate entry must be used for each type of package. Enter any special package markings, special handling requirements, and delivery instructions. Note: For hazardous material items, special provisions must be met in completing this field.",
               "ITEM_WEIGHT": "Enter the total gross weight, in pounds, for each line item. For bulk shipments, the TARE and net weights should also be referenced in the description field. For package shipments, include the weights of pallets and skids. The total weight of the merchandise should be shown after the last line item, with pallet and dunnage weights shown separately.",
               "ITEM_CLASS": "Enter either the five-digit class (per the Uniform Freight Classification or the National Motor Freight Classification) or a two-digit class rate (a percentage of the first class 100 rate) per line item. This information may be determined by contacting the carrier."
            },
           "ITEM_2": 
            {
               "ITEM_NUMBER_OF_PACKAGES": "Enter the total number of packages per line item; if the packages are consolidated on a pallet or in an outer container, note this information. For example: 112 PKGS 3 Pall.",
               "ITEM_DESCRIPTION": "Enter the description of each item, noting the type of package (carton, barrel, etc.) and the quantity per package. Since the correct freight classification is essential in describing an item, there must be a separate line item for each different freight classification description. If more than one type of packaging is used per freight classification, a separate entry must be used for each type of package. Enter any special package markings, special handling requirements, and delivery instructions. Note: For hazardous material items, special provisions must be met in completing this field.",
               "ITEM_WEIGHT": "Enter the total gross weight, in pounds, for each line item. For bulk shipments, the TARE and net weights should also be referenced in the description field. For package shipments, include the weights of pallets and skids. The total weight of the merchandise should be shown after the last line item, with pallet and dunnage weights shown separately.",
               "ITEM_CLASS": "Enter either the five-digit class (per the Uniform Freight Classification or the National Motor Freight Classification) or a two-digit class rate (a percentage of the first class 100 rate) per line item. This information may be determined by contacting the carrier."
            },
        }
      "WITHOUT_RECOURSE": "For prepaid shipments, leave blank. Otherwise, add - THE CARRIER SHALL NOT MAKE DELIVERY OF THE SHIPMENT WITHOUT PAYMENT OF FREIGHT AND ALL OTHERLAWFUL CHARGES.",
      "PREPAID_SHIPMENT": "Enter “Prepaid” if shipment is to be paid for by the shipper. If this field is left blank, the carrier will seek to collect the freight charges from the consignee ",
      "PREPAYMENTS_RECEIVED": "Carrier enters any payments received in advance from the shipper for the shipment.",
      "CHARGES_ADVANCED": "Carrier enters any advanced charges for the shipment, if applicable.",
      "COD_SHIPMENT": "First, check whether the freight charges are prepaid (the carrier bills the shipper) or collect (the carrier deducts the freight charges from the amount collected from the consignee). Second, enter the amount to be collected for the merchandise itself—be sure to include the freight charges. Third, enter any collection fees, if applicable. Enter total charges to be collected by carrier.",
      "SHIPMENT_DECLARED_VALUE": "When the weight charged by the carrier is dependent upon the value of the shipment, the dollar value per unit of measure (for example, $100.00/pound) must be stated by the shipper.",
      "SHIPPER_AGENT": "Enter the signature of the individual preparing the shipment for the shipper.",
      "CARRIERS_AGENT": "The carrier’s agent will sign here prior to taking control of the shipment.",
      "CERTIFICATION_HAZARDOUS_MATERIAL": "If the shipments is of hazardous material, add - THIS IS TO CERTIFY THAT THE ABOVE-NAMED MATERIALS ARE PROPERLY CLASSIFIED, DESCRIBED, PACKAGED, MARKED AND LABELED AND ARE IN PROPER CONDITION FOR TRANSPORTATION ACCORDING TO THE APPLICABLE REGULATIONS OF THE DEPARTMENT OF TRANSPORTATION."
     }
}

4.6 Publish GPS data

It is recommended to use National Marine Electronics Association (NMEA) formatted Global Positioning System (GPS) data

Sample input

{
  "primechain_address": "1N9VtvZvP3rsw5Rf4Qpi12TWBaDoEwM2BAEsv2",
  "data": 
    {
      "NMEA_GPS_DATA": "$GPGGA,181908.00,3404.7041778,N,07044.3966270,W,4,13,1.00,495.144,M,29.200,M,0.10,0000*40",
    }
}

Explanation:

  1. All NMEA messages start with the $ character, and each data field is separated by a comma.
  2. GP represent that it is a GPS position (GL would denote GLONASS - Russia's version of GPS)
  3. 181908.00 is the time stamp: UTC time in hours, minutes and seconds.
  4. 3404.7041778 is the latitude in the DDMM.MMMMM format. Decimal places are variable.
  5. N denotes north latitude.
  6. 07044.3966270 is the longitude in the DDDMM.MMMMM format. Decimal places are variable.
  7. W denotes west longitude.
  8. 4 denotes the Quality Indicator: (1 = Uncorrected coordinate, 2 = Differentially correct coordinate (e.g., WAAS, DGPS), 4 = RTK Fix coordinate (centimeter precision), 5 = RTK Float (decimeter precision)
  9. 13 denotes number of satellites used in the coordinate.
  10. 1.0 denotes the HDOP (horizontal dilution of precision).
  11. 495.144 denotes altitude of the antenna.
  12. M denotes units of altitude (eg. Meters or Feet)
  13. 29.200 denotes the geoidal separation (subtract this from the altitude of the antenna to arrive at the Height Above Ellipsoid (HAE).
  14. M denotes the units used by the geoidal separation.
  15. 1.0 denotes the age of the correction (if any).
  16. 0000 denotes the correction station ID (if any).
  17. *40 denotes the checksum.
    (Source: https://www.gpsworld.com/what-exactly-is-gps-nmea-data/)

5. Decrypt, verify and retrieve data from the blockchain

To retrieve data use post /api/v1/get_data and pass 5 parameters:

  1. tx_id_enc_data - the id of the transaction in which the encrypted data and tag were published to the data stream.
  2. tx_id_signature - the id of the transaction in which the digital signature, hash and the signer's primechain address were published to the data stream.
  3. aes_password - the AES password.
  4. aes_iv - the Initialization Vector (IV).
  5. stream_name - the name of the data stream.

Sample input

{
  "tx_id_enc_data": "16346d48deea43865a276b5153fec90ac2ef83f146a20bf6826df995acdc5fc8",
  "tx_id_signature": "7c72b8fc633d9a091e878ef6c610e4383ca597f846092a35077374fb0accea76",
  "aes_password": "kfkNhEWZErbMLhtKkg6zSTy85Aq9QIJr",
  "aes_iv": "9UuZX4vgZ8r3",
  "stream_name": "200_tons_xyz_Jan_2019"
}

This is what happens:

  1. The digital signature, hash and the primechain address of the signing entity are retrieved from the data stream.
  2. The encrypted data and tag are retrieved from the data stream.
  3. The encrypted data is decrypted.
  4. The digital signature is verified.

The following is the output:

  1. data - the unencrypted data.
  2. primechain_address - the primechain address of the signer.
  3. signature_status - the verification status of the signature.
  4. timestamp - the timestamp

Sample output

{
"status": 200,
"response": {
"data": "This is the data that will be encryptd and stored.",
"signer_detail": "1BiWh3dEMEDVRHNTsrYf7MCHHfXP2qL6or34PP",
"signature_status": true,
"timestamp": "09/01/2019 01:42:47:00"
}
}

6. Invoice discounting

Invoice discounting enables suppliers to sell their invoices at a discount to investors. This enables suppliers to get faster access to money they are owed and enables buyers to get more time to pay. Instead of relying on the creditworthiness of suppliers (usually smaller businesses), the investors deal with buyers (usually large businesses). This can lower financing costs, optimize working capital and improve business efficiency.

Invoice discounting is also referred to as supply chain finance and factoring. The process involves 4 parties:

  • banks
  • large corporates (payers)
  • supplier (payees)
  • investors

Benefits of using the blockchain for invoice discounting include automated reconciliation and a provably immutable and transparent process.

6.1 Process flow

The process flow is as follows:

  1. A corporate (payers) publishes an invoice to the blockchain. This invoice is a blockchain asset and is immediately transferred to the relevant supplier (payee).
  2. Participants, especially investors, view invoices. This list of invoices can be filtered based on payer, payee, maturity date and value.
  3. Investors purchase fiat currency tokens from the bank. The payment to the bank for purchasing these tokens is done via conventional banking processes.
  4. All participants, especially investors, view all bids.
  5. Investors place bids. The bid amount is "locked" and "un-spendable" till they cancel their bid or till the supplier (payee) rejects their bid.
  6. The supplier (payee) rejects bids that are not acceptable to her.
  7. The supplier (payee) accepts a bid. The invoice now gets transferred to the relevant investor and the supplier immediately receives the relevant quantity of tokens. This is an atomic transaction and does not require any re-conciliation. The supplier (payee) can redeem these tokens from the bank.
  8. Upon maturity of the invoice, or any time before that, the corporate (payer) purchases fiat currency tokens from the bank. The payment to the bank for purchasing these tokens is done via conventional banking processes.
  9. The corporate (payer) places a bid to purchase the invoice from the investor holding the invoice.
  10. The investor accepts the bid. The invoice now gets transferred to the corporate (payer) and the investor immediately receives the relevant quantity of tokens. This is an atomic transaction and does not require any re-conciliation.
  11. The corporate (payer) retires the invoice by sending it to the burn address.

6.2 Publishing a new invoice

New invoices can be published to the blockchain by large corporates (payers) using post /api/v1/create_invoice and passing these parameters:

  1. invoice_payer - the primechain address of the corporate who is the payer of the invoice.
  2. invoice_payee - the primechain address of the supplier who is the payee of the invoice.
  3. invoice_name - the name of the invoice. This must be unique across the blockchain and can contain a maximum of 32 characters including blank spaces.
  4. invoice_details - the details of the invoice. This contains 3 parameters, namely
    • invoice_amount - the maturity amount of the invoice.
    • invoice_maturity - the maturity date of the invoice.
    • invoice_description - optional additional information about the invoice.

The newly created invoice is created as an asset of the blockchain and is transferred automatically to the supplier (payee).

Sample input

{
  "invoice_payer": "aaa",
  "invoice_payee": "aaaa",
  "invoice_name": "Invoice no. 235235",  
  "invoice_details": 
    {
      "invoice_amount": "USD 856,000"
      "invoice_maturity": "10-April-2019"
      "invoice_description": "This is optional additional information about the invoice."
     }
}

Note: This may take upto 30 seconds.

Output is:

  • tx_id - the id of the transaction in which the invoice was published to the blockchain
  • invoice_reference_number - the unique reference number of the asset
  • invoice_details - invoice details

Sample output

{
"status": 200,
"response": {
"tx_id": "6b8842e04d649d33a2f6cd4e632d1c61e5989dd46532a8a8eee566ee58656fbc",
"invoice_reference_number": "365-515-34923",
"invoice_details": {
"details": {
"invoice_amount": "USD 856,000",
"invoice_maturity": "10-April-2019",
"invoice_description": "This is optional additional information about the invoice."
}
}
}
}

6.3 Viewing invoices

Participants, especially investors, view invoices. This list of invoices can be filtered based on payer, payee, maturity date and value. To view all the invoices, use get /api/v1/view_all_invoices.

Sample output

{
"status": 200,
"all_invoices": [
  {
"name": "SILVER-tokens-series-A",
"issuetxid": "846d9aee914b262dab84206fa5f67254e3fb82efde467d5e3f3b906111ef1777",
"assetref": "115-513-28036",
"multiple": 1,
"units": 1,
"open": false,
"restrict": {
"send": false,
"receive": false
},
"details": {
"details": "Backed by silver jewellery held in Lot A at Zimblia office"
},
"issueqty": 19500,
"issueraw": 19500,
"subscribed": true,
"synchronized": true,
"transactions": 13,
"confirmed": 13,
"issues": [
  {
"txid": "846d9aee914b262dab84206fa5f67254e3fb82efde467d5e3f3b906111ef1777",
"qty": 19500,
"raw": 19500,
"details": {
"details": "Backed by silver jewellery held in Lot A at Zimblia office"
},
"issuers": [
  "1Go5neH1MUtcMdFfS6U5MDYsLJ51s6ZX1gmg3e"
],
}
],
},
  {
"name": "GOLD-tokens-series-A",
"issuetxid": "409dc914fd64e43ad667f6880276cfae1ae6c3ea92c0813a48d76f41924cf245",
"assetref": "137-267-40256",
"multiple": 1,
"units": 1,
"open": true,
"restrict": {
"send": false,
"receive": false
},
"details": {
"details": "Backed by silver jewellery held in Lot A at Zimblia office"
},
"issueqty": 19500,
"issueraw": 19500,
"subscribed": true,
"synchronized": true,
"transactions": 7,
"confirmed": 7,
"issues": [
  {
"txid": "409dc914fd64e43ad667f6880276cfae1ae6c3ea92c0813a48d76f41924cf245",
"qty": 19500,
"raw": 19500,
"details": {
"details": "Backed by silver jewellery held in Lot A at Zimblia office"
},
"issuers": [
  "1Go5neH1MUtcMdFfS6U5MDYsLJ51s6ZX1gmg3e"
],
}
],
},
  {
"name": "GOLD-tokens-series-B",
"issuetxid": "7df309886ba8fa220c3be3f4e24c763bb5ac6cc01063aa089b55cf4a64f68a63",
"assetref": "144-266-62333",
"multiple": 1,
"units": 1,
"open": true,
"restrict": {
"send": false,
"receive": false
},
"details": {
"details": "Backed by Gold jewellery held in Lot B at Zimblia office"
},
"issueqty": 24500,
"issueraw": 24500,
"subscribed": true,
"synchronized": true,
"transactions": 2,
"confirmed": 2,
"issues": [
  {
"txid": "7df309886ba8fa220c3be3f4e24c763bb5ac6cc01063aa089b55cf4a64f68a63",
"qty": 19500,
"raw": 19500,
"details": {
"details": "Backed by Gold jewellery held in Lot B at Zimblia office"
},
"issuers": [
  "1Go5neH1MUtcMdFfS6U5MDYsLJ51s6ZX1gmg3e"
],
},
  {
"txid": "113233f116656c8c7b866e87e904cd419ccbf69934e16adf31d1a9c8c3eddf61",
"qty": 5000,
"raw": 5000,
"details": {},
"issuers": [
  "1Go5neH1MUtcMdFfS6U5MDYsLJ51s6ZX1gmg3e"
],
}
],
},
  {
"name": "Invoice no. 235235",
"issuetxid": "6b8842e04d649d33a2f6cd4e632d1c61e5989dd46532a8a8eee566ee58656fbc",
"assetref": "365-515-34923",
"multiple": 1,
"units": 1,
"open": false,
"restrict": {
"send": false,
"receive": false
},
"details": {
"details": {
"invoice_amount": "USD 856,000",
"invoice_maturity": "10-April-2019",
"invoice_description": "This is optional additional information about the invoice."
}
},
"issueqty": 1,
"issueraw": 1,
"subscribed": true,
"synchronized": true,
"transactions": 1,
"confirmed": 1,
"issues": [
  {
"txid": "6b8842e04d649d33a2f6cd4e632d1c61e5989dd46532a8a8eee566ee58656fbc",
"qty": 1,
"raw": 1,
"details": {
"details": {
"invoice_amount": "USD 856,000",
"invoice_maturity": "10-April-2019",
"invoice_description": "This is optional additional information about the invoice."
}
},
"issuers": [
  "1VUid7fZaiFnNXddiwfwvk8idyXixkFKRSQvMp"
],
}
],
}
],
}

6.4 Bidding by investors

Investors place bids on invoices. To place a bid on an invoice, the investor must hold sufficient quantity of fiat currency tokens (token). These tokens are issued by banks against fiat currency deposits held by them. Investors can purchase these tokens from their banks. Once an investor places a bid, the relevant amount of tokens are ‘locked’ and 'un-spendable' till either:

  • the supplier (payee) rejects the bid or
  • the investor cancels his bid

To create a bid, the investor uses post /api/v1/create_bid and passes these parameters:

  1. from_address - the primechain address of the investor
  2. to_address - the primechain address of the payee
  3. invoice_reference_number - the reference number of the invoice
  4. token - name of the fiat currency token
  5. token_amount - quantity of the fiat currency token being offered in return for the invoice

Sample input

{
  "from_address": "1b8yZEFmK2HSTKUm1rgKUDABPAq8CGRJYQWW2k",
  "to_address": "1HhDFkG6erh3cusjY1M8tgEQr3dhTM8Dh71Pmr",
  "invoice_reference_number": "4607-266-27124",
  "token": "Global-Bank-USD",
  "token_amount": 100
}

The following gets published to the OFFER_DETAIL_STREAM data-stream:

  1. The primechain address of the bidder
  2. Reference number of the invoice
  3. Name of the fiat currency token
  4. Quantity of the fiat currency token offered for the invoice
  5. A hexadecimal representation of the bid

The output is the id of the transaction in which the bid information is stored in the blockchain.

Sample output

{
  "status": 200,
  "tx_id": "950e37cc585dc6437e95ef9d37956513daa9b83f0438fbf49a82f6c2e861e907"
}

6.5 Cancelling of bids by investors

To cancel a bid, the investor uses post /api/v1/cancel_bid and passes 1 parameter - the id of the transaction in which the bid information is stored in the blockchain:

Sample input

{
  "tx_id": "9acbe1619a749f0f690e65ae4e7836c56a9e923705119563c1351b7601ec3998"
}

Sample output

{
"status": 200,
"response": true
}

6.6 Viewing bids

All participants can view all bids placed on all invoices using get /api/v1/view_all_bids. This creates a highly transparent platform and enables price discovery.

Sample output

{
"status": 200,
"all_bid_details": [
  {
"from_address": "1b8yZEFmK2HSTKUm1rgKUDABPAq8CGRJYQWW2k",
"to_address": "1HhDFkG6erh3cusjY1M8tgEQr3dhTM8Dh71Pmr",
"invoice_reference_number": "4607-266-27124",
"token": "lite_coin_8763737",
"token_amount": 10,
"txid": "110f4b14f225789b22db9676470898ca6d32e6f8af0d5ccd30a4ebfa6d6397af",
"vout": 0,
"offer_blob": "0100000001af97636dfaeba430cd5c0daff8e6326dca9808477696db229b7825f2144b0f11000000006a4730440220736c0d78bcb3e27a27891485867c32422b4533f88005a76d33e95d8f3584afb502201e815010859e02ab055b7405c41b80903683c21fe495f673ab2d0d73216a4ed6832102ae5cc5f1f9e1557bf3323dae43afdad30a0cbd8c3738ca4a6d0b6127484c063affffffff0100000000000000003776a914fc94b1fcb15f639eef422098fdd415167740831788ac1c73706b712d3aad14eaa2d1925b57b995716a69f401000000000000007500000000"
}
],
}

To view bid details for a specific invoice, use post /api/v1/view_bid and pass the invoice reference number as a parameter.

Sample input

{
  "invoice_reference_number": "4607-266-27124"
}

Sample output

{
"status": 200,
"response": [
  {
"from_address": "1b8yZEFmK2HSTKUm1rgKUDABPAq8CGRJYQWW2k",
"to_address": "1HhDFkG6erh3cusjY1M8tgEQr3dhTM8Dh71Pmr",
"invoice_reference_number": "4607-266-27124",
"token": "lite_coin_8763737",
"token_amount": 100,
"txid": "602dceb782166d222c6fed8470feaa62fd3b66b0bfcef2a91f729684b46222a6",
"vout": 0,
"offer_blob": "0100000001a62262b48496721fa9f2cebfb0663bfd62aafe7084ed6f2c226d1682b7ce2d60000000006b483045022100ee606fc93d4d04298d04551b4c60893a7c0bab2cd92ad815b404d8210d6bb9ce02205ccbd2ec2db9a1b4a2b90edae48a5ce868b1d91bcc8e9d08d37680a37aaaa827832102ae5cc5f1f9e1557bf3323dae43afdad30a0cbd8c3738ca4a6d0b6127484c063affffffff0100000000000000003776a914fc94b1fcb15f639eef422098fdd415167740831788ac1c73706b712d3aad14eaa2d1925b57b995716a69f401000000000000007500000000"
}
],
}

6.7 Rejection of bids

A supplier (payee) can reject bids made on invoices in which she is the payee. To reject a bid, use post /api/v1/reject_bid and pass the following parameters:

  1. transaction id of the bid
  2. primechain address of the payee

Sample input

{
  "tx_id": "9acbe1619a749f0f690e65ae4e7836c56a9e923705119563c1351b7601ec3998",
  "primechain_address": "1HhDFkG6erh3cusjY1M8tgEQr3dhTM8Dh71Pmr"
}

Sample output

{
"status": 200,
"response": true
}

6.8 Acceptance of bids

A supplier (payee) can accept bids made on invoices in which she is the payee. If she accepts the bid, the invoice is transferred to the relevant investor and the bid amount of the tokens is transferred to her. She can redeem the tokens from the bank. To accept a bid, use post /api/v1/accept_bid and pass the following parameters:

  1. transaction id of the bid
  2. primechain address of the payee

Sample input

{
  "tx_id": "ce1a7475c8419ad3a30ef9db98d7219aa72221fe9fe2cae8f652a690efda80fa",
  "primechain_address": "1HhDFkG6erh3cusjY1M8tgEQr3dhTM8Dh71Pmr"
}

Sample output

{
"status": 200,
"tx_id": "1b1cd89ebd0b813780ffc0d39361ab4711a92e97ad6073304cb4909083268f71"
}

6.9 Buyback of the invoice upon maturity of invoice

Upon maturity of the invoice, or any time before that, the payer of an invoice places a bid to purchase the invoice from the investor holding the invoice. To place this bid, the payer must hold sufficient quantity of fiat currency tokens (token). These tokens are issued by banks against fiat currency deposits held by them. Payers can purchase these tokens from their banks.

To create a bid, use post /api/v1/create_bid and to accept the bid, use post /api/v1/accept_bid as explained in the sections above.

The invoice gets transferred to the payer and the investor receives the bid amount of the tokens. The investor can redeem the tokens from the bank.

6.10 Retiring the invoice

The corporate (payer) then retires the invoice using post /api/v1/retire_invoice and passing the invoice reference number as a parameter.

Sample input

{
  "invoice_reference_number": "aaa"
}

Sample output

{
  "status": 200,
  "tx_id": "93bf243e60a029430ccca38f2e2165b16e5ee9e8fa516ea2552144de089f0a4b"
}


Have a query? Email us on info@primechain.in