Description of the solution for the block chain in cross border trade — 1
The shopping platform nowadays is mostly developed by html, javascript, css, php and SQL database and as we are trying to develop new function and business model for the general system, our solution will follow this trend but combine with some new concept and technology.
In our solution, the role of the online platform is not only an online shopping centre, but also a centre to gather and pack the data from different aspects in the region. The data of the seller (shop/provider/producer) in the region will be hashed and done the consensus with other oversea platform (node) to guarantee the data is immutable. The data can also be translated to different language for any people to check and read.
In the seller side, there are 2 types of data. The first one is the seller’s information and the other is the data of the production process.
The seller’s information is mainly for the credit system. However, based on the block chain concept, the information cannot be deleted or update. It can only be accumulated. The data from the production process is for tracking and will add and accumulate rapidly parallel to the production process. The product ID is the core of the production process data and it will become a very long chain. It should be ready for tracing and tracking.
Other than the seller’s, there is data come from the transaction. The transaction data record the buying process and the payment result. The core of this block chain is the invoice number. The detail of the invoice will be saved in the local shop or platform’s own database and will not be sent to other platform to protect the privacy of the common buyer.
Here we need to figure out how can we handle data from different sources with different contents and let numerous parties to input the data? One of our proposal is to utilize the JSON.
“JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language Standard ECMA-262 3rd Edition – December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others. These properties make JSON an ideal data-interchange language.”
https://www.json.org/json-en.html
JSON is flexible and easy to understand. It is supported by most of the programming language such as PHP and PYTHON. It is also easy to send to other platform or system by different protocol such as HTTP and MQTT (machine to machine/machine to platform).
By Kong Yuk Kan 27 August 2020 in Vancouver, B.C., Canada
Description of the solution for the block chain in cross border trade — 2
To do the consensus between platforms is another problem especially the platforms are in far distant.
There is always get firewall setting issue in communicating between servers and platforms. The connection state also need to considerate.
In our solution we prefer use the REST API to go through the port 80 in http protocol. Almost 100% of the servers and cloud servers would not block the port 80.
“Representational state transfer (REST) is a software architectural style that defines a set of constraints to be used for creating Web services. Web services that conform to the REST architectural style, called RESTful Web services, provide interoperability between computer systems on the internet. RESTful Web services allow the requesting systems to access and manipulate textual representations of Web resources by using a uniform and predefined set of stateless operations. Other kinds of Web services….”
https://en.wikipedia.org/wiki/Representational_state_transfer
The REST API can send the data by javascript, php (curl) or even a simple form. It is very flexible for the related parties to send us the data by different ways. However, as our REST API is utilized in block chain concept, we only allow the “post” and “get” function. No “delete”, “update” is allowed.
Other than doing the block chain consensus, the platform may act as a middle man between the other platform and the payment gateway. Many requests will go through our platform to the 3rd party payment gateway. How to identify each request and response with correct message? To solve this problem, we need a middle ware to store the temporary data and waiting for the response to run the next step. We use the session variable to handle this stateless connection.
JSON handles the data structure and the REST API handles the communication channel.
By Kong Yuk Kan 27 August 2020 in Vancouver, B.C., Canada
Description of the solution for the block chain in cross border trade — 3
Our smart contract focus in the B2B sector. It works on PGP mechanism. The buyer and seller need to sign the contract by their private keys generated by the platform and the platform use their public keys to certify the contract. The content of the contract will keep in the block chain and do consensus with all the platform.
“PGP encryption or Pretty Good Privacy encryption, is a data encryption computer program that gives cryptographic privacy and authentication for online communication…… PGP encryption uses a mix of data compression, hashing, and public-key cryptography. It also uses symmetric and asymmetric keys to encrypt data that is transferred across networks. It combines features of private and public key cryptography.”
https://digitalguardian.com/blog/what-pgp-encryption-defining-and-outlining-uses-pgp-encryption
In the smart contract, the buyer pay in stage by stage. So both the buyer and seller bear the same risk and both side need to submit enough information to secure the contract. As it is an commercial contract, the whole content will not be opened to public. How to execute the smart contract is an issue. The system nowadays ask the buyer to put the crypto-currency on the system and when the smart contract reach a stage, a certain amount of crypto-currency will be sent to the seller. As until now not all the market accept crypto-currency payment, our smart contract can paid by our 3rd party payment gateway.
In our smart contract system, our block chain tracking and tracing mechanism is the trigger or so called block chain oracle. So the platform and the system is also the guarantor of the smart contract.
Working with the B2B concept, the smart contract can be developed as digital key or digital credential for real goods. So the smart contract itself can be transferred, that means buy and sell. If there are some commodity that are hard to transfer physically or the buyer just want to invest and do not want to keep or manage the commodity, the ownership and the location of the commodity can be separated. Then the digitalized ownership can buy and sell in the market. Of course it then will create a scenario that a commodity is inside a country but the ownership is outside. However, is it also a good way to lineup the international or cross border trade market?
In this sense the smart contract, like the invoice number and product id in our system, works like a crypto-currency.
By Kong Yuk Kan 29 August 2020 in Vancouver, B.C., Canada
Description of the solution for the block chain in cross border trade — 4
Additional Calculations:
Other than the common calculation in online shopping platform, some special calculation need to add our solution.
Credit calculation–
In the B2C model, credit system is mainly for the buyer to check the manufacturer/provider/seller. In this section, the credit system will handle the information base on:
1. More information is better than less;
2. Public and official information is better than private;
3. New information is better than old information;
The system will also monitor and check the process in logistic and customer service.
The result will show in marks to make the buyers easy to understand. However, if the buyers need the information in detail, they can login to check the data by compare the hash with 3rd party apps.
In the B2B model, both the information(history, behaviour, etc) of the buyer and seller will be marked and recorded.
Python programming will handle the calculation of the credit system. Python has rich library and tools such as numpy, pandas for A.I. and Deep learning calculation. Moreover, it is not necessary for the credit calculation run in real-time, Python is good enough for finishing the calculation in routine.
Ledger/Balance calculation–
The system cooperate with multi-platform or node in different region with independent account system. So we need to calculate the balance sheet between the platforms. The calculation will work in 2 major concept:
–Barter trade concept:
The platform will work as a middle man to calculate the balance between different platforms in barter trade concept to minimize the usage of foreign currency.
–Middle currency concept:
To balance the account of different platform with different currency, the crypto-currency or virtual currency will be used as a medium. The value of this crypto or virtual currency need to reference to the foreign exchange. The most important is both side agreed to the exchange value of this crypto/virtual currency.
The balance sheet between platforms would become an internal ledger working in block chain concept. In this ledger, the invoice will work like a crypto-currency and the ledger records the transaction of the invoice. The platform who finally handle the payment of the invoice would become the miner to build the new block and start the consensus.
By Kong Yuk Kan 31 August 2020 in Vancouver, B.C., Canada
Micro-service architecture for Block Chain in cross border trade
To maintain the flexibility of the system, our solution is designed in the microservice architecture :
“Microservices – also known as the microservice architecture – is an architectural style that structures an application as a collection of services that are:
-Highly maintainable and testable
-Loosely coupled
-Independently deployable
-Organized around business capabilities
-Owned by a small team
The microservice architecture enables the rapid, frequent and reliable delivery of large, complex applications. It also enables an organization to evolve its technology stack.”
https://microservices.io/index.html
The services in the system are supported by two connected but independent databases. Most of the functions can run separately and each main service will be supported by many small services. The micro-service architecture fit the concept of distribution in block chain system. The architecture allows the I.T. team in different region to develop new services and connect to the system.
The micro-service architecture can help the system run in different area with different language, culture and even different religion, especially in South East Asia (Buddhism, Islam, Catholic, Protestant, etc).
By Kong Yuk Kan 1 September 2020 in Vancouver, B.C., Canada
Blockchain Ethereum – Ví dụ về hàm Delegatecall trong solidity
Blockchain Ethereum (P4) – Kết Nối Các Node Sử Dụng Bootnode
Blockchain Ethereum (P3) – Cài Đặt Private Blockchain trên nền tảng Ethereum
Install web3 and nodejs
Sử dụng Virtual Box
Đọc sách 2021