What is a distributed ledger? What about the design, planning and typical application scenarios of distributed ledgers? Based on such problems encountered by developers in the community recently, I will share some personal experiences on the distributed ledger OpenLedger, hoping to give you some lessons and references.
What is a distributed ledger and how does it relate to blockchain?
Ledger is a technology used to record changes in equity. The ledger has a wide range of applications, it can be used by individuals, households, businesses and banks to record customer loans. Below I will introduce the characteristics of different types of ledgers through life examples.
The first is the personal ledger, which is the simplest way of accounting and is mainly used to record personal income and expenses.
The second is the family ledger. Compared with the personal ledger, when multiple people are jointly keeping accounts, we need to pay attention to which family member is the income and expenditure object of each account. In addition, the family account book also needs to pay attention to the simultaneous income and expenditure of multiple family members to avoid the problem of disordered accounting.
The third is the corporate ledger. Compared with the household ledger, the corporate ledger is more complex, and it is necessary to increase the attributes of the account period and subject. Account period can help companies count changes in account equity over a period of time, such as a fiscal year.
Fourth, it is the bank's ledger. The bank's ledger needs to increase the equity subject, that is, the transaction initiator. The bank account book is not used to record its own income and expenditure, but is used to record user deposits, loans, and transfer transactions. Therefore, the main body of bank bookkeeping is the user. Individual users can initiate transactions by themselves, while banks are responsible for bookkeeping, and multiple accountants and cashiers of corporate users can initiate transactions in the same account.
The above four types are called centralized accounting methods, and the accounting subject is single. So what is a distributed ledger?
- First of all, different from centralized bookkeeping, there are many participants in distributed bookkeeping, and the interests of the participants are not necessarily the same, there may be common interest demands, and there may be games between different interests;
- Secondly, distributed accounting has the characteristics of multi-center, and the participating organizations have a clear division of labor;
- Finally, the organizational relationship and ledger system of distributed accounting have a hierarchical structure, and there are many accounting subjects, which is significantly different from the point-to-point and multi-centralized relationship in traditional blockchains.
Taking credit asset securitization as an example, the bank provides mortgage loans to home buyers and lends money to home buyers. At this time, the bank and the home buyer will form a loan relationship.
Due to the longer repayment period of the housing loan, the loan interest is relatively low. If the bank co-operates the same loan with the business, or borrows it through a credit card, the return on this kind of cooperation is higher.
Therefore, lending banks hope to recover the loan quickly and obtain a high rate of return. Through the asset securitization business, the loan principal and interest that the lending bank would have to recover in 30 years can now be recovered within one month.
The lending bank first needs to package the loan, package it into securities through the trust company, and then sell it to different investors or investment institutions through the securities company.
After the above process is completed, the loan bank can basically recover the money. At the same time, the loan bank also needs to pay a certain fee. At this time, the borrower will continue to repay according to the loan contract.
The principal and interest of the repayment need to be returned to the securities investor. The borrower will continue to repay the principal and interest to the lending bank for the next 30 years. The lending bank will transfer the received money to the custodian bank, and the custodian bank will then follow a certain calculation method. Pay to the custodian institution, and the custodian institution will pay the securities investors after calculating the principal and interest of the securities.
This is the business relationship in it. Each institution has its own IT system. The inability to communicate between businesses will lead to low efficiency. It may take several days to complete the flow of funds and information.
However, with the OpenLedger distributed ledger technology, funds and securities-related ledgers can be recorded uniformly, information can be transmitted in real time, the speed of circulation can be improved, and the efficiency of business can be improved.
In addition, the use of distributed ledger technology can also achieve financial penetrating supervision, and can well identify potential risks in intermediate processes.
Distributed ledgers place the following requirements on technology:
- The first is multi-center, which has multiple organizations participating together, which is different from the traditional centralized model, which is a governance model based on autonomy. In the original centralization, we can only rely on the data of the bookkeeper, and the distributed ledger, due to the participation of different institutions, we need a new governance model to meet the needs of the scene;
- The second is the consensus mechanism. We need to realize that the data can be recognized by multiple parties, that is, to achieve data consensus;
- Finally , there is the account model. Because organizational accounts require people in specific positions to perform operations, we cannot just rely on the point-to-point account model, but also need a three-dimensional account system and a hierarchical structure. These structural characteristics are highly related to blockchain technology, which is why we choose FISCO BCOS as the underlying platform to implement distributed ledgers.
Introduction to OpenLedger Background and Features
We abstract and separate the objects involved in the ledger, which can be divided into the following five categories:
- Individuals , individuals have their own accounts directly in the distributed ledger by opening an account;
- Organization , the employee in the organization does not have his own account, but he comes from an organization and participates in business on behalf of the organization, then the account belongs to the organization he belongs to;
- Accounts , used to record the owner's interests;
- Equity , currently we support two types of equity, namely equity based on changes in account balance and equity based on changes in ownership, the latter itself is similar to a physical asset;
- Ledger , each type of equity corresponds to a ledger, which is very similar to the ledger or ledger that records changes in equity.
Based on the understanding of the above concepts, we can better understand the design ideas of OpenLedger. First of all, our bottom layer uses the FISCO BCOS blockchain platform and uses different open source projects as technical support.
The OpenLedger in the middle mainly consists of core components such as ledgers, accounts, rights and interests, and organizations, as well as the governance system of this distributed ledger, such as contract governance, authority management, etc. We can support different businesses through ledgers.
OpenLedger Design and Planning
Segregation of Duties
There is a division of responsibilities between individuals and organizations. If users need to use distributed ledgers, they can open an account through an organization in the distributed ledgers. The condition for opening an account is that there needs to be a business relationship between the organization that opens the account and the individual. Such an organization Referred to as KYC.
After opening an account, we will have an account on the distributed ledger. The owner of the account may be an organization or a natural person. The organization responsible for helping him open an account is the KYC organization for the account. The KYC organization will record the basic information of the account owner, which is not shared. Currently, our design does not allow other businesses to access and modify user profiles.
double signature
The alliance chain does not directly provide blockchain services to end users, and usually adopts the method of private key custody, that is, the private key is hosted to the enterprise that provides it with business. This design method is equivalent to entrusting the private key to a business party for management and use, and the signature generated by the private key is also initiated by the business party.
Organizations may use your private key to initiate business without permission, and user rights and interests cannot be reflected in the ledger. Therefore, we have designed a double signature mechanism. Users can always keep their private key, and can directly initiate transactions with the private key. After signing, they submit it to a business party. When the business party uses it to access the blockchain, the transaction is performed on the private key. The second signature, which submits the transaction to the blockchain.
The blockchain will verify the signature of the business party, check whether it is a participating organization allowed in the alliance, and then submit the transaction signed by the user to the smart contract, and check it according to the user's signature to see if the initial signature is ours. Accredited User.
Only through such two signatures and two signature verification operations, the corresponding smart contract will be executed. With the help of the double signature mechanism, it can ensure that the user account will not be used by a third party without authorization, and protect the rights and interests of the user chain.
ledger
After accounting, it is often necessary to check accounts. The conditions for checking accounts are very complicated. The data structure of the blockchain generally adopts the Merkle tree structure, and the data in the account may be scattered in the blocks of multiple blockchains. If you need to query data, you may need to call many times to query transaction or block data to finally get the desired data. The whole process is very cumbersome and inefficient.
We use the CRUD precompiled contract of FISCO BCOS to record the history of the entire account change in a two-dimensional table. When we query, the database C-type query conditions can easily obtain the query results, and can be calculated based on the account.
Typical application scenarios of OpenLedger
Securitization of Credit Assets
There are two types of rights, one is capital rights and the other is securities rights.
The borrower needs to give the money to the borrowing bank first, and the borrowing bank transfers the money to the custodian bank. After the custodian bank receives the money, it calculates relevant taxes, principal and interest, etc., and pays the principal and interest to the custodian institution, and the custodian institution pays it to the investor. flow of funds.
The latter is the circulation process of securities. The lending bank packages the loan and sells it to the trust company. The trust company designs the loan into securities, and the securities company is responsible for selling it to investors. This will create the flow of securities.
If the OpenLedger technology is used to process, only two types of interests, capital and securities, need to be designed. These two organizations act as the custodian of the equity account book and maintain the account book.
Other institutions only need to open an account. If the equity is an individual, the individual will directly initiate the transfer transaction. If the equity is an institution, the agency's salesperson will operate the institution's account and initiate the transfer of equity.
Business scenarios with strong demand for separation of duties
As mentioned above, an individual can be the owner of the account, directly maintain his own account, and use the private key to initiate signatures to transfer rights; it can also be an organization that performs transfer operations on behalf of the organization. It may be a fund custodian or a lending bank, which is mainly responsible for transferring the money received from the escrow account to the account of the fund custodian bank in a timely manner.
Investors open an account to conduct business directly with a securities company, so they need to be represented by a securities company. The securities company will maintain the investor's personal information. Personal information cannot be accessed by other organizations in OpenLedger, and business can only be performed through the account.
Once the investor's data is lost, the account cannot be used in the traditional blockchain, but in the OpenLedger distributed ledger, it can reset the private key through the settings of the account system, and the user can still use the original account. And the rights will not be lost.
For more dry goods, please pay attention to the FISCO BCOS open source community public account, visit the FISCO BCOS code repository to download all the source code of the project: https://github.com/FISCO-BCOS/FISCO-BCOS , please click the star collection in the upper right corner of the page , to get the latest version.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。