Sharing mechanism based on block chain distributed database
Technical Field
The invention belongs to the technical field of block chain systems, and particularly relates to a block chain distributed database-based sharing mechanism.
Background
The blockchain is a novel application mode of decentralized distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and other computer technologies. The consensus mechanism is a mathematical algorithm for establishing trust and obtaining rights and interests among different nodes in the blockchain system. The block chain technology development goes through three stages in total: the first stage of the currency block chain technology represented by bitcoin, the second stage of the concordance block chain technology represented by Ethengfang and the third stage of the super account book project technology for realizing complete authority control and safety guarantee.
Wherein the decentralization is: the peer-to-peer communication technology is an internet technology of peer-to-peer links, and realizes communication between peer nodes by relying on common computing power and bandwidth of participants in a network. Asymmetric encryption algorithm: the method comprises the steps of using an asymmetric encryption algorithm to realize encryption and signature verification of data, encrypting the data by using a public key, decrypting the data by using a private key, signing the data by using the private key, and verifying the signature by using the public key. The chain data structure: the frequently-mentioned blocks are that index data are stored on each block, the blocks are combined together in a chain mode to form a data structure, and the block header of each block contains the transaction information compression value of the previous block, so that the created block can be linked to the current block, that is, all the blocks contain the reference structure of the previous block, and each block is gathered to form a long chain.
The consensus mechanism refers to that when a plurality of nodes form a network cluster through asynchronous communication, the network is unreliable by default, and a consistency state is formed through a specific mechanism, namely consensus. The consensus algorithm in the platform adopts PBFT, the PBFT algorithm can tolerate less than 1/3 invalid or malicious nodes as malicious nodes, the Byzantine problem under the condition of a limited number of nodes is realized, the fault tolerance of 3f +1 is realized, and certain performance is ensured.
An intelligent contract is a computer protocol intended to propagate, validate or execute contracts in an informational manner. Smart contracts allow trusted transactions to be conducted without third parties, which transactions are traceable and irreversible. The intelligent contracts define and execute the loaded items through code, so that the two parties do not need to establish trust, the intelligent contracts are automatically executed once started, and the intelligent contracts are completely decentralized and do not depend on a single server to automatically run through a network node.
The transaction number per second of the blockchain is 7, which is much lower than the transaction speed of the internet. The transaction verification time is long in bitcoin as an example, and the one-time confirmation time of the current bitcoin transaction is about 10 minutes on average, which is also the generation time of one block. In the case of 6 confirmations, it is necessary to wait for 1 hour, whereas the authentication of a transaction such as a payment treasure requires only a few seconds. (2) Decentralization easily results in that products relying on block chain technology cannot form an authoritative credit endorsement, which for many current business models, if the technology is completely based on decentralization, there is a huge transformation risk, and in the business field, the risk needs to be particularly concerned. (3) And (4) the safety problem of the intelligent contract. The intelligent contracts of the blockchain are visible to all users, so that security vulnerabilities on the blockchain are easily attacked by malicious attacks and may not be repaired quickly, resulting in immeasurable losses.
Disclosure of Invention
The invention aims to provide a sharing mechanism based on a block chain distributed database, which reduces the malicious attack of security holes and improves the generation time of block chains.
In order to achieve the purpose, the invention adopts the following technical scheme:
1. the sharing mechanism based on the block chain distributed database is characterized by comprising the following steps:
1) and (3) a data layer: collecting and storing data streams in a network under a data monitoring platform, capturing a data packet, selecting one of a plurality of servers as a formulated server as a storage unit, selecting an Ethernet workshop for construction, and constructing a decentralized network by using an Ethernet workshop client so as to support intelligent contract interaction operation and information storage;
2) network layer: packaging by using token of an http protocol, matching a logic parameter corresponding to an encapsulation instruction when the encapsulation instruction is received, matching a client in the network layer encapsulation process, accessing a communication terminal through the client, wherein the address of an access data packet is an internal IP address of the communication terminal, the internal IP address comprises a common address and two standby addresses, and then inputting input data into a network model to obtain output data;
3) a consensus layer: after the block passes the consensus verification of the primary consensus layer, POW consensus and POS consensus confirmation are carried out on the secondary consensus layer, M nodes are set in the POW consensus of the secondary consensus layer, N nodes are set in the POS consensus, Mx or Ny is selected from the M nodes and the N nodes respectively to serve as a main node, then the Mx or Ny nodes are packaged into the block through a request of the primary consensus and are fed back to the POW consensus and the POS consensus respectively, then a Byzantine fault-tolerant BFT consensus algorithm is adopted, and on the premise of decentralization, data consensus of each block chain is formed and packaging is carried out.
According to the characteristics, the data layer in the step 1) utilizes a specific storage instruction Ethernet client to establish network connection.
In some examples, the logic parameter in step 2) is to set an initial Ncs parameter, and set a term as a design parameter to adapt to different use requirements, and the parameter is fuzzified by calculating an error of the parameter, so as to be converted into a corresponding logic.
According to the characteristics, the modules are deployed on the block chain, so that a user can realize visual deployment on the block chain platform, the bottom chain building framework is selected, and the block chain platform sharing the bottom chain building framework of the shared participants is built.
In some examples, data is output by using a data block of a server, and transaction data is obtained, wherein the transaction data comprises 1 or n transaction attributes, the n transaction attributes form n-m data blocks through a hash algorithm, 1 ≦ n-m ≦ 2, and the n transaction data form a query function through the hash algorithm.
According to the characteristics, the encryption transmission module is obtained through a TCP protocol, data are encrypted through a private key and then decrypted through a public key, a response head of a computer client is used for returning a client public key of a current version, the sequential public key is updated every 3-6 months, the sequential client is updated every 8-10 months, and the client corresponds to a corresponding public key every time the client is updated.
Compared with the prior art, the invention has the beneficial effects that:
1) the sharing mechanism based on the block chain distributed database realizes the registration of market members and the control of electronic contracts in the process of power transaction business and the evidence-storing uplink of the market members and the data of the electronic contracts by relying on the technical advantages of block chain technical data disclosure, non-falsification, digital authentication, trace recording and the like.
2) The invention realizes the conversion from traditional account password login to digital identity authentication based on a sharing mechanism of a block chain distributed database, realizes the rapid authentication and verification of market member registration, realizes the real-time monitoring of the electric power transaction process, thoroughly solves the service pain points of low efficiency of market members and easy error of manual verification, and realizes the service targets of chain storage traceability and non-falsification of electronic contract data.
3) The sharing mechanism based on the block chain distributed database realizes data source tracing and query based on the block chain technology through real-time display and data verification of market member information and transaction electronic contracts, and provides technical support for development of electric power transaction services.
Detailed Description
Embodiments of the present invention will be described in more detail below. It should be understood, however, that the present invention may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art. Those skilled in the art will recognize that alternative embodiments may be made from the following description without departing from the spirit and scope of the invention.
Example 1
1. The sharing mechanism based on the block chain distributed database is characterized by comprising the following steps:
1) and (3) a data layer: collecting and storing data streams in a network under a data monitoring platform, capturing a data packet, selecting one of a plurality of servers as a formulated server as a storage unit, selecting an Ethernet workshop for construction, and constructing a decentralized network by using an Ethernet workshop client so as to support intelligent contract interaction operation and information storage; and establishing network connection in the data layer by utilizing a specific storage instruction Etherhouse client.
2) Network layer: packaging by using token of an http protocol, matching a logic parameter corresponding to an encapsulation instruction when the encapsulation instruction is received, matching a client in the network layer encapsulation process, accessing a communication terminal through the client, wherein the address of an access data packet is an internal IP address of the communication terminal, the internal IP address comprises a common address and two standby addresses, and then inputting input data into a network model to obtain output data; the logic parameters are initial Ncs parameters and design parameters to adapt to different use requirements, and the parameters are fuzzified by calculating errors of the parameters so as to be converted into corresponding logics.
3) A consensus layer: after the block passes the consensus verification of the primary consensus layer, POW consensus and POS consensus confirmation are carried out on the secondary consensus layer, 5 nodes are set in the POW consensus of the secondary consensus layer, 6 nodes are set in the POS consensus, one main node is selected from the 5 nodes and the 6 nodes respectively, then one node is packaged into the block through a request of the primary consensus and is fed back to the POW consensus and the POS consensus respectively, then a Byzantine-based fault-tolerant BFT consensus algorithm is adopted, and on the premise of decentralization, data consensus of each block chain is formed and is packaged.
And deploying the module on the block chain, so that a user realizes visual deployment on the block chain platform, selects the bottom chain building framework, and builds the block chain platform sharing the bottom chain building framework of the shared participants. Data are output by using data blocks of a server to obtain transaction data, wherein the transaction data comprise 1 or 5 transaction attributes, the n transaction attributes form 1 data block through a hash algorithm, and the 5 transaction data form a query function through the hash algorithm. The method comprises the steps of acquiring an encryption transmission module through a TCP protocol, encrypting data by using a private key, decrypting the data by using a public key, returning a client public key of a current version by using a response head of a computer client, updating sequential public keys every 3 months, updating sequential clients every 8 months, and enabling the clients to correspond to a corresponding public key every time of updating.
Example 2
1. The sharing mechanism based on the block chain distributed database is characterized by comprising the following steps:
step 1) and step 2) are the same as in example 1.
3) A consensus layer: after the block passes the consensus verification of the primary consensus layer, POW consensus and POS consensus confirmation are carried out on the secondary consensus layer, 6 nodes are set in the POW consensus of the secondary consensus layer, 7 nodes are set in the POS consensus, one main node is selected from the 6 nodes and the 7 nodes respectively, one node is packaged into the block through a request of the primary consensus and is fed back to the POW consensus and the POS consensus respectively, then a Byzantine fault-tolerant BFT consensus algorithm is adopted, and on the premise of decentralization, data consensus of each block chain is formed and is packaged.
And deploying the module on the block chain, so that a user realizes visual deployment on the block chain platform, selects the bottom chain building framework, and builds the block chain platform sharing the bottom chain building framework of the shared participants. Data are output by using data blocks of a server to obtain transaction data, wherein the transaction data comprise 1 or 6 transaction attributes, the n transaction attributes form 2 data blocks through a hash algorithm, and the 6 transaction data form a query function through the hash algorithm. The method comprises the steps of acquiring an encryption transmission module through a TCP protocol, encrypting data by using a private key, decrypting the data by using a public key, returning a client public key of a current version by using a response head of a computer client, updating sequential public keys every 6 months, updating sequential clients every 10 months, and enabling the clients to correspond to a corresponding public key every time of updating.
The above description is only for the specific embodiments of the present disclosure, but the scope of the embodiments of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of the changes, substitutions or combinations within the technical scope of the embodiments of the present disclosure or under the concept of the embodiments of the present disclosure, and all of them should be covered by the scope of the embodiments of the present disclosure.