CN110717825A - Distributed data transaction accounting system based on block chain - Google Patents
Distributed data transaction accounting system based on block chain Download PDFInfo
- Publication number
- CN110717825A CN110717825A CN201810682292.XA CN201810682292A CN110717825A CN 110717825 A CN110717825 A CN 110717825A CN 201810682292 A CN201810682292 A CN 201810682292A CN 110717825 A CN110717825 A CN 110717825A
- Authority
- CN
- China
- Prior art keywords
- transaction
- log
- supplier
- demander
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/12—Accounting
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明属于云计算资源管理领域,涉及分布式数据存储、点对点传输、共识机制技术,具体涉及一种基于区块链的分布式数据交易记账系统。本发明包括:使用前置机容器作为通信工具在各个物理机之间发送接收交易;使用开源的Hyperledger Fabric搭建联盟链;使用java编写Monitor将交易信息写入区块链;使用couchdb数据库进行富查询;使用开源工具fabric‑explorer将区块生成信息可视化的展示出来。本发明解决了传统数据存储的过中心化、缺乏信任,数据在传输过程中可能被修改等问题,实现了一致、防篡改、自动化和高效的账单记录以及账本的保存、智能清算。
The invention belongs to the field of cloud computing resource management, relates to distributed data storage, point-to-point transmission, and consensus mechanism technologies, and in particular relates to a distributed data transaction accounting system based on blockchain. The invention includes: using the front-end container as a communication tool to send and receive transactions between physical machines; using open source Hyperledger Fabric to build a consortium chain; using java to write a Monitor to write transaction information into the blockchain; using couchdb database for rich query ; Use the open source tool fabric‑explorer to visualize the block generation information. The invention solves the problems of over-centralization and lack of trust in traditional data storage, and data may be modified during transmission, and realizes consistent, tamper-proof, automatic and efficient billing records, account book preservation, and intelligent settlement.
Description
技术领域technical field
本发明属于云计算资源管理领域,涉及分布式数据存储、点对点传输、共识机制技术,具体涉及一种基于区块链的分布式数据交易记账系统。The invention belongs to the field of cloud computing resource management, relates to distributed data storage, point-to-point transmission, and consensus mechanism technologies, and in particular relates to a distributed data transaction accounting system based on blockchain.
背景技术Background technique
据资料显示,区块链技术被认为电力、互联网之后,又一个具备颠覆性的核心技术。作为一种构建价值互联网的底层技术,区块链改变的将是价值传递的方式,区块链的出现将解决一个很重要的问题——如何获取未知的信任。According to data, blockchain technology is considered to be another disruptive core technology after electricity and the Internet. As an underlying technology for building the Internet of Value, the blockchain will change the way of value transmission. The emergence of the blockchain will solve a very important problem - how to obtain unknown trust.
区块链技术是基于去中心化的对等网络,用开源软件把密码学原理、时序数据和共识机制相结合,保障分布式数据库中各节点的连贯和持续,使信息能即时验证、可追溯,但难以篡改和无法屏蔽,从而创造了一套隐私、高效、安全的共享价值体系。Blockchain technology is based on a decentralized peer-to-peer network. It uses open source software to combine cryptographic principles, time series data and consensus mechanisms to ensure the coherence and continuity of each node in the distributed database, so that information can be verified and traceable in real time. , but it is difficult to tamper with and cannot be shielded, thus creating a private, efficient and secure shared value system.
传统数据库使用CS(client-server)网络结构,其中,用户可以修改数据,同时,数据库的控制权也在一个中心机构,比如公司或机构,它们对客户端身份验证之后,就会提供对数据库的访问权限;这个中心机构(公司或组织等)负责数据库等管理,是明确的主体,如果黑客对数据感兴趣,一旦机构遭到攻击,安全受到威胁,数据就有可能被改变甚至被删除;另外,机构内具有权限的管理人的风险也同样存在。The traditional database uses the CS (client-server) network structure, in which the user can modify the data, and at the same time, the control of the database is also in a central organization, such as a company or organization, after they authenticate the client, they will provide access to the database. Access rights; this central institution (company or organization, etc.) is responsible for the management of databases, etc., and is a clear subject. If hackers are interested in data, once the institution is attacked and security is threatened, the data may be changed or even deleted; in addition , the risk of managers with authority within the organization also exists.
传统的数据库有明显中心化服务的痕迹;区块链数据库则不同,它由多个分布式去中心化的节点组成,所有节点都参与数据管理,在账本数据库增加任何数据,都得到节点确认,这些账本对于所有节点都是公开和透明的,就像比特币的账本中要增加交易数据,必须取得共识,在节点们确认后才能进入区块,这种共识算法保证了网络的安全,也让它不可篡改;共识的机制除了算力竞争的POW,还是授权证明POS和委托授权证明DPOS等。The traditional database has obvious traces of centralized services; the blockchain database is different. It consists of multiple distributed and decentralized nodes. All nodes participate in data management. Any data added to the ledger database will be confirmed by the nodes. These ledgers are open and transparent to all nodes, just like Bitcoin’s ledger to add transaction data, a consensus must be obtained, and the block can only be entered after the nodes have confirmed it. This consensus algorithm ensures the security of the network and also allows It cannot be tampered with; in addition to the POW of computing power competition, the consensus mechanism is the authorization certificate POS and the delegation authorization certificate DPOS.
传统的数据库中,可以对数据进行创建、读取、修改和删除操作;区块链设计更为简化,把对数据修改和删除操作去掉,用户只能在区块上增加数据,所有进入区块的确认数据将不能更改,也就是它只有读和写的操作:可以从区块链中查询和检索数据,可以写入增加更多的数据到区块链上,无法对数据进行修改和删除操作。In the traditional database, data can be created, read, modified and deleted; the blockchain design is more simplified, and the data modification and deletion operations are removed. Users can only add data to the block, and all enter the block. The confirmation data will not be changed, that is, it has only read and write operations: data can be queried and retrieved from the blockchain, more data can be written to the blockchain, and data cannot be modified or deleted. .
区块链允许交易的确认和写入,一个交易就是改变区块链上数据状态的一个操作,旧的记录永远保持不变,新的纪录则改变过去的数据状态。假如,用法币购买了100个btc,这些都会永久记录在区块链上,某天,用10个比特币购买了一辆汽车,这个交易的数据会记录在区块链上,使用者比特币钱包余额就剩下90个btc;不过,区块链数据库会保存所有的记录,使用者之前拥有100个btc历史也会被永久保留下来,而传统数据库一般都是升级到最终的数据状态。The blockchain allows the confirmation and writing of transactions. A transaction is an operation that changes the state of data on the blockchain. The old record remains unchanged, and the new record changes the past data state. If 100 btc are purchased with fiat currency, these will be permanently recorded on the blockchain. One day, a car is purchased with 10 bitcoins, the data of this transaction will be recorded on the blockchain, and the user bitcoin The wallet balance is left with 90 btc; however, the blockchain database will save all records, and the user's previous 100 btc history will also be permanently retained, while traditional databases are generally upgraded to the final data state.
传统的数据库一般都是私密的,但是区块链数据公开可验证,保证完整和透明,用户可以确认自己检索的和查阅的区块链数据是完整的,没有被篡改的,而传统数据库则很难保证。Traditional databases are generally private, but blockchain data is open and verifiable to ensure completeness and transparency. Users can confirm that the blockchain data retrieved and consulted by themselves is complete and has not been tampered with, while traditional databases are very Hard to guarantee.
Hyperledger(中文名为超级账本)是Linux基金会于2015年发起的推进区块链数字技术和交易验证验证的开源项目,Hyperledger的目标是让成员共同合作、共建开放平台以满足来自多个不同行业各种用户的需求,同时能大大简化业务流程;Hyperledger的创始成员有IBM、Intel、思科等大公司。Hyperledger (Chinese name Hyperledger) is an open source project launched by the Linux Foundation in 2015 to promote blockchain digital technology and transaction verification. The goal of Hyperledger is to allow members to cooperate and build an open platform to meet the needs of multiple The needs of various users in the industry, while greatly simplifying business processes; Hyperledger's founding members include IBM, Intel, Cisco and other large companies.
Hyperledger是对传统区块链模型的革新,Hyperledger通过提供一个模型,这种模型在某种程度上允许创建授权和非授权的区块链,除此之外,Hyperledger通过一个提供针对身份识别、可审计及隐私的安全和健壮模型,使得缩短计算周期、提高规模效率和响应各个行业的应用需求成为可能。Hyperledger is an innovation to the traditional blockchain model. Hyperledger provides a model that allows the creation of authorized and non-authorized blockchains to a certain extent. In addition, Hyperledger provides an A secure and robust model for auditing and privacy makes it possible to shorten computing cycles, increase efficiency at scale, and respond to application needs across industries.
Hyperledger Fabric是Hyperledger的核心项目,甚至在一些场合当提到Hyperledger的时候一般会认为就是指Fabric,这其实是误解,但是也从侧面反映Hyperledger Fabric在Hyperledger中占据的地位。Hyperledger Fabric本质上是一个分布式共享账本,Hyperledger Fabric的目标是成为开发应用和解决方案的基础,在设计上它采用模块化架构,模块化架构的优点是组件可以根据需要灵活配置,可以做到插入即用;Hyperledger Fabric最初由IBM开发,目前由整个Linux基金会共同维护。Hyperledger Fabric is the core project of Hyperledger. Even in some occasions, when Hyperledger is mentioned, it is generally considered to refer to Fabric. This is actually a misunderstanding, but it also reflects the position of Hyperledger Fabric in Hyperledger from the side. Hyperledger Fabric is essentially a distributed shared ledger. The goal of Hyperledger Fabric is to become the basis for developing applications and solutions. In design, it adopts a modular architecture. The advantage of the modular architecture is that components can be flexibly configured as needed, which can be achieved Plug and play; Hyperledger Fabric was originally developed by IBM and is currently maintained by the entire Linux Foundation.
Hyperledger Explorer是一个用来对区块链进行配置管理、区块和交易数据查询、节点管理的工具,通过Hyperledger Explorer可以查看区块链内部的信息,比如:账本数、区块数、交易数等数据;同时Hyperledger Explorer还可以对区块链进行管理,比如执行部署智能合约、更新智能合约等常用操作;Hyperledger Explorer的愿景是支持Hyperledger下面的所有区块链产品,目前Hyperledger Explorer只支持Fabric,未来将逐步支持更多的区块链实现。Hyperledger Explorer is a tool for configuration management, block and transaction data query, and node management of the blockchain. Through Hyperledger Explorer, you can view the internal information of the blockchain, such as: the number of ledgers, the number of blocks, the number of transactions, etc. At the same time, Hyperledger Explorer can also manage the blockchain, such as performing common operations such as deploying smart contracts and updating smart contracts; the vision of Hyperledger Explorer is to support all blockchain products under Hyperledger. Currently, Hyperledger Explorer only supports Fabric, and in the future More blockchain implementations will be gradually supported.
基于现有技术的现状,本申请的发明人拟提供一种基于区块链的分布式数据交易记账系统,本发明中,使用Hyperledger Fabric搭建分布式数据交易平台,使用Hyperledger Explorer可视化的展示各种参数。Based on the current state of the art, the inventor of the present application intends to provide a distributed data transaction accounting system based on blockchain. In the present invention, Hyperledger Fabric is used to build a distributed data transaction platform, and Hyperledger Explorer is used to visually display various kind of parameters.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于基于现有技术的现状,提供一种基于区块链的分布式数据交易记账系统,本发明中,使用Hyperledger Fabric搭建分布式数据交易平台,使用Hyperledger Explorer可视化的展示各种参数。The purpose of the present invention is to provide a blockchain-based distributed data transaction accounting system based on the current state of the art. In the present invention, Hyperledger Fabric is used to build a distributed data transaction platform, and Hyperledger Explorer is used to visually display various parameter.
本发明中涉及分布式数据存储、点对点传输、共识机制技术,本发明的基于区块链的分布式数据交易记账系统包括:使用前置机容器作为通信工具在各个物理机之间发送接收交易;使用开源的Hyperledger Fabric搭建联盟链;使用java编写Monitor将交易信息写入区块链;使用couchdb数据库进行富查询;使用开源工具fabric-explorer将区块生成信息可视化的展示出来。The present invention relates to distributed data storage, point-to-point transmission, and consensus mechanism technologies. The blockchain-based distributed data transaction accounting system of the present invention includes: using a front-end container as a communication tool to send and receive transactions between physical machines ; Use the open source Hyperledger Fabric to build a consortium chain; use java to write Monitor to write transaction information into the blockchain; use the couchdb database for rich queries; use the open source tool fabric-explorer to visualize the block generation information.
具体的,本发明的基于区块链的分布式数据交易记账系统,是基于区块链的数据交易记账平台,在这个平台上,以前置机容器为中介,在供需双方之间发送请求;使用基于区块链的Hyperledger Fabric搭建的平台,可以分布式存储供需方之间的交易日志,并且能实时可视化的展示出区块的生成速率、交易信息写入区块链的速率。其包括:Specifically, the blockchain-based distributed data transaction accounting system of the present invention is a blockchain-based data transaction accounting platform. On this platform, the front-end container is used as an intermediary to send requests between supply and demand parties. ; The platform built by the blockchain-based Hyperledger Fabric can store transaction logs between supply and demand parties in a distributed manner, and can visualize the generation rate of blocks and the rate at which transaction information is written to the blockchain in real time. It includes:
(1)前置机收发交易:(1) Front-end sending and receiving transactions:
供方和需方的前置机都有sender。在供方将数据传输给需方后,供方的sender将交易信息写入日志文件,并将其发送到交易中心的服务器上,在需方接收到数据后,需方的sender将交易信息写入日志文件,并发送到交易中心的服务器上;Both the supply-side and demand-side front-end computers have senders. After the supplier transmits the data to the buyer, the sender of the supplier writes the transaction information into the log file and sends it to the server of the trading center. After the buyer receives the data, the sender of the buyer writes the transaction information to the log file. into the log file and send it to the server of the trading center;
交易中心将计算和分析每天的日志,并且产生账单,如果需方的日志和供方的日志在同一笔订单上出现了不同,交易中心将会以需方的日志为准;The trading center will calculate and analyze the daily logs, and generate bills. If the demander's log and the supplier's log are different in the same order, the trading center will take the demander's log as the standard;
由于供方和需方的本地日志可能会被篡改,如果被篡改的日志被用来做共识,获得的结果可能是不准确的;对于交易中心来说,最值得信任的方式是将sender发送的日志直接写入区块链中;Since the local logs of the supplier and the demander may be tampered with, if the tampered logs are used for consensus, the result may be inaccurate; for the trading center, the most trustworthy way is to send the sender The log is directly written to the blockchain;
(2)支持区块链的数据交易原型系统(2) Data transaction prototype system supporting blockchain
本发明使用Hyperledger fabric的1.0版本为数据交易平台构建区块链系统,交易中心,供方和需方需要解决通过区块链的chaincode自动保存一个没有欺骗的,一致的分布式账本的问题,并且系统中的参与方的互不信任;.The present invention uses the 1.0 version of Hyperledger fabric to build a blockchain system for the data trading platform, the trading center, the supplier and the demander need to solve the problem of automatically saving a non-spoofed, consistent distributed ledger through the chaincode of the blockchain, and Mutual distrust of the participants in the system; .
本发明中在支付交易记录中使用区块链的智能合约技术进行分布式处理和分布式存储,这是交易中心最近在区块链领域中最优先考虑的问题;这使得各方可以在自己的服务器中存储相同的完整的交易信息,以确保公平地解决争议,简化流程并节省资源。In the present invention, the smart contract technology of the blockchain is used in the payment transaction record for distributed processing and distributed storage, which is the most priority given by the transaction center in the blockchain field recently; The same complete transaction information is stored on the server to ensure fair dispute resolution, streamlining processes and saving resources.
本发明中,使用智能合约和共识策略检查数据供应方和数据需求方的日志,以达成一致.能弥补目前的交易中心系统只使用需求方的日志的缺陷,(共识,半中心化)交易中心的区块链节点使用智能合约检查数据供应商的日志和数据需求者的日志,然后将其传送到交易中心,然后将公共部分写入区块链,测试添加共识后的处理性能是否符合商业要求。In the present invention, smart contracts and consensus strategies are used to check the logs of the data supplier and the data demander to reach an agreement. It can make up for the defect that the current trading center system only uses the logs of the demander, and the (consensus, semi-centralized) trading center The blockchain nodes use smart contracts to check the data supplier's log and the data demander's log, then transmit it to the transaction center, and then write the public part to the blockchain to test whether the processing performance after adding consensus meets business requirements .
更具体的,本发明的基于区块链的分布式数据交易记账系统,其特征在于,该系统为基于区块链的数据交易记账平台,该平台中,以前置机容器为通信中介,在供需双方之间发送请求,其中,分布式存储供需方之间的交易日志,能实时可视化的展示出区块的生成速率、交易信息写入区块链的速率;其包括:More specifically, the blockchain-based distributed data transaction accounting system of the present invention is characterized in that the system is a blockchain-based data transaction accounting platform, in which the front-end container is used as a communication intermediary, A request is sent between the supply and demand sides, wherein the transaction logs between the supply and demand sides are distributed and stored, which can visualize the generation rate of blocks and the rate at which transaction information is written into the blockchain in real time; it includes:
(1)交易中心、供方、需方三者的关系(1) The relationship between the trading center, the supplier and the demander
供方和需方的前置机有sender;在供方将数据传输给需方后,供方的sender将交易信息写入日志文件,并将其发送到交易中心的服务器上;在需方接收到数据后,需方的sender将交易信息写入日志文件,将其发送到交易中心的服务器上;The front-end machines of the supplier and the buyer have senders; after the supplier transmits the data to the buyer, the sender of the supplier writes the transaction information to the log file and sends it to the server of the trading center; After the data is received, the sender of the buyer writes the transaction information into the log file and sends it to the server of the transaction center;
交易中心(System Data Exchange Center,SDEC)计算和分析每天的日志,并且产生账单,如果需方的日志和供方的日志在同一笔订单上出现了不同,交易中心以需方的日志为准。The trading center (System Data Exchange Center, SDEC) calculates and analyzes the daily logs, and generates bills. If the log of the demander and the log of the supplier appear different in the same order, the trading center shall take the log of the demander as the standard.
(2)供需方monitor处理交易(2) Supply and demand side monitors process transactions
供需双方前置机中置有特定的脚本将所有交易日志发送到交易中心对应的目录下;There is a specific script in the front-end machine of the supply and demand sides to send all transaction logs to the corresponding directory of the trading center;
交易中心服务器上有redis读取需方发送过来的日志,该redis称为需方Monitor;There is redis on the transaction center server to read the logs sent by the demander, and the redis is called the demander Monitor;
交易中心服务器上还有用java写的称为ledger的供方monitor;There is also a supplier monitor called ledger written in java on the trading center server;
(3)fabric-explorer可视化展示(3) fabric-explorer visual display
在进行数据交易的同时,平台给每个channel启动一个fabric-explorer,即一个web页面,每个web页面能可视化的显示生成区块数、交易的exid及其生成速率;While conducting data transactions, the platform starts a fabric-explorer for each channel, that is, a web page, each web page can visually display the number of blocks generated, the exid of the transaction and its generation rate;
(4)支持区块链的数据交易原型系统(4) Data transaction prototype system supporting blockchain
使用Hyperledger fabric的1.0版本为数据交易平台构建区块链系统;交易中心、供方和需方共同构成所述的分布式数据交易系统。Use the 1.0 version of Hyperledger fabric to build a blockchain system for the data trading platform; the trading center, the supplier and the demander together constitute the described distributed data trading system.
本发明中,所述的供方monitorr负责比对供需方日志,读取供方日志与redis中的需方日志后再将其进行比对,将一样的日志写入区块链,比对失败的日志加入fail数组;In the present invention, the supply side monitorr is responsible for comparing the supply and demand side logs, reads the supply side logs and the demand side logs in redis and then compares them, writes the same logs into the blockchain, and the comparison fails The log is added to the fail array;
比对的成功与失败的信息输出在nohup.out文件中。The information on the success and failure of the comparison is output in the nohup.out file.
本发明中,所述的交易中心、供方和需方共同构成的分布式数据交易系统,采用双供方三需方模式,交易中心加入每一个通道,同时交易中心也作为orderer节点负责打包交易并生成区块;In the present invention, the distributed data trading system composed of the trading center, the supplier and the demander adopts the mode of two suppliers and three demanders. The trading center joins each channel, and the trading center is also responsible for packaging transactions as an orderer node. and generate blocks;
本发明中,在支付交易记录中使用区块链的智能合约技术进行分布式处理和分布式存储,使各方可在自己的服务器中存储相同的完整的交易信息,以确保公平地解决争议,简化流程并节省资源;交易中心的区块链节点使用智能合约检查数据供应商的日志和数据需求者的日志,然后将其传送至交易中心,将公共部分写入区块链。In the present invention, the smart contract technology of blockchain is used for distributed processing and distributed storage in payment transaction records, so that all parties can store the same complete transaction information in their own servers to ensure a fair resolution of disputes, Simplifies the process and saves resources; the blockchain nodes of the trading center use smart contracts to check the logs of data suppliers and data demanders, and then transmit them to the trading center to write the public part to the blockchain.
本发明中,交易从供需方前置机发送至SDEC采用“推”策略,通过编写shell脚本实现每0.5秒发送一次,即将前置集中/dep/go/log/busilog中的日志文件发送至SDEC中的/home/ubuntu/sender/busilog目录下,日志文件格式为busi.log.succ.xxxxxx,日志文件每天生成一次。In the present invention, the transaction is sent from the front-end machine on the supply and demand side to the SDEC using the "push" strategy, and the transaction is sent every 0.5 seconds by writing a shell script, that is, the log file in the front-end centralized /dep/go/log/busilog is sent to the SDEC In the /home/ubuntu/sender/busilog directory, the log file format is busi.log.succ.xxxxxx, and the log file is generated once a day.
本发明中,所述系统中智能合约(chaincode)支持多种交易数据查询方式,包括根据交易号exid查询交易外,以及根据时间段来查询,即查询某一时间段内的日志;还支持范围查询,即查询某一段交易号范围内的所有日志;还支持富查询,即根据别的交易参数查询交易日志,交易的存储格式有字段:date,time,supplierID,demanderID,taskID和exID,富查询可通过所述字段中的一个查询交易日志。In the present invention, the smart contract (chaincode) in the system supports a variety of transaction data query methods, including querying transactions according to the transaction number exid, and querying according to time periods, that is, querying logs within a certain time period; Query, that is, query all logs within a certain range of transaction numbers; it also supports rich query, that is, query transaction logs according to other transaction parameters, the transaction storage format has fields: date, time, supplierID, demanderID, taskID and exID, rich query The transaction log can be queried through one of the fields.
本发明中,所述系统中建channel和交易日志写入账本分别写在两个函数里,即channel_fat.jar和ledger_fat.jar,其中包括:开始启动各节点容器后,通过运行java-jar channel_fat.jar建立channel,建立成功后,分别启动供方monitor和需方monitor(即redis),待有日志发送过来时便开始工作,需方monitor负责将需方日志导入redis,供方monitor负责将比对供方和redis中的日志,最后将比对成功的日志写入区块链。In the present invention, the channel built in the system and the transaction log written into the ledger are written in two functions, namely channel_fat.jar and ledger_fat.jar, which include: after starting each node container, by running java-jar channel_fat. The jar establishes a channel. After the establishment is successful, the supplier monitor and the demander monitor (ie redis) are started respectively, and the work starts when the log is sent. The demander monitor is responsible for importing the demander log into redis, and the supplier monitor is responsible for comparing Logs in the supplier and redis, and finally write the successful log to the blockchain.
本发明提供了一种基于区块链的分布式数据交易记账系统,在支付交易记录中使用区块链的智能合约技术进行分布式处理和分布式存储,使得各方可以在自己的服务器中存储相同的完整的交易信息,以确保公平地解决争议,简化流程并节省资源;使用智能合约和共识策略检查数据供应方和数据需求方的日志,以达成一致.能弥补目前的交易中心系统只使用需求方的日志的缺陷。The present invention provides a blockchain-based distributed data transaction accounting system. In payment transaction records, the smart contract technology of the blockchain is used for distributed processing and distributed storage, so that all parties can use their own servers to perform distributed processing and storage. Store the same complete transaction information to ensure fair dispute resolution, simplify the process and save resources; use smart contracts and consensus strategies to check the logs of the data supplier and data demander to reach an agreement. Can make up for the current transaction center system only Defects in using demand-side logs.
本发明的优点有:能解决传统数据存储的过中心化、缺乏信任,数据在传输过程中可能被修改等问题,实现一致、防篡改、自动化和高效的账单记录以及账本的保存、智能清算。The advantages of the invention are as follows: it can solve the problems of over-centralization and lack of trust in traditional data storage, and the data may be modified during the transmission process, and realize consistent, tamper-proof, automatic and efficient billing records, account book preservation, and intelligent settlement.
下面结合附图和实施例详细描述本发明的技术方案。The technical solutions of the present invention will be described in detail below with reference to the accompanying drawings and embodiments.
附图说明Description of drawings
图1是第一阶段系统设计的架构图。Figure 1 is the architecture diagram of the first stage system design.
图2显示了背书策略。Figure 2 shows the endorsement strategy.
图3显示了供需双方生成日志信息的伪代码。Figure 3 shows the pseudocode for the generation of log messages between the supply and demand sides.
图4是第二阶段的系统架构图。Figure 4 is a system architecture diagram of the second stage.
具体实施方式Detailed ways
实施例1Example 1
第一阶段系统的设计,图1是第一阶段系统设计的架构图,The design of the first stage system, Figure 1 is the architecture diagram of the first stage system design,
(1)总体架构(1) Overall structure
来自发件人的交易记录绝对是防篡改的,SDEC希望将需求者的日志加载到区块链中,由于需求方是付款方,SDEC根据实际收到的数据需求收费是合理的,所以在第一步中,可以直接将需求者的日志载入区块链,并测试写入区块链的性能,如果性能能够满足实际业务环境的需求,SDEC将从实验室环境改善为商业环境,并实现路径利用;The transaction record from the sender is absolutely tamper-proof. SDEC hopes to load the log of the demander into the blockchain. Since the demander is the payer, it is reasonable for SDEC to charge according to the actual received data demand, so in the first In one step, the user's log can be directly loaded into the blockchain, and the performance of writing to the blockchain can be tested. If the performance can meet the needs of the actual business environment, SDEC will improve from a laboratory environment to a business environment, and realize path utilization;
在此需要重写日志监控程序,The log monitor program needs to be rewritten here,
为了合并和处理exid,发送之前的单个数据计划达到两个条件:1.已经有10个exids2.超时设置,对于第二种情况,可能难以为每个单独的数据设置一个计时器并对其进行监视,另外,由于数据不需要很强的时效性,所以处理后的数据的发送时间可以稍微延迟一些,之后,采取以下策略:In order to merge and process exids, a single data plan before sending meets two conditions: 1. There are already 10
按照固定的时间间隔(暂定为1s),读取日志文件并统一处理此期间的所有日志(升级功能),当具有相同taskid的数据包含10个exid数据时,它将创建一个新数据(一个用于保存数据的二维数组),当这段时间的日志被完全处理后,二维数组被发送到上传函数,该函数将通过java sdk将这些数据一个接一个地发送给需求者;According to a fixed time interval (tentatively set to 1s), read the log file and process all logs during this period uniformly (upgrade function), when the data with the same taskid contains 10 exid data, it will create a new data (one A two-dimensional array for saving data), when the logs of this period are completely processed, the two-dimensional array is sent to the upload function, which will send these data to the requester one by one through the java sdk;
在第一个原型的材料中共享的业务日志的日志格式中,只将所需的字段写入区块链,包括日期,时间,supplierID,demanderID,taskID和exID。除exID外,其他字段的值是相同的,通过将exID的多个项目合并到一个区块链交易记录中缩短区块链的存储,满足面料的性能;In the log format of the business log shared in the materials of the first prototype, only the required fields are written to the blockchain, including date, time, supplierID, demanderID, taskID and exID. Except for exID, the values of other fields are the same. By merging multiple items of exID into one blockchain transaction record, the storage of the blockchain is shortened to meet the performance of the fabric;
测试合并数(10,50,1000,10000等)是否会影响系统的性能:Test if the number of merges (10, 50, 1000, 10000, etc.) affects the performance of the system:
背书策略(如图2所示):Endorsement strategy (as shown in Figure 2):
背书在SDEC服务器中完成,因此背书人始终是加入该通道的SDEC组织的节点;The endorsement is done in the SDEC server, so the endorser is always the node of the SDEC organization joining the channel;
Sender:Sender:
该程序主要用于组织间的日志传输,日志通常由供需双方发送给SDEC或者背书节点,并根据需求添加一定的过滤条件,以保证信息的安全,有必要声明,在实际使用中,这部分功能将由SDEC方完成,本实施例中只能达到基本功能要求,而不是最佳性能;This program is mainly used for log transmission between organizations. Logs are usually sent to SDEC or endorsement nodes by both supply and demand parties, and certain filtering conditions are added according to requirements to ensure the security of information. It is necessary to declare that in actual use, this part of the function It will be completed by the SDEC side, and in this embodiment, only basic functional requirements can be achieved, not optimal performance;
该程序存储在“发件人”文件夹中,只存在于“SDEC”机器中,路径为/home/ubuntu/sender,该文件夹包含:FileReaders.jar(函数实现),LogSender23X.properties(配置文件,包括时间间隔,读取文件路径和其他参数),nohup.out(错误输出),restart23X.sh(重新启动发件人进程),blockchain。pem(密钥文件)和busilog文件夹(存储接收到的日志),shutall.sh(关闭所有发件人);The program is stored in the "sender" folder, only exists in the "SDEC" machine, the path is /home/ubuntu/sender, the folder contains: FileReaders.jar (function implementation), LogSender23X.properties (configuration file , including time interval, read file path and other parameters), nohup.out (error output), restart23X.sh (restart sender process), blockchain. pem (key file) and busilog folder (stores received logs), shutdown.sh (closes all senders);
运行命令:sh retart23X.sh启动进程,其中包括实施细节:Run the command: sh retart23X.sh to start the process, which includes the implementation details:
使用拉策略:由于当前模型相对简单,使用SDEC远程连接到需求者的主机,提取日志并写入本地,使用ssh连接,使用密钥文件(blockchain.pem)登录登录表单,此方法需要打开目标主机的日志文件的权限,这是非常不安全的,它只在测试环境中使用,不管这个因素如何,pull策略都可以只在SDEC而不是per-demander上部署发送者;Use pull strategy: Since the current model is relatively simple, use SDEC to remotely connect to the demander's host, extract logs and write locally, use ssh to connect, use the key file (blockchain.pem) to log in to the login form, this method requires opening the target host Permissions on the log file, which is very insecure, it is only used in test environments, regardless of this factor, the pull policy can deploy the sender only on SDEC and not per-demander;
跟踪日志文件:日志文件存储在SDEC中,统一在busilog目录中,不同的memid将有不同的子目录,日志文件名与原文相同,并且由于需求者的日志文件名称每天都在更改,因此发件人需要跟踪文件名以准确读取所需的日志;Tracking log files: The log files are stored in SDEC and are unified in the busilog directory. Different memids will have different subdirectories. The log file name is the same as the original one. Since the log file name of the requester changes every day, it is sent One needs to keep track of filenames to read exactly the logs needed;
读写文件:由于拥有更改需求者日志文件的权限,本发明使用更简单的读写策略:在读取时删除,追加写入,在实验环境中,确定需要的日志在后续步骤中不存在(但不在实际应用中),所以在读取的同时,删除读取的内容,并且简化读写信息,在写入文件中,即使有多个发送者进程在运行,根据不同的memid的写入目录也会不同,所以不需要考虑写入冲突;Read and write files: Due to the authority to change the log file of the demander, the present invention uses a simpler read and write strategy: delete when reading, and write additionally. In the experimental environment, it is determined that the required log does not exist in the subsequent steps ( But not in practical applications), so while reading, delete the read content, and simplify the read and write information, in the write file, even if there are multiple sender processes running, according to the different memid write directory will also be different, so there is no need to consider write conflicts;
参数配置:不同的发送者进程,参数配置会有所不同,同时也为了方便后续的更改,提取参数中可能发生的变化次数,并写入属性配置文件中;Parameter configuration: The parameter configuration will be different for different sender processes. At the same time, in order to facilitate subsequent changes, the number of possible changes in the parameters is extracted and written into the attribute configuration file;
(5)需方日志monitor:(5) Demander log monitor:
该程序主要监视日志,根据一些关键字进行处理,并将伪数据实时输出到javaSDK程序中,在数据查询过程中,如果需求者数据库的前端没有相应的缓存,它会向供应商机前端请求并获取数据,供需双方都会生成日志信息,在当前环境下,本发明需要将成功日志中的exid上传到区块链,其中的伪代码如图3所示;This program mainly monitors the logs, processes them according to some keywords, and outputs the pseudo data to the javaSDK program in real time. During the data query process, if the front end of the demander database does not have a corresponding cache, it will request and obtain the front end of the supplier opportunity. Data, both the supply and demand sides will generate log information. In the current environment, the present invention needs to upload the exid in the successful log to the blockchain, and the pseudocode is shown in Figure 3;
该程序存储在monitor文件夹中,供应商路径为:/home/e_dep/monitor,需求者路径为:/opt/project/monitor;该文件夹包含四个文件:LogMonitor.jar(函数实现),LogMonitor.properties(配置文件,包括时间间隔,输入路径和其他参数),nohup.out(错误输出),restart.sh(重新启动监视进程);The program is stored in the monitor folder, the supplier path is: /home/e_dep/monitor, and the demander path is: /opt/project/monitor; the folder contains four files: LogMonitor.jar (function implementation), LogMonitor .properties (configuration file, including time interval, input path and other parameters), nohup.out (error output), restart.sh (restart the monitoring process);
(6)功能需求分析及其实现:(6) Functional requirements analysis and its realization:
实时输出:本发明的交易平台统计结果需要实时输出,默认时间间隔为1分钟,该程序使用伪实时输出简化程序并提高性能;实现:当进程启动时,设置延迟参数:delay1,用于在一分钟内保持线程创建时间,然后每隔1分钟(可配置,但必须是60的除数)创建一个统计线程,提取前一分钟内的所有日志信息以进行统计,由于每分钟生成的日志数量不同,因此每次统计中的时间成本都不相同,但输出统计结果的时间戳将基于线程创建时间;Real-time output: The statistical results of the trading platform of the present invention require real-time output, and the default time interval is 1 minute. The program uses pseudo-real-time output to simplify the program and improve performance; implementation: when the process starts, set the delay parameter: delay1, which is used for a Keep the thread creation time within minutes, and then create a statistics thread every 1 minute (configurable, but must be a divisor of 60), extract all log information in the previous minute for statistics, due to the different number of logs generated per minute, Therefore, the time cost in each statistic is different, but the timestamp of the output statistic result will be based on the thread creation time;
日志读取:将数据传输存储在busilog文件夹中时生成的日志文件以及基于日期每天生成的两个文件,例如:busi.log.succ.20170810和busi.log.err.20170810,(在当今的用例中,它不需要监视和查出失败文件);当进程启动时,设置延迟参数:delay2,以保持每天24点钟跟踪日志文件的线程的创建,然后每24小时创建一个跟踪线程,如果找到满意的日志文件,更新参数rafsucc和raferr(统计线程监听对象),更改收听对象时可能会出现数据丢失的问题,在上述的策略中,应注意统计线程必须在一分钟内创建,并且24点钟创建的统计线程(注意线程A)的对象仍应该是原始对象,因此跟踪线程只需要完成在创建下一个统计线程之前替换监视对象,所以延迟参数可以增加几秒(例如设置为30秒),但是由于统计过程中的线程A占用参数rafsucc,如果在统计完成之前运行跟踪线程,将导致数据丢失,所以除了增加延迟参数外,为了有效避免数据丢失问题,需要提高统计线程的性能,并尽量避免在当时进行交易;Log reading: log file generated when data transfer is stored in busilog folder and two files generated daily based on date, for example: busi.log.succ.20170810 and busi.log.err.20170810, (in today's use case, it does not need to monitor and find out failure files); when the process starts, set the delay parameter: delay2 to keep the creation of the thread that traces the
提取必要的数据:由于加载到链中的流量限制,无法容忍具有大量exid的单个加载链,本发明将团队带入连锁战略,设置一个组参数(batchNum),暂定为50,即每个组包含50个exids,分组基于taskid。处理日志时,将其taskid和exid与当前组相比较,如果taskid匹配,则exid小于50,然后加入exid;或者创建一个新组,保存demanderID,supplierID,taskid,exid等信息,所以,单个团队进入连锁店,相当于50人进入连锁店,效率提高50倍;此外,该程序还需要一些容错功能,考虑到可能有一些日志读取不完整,例如,因为统计线程每分钟创建一次,并且此时获得的长度可能不是日志长度的约数,“最后一个”日志可能不会完整,事实上,在实际操作中,常出现每次交易后的最后一个日志并不总是完整的,为此,在不失一般性的情况下,本发明将日志保存到下一个要读取的统计线程,这意味着指针将回来,另外,如果日志写入错误,应该有适当的措施丢弃无效日志并继续读取后续的有效日志;Extract the necessary data: Due to the limitation of the flow loaded into the chain, a single load chain with a large number of exids cannot be tolerated, the present invention brings the team into the chain strategy, and sets a group parameter (batchNum), tentatively set to 50, that is, each group Contains 50 exids, grouped based on taskid. When processing the log, compare its taskid and exid with the current group, if the taskid matches, the exid is less than 50, and then join the exid; or create a new group, save the demanderID, supplierID, taskid, exid and other information, so a single team enters A chain store, equivalent to 50 people entering a chain store, is 50 times more efficient; in addition, the program also needs some fault tolerance, considering that there may be some log reads that are incomplete, for example, because the statistics thread is created every minute, and the obtained at this time The length may not be a divisor of the log length, and the "last" log may not be complete. In fact, in practice, it often occurs that the last log after each transaction is not always complete. In general, the present invention saves the log to the next statistical thread to be read, which means that the pointer will come back. In addition, if the log is written incorrectly, there should be appropriate measures to discard the invalid log and continue to read the subsequent ones. valid log;
参数可以配置:实际上,由于操作环境的不同,程序的参数需要做适当的修改,考虑不同的操作环境,本发明将以下参数设置为可配置的,包括:时间间隔(可以是除数60),日志目录路径,二维字符串数组str的大小(默认值为100),组参数(batchNum,defualt是50),配置文件被命名为LogMonitor.properties;Parameters can be configured: In fact, due to different operating environments, the parameters of the program need to be appropriately modified. Considering different operating environments, the present invention sets the following parameters as configurable, including: time interval (which can be a divisor of 60), The log directory path, the size of the two-dimensional string array str (the default value is 100), the group parameters (batchNum, default is 50), and the configuration file is named LogMonitor.properties;
(7)Chaincode调用和查询(7) Chaincode call and query
以下将介绍链接代码调用和查询阶段1的相关功能,The following will introduce the relevant functions of the link code call and query
调用chaincode和完成这些函数的过程如下所示:首先,程序调用java sdk将参数传递给chaincode,所有参数将传递给一个名为Invoke的函数,然后,这个Invoke函数会根据参数调用其他函数完成相应的功能,而这个chaincode提供了不同的查询方式,The process of calling chaincode and completing these functions is as follows: First, the program calls java sdk to pass parameters to chaincode, all parameters will be passed to a function named Invoke, then this Invoke function will call other functions according to the parameters to complete the corresponding function, and this chaincode provides different query methods,
下表列出了函数名称及其功能:The following table lists the function names and their functions:
具体实施程序如下:The specific implementation procedures are as follows:
载入数据load data
函数1.链码载入数据函数
输入:汇总的交易信息包括时间,需方ID,供方ID,工作ID,计数和exid数组Input: Aggregated transaction information including time, buyer ID, supplier ID, job ID, count and exid array
输出:无output: none
/*步骤1:从输入读取exid数组*//* Step 1: Read exid array from input */
Exid数组←输入参数Exid array ← input parameter
/*步骤2:将exid数组和必要的数据写入区块链*//* Step 2: Write the exid array and necessary data to the blockchain */
storeExidArrayToBlockchain(时间,需方ID,供方ID,工作ID,计数,exid数组)storeExidArrayToBlockchain(time, demander ID, supplier ID, job ID, count, exid array)
return Nonereturn None
loadData的功能是将exid数组存储到区块链中。首先,loadData函数从java sdk接收参数,其中包括时间,需方ID,供方ID,工作ID,交易数和exid数组。然后,调用函数storeExidArrayToBlockchain将所有必要的信息存储到区块链中。The function of loadData is to store the exid array into the blockchain. First, loadData function receives parameters from java sdk, which includes time, demander ID, supplier ID, job ID, number of transactions and an array of exid. Then, call the function storeExidArrayToBlockchain to store all the necessary information into the blockchain.
查询数据Query data
函数2.链码查询数据函数
输入:exid数组包含用户想要检查是否写入区块链的所有exidInput: The exid array contains all the exids that the user wants to check if written to the blockchain
输出:汇总的交易信息包括时间,需方ID,供方ID,工作ID,计数和exid数组Output: Aggregated transaction information including time, buyer ID, supplier ID, job ID, count and exid array
queryData的功能是查询区块链中是否存在exid。起初,这个函数接收java sdk想要查询的exid数组。然后,遍历该数组,根据exid构造查询字符串,发送查询字符串并获取查询结果。查询结果包括time,demanderid,supplierid,taskked,count和exid数组。最后,汇总所有查询结果并返回。The function of queryData is to query whether the exid exists in the blockchain. At first, this function receives an array of exids that the java sdk wants to query. Then, traverse the array, construct a query string based on exid, send the query string and get the query result. The query result includes an array of time, demanderid, supplierid, taskked, count and exid. Finally, all query results are aggregated and returned.
c.范围查询数据c. Range query data
queryDataByRange的功能是查询时间段内存在于区块链中的所有exid信息,并返回exid的总数。该函数接收三个参数,开始时间,结束时间和taskid。然后,根据这三个参数构造查询字符串并在区块链中查询。然后,遍历查询结果,从查询字符串中获取count参数并添加所有计数。最后,返回exid的总数。The function of queryDataByRange is to query all exid information in the blockchain in the time period and return the total number of exid. The function receives three parameters, start time, end time and taskid. Then, a query string is constructed based on these three parameters and queried in the blockchain. Then, iterate through the query results, get the count parameter from the query string and add all counts. Finally, return the total number of exids.
2、第二阶段的系统设计2. System design of the second stage
(1)整体架构(1) Overall structure
背书节点的chaincode容器将遍历exID数组,The chaincode container of the endorsing node will traverse the exID array,
对于每个exID,chaincode将搜索它是否存在于nosql中,由于搜索需求者日志文件的性能很差,本发明使用关键值数据库来提高性能,如果exID存在,chaincode会将其添加到成功数组中,如果exID不存在,chaincode将在稍后再次检查,如果exID仍然不存在,chaincode会将其添加到失败数组中,最后,chaincode会将包含成功数组的事务写入区块链,并将失败数组返回给供方monitor;图4是第二阶段的系统架构图;For each exID, chaincode will search if it exists in nosql, since the performance of searching the requester's log file is poor, the present invention uses a key value database to improve performance, if the exID exists, chaincode will add it to the success array, If the exID does not exist, the chaincode will check again later, if the exID still does not exist, the chaincode will add it to the failure array, and finally, the chaincode will write the transaction containing the success array to the blockchain and return the failure array To the supplier monitor; Figure 4 is the system architecture diagram of the second stage;
(2)背书策略(2) Endorsement strategy
背书是在SDEC服务器中完成,因此背书者始终是加入该通道的SDEC组织的节点,Chaincode的背书策略文件与第一阶段的相同(如图2所示);The endorsement is done in the SDEC server, so the endorser is always the node of the SDEC organization that joins the channel, and the endorsement policy file of Chaincode is the same as that of the first stage (as shown in Figure 2);
(3)Sender和log monitors(3) Sender and log monitors
第二阶段的sender与第一阶段的一样,The sender of the second stage is the same as the first stage,
Stage2的供方Monitor与第一阶段的需方monitor相同,并在第一阶段的基础上进行改进,主要体现在:The supply-side monitor of
a.处理无效日志a. Handling invalid logs
基于在调试过程中,发现绝大多数无效日志是由于将单个日志分成两行,导致程序将它们判断为无效,本发明改进了无效日志处理的过程:拼接两个可能由上述原因导致的无效日志,恢复到有效日志并记录它;Based on the fact that in the debugging process, it is found that most of the invalid logs are caused by dividing a single log into two lines, which causes the program to judge them as invalid. The present invention improves the invalid log processing process: splicing two invalid logs that may be caused by the above reasons , revert to a valid log and record it;
b.updateStr函数更改b.updateStr function changes
为配合实现处理无效日志的功能,本发明修改判断无效的条件;上传的每条记录的时间从原始系统时间改变为每行的第一条记录的日志时间In order to cooperate to realize the function of processing invalid logs, the present invention modifies the conditions for judging invalid; the time of each uploaded record is changed from the original system time to the log time of the first record of each line
c.uploadStr函数更改c.uploadStr function changes
上传的字符串中的一些参数做调整;Adjust some parameters in the uploaded string;
(4)需方log monitor(4) Demander log monitor
需方log monitor的功能是将需方的日志信息存储到redis数据库,其中显示了将单个文件写入redis数据库的过程;在本发明的系统中,有多个需求者,所有需求者的日志文件都存储在同一个文件夹中,启动多个进程读取日志文件,然后写入redis数据库,由于多个供应商可能会请求相同的exid数据,本发明将exid和taskid存储为redis数据库中的值;The function of the demander's log monitor is to store the demander's log information in the redis database, which shows the process of writing a single file into the redis database; in the system of the present invention, there are multiple demanders, and the log files of all demanders are All are stored in the same folder, start multiple processes to read the log file, and then write to the redis database. Since multiple suppliers may request the same exid data, the present invention stores the exid and taskid as the values in the redis database ;
(5)链码的调用和查询(5) Chaincode call and query
所述的链接代码调用和查询阶段1的相关功能,基本程序和功能类型与阶段1相同,与第1阶段系统相比,只有loadData()函数有很大的不同,该阶段,在将exid和相关信息存储到区块链之前,loadData()函数需要检查数据库中是否存在exid,其他功能的功能与第1阶段系统相同;The described link code calls and queries the related functions of
载入数据load data
loadData功能是将存在于需求日志和供应商日志中的exid存储到区块链中,首先,loadData函数从java sdk接收参数,其中包括Time,DemanderID,SupplierID,TaskID,Count和exid数组,函数初始化两个数组,success_array和fail_array,存储查询成功exids和失败exid,然后,这个函数应用redis连接池,每次,查询redis数据库时,需要从连接池中获得一个连接,然后,遍历exid数组中的exid,将exid和任务集成为值,当数据库中存在该值时,将其放入成功数组中,或者存储在失败数组中,当这个遍历完成时,开始第二遍;该过程之后,如果值也不在redis数据库中,将它视为最终失败的exid,最后,将成功数组存储到区块链并返回失败的exids;The loadData function is to store the exid existing in the demand log and supplier log into the blockchain. First, the loadData function receives parameters from the java sdk, including Time, DemanderID, SupplierID, TaskID, Count and exid arrays, the function initializes two Arrays, success_array and fail_array, store the query success exids and failure exids, then, this function applies the redis connection pool, each time, when querying the redis database, you need to get a connection from the connection pool, and then traverse the exid in the exid array, Integrate exid and task as a value, when the value exists in the database, put it in the success array, or store it in the failure array, when this traversal is complete, start the second pass; after the process, if the value is not in either In the redis database, it is regarded as the exid of the final failure, and finally, the success array is stored in the blockchain and the exid of the failure is returned;
当该遍历完成时,开始第二遍,在这个过程之后,如果值也不在redis数据库中,将它视为最终失败的exid,最后,将成功数组存储到区块链并返回失败的exids;When this traversal is completed, start the second pass, after this process, if the value is not in the redis database either, treat it as the final failed exid, and finally, store the success array to the blockchain and return the failed exids;
查询数据Query data
c.范围查询数据c. Range query data
Claims (7)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810682292.XA CN110717825B (en) | 2018-06-27 | 2018-06-27 | Distributed data transaction accounting system based on block chain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810682292.XA CN110717825B (en) | 2018-06-27 | 2018-06-27 | Distributed data transaction accounting system based on block chain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110717825A true CN110717825A (en) | 2020-01-21 |
CN110717825B CN110717825B (en) | 2023-04-07 |
Family
ID=69208890
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810682292.XA Active CN110717825B (en) | 2018-06-27 | 2018-06-27 | Distributed data transaction accounting system based on block chain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110717825B (en) |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111652615A (en) * | 2020-06-24 | 2020-09-11 | 杨刘琴 | Safety identification method based on block chain big data and artificial intelligence cloud service platform |
CN111783133A (en) * | 2020-06-02 | 2020-10-16 | 广东科学技术职业学院 | A network resource management method based on blockchain technology |
CN112015796A (en) * | 2020-08-25 | 2020-12-01 | 广东广宇科技发展有限公司 | Block chain-based engineering inspection method, device, system, medium and equipment |
CN112132680A (en) * | 2020-06-15 | 2020-12-25 | 合肥维天运通信息科技股份有限公司 | A method and system for DEFI trading market of logistics bills receivable options based on blockchain |
CN112232937A (en) * | 2020-09-29 | 2021-01-15 | 辽宁便利电科技有限公司 | Intelligent processing system and method based on distributed accounting |
CN112463265A (en) * | 2020-12-10 | 2021-03-09 | 南京知麦信息科技有限公司 | Agricultural product Internet of things information chaining method based on alliance chain |
CN112508708A (en) * | 2020-12-13 | 2021-03-16 | 李力 | Block chain technology-based securitized cash flow tracking method and system |
CN112835985A (en) * | 2021-03-12 | 2021-05-25 | 湖北星地智链科技有限公司 | Spatial data sharing system and method based on distributed account book |
CN113987439A (en) * | 2021-10-28 | 2022-01-28 | 杭州迪普科技股份有限公司 | System and method for keeping command line authority consistent with page authority |
CN114385488A (en) * | 2021-12-17 | 2022-04-22 | 杭州趣链科技有限公司 | Blockchain testing method, device, equipment and storage medium |
WO2022100063A1 (en) * | 2020-11-16 | 2022-05-19 | 平安科技(深圳)有限公司 | Method and apparatus for generating and storing logs of smart contract, device, and storage medium |
CN114780968A (en) * | 2022-06-23 | 2022-07-22 | 国网区块链科技(北京)有限公司 | Intelligent contract upgrading method and device |
CN115658602A (en) * | 2022-09-08 | 2023-01-31 | 中农融信(北京)科技股份有限公司 | A method for dynamic migration and recovery of block files based on blockchain |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080097805A1 (en) * | 2006-10-23 | 2008-04-24 | Wells R Scott | Transaction processing method |
CN105956923A (en) * | 2016-04-20 | 2016-09-21 | 上海如鸽投资有限公司 | Asset transaction platform and digital certification and transaction method for assets |
CN106530088A (en) * | 2016-12-19 | 2017-03-22 | 杜伯仁 | Method for trading stock product based on block chain security nodes |
CN107194798A (en) * | 2017-04-28 | 2017-09-22 | 广东网金控股股份有限公司 | A kind of bank clearing method based on block chain alliance chain |
CN107423959A (en) * | 2017-08-07 | 2017-12-01 | 浙江宇安消防装备有限公司 | A kind of sending and receiving list and payment services expense operation system paid without fixed order |
CN107786642A (en) * | 2017-09-30 | 2018-03-09 | 上海数据交易中心有限公司 | Block chain building method and device, storage medium, server for data circulation |
-
2018
- 2018-06-27 CN CN201810682292.XA patent/CN110717825B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20080097805A1 (en) * | 2006-10-23 | 2008-04-24 | Wells R Scott | Transaction processing method |
CN105956923A (en) * | 2016-04-20 | 2016-09-21 | 上海如鸽投资有限公司 | Asset transaction platform and digital certification and transaction method for assets |
CN106530088A (en) * | 2016-12-19 | 2017-03-22 | 杜伯仁 | Method for trading stock product based on block chain security nodes |
CN107194798A (en) * | 2017-04-28 | 2017-09-22 | 广东网金控股股份有限公司 | A kind of bank clearing method based on block chain alliance chain |
CN107423959A (en) * | 2017-08-07 | 2017-12-01 | 浙江宇安消防装备有限公司 | A kind of sending and receiving list and payment services expense operation system paid without fixed order |
CN107786642A (en) * | 2017-09-30 | 2018-03-09 | 上海数据交易中心有限公司 | Block chain building method and device, storage medium, server for data circulation |
Non-Patent Citations (1)
Title |
---|
张汉宁;朱秀文;: "敏捷供应链中供方收益研究" * |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111783133A (en) * | 2020-06-02 | 2020-10-16 | 广东科学技术职业学院 | A network resource management method based on blockchain technology |
CN112132680A (en) * | 2020-06-15 | 2020-12-25 | 合肥维天运通信息科技股份有限公司 | A method and system for DEFI trading market of logistics bills receivable options based on blockchain |
CN111652615B (en) * | 2020-06-24 | 2021-01-29 | 广西新农商供应链科技有限公司 | Safety identification method based on block chain big data and artificial intelligence cloud service platform |
CN111652615A (en) * | 2020-06-24 | 2020-09-11 | 杨刘琴 | Safety identification method based on block chain big data and artificial intelligence cloud service platform |
CN112015796A (en) * | 2020-08-25 | 2020-12-01 | 广东广宇科技发展有限公司 | Block chain-based engineering inspection method, device, system, medium and equipment |
CN112232937A (en) * | 2020-09-29 | 2021-01-15 | 辽宁便利电科技有限公司 | Intelligent processing system and method based on distributed accounting |
WO2022100063A1 (en) * | 2020-11-16 | 2022-05-19 | 平安科技(深圳)有限公司 | Method and apparatus for generating and storing logs of smart contract, device, and storage medium |
CN112463265A (en) * | 2020-12-10 | 2021-03-09 | 南京知麦信息科技有限公司 | Agricultural product Internet of things information chaining method based on alliance chain |
CN112463265B (en) * | 2020-12-10 | 2023-11-14 | 南京知麦信息科技有限公司 | Agricultural product Internet of things information uplink method based on alliance chain |
CN112508708A (en) * | 2020-12-13 | 2021-03-16 | 李力 | Block chain technology-based securitized cash flow tracking method and system |
CN112835985A (en) * | 2021-03-12 | 2021-05-25 | 湖北星地智链科技有限公司 | Spatial data sharing system and method based on distributed account book |
CN113987439A (en) * | 2021-10-28 | 2022-01-28 | 杭州迪普科技股份有限公司 | System and method for keeping command line authority consistent with page authority |
CN114385488A (en) * | 2021-12-17 | 2022-04-22 | 杭州趣链科技有限公司 | Blockchain testing method, device, equipment and storage medium |
CN114780968A (en) * | 2022-06-23 | 2022-07-22 | 国网区块链科技(北京)有限公司 | Intelligent contract upgrading method and device |
CN115658602A (en) * | 2022-09-08 | 2023-01-31 | 中农融信(北京)科技股份有限公司 | A method for dynamic migration and recovery of block files based on blockchain |
Also Published As
Publication number | Publication date |
---|---|
CN110717825B (en) | 2023-04-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110717825B (en) | Distributed data transaction accounting system based on block chain | |
US11599555B2 (en) | Data manifest as a blockchain service | |
CN114297174B (en) | Data migration audit trails enabled by blockchain | |
US11789933B2 (en) | System and method for a hybrid contract execution environment | |
US11341121B2 (en) | Peer partitioning | |
CN113239399B (en) | Supply chain data supervision method based on block chain, electronic equipment and storage medium | |
CN109034833A (en) | A kind of product back-tracing information management system and method based on block chain | |
WO2021135169A1 (en) | Blockchain-based management method, terminal, apparatus, and storage medium | |
CN108804928A (en) | The secure and trusted block chain and management method of data in a kind of traceability system | |
US20130290226A1 (en) | System and method for social graph and graph assets valuation and monetization | |
US10693646B2 (en) | Event execution using a blockchain approach | |
CN115456773B (en) | Payment control method, device, equipment and medium based on blockchain | |
CN114900290A (en) | Data transaction model and privacy protection method based on block chain | |
CN111459461A (en) | Energy use right verification and transaction system and method based on Internet of things and block chain technology | |
CN111327613A (en) | Distributed service authority control method and device and computer readable storage medium | |
CN112200646A (en) | Material contract fund payment approval management system and method | |
Li et al. | Cost-effective data feeds to blockchains via workload-adaptive data replication | |
WO2020118859A1 (en) | Decentralized chip research and development transaction data storage method and system | |
CN113706313A (en) | Financing method, system and computer readable storage medium based on block chain | |
CN114022285A (en) | Cross-enterprise cloud computing resource metering method and system based on alliance block chain | |
CN117522581A (en) | Distributed resource transaction platform based on blockchain | |
Lu et al. | Educoin: a secure and efficient payment solution for mooc environment | |
Zhou et al. | Towards a data-centric view of cloud security | |
US20250007721A1 (en) | System and method for generating blockchain token support from a set of declarations | |
Imran et al. | Research perspectives and challenges of blockchain for data-intensive and resource-constrained devices |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |