@lambeta
2019-05-29T14:47:26.000000Z
字数 13222
阅读 313
blockchain
[Characters of Blockchain]
First of all, let's review the characters of Blcokchain quicklys.
We all know blockchain from different characters, such as distributed ledger, non-tampered, traceablility, smart contract, trust machine. But the blockchain features we focus on today are these three points: distributed ledger, traceability and smart contracts.
[Auto finance background]
[Car’s lifecycle]
Let's take a brief look at the auto fianance industry. Auto finance is actually a very small part in the financial industry. Because it all happens around cars, so let us first look at the entire life cycle of a car, and how the transaction happens around it.
From the production of parts, to the OEM (original equipment manufacture) to manufacture the car, and then through the sales companies in various regions, such as the sales companies in Europe, North America, China, etc., the car is sold to the dealers in different regions. Of course, in fact, in China, dealers can also be divided into different levels, and finally they are sold to customers. Once the new car is sold, it has entered the aftermarket, as well as the resale of used car and so on.
From the production and transportation of parts to a car sold to dealers, which is known as supply chain finance, and customers buy cars by finance, regarding it is new or used. We usually call it retail finance. There are many participants in each field, and their focuses are different. Today we have selected a very good subject, which covers these two different sub-areas. that is the auto finance company. Auto finance companies, which are established by the manufacturer of car, like Mercedes-Benz, all of them have their own financial companies, and gradually become the main financial service providers of their vehicles.
[Auto finance business model]
In order to make it easier for everyone to understand the context of the application, let's take a brief look at the main business scenario of the auto finance company.
This picture looks a bit more complicated, but it is actually very simple. 123 is the wholesale finance of cars, and 45 is the retail finance of cars. In Wholesale finance process, financial companies provide loans to dealers. In the retail process, financial companies come to provide loans to customers. Because of the two different financial activities, we can see the two red arrow line in the opposite direction. In financial terms, we call this netting-off, that is, the debts offset each other, and the difference between the two loan behaviors makes the financial company earned interest income from wholesale and retail with lower cash fund. This is the main business and main income model of auto finance companies. So what are the pain points in this business model?
[Business pain points]
First, financial reconciliation costs are high and inefficient. The financial cost here should not be understood as the financial cost of a company, but the total cost of the entire system. You may imagine, there may be more than one sales company and financial company and hundreds of dealers just in China region. Even if each company has only two financial people, there are more than thousand of financial auditors, even more in the global sales.
When different types of institutions do reconciliation, they often export spreadsheets from the system and send them by mail. You even need to print the form, stamp it, and mail it. After the other party receives it, compare it with their data. they are really inefficent and should be avoid。
And also, the utilization of funds is not transparent. As we mentioned earlier, avoiding duplicate loans on the same car is the key to the business of auto finance companies. The traditional financial accounting method cannot timely and transparently demonstrate the real-time utilization of funds, how many funds have been inefficiently wasted, how much potential losses have been caused, we don't know.
Second, deep-tier suppliers are hard to finance. for financial companies, they can only finance the direct suppliers, for example the upstream supplier of parts somehow can not finance by financial companies, because they don't have enough credit to get trust of financial company.
Third, numberous dealers need to be reviewd manually by different financial companies. This can't be regarded as a pain point, but should be understood as a waste of resources. Let's not start here, let's talk about it later. In any industry, there is efficiency improvement, cost reduction, and optimization of the credit system.
[Blockchain in auto finance]
Let's first take a look at how blockchain technology can solve the first problem. Review the three characteristics of the blockchain: distributed ledger, traceability, smart contracts.
[Liability]
Let us first understand the basic unit of the ledger which is the concept of liability. To put it simply, a liability is a payable, which is called Account Payable in finance and is often abbreviated as AP. The sales company sold a car to the dealer at a price of 200,000. In the process of transferring ownership, the dealer owed the sales company a liablity of 200,000. Now that the financial company is involved, the liablity relationship has turned into a liablity of 200,000 yuan owed by the financial company to the sales company, and the dealer owes the financial company a liability of 200,000, and because of the deferred repayment, the latter It is also necessary to pay an interest. This is the bookkeeper of liability, each liability requires the signature of the participants to be confirmed and then saved under the nodes of each participating legal entity to make a consensus on a transaction.
[Payment]
The liability is kept, how to pay off? Now the financial company has lend money to the sales company and paid 200,000. Then the liability should be paid off, through the smart contract, we can ensure the cash payment corresponding to liability repayment.
[Real-time distributed ledger]
Therefore, in this ledger, through the distributed consensus mechanism of the blockchain, each of the real-time transaction books that cannot be tampered with is recorded, and the current accounts receivable can be obtained without more effort, it reduces costs.
[Summary]
Therefore, in a nutshell, in simple terms, the application of blockchain in the field of auto finance can realize the distributed ledger around its transaction by digitizing the single core asset of the car. If there is a digital currency in the future, then currency could be the booking record itself; in the end we can think further, under the endorsement of blockchain technology, the entities in the future supply chain network can also achieve peer-to-peer finance more efficiently, because each All financial and transaction between the entities are recorded on blockchain, which can provide reliable credit records. Delear can also issue their own financing bonds through smart contracts, and automatically perform redemption after expiration, reducing the cost of trust. This transparent and efficient capability can speed up the maturity of supply chain ecosystem.
[Technology in deep]
[Technical selection framework]
The first question, and I believe, lots of technical people also care about, is which blockchain framework or platform should I choose. that is quite hard to answer. But after research and comparision between the mainstream blockchain framework/platform, we have a six dimensions evaluation framework to help us choose the right blockchain.
[Design and DevOps]
There have two big part and each part has two or more steps.
Identifying the data on the chain refers to how the facts of which transactions are worth recording; the contract design refers to how the car and its related financial activities are automatically completed in a programmable way; how the API design exposes the platform capabilities. The deployment unit and network deployment network topology are part of the implementation and are designed to answer how distributed ledgers actually run in the enterprise. Of course, what I am talking about today is based on the distributed ledger technology of Corda. Corda is not a blockchain, but a DLT inspired by blockchain, namely distributed ledger technology, which is composed of R3. Developed and maintained by the world's top financial blockchain alliance.
[Identify on-chain data]
Auto finance always has financial activities around the life cycle of the car. The problem we need to analyze clearly is when the car is transferred, between the parties involved in the car, and what changes in the data accompanying the car in the process of transfer. In analyzing this business, we used the analysis method of event stormming in the software industry, analyzed the business events of car transfer between various legal entities, and then sorted the events, and figure out data through events, including transaction participants. information of the car, ownership and possession of the car, liablity and so on.
[Corda state]
After analyzing the data on chain, we started to model the data. Before that, it is necessary to introduce Corda's programming model, State, because it will directly affect our subsequent model design. One of the core concepts in Corda is State, which is the fact of a distributed ledger that represents the agreement of participants. Taking the IOU as an example, State is actually a collection of key attributes of the debt, including the borrower, the lender, the amount of money, and the repayment deadline. When it partially pay off, the content of the debt will change. The way to change is to mark the old debts as historic, and then generate a new state.
[Modelling car and liability]
In our scenario, the core State is the car and the liability. Because Corda is running on the JVM, the preferred language for development is kotlin, so here we directly model the car and liability in the kotlin data class, and inherited the Corda built-in LinearState, LinearState has a globally unique ID that does not change during the evolution of the data. If someone understands the concept of DDD, it should be able to automatically map to the entity concept. In addition, Corda also has a core state called Fungiable Asset, which can be analogized to value objects, such as: Cash.
[UTXO (unspent transaction output)]
How to evolve after State modeling is completed? This has to mention a UTXO concept, UTXO is an abbrivation of unspent transaction ouput, originally introduced by Bitcoin, it has many benefits, such as can be traced back to the source of each output, to help verify the existence of double-spending, Corda gets the same benefits. When the sales company wholesales the car to the dealer, it will input the ownership of the car as the input of the transaction, and produce the output, which includes the change of ownership and the generation of liability. The car as an input will be marked as historic. The transaction itself must also be signed by both parties to the transaction.
[Smart contract design]
All we talked about above are the data on the chain and the evolution of the data, but these processes are not automatically executed. For complex financial contracts, there are often multiple changes to the state. At this time, we must use automated processes to manage these changes. The things that control these changes are actually smart contracts. Take the dealer wholesale car as an example. A possible contract template is to genearate a liabity at the same time as the transfer of the car, with repayment deadline. When this contract forces the state to change, both parties must provide signature.
[Corda flow and contract]
Before entering the smart contract implementation, we must first understand the concept of flow and contract in Corda. Flow is an automated process in Corda that controls how the participating nodes update the State. It control how to get the counterparty's signature. A standard flow process involves acquiring data on the chain, creating a transaction, self-signing and sending it to the counterparty for transaction verification, then signing, and finally submitting the transaction on both ledger. Contract is the script used to provide validation during the transaction verification process.
[Programmable smart contract]
In our scenario, the smart contract grows like this. In the flow, the data of the original car is taken out from the chain, and a new car with the transfer of ownership and a libility is generated. Then a transaction is constructed through txBuilder. The input of the transaction is the original car, and the output is the new car with its liability; the last is the process of verification and signature and transaction submission. You may have noticed that there is a firstNotary parameter in txBuilder. Notary is a special kind of node in corda, which is specially used to prevent the problem of double-spending. So every transaction requires a notary node to participate and sign the transaction. In the transaction verification process, the contract we defined will be executed. This contract is very simple, there is only one pure function called verify(). It is used to assert whether each state update meets the requirements.
[API design]
With a smart contract, we have to consider how to expose the their capabilities. In other words, from the consumer's point of view, how can they be easy to use the capabilities provided by the platform to complete their business. So here we take advantage of the idea of REST api design, make the capabilities of the platform as a resource, define a car-central URI, and then select the appropriate HTTP verb to control the REST api.
[Layered architecture]
From identify data chain, to smart contract design, to API design, we use Corda's distributed ledger technology at different levels. The lowest-level distributed ledger records the fact that each transaction emitted, and can be non-tampered and traceable; the smart contract layer provides financial contract; the top-level REST api is exposed as resources.
[Deployment unit]
How did such an auto finance platform run? With docker, we package a deployment unit into a docker image. The bottom layer is a full Corda node. All smart contracts and states are deployed on this node in a jar package. At the same time, we use springboot to connect through RPC. To the Corda node, the smart contract is invoked to expose the REST api; the Corda nodes communicate with each other through the channels of messaging.
[Network topology]
Once packaged into a docker image, it can be deployed into the runtime environment to form a distributed ledger network. There are 2 nodes to note here. The leftmost permission service is used to issue certificates to each incoming node, giving each participating entity an identity. The middle, Network map is similar to the service discovery in microservices. The discovery of different nodes in Corda is not done by broadcasting, but by registering into the Network map and get the information of other nodes, to find the other party.
[Platform highlights]
Finally, we review the three-tier architecture mentioned earlier and re-focus the platform from a value perspective. The traditional platform exposes services through api to gain value input, but the core assets of the blockchain platform are actually in the lowest level of the ledger. Based on these transaction facts and liability or payment records, we can easily manage the digital assets of each legal entity, calculate real-time liabity information, and trace the value of the vehicle. In the future, with big data analysis and AI, it is more likely to create a more complete Supply chain ecosystem.
Thanks all and thanks for your time.