CN110992182B - Transaction method and system of blockchain wallet - Google Patents

Transaction method and system of blockchain wallet Download PDF

Info

Publication number
CN110992182B
CN110992182B CN201911226055.3A CN201911226055A CN110992182B CN 110992182 B CN110992182 B CN 110992182B CN 201911226055 A CN201911226055 A CN 201911226055A CN 110992182 B CN110992182 B CN 110992182B
Authority
CN
China
Prior art keywords
transaction
wallet
information
merck
blockchain
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.)
Active
Application number
CN201911226055.3A
Other languages
Chinese (zh)
Other versions
CN110992182A (en
Inventor
林哲明
陈浩
陈建秋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuzhou Boquan Network Technology Co ltd
Original Assignee
Fuzhou Boquan Network Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fuzhou Boquan Network Technology Co ltd filed Critical Fuzhou Boquan Network Technology Co ltd
Priority to CN201911226055.3A priority Critical patent/CN110992182B/en
Publication of CN110992182A publication Critical patent/CN110992182A/en
Application granted granted Critical
Publication of CN110992182B publication Critical patent/CN110992182B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/36Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes
    • G06Q20/367Payment architectures, schemes or protocols characterised by the use of specific devices or networks using electronic wallets or electronic money safes involving electronic purses or money safes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management

Abstract

The application relates to the technical field of blockchain, in particular to a transaction method and a transaction system of a blockchain wallet, comprising the following steps: the merck tree server acquires merck tree information in the blockchain; the block chain wallet establishes connection with a forwarding server; the blockchain wallet sends transaction information to the blockchain and updates account balance at the same time; the block chain wallet inquires the merck path information of the current transaction from the merck tree server and sends the merck path information and the transaction information to the forwarding server; the forwarding server sends the transaction information and the merck path information to a transaction receiver; and the transaction receiver performs transaction verification and confirms the transaction according to the merck path information. The method provides a point-to-point implementation mode of the blockchain wallet, so that the wallet server does not need to climb transaction information on the blockchain, the transaction of the wallet is not influenced by a large block, the transaction efficiency is improved, and the operation cost of wallet servers is reduced.

Description

Transaction method and system of blockchain wallet
Technical Field
The application relates to the technical field of blockchain, in particular to a transaction method and a transaction system of a blockchain wallet.
Background
Blockchains are novel application modes of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanisms, encryption algorithms, and the like. Blockchain (Blockchain) is essentially a de-centralized database, which is a string of data blocks that are generated in association using cryptographic methods, each of which contains a batch of information for network transactions to verify the validity of its information and to generate the next block.
In the blockchain, there is no concept of balance account, the balance of account is composed of a plurality of UTXOs (Unspent Transaction Output, unexpired output) records, each income is one UTXO, the UTXOs must be completely spent when spent, if the balance is left, a new UTXO must be generated, and the amount information in the UTXOs cannot be changed. Because of this feature of blockchain, it cannot provide a centralized service to query the balance and history of each user. In such cases, there is a need for a class of software to assist the user in managing assets on the blockchain, such as wallets, whose primary functions include public and private key management, history queries, balance queries, send and receive transactions, and the like. The implementation modes of the wallet on the market at present mainly comprise the following two modes:
in the first mode, the background service crawls all transaction information on the blockchain, then analyzes the transaction of each address, stores the transaction in the relational database, updates the balance of the user if the transaction related to the current wallet user is crawled, and requests the data in the relational database from the server when the wallet client inquires the balance or the history record. When the wallet sends a transaction, the collection of UTXOs is requested from the server, and then the constructed transaction is sent onto the blockchain network. Unlike a traditional centralized wallet, the wallet server cannot directly obtain information about balance change of the user, and only can screen out related transactions of the user from massive transactions on a blockchain.
In a blockchain, the number of blocks exceeds 60 tens of thousands, the number of transactions exceeds 3 billion, and the address-related pipeline exceeds 20 billion. The block size limit of a blockchain is experienced as 1M (megabytes), 8M,128M,256M. Very large blockchains have emerged with sizes of each block above 1GB (GB gigabyte), with sizes of the entire blockchain above 10TB (TB stands for gigabyte), and with transaction numbers above five million per ten minutes. In the near future, the block size limitation will be cancelled, and the transaction amount and the size of the whole chain will increase exponentially, because only oversized blocks with unlimited sizes can carry massive transactions in the real world, and various data that need to be permanently stored, and that are not tamperable, facilitating auditing. In this case, maintaining a full node of a blockchain and crawling data from the full node has the following problems: 1. all transactions within the crawling block require a significant amount of computation; 2. storing transactions requires a large amount of storage space; 3. the efficiency is low, and the transaction is not updated timely; 4. in order to realize efficient storage and query, a database and table splitting scheme of a relational database is complicated. Both of these problems result in increased wallet operating costs.
In the second mode, for example, BIP 270 and payail modes, a third party server is adopted to perform unified and centralized management on wallets, when transactions occur between wallets, a server corresponding to a mailbox domain name needs to be queried for a payment template according to a mailbox of the other party, then the template is filled, the transaction is constructed, and the server for submitting the transaction is submitted. The problem of this approach is that a large amount of work needs to be done by the third party server, the third party server needs to have a domain name corresponding to the mailbox, the generation of the payment template needs to be supported, and the UTXO and the history of the receiving end need to be managed. Moreover, the wallet of the user excessively depends on the third party server, so that the safety of the asset cannot be ensured, and the wallet cannot be freely migrated.
Therefore, how to reduce the cost of operation and to efficiently and flexibly manage the blockchain wallet is one of the problems that wallet providers are currently urgently required to solve.
Disclosure of Invention
One of the purposes of the present invention is to overcome the above drawbacks, and to provide a point-to-point transaction method for a blockchain wallet, so that a wallet server does not need to climb the transaction on the blockchain, so that the transaction of the wallet is not affected by a large block, and the efficiency of the wallet transaction is improved.
In order to solve the technical problems, the invention provides a transaction method of a blockchain wallet, which comprises the following steps:
the merck tree server acquires and stores merck tree information of each block in the block chain;
the blockchain wallet uses the public key as identity information to establish connection with a forwarding server;
the transaction initiator blockchain wallet sends transaction information to the blockchain; the transaction information comprises transaction numbers, an initiator public key, a receiver public key and transaction amount information;
the transaction initiator blockchain wallet updates account balance and transaction history records;
the transaction initiator blockchain wallet queries the merck tree server for merck path information of the current transaction;
the transaction initiator blockchain wallet sends the merck path information and the transaction information to the forwarding server;
the forwarding server sends the transaction information and the merck path information to a transaction receiver according to a receiver public key in the transaction information;
and the transaction receiver performs transaction verification and confirms the transaction according to the merck path information.
The method of the invention provides a transaction method of the point-to-point blockchain wallet, wherein transaction parties carry out transaction communication through a forwarding server, meanwhile, the information of the blockchain merck tree is acquired, and the information of the blockchain transaction is verified according to the information of the merck tree, so that a wallet server does not need to climb the information of the transaction on the blockchain, the transaction efficiency is improved, the disk storage space is reduced, the transaction of the wallet is not influenced by a large block, and meanwhile, the operation cost of a wallet server is reduced. In addition, through a public key-based authentication communication model, wallets of individual service providers can communicate with each other through this communication model.
Further, the merck tree server obtains and stores merck tree information of each block in the blockchain, which comprises the following specific steps:
acquiring the numbers of all transactions in a block according to the recorded sequence;
starting from the first transaction number, merging every two adjacent odd transaction numbers with the even transaction numbers, calculating to generate a hash value of the upper layer, and if the total number of transactions is odd, calculating the last transaction number to generate the hash value of the upper layer;
repeatedly executing the operation on the generated hash value until a unique hash value is generated, and obtaining the merck tree structure of the block;
and saving the merck tree structure and the current block height generated in the previous step.
Further, the forwarding servers are multiple, and each forwarding server sends the received merck path information and the transaction information to all other forwarding servers.
By setting the forwarding server cluster, capacity expansion and load balancing of forwarding servers can be conveniently carried out, message processing capacity and efficiency are improved, meanwhile, mutual disaster recovery backup can be realized, and failure rate is reduced.
Further, the blockchain wallet uses the public key as identity information to establish connection with the forwarding server, specifically:
the blockchain wallet establishes long connection with a forwarding server by using all public keys respectively;
or the blockchain wallet uses all public keys to establish long connection with a wallet proxy, the wallet proxy uses the public keys to establish long connection with a forwarding server, and meanwhile, the blockchain wallet sets proxy information of all public keys on the forwarding server.
Through the wallet proxy mechanism, the connection quantity of wallets and forwarding servers can be greatly reduced, the design and implementation complexity of the forwarding servers are reduced, the operation efficiency is improved, and meanwhile, access and management of different wallet servers are facilitated.
Further, the "the transaction initiator blockchain wallet updates account balance and transaction history," specifically:
if the transaction initiator blockchain wallet is directly connected with the forwarding server, updating account balance and transaction history record locally;
and if the transaction initiator blockchain wallet is connected with the forwarding server through the wallet proxy, the account balance and the transaction history record are sent to the wallet proxy, and the account balance and the transaction history record are updated by the wallet proxy.
Further, the "the transaction initiator blockchain wallet transmits the merck path information and the transaction information to the forwarding server", specifically:
if the transaction initiator blockchain wallet is directly connected with a forwarding server, the merck path information and the transaction information are sent to the forwarding server;
and if the transaction initiator blockchain wallet is connected with the forwarding server through the wallet proxy, the merck path information and the transaction information are sent to the wallet proxy, and the wallet proxy sends the merck path information and the transaction information to the forwarding server again.
Further, the "the forwarding server sends the transaction information and the merck path information to the transaction receiver according to the public key of the receiver in the transaction information" specifically includes:
the forwarding server stores the received message;
if the public key of the transaction receiver blockchain wallet has specified proxy information, searching corresponding connection according to the public key of the wallet proxy, and sending the transaction information and the merck path information;
if the public key of the transaction receiver blockchain wallet does not specify proxy information, searching corresponding connection according to the public key of the transaction receiver blockchain wallet, and sending the transaction information and the merck path information.
Further, the transaction verification and confirmation transaction by the transaction receiver according to the merck path information includes the following steps:
the transaction receiver acquires and stores the head information of each block in the block chain; the transaction receiver is a blockchain wallet or wallet proxy;
the transaction receiver calculates the root of the merck tree according to the transaction number and the merck path information;
and the transaction receiver compares the calculated root of the merck tree with the root of the merck tree obtained from the head information of the corresponding height block, and if the calculated root of the merck tree is equal to the root of the merck tree, the transaction receiver considers the transaction to be effective, and updates the account balance and the transaction history record.
Correspondingly, the application also provides a transaction system of the block chain wallet, which comprises a merck tree server, the block chain wallet, a forwarding server and a wallet agent, wherein,
the merck tree server is used for acquiring and storing merck tree information of each block in the block chain, and meanwhile, merck path information inquiry can be carried out according to the provided transaction number;
the block chain wallet uses public key as identity information to establish connection with the forwarding server, or uses all public keys to establish long connection with wallet proxy and sets proxy information of all public keys on the forwarding server, and is used for sending transaction information to the block chain and updating account balance and transaction history record; the merck path information is used for inquiring the merck tree server about the current transaction, and meanwhile, the merck path information and the transaction information are sent to the forwarding server; the merck path information and the transaction information are received, and transaction verification and transaction confirmation are carried out according to the merck path information.
The forwarding server is used for identity verification and connection management of the blockchain wallet and the wallet proxy; the merck path information and the transaction information sent by the transaction initiator blockchain wallet are received; the method comprises the steps of sending transaction information and merck path information to a transaction receiver according to a public key of the receiver in the transaction information; the transaction receiver is a blockchain wallet or wallet proxy;
the wallet proxy establishes long connection with the forwarding server by using the public key of the wallet proxy, and establishes long connection with the managed blockchain wallet of the wallet proxy at the same time, and is used for updating account balance and transaction history record information of the managed blockchain wallet of the transaction initiator; the merck path information and the transaction information sent by the transaction initiator blockchain wallet managed by the merck path information are received and sent to a forwarding server; the merck path information and the transaction information are received, and transaction verification and transaction confirmation are carried out according to the merck path information.
Further, the forwarding servers are multiple, and each forwarding server sends the received merck path information and the transaction information to all other forwarding servers.
Compared with the prior art, the technical scheme of the invention has the following beneficial effects:
1. the method of the invention provides a transaction method of the point-to-point blockchain wallet, wherein transaction parties carry out transaction communication through a forwarding server, meanwhile, the information of the blockchain merck tree is acquired, and the information of the blockchain transaction is verified according to the information of the merck tree, so that a wallet server does not need to climb the information of the transaction on the blockchain, the transaction efficiency is improved, the disk storage space is reduced, the transaction of the wallet is not influenced by a large block, and meanwhile, the operation cost of a wallet server is reduced. In addition, through a public key-based authentication communication model, wallets of individual service providers can communicate with each other through this communication model.
2. By setting the forwarding server cluster, capacity expansion and load balancing of forwarding servers can be conveniently carried out, message processing capacity and efficiency are improved, meanwhile, mutual disaster recovery backup can be realized, and failure rate is reduced.
3. Through the wallet proxy mechanism, the connection quantity of wallets and forwarding servers can be greatly reduced, the design and implementation complexity of the forwarding servers are reduced, the operation efficiency is improved, and meanwhile, access and management of different wallet servers are facilitated.
Drawings
FIG. 1 is a flow chart of the steps of a transaction method of a blockchain wallet of the present invention.
Fig. 2 is a schematic diagram of the merck tree structure of the present invention.
Fig. 3 is a block chain wallet transaction system block diagram of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a block chain wallet transaction method of the present invention includes the steps of:
step 1, acquiring and storing merck tree information of each block in a block chain by a merck tree server;
in a blockchain, each block typically includes a block header and a transaction data block, where the transaction data block records zero or more pieces of transaction data, and the block header records information such as version number, hash of a preceding block, difficulty, generation time, merkel tree (Merkel) root, and the like. The merck tree is a binary tree formed by all transactions in the current block, leaf nodes of the tree are numbers of each transaction, a hash value is calculated and generated after pairwise pairing combination according to the transaction sequence, and the only hash value is finally calculated by continuously cycling pairwise pairing, namely the root of the merck tree. In this application, the complete tree structure of the merck tree needs to be saved for transaction verification of the transaction receiver, and is usually saved in a relational database. The specific steps of acquiring and storing the merck tree information of each block in the block chain by the merck tree server are as follows:
step 11, obtaining the numbers of all transactions in a block according to the recorded sequence;
step 12, starting from the first transaction number, merging every two adjacent odd transaction numbers with the even transaction numbers, then calculating to generate a hash value of the upper layer, and if the total number of transactions is odd, calculating the last transaction number to generate the hash value of the upper layer;
step 13, repeatedly executing the operations on the generated hash values, and continuously generating the hash value of the previous layer until a top layer consisting of unique hash values is obtained, wherein the unique hash values are roots of the merck tree, and the hash values of all layers and transaction numbers of leaf nodes form the merck tree structure of the block;
step 14, saving the merck tree structure and the current block height generated in the previous step. The block height refers to the sequence number of the blocks of the block chain, and is continuously increased along with the increase of the blocks. After the merck tree structure corresponding to each block in the whole block chain and the height of the block to which the block belongs are stored, the block chain wallet can autonomously judge whether a transaction is in one block or not by only knowing the Hash value of the corresponding merck tree related path of the transaction.
It should be noted that, since the block height of the blockchain is continuously increased during the running process, the merck tree server must continuously monitor the block height of each block in the blockchain to correspondingly synchronize the merck tree structure information in each block whenever the blockchain is found to be newly added with one block.
Step 2, the blockchain wallet uses the public key as identity information to establish connection with a forwarding server; in the invention, the forwarding server is used for forwarding transaction information among the blockchain wallets, and the forwarding service is responsible for receiving and managing the long connection of the blockchain wallets, receiving the transaction information sent by the blockchain wallet of the transaction initiator and forwarding the transaction information to the transaction receiver according to the public key information. The blockchain wallet is a client for managing assets on the blockchain and can be divided into a full-node wallet and a light wallet (SPV, simplified Payment Verification), wherein the full-node wallet stores information on all blockchains besides managing own assets, can verify whether messages sent by other people are real, is large in size generally, and the light wallet can only send messages and only verify transactions related to the light wallet, is the most common portable and efficient, does not affect daily use wallet clients, is a user of the whole network, and therefore needs to pay for each use usually. The blockchain wallet must establish a connection with the forwarding server using public keys as identity information, each public key being a unique identity during the blockchain wallet transaction.
In a preferred embodiment, since a blockchain wallet may have multiple public keys, each of which may receive transaction information, when the blockchain wallet is directly connected to the forwarding server, all public keys may be used to establish long connections with the forwarding server, respectively; in addition, a wallet proxy can be arranged between the blockchain wallet and the forwarding server, the blockchain wallet uses all public keys of the blockchain wallet to establish long connection with the wallet proxy, the wallet proxy uses all public keys of the blockchain wallet to establish long connection with the forwarding server, and proxy information of all public keys is arranged on the forwarding server, so that the forwarding server forwards all transactions related to the blockchain wallet public keys to the arranged wallet proxy, and in practical application, the arranged proxy information is the one-to-one correspondence of the public keys of the wallet and the public keys of the wallet proxy. Through the wallet proxy mechanism, the connection quantity of wallets and forwarding service ends can be greatly reduced, the design and implementation complexity of the forwarding service ends are reduced, the operation efficiency is improved, and meanwhile, access and service management of different wallet service providers are facilitated.
Preferably, the forwarding server may also verify the public key of the blockchain wallet or wallet proxy, making identity verification, allowing only the blockchain wallet or wallet proxy to establish a connection through the verification. In general, the forwarding server may also collect a fee for a blockchain wallet or wallet proxy applying for connection, and as a payment for forwarding the transaction, the connection may be established only after the fee is collected successfully, and a service scheme based on a payment model is provided through the forwarding server, so that the forwarding server may be prevented from being attacked by an anonymous wallet or an illegal wallet.
In another preferred embodiment, a server cluster may be formed by a plurality of forwarding servers, and the blockchain wallet or wallet proxy may select any one forwarding server in the cluster to connect, where each forwarding server configures address information of all other forwarding servers in the cluster, and the forwarding servers forward to all other servers when receiving the transaction message. By setting the forwarding server cluster, capacity expansion and load balancing of forwarding servers can be conveniently carried out, message processing capacity and efficiency are improved, meanwhile, mutual disaster recovery backup can be realized, and failure rate is reduced.
Step 3, the transaction initiator blockchain wallet sends transaction information to the blockchain; the transaction initiator blockchain wallet constructs transaction information, which generally comprises information such as a transaction number, a transaction initiator public key, a transaction receiver public key, a transaction amount and the like, submits the information to a P2P network of the blockchain, and writes the information into a new block after confirming the transaction by the blockchain according to an operation mechanism of the blockchain.
Step 4, updating account balance and transaction history records by the transaction initiator blockchain wallet;
according to the technical scheme, account balance and transaction history of the wallet can be stored locally so as to be convenient for inquiring, and the storage mode can be stored through a database or a file. Specifically, if the blockchain wallet is directly connected with the forwarding server, the blockchain wallet locally updates account balance and transaction history records; if the blockchain wallet is connected with the forwarding server through the wallet proxy, the blockchain wallet sends the account balance and the transaction history record to the wallet proxy, and the wallet proxy updates the account balance and the transaction history record. In a specific practical application scenario, one wallet proxy usually corresponds to one wallet server and is responsible for managing all the blockchain wallets under the wallet server, receiving the transaction information of all the blockchain wallets of the server, simultaneously uniformly managing the balance and the transaction history of all the blockchain wallets, and requesting the wallet proxy to inquire the balance and the transaction record.
Step 5, inquiring the merck path information of the current transaction from the merck tree server by the transaction initiator blockchain wallet; when the transaction is written to a block by the blockchain validation, the merck tree server obtains and saves the merck tree structure of the block. At this time, the transaction initiator blockchain wallet can query the merck tree server for the merck path information of the current transaction, where the merck path information includes the block height of the current transaction and the set composed of the transaction number or hash value, and the current transaction number and the queried merck path information can calculate the root of the merck tree. If the transaction initiator blockchain wallet can not inquire the merck path information of the current transaction from the merck tree server for a long time, the transaction initiator blockchain wallet can rollback the transaction, wherein the merck path information indicates that the transaction is not confirmed by the blockchain. Referring to fig. 2, which is a schematic diagram of the merck tree structure of the present invention, taking 8 transaction records as an example, when the merck tree server obtains and stores the merck tree structure information, the first-layer hash value, the second-layer hash value and the transaction number of the last layer of the block merck tree with the block height of n+2 are stored in the database. If the blockchain wallet needs to query the merck path corresponding to the transaction 5, the merck tree server returns the block height n+2 where the transaction 5 is located, and returns the minimum set of the transaction 6, the second-layer hash value 4 and the first-layer hash value 1. The root of the merck tree can be calculated by the transaction 5 number, the transaction 6 number, the second level hash value 4, and the first level hash value 1.
Step 6, the transaction initiator blockchain wallet transmits the merck path information and the transaction information to the forwarding server;
specifically, if the transaction initiator blockchain wallet is directly connected with the forwarding server, the merck path information and the transaction information are sent to the forwarding server; if the transaction initiator blockchain wallet is connected with the forwarding server through the wallet proxy, the queried merck path information and transaction information are sent to the wallet proxy, and then the wallet proxy sends the merck path information and the transaction information to the forwarding server.
Step 7, the forwarding server sends the transaction information and the merck path information to a transaction receiver according to the public key of the receiver in the transaction information;
in a preferred embodiment, a forwarding server cluster may be formed by a plurality of forwarding servers, where each forwarding server configures address information of all other forwarding servers in the cluster, and each forwarding server sends the received merck path information and transaction information to all other forwarding servers.
Specifically, the forwarding server sends the transaction information and the merck path information to the transaction receiver according to the public key of the transaction receiver blockchain wallet, and the method comprises the following steps:
step 71, the forwarding server stores the received message for subsequent query, typically in a relational database;
step 72, if the public key of the transaction receiver blockchain wallet has specified proxy information, namely, a corresponding wallet proxy public key is set, searching for corresponding connection according to the wallet proxy public key, and transmitting the transaction information and the merck path information through the connection;
step 73, if the public key of the transaction receiver blockchain wallet does not specify proxy information, which indicates that the blockchain wallet directly establishes long connection with the forwarding server, searching corresponding connection according to the public key of the transaction receiver blockchain wallet, and transmitting the transaction information and the merck path information through the connection.
And 8, the transaction receiver performs transaction verification and confirms transaction according to the merck path information, wherein the receiver refers to a blockchain wallet or a wallet proxy, if the receiver is the blockchain wallet, the blockchain wallet performs transaction verification and confirmation, and if the receiver is the wallet proxy, the wallet proxy performs transaction verification and confirmation for all the blockchain wallets managed by the receiver. The transaction receiver performs transaction verification and confirms the transaction, comprising the following steps:
step 81, the transaction receiver acquires and stores the head information of each block in the block chain; here, the purpose of the transaction receiver re-acquiring all the tile header information from the tile chain is to acquire the value of the merck root corresponding to each tile height for verification of the transaction. Since the block height of the blockchain is continuously increased, the header information of the newly added block must be synchronously acquired and stored whenever a new block is generated. Taking a blockchain as an example, each blockhead occupies 80 bytes, the current blockheight is about 60 ten thousand, the total blockchain wallet occupies about 50M space, if a transaction receiver is a blockchain wallet, the blockchain wallet needs to occupy 50M space to store the blockchain head information, if the transaction receiver is a wallet agent, the wallet agent uniformly acquires and stores the head information of each blockin the blockchain, and each blockchain wallet does not need to acquire and store the head information respectively, so that the space occupation is reduced.
Step 82, the transaction receiver calculates the root of the merck tree according to the transaction number and the merck path information; for example, from the merck tree in fig. 2, the step of calculating the root of the merck tree for transaction 5 and its associated merck path information is: and merging the serial number of the transaction 5 with the serial number of the transaction 6 to calculate a hash value to obtain a second-layer hash value 3, merging the second-layer hash value 4 to calculate a hash value to obtain a first-layer hash value 2, merging the first-layer hash value 1 to calculate a hash value to obtain the root of the merck tree.
Step 83, the transaction receiver compares the root of the merck tree obtained by calculation with the root of the merck tree obtained from the header information of the corresponding height block, and according to the generation mechanism of the merck tree, the transaction receiver can autonomously judge whether a transaction is in a block or not only needs to know the merck path information related to the transaction. Because the query result returned by the merck tree server contains the block height of the current trade place, the trade receiver can directly obtain the root of the merck tree from the block header information of the corresponding height and compare the root of the merck tree with the calculated root of the merck tree. If the two are equal, the transaction is considered to be true and effective, updating the account balance and the transaction history record by a blockchain wallet or a wallet proxy; if the balance is not equal, the data is illegally modified in the transmission process, and the local wallet does not update the balance and record the transaction.
The method of the invention provides a transaction method of the point-to-point blockchain wallet, wherein transaction parties carry out transaction communication through a forwarding server, meanwhile, the information of the blockchain merck tree is acquired, and the information of the blockchain transaction is verified according to the information of the merck tree, so that a wallet server does not need to climb the information of the transaction on the blockchain, the transaction efficiency is improved, the disk storage space is reduced, the transaction of the wallet is not influenced by a large block, and meanwhile, the operation cost of a wallet server is reduced. In addition, through a public key-based authentication communication model, wallets of individual service providers can communicate with each other through this communication model.
Fig. 3 is a block diagram of a transaction system for a blockchain wallet of the present invention, including a merck tree server, a blockchain wallet, a forwarding server, and a wallet proxy, wherein,
the merck tree server is used for acquiring and storing merck tree information of each block in the block chain, and meanwhile, merck path information inquiry can be carried out according to the provided transaction number; the specific steps of acquiring and storing the merck tree information of each block in the blockchain by the merck tree server are as follows: acquiring the numbers of all transactions in a block according to the recorded sequence; starting from the first transaction number, merging every two adjacent odd transaction numbers with the even transaction numbers, calculating to generate a hash value of the upper layer, and if the total number of transactions is odd, calculating the last transaction number to generate the hash value of the upper layer; repeatedly executing the operations on the generated hash values, and continuously generating the hash value of the upper layer until the top layer consisting of the unique hash value is obtained, wherein the unique hash value is the root of the merck tree, and the hash values of all layers and the transaction numbers of the leaf nodes form the merck tree structure of the block; and saving the merck tree structure and the current block height generated in the previous step. The merck tree server constantly monitors the block height of the blockchain and, whenever a new block is found to be added by the blockchain, synchronizes the merck tree structure information in that block accordingly.
The blockchain wallet is a client used for managing assets on the blockchain and can be divided into a full-node wallet and a light wallet, a public key is used as identity information to establish connection with a forwarding server, or all public keys are used for establishing long connection with a wallet proxy and proxy information of all public keys is arranged on the forwarding server and used for sending transaction information to the blockchain and updating local account balance and transaction history records; the merck tree server is used for inquiring merck path information of the current transaction and sending the merck path information and the transaction information to the forwarding server; the merck path information and the transaction information are received, and transaction verification and transaction confirmation are carried out according to the merck path information.
The forwarding server is used for identity verification and connection management of the blockchain wallet and the wallet proxy; the merck path information and the transaction information sent by the transaction initiator blockchain wallet are received; the method comprises the steps of sending the transaction information and the merck path information to a transaction receiver according to a public key of the transaction receiver blockchain wallet; the transaction receiver is a blockchain wallet or wallet proxy;
in a specific practical application scenario, one wallet proxy usually corresponds to one wallet server and is responsible for managing all the blockchain wallets under the wallet server, receiving the transaction information of all the blockchain wallets of the server, simultaneously uniformly managing the balance and the transaction history of all the blockchain wallets, and requesting the wallet proxy to inquire the balance and the transaction record. The wallet agent establishes long connection with the forwarding server by using the public key of the wallet agent, and establishes long connection with the managed blockchain wallet of the wallet agent, so as to update the account balance and transaction history record information of the managed blockchain wallet of the transaction initiator; the merck path information and the transaction information sent by the transaction initiator blockchain wallet managed by the merck path information and the transaction information are received and sent to a forwarding server; the merck path information and the transaction information are received, and transaction verification and transaction confirmation are carried out according to the merck path information.
Preferably, the plurality of forwarding servers form a forwarding server cluster, and each forwarding server sends the received merck path information and the transaction information to all other forwarding servers.
The foregoing detailed description will be given for the purpose of illustration only, and the invention is not limited to the above-described embodiments, but is to be construed as merely illustrative of the principles of the invention, as long as they are within the scope of the invention.

Claims (6)

1. A method of trading a blockchain wallet, comprising the steps of:
the merck tree server obtains and stores merck tree information of each block in the block chain, and the specific steps are as follows: acquiring the numbers of all transactions in a block according to the recorded sequence; starting from the first transaction number, merging every two adjacent odd transaction numbers with the even transaction numbers, calculating to generate a hash value of the upper layer, and if the total number of transactions is odd, calculating the last transaction number to generate the hash value of the upper layer; repeatedly executing the operation on the generated hash value until a unique hash value is generated, and obtaining the merck tree structure of the block; storing the merck tree structure and the current block height generated in the previous step;
the blockchain wallet uses a public key as identity information to establish connection with a forwarding server, and the method comprises the following specific steps: the blockchain wallet establishes long connection with a forwarding server by using all public keys respectively; or the blockchain wallet uses all public keys to establish long connection with a wallet proxy, the wallet proxy uses the public keys to establish long connection with a forwarding server, and meanwhile, the blockchain wallet sets proxy information of all public keys on the forwarding server; the forwarding servers are multiple, and each forwarding server transmits the received merck path information and transaction information to all other forwarding servers;
the transaction initiator blockchain wallet sends transaction information to the blockchain; the transaction information comprises transaction numbers, an initiator public key, a receiver public key and transaction amount information;
the transaction initiator blockchain wallet updates account balance and transaction history records;
the transaction initiator blockchain wallet queries the merck tree server for merck path information of the current transaction;
the transaction initiator blockchain wallet sends the merck path information and the transaction information to the forwarding server;
the forwarding server sends the transaction information and the merck path information to a transaction receiver according to a receiver public key in the transaction information;
and the transaction receiver performs transaction verification and confirms the transaction according to the merck path information.
2. The blockchain wallet transaction method of claim 1, wherein the transaction initiator blockchain wallet updates account balances and transaction histories, in particular:
if the transaction initiator blockchain wallet is directly connected with the forwarding server, updating account balance and transaction history record locally;
and if the transaction initiator blockchain wallet is connected with the forwarding server through the wallet proxy, the account balance and the transaction history record are sent to the wallet proxy, and the account balance and the transaction history record are updated by the wallet proxy.
3. The method of claim 1, wherein the transaction initiator blockchain wallet sends the merck path information and the transaction information to the forwarding server, in particular:
if the transaction initiator blockchain wallet is directly connected with a forwarding server, the merck path information and the transaction information are sent to the forwarding server;
and if the transaction initiator blockchain wallet is connected with the forwarding server through the wallet proxy, the merck path information and the transaction information are sent to the wallet proxy, and the wallet proxy sends the merck path information and the transaction information to the forwarding server again.
4. The method of claim 1, wherein the forwarding server sends the transaction information and the merck path information to a transaction receiver according to a receiver public key in the transaction information, specifically:
the forwarding server stores the received message;
if the public key of the transaction receiver blockchain wallet has specified proxy information, searching corresponding connection according to the public key of the wallet proxy, and sending the transaction information and the merck path information;
if the public key of the transaction receiver blockchain wallet does not specify proxy information, searching corresponding connection according to the public key of the transaction receiver blockchain wallet, and sending the transaction information and the merck path information.
5. The transaction method of the blockchain wallet of claim 1, wherein the transaction receiver performs transaction verification and confirms transaction according to the merck path information, comprising the steps of:
the transaction receiver acquires and stores the head information of each block in the block chain; the transaction receiver is a blockchain wallet or wallet proxy;
the transaction receiver calculates the root of the merck tree according to the transaction number and the merck path information;
and the transaction receiver compares the calculated root of the merck tree with the root of the merck tree obtained from the head information of the corresponding height block, and if the calculated root of the merck tree is equal to the root of the merck tree, the transaction receiver considers the transaction to be effective, and updates the account balance and the transaction history record.
6. A transaction system for a blockchain wallet is characterized by comprising a merck tree server, a blockchain wallet, a forwarding server and a wallet proxy, wherein,
the merck tree server is used for acquiring and storing merck tree information of each block in the block chain, and comprises the following specific steps: acquiring the numbers of all transactions in a block according to the recorded sequence; starting from the first transaction number, merging every two adjacent odd transaction numbers with the even transaction numbers, calculating to generate a hash value of the upper layer, and if the total number of transactions is odd, calculating the last transaction number to generate the hash value of the upper layer; repeatedly executing the operation on the generated hash value until a unique hash value is generated, and obtaining the merck tree structure of the block; storing the merck tree structure and the current block height generated in the previous step; meanwhile, merck path information inquiry can be carried out according to the provided transaction number;
the block chain wallet is used for establishing connection with the forwarding server by using the public key as identity information, and comprises the following specific steps: the blockchain wallet establishes long connection with a forwarding server by using all public keys respectively; or the blockchain wallet uses all public keys to establish long connection with a wallet proxy, the wallet proxy uses the public keys to establish long connection with a forwarding server, and meanwhile, the blockchain wallet sets proxy information of all public keys on the forwarding server; the method comprises the steps of sending transaction information to a blockchain, and updating account balance and transaction history records; the merck path information is used for inquiring the merck tree server about the current transaction, and meanwhile, the merck path information and the transaction information are sent to the forwarding server; the merck path information and the transaction information are received and transmitted by the forwarding server, and transaction verification is carried out and transaction is confirmed according to the merck path information;
the forwarding server is used for identity verification and connection management of the blockchain wallet and the wallet proxy; the merck path information and the transaction information sent by the transaction initiator blockchain wallet are received; the method comprises the steps of sending transaction information and merck path information to a transaction receiver according to a public key of the receiver in the transaction information; the transaction receiver is a blockchain wallet or wallet proxy; the forwarding servers are multiple, and each forwarding server sends the received merck path information and the transaction information to all other forwarding servers;
the wallet proxy establishes long connection with the forwarding server by using the public key of the wallet proxy, and establishes long connection with the managed blockchain wallet of the wallet proxy at the same time, and is used for updating account balance and transaction history record information of the managed blockchain wallet of the transaction initiator; the merck path information and the transaction information sent by the transaction initiator blockchain wallet managed by the merck path information are received and sent to a forwarding server; the merck path information and the transaction information are received, and transaction verification and transaction confirmation are carried out according to the merck path information.
CN201911226055.3A 2019-12-04 2019-12-04 Transaction method and system of blockchain wallet Active CN110992182B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911226055.3A CN110992182B (en) 2019-12-04 2019-12-04 Transaction method and system of blockchain wallet

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911226055.3A CN110992182B (en) 2019-12-04 2019-12-04 Transaction method and system of blockchain wallet

Publications (2)

Publication Number Publication Date
CN110992182A CN110992182A (en) 2020-04-10
CN110992182B true CN110992182B (en) 2023-06-16

Family

ID=70089996

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911226055.3A Active CN110992182B (en) 2019-12-04 2019-12-04 Transaction method and system of blockchain wallet

Country Status (1)

Country Link
CN (1) CN110992182B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111709735B (en) * 2020-04-28 2023-10-20 上海墨珩网络科技有限公司 System and method for processing trusted transaction based on blockchain
CN113256289B (en) * 2021-05-17 2023-06-30 网易(杭州)网络有限公司 Block chain judging method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108765151A (en) * 2018-05-11 2018-11-06 深圳市恋上互联网技术有限公司 A kind of method of commerce based on block chain
CN108805565A (en) * 2018-05-17 2018-11-13 深圳前海微众银行股份有限公司 Promise existence proof method, equipment and readable storage medium storing program for executing based on block chain
CN109544331A (en) * 2018-10-12 2019-03-29 深圳壹账通智能科技有限公司 Supply chain financial application method, apparatus and terminal device based on block chain
CN110175840A (en) * 2019-04-19 2019-08-27 华中科技大学 Method, client, alliance's chain and the system of light wallet mechanism are realized in alliance's chain
CN110334175A (en) * 2019-04-29 2019-10-15 山东冰链网络信息科技有限公司 Zero-knowledge proof method, system and the storage medium of medical document

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016164310A1 (en) * 2015-04-05 2016-10-13 Digital Asset Holdings Digital asset intermediary electronic settlement platform
KR101919590B1 (en) * 2017-05-10 2019-02-08 주식회사 코인플러그 METHOD FOR PAYING COST OF IoT DEVICE BASED ON BLOCKCHAIN AND MERKLE TREE STRUCTURE RELATED THERETO, AND SERVER, SERVICE PROVIDING TERMINAL, AND DIGITAL WALLET USING THE SAME

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108765151A (en) * 2018-05-11 2018-11-06 深圳市恋上互联网技术有限公司 A kind of method of commerce based on block chain
CN108805565A (en) * 2018-05-17 2018-11-13 深圳前海微众银行股份有限公司 Promise existence proof method, equipment and readable storage medium storing program for executing based on block chain
CN109544331A (en) * 2018-10-12 2019-03-29 深圳壹账通智能科技有限公司 Supply chain financial application method, apparatus and terminal device based on block chain
CN110175840A (en) * 2019-04-19 2019-08-27 华中科技大学 Method, client, alliance's chain and the system of light wallet mechanism are realized in alliance's chain
CN110334175A (en) * 2019-04-29 2019-10-15 山东冰链网络信息科技有限公司 Zero-knowledge proof method, system and the storage medium of medical document

Also Published As

Publication number Publication date
CN110992182A (en) 2020-04-10

Similar Documents

Publication Publication Date Title
CN107193490B (en) Distributed data storage system and method based on block chain
CN109639406B (en) Efficient trust solution method based on block chain and IPFS
CN110569675B (en) Multi-Agent transaction information protection method based on block chain technology
US20210084105A1 (en) System and apparatus to manage data using a peer-to-peer network and the blockchain
CN108924092B (en) Public arbitration distributed cloud storage method and system based on block chain
US11962577B2 (en) Resource transfer setup and verification
WO2020186788A1 (en) Blockchain-based certificate verification method and device, storage medium, and electronic device
US20190199515A1 (en) Concurrent transaction processing in a high performance distributed system of record
CN102170440B (en) Method suitable for safely migrating data between storage clouds
WO2019114096A1 (en) Blockchain-based storage system
CN104615666B (en) Contribute to the client and server of reduction network communication
CN110741372A (en) Computer-implemented system and method for managing transactions on a blockchain network
CN108776929A (en) Bill processing method, system based on block chain database and readable storage medium storing program for executing
WO2018228973A1 (en) Improved hardware security module management
CN104520822A (en) Data storage application programming interface
CN111611315A (en) Financial big data-oriented multi-branch tree structure block chain integrated optimization storage method
WO2022121538A1 (en) Data synchronization method and system based on blockchain, and related device
US20230316273A1 (en) Data processing method and apparatus, computer device, and storage medium
CN112101942B (en) Transaction request processing method, system, device and equipment based on block chain
CN101647006A (en) Be used for method of data backup and system
WO2019184775A1 (en) Management data storage method and device, and storage medium
CN110992182B (en) Transaction method and system of blockchain wallet
CN112036886A (en) Block chain-based power big data exchange method and system
CN113343213A (en) Multi-CA cross-domain authentication method based on block chain in distributed autonomous network
CN109146677A (en) Method, computer system and the readable storage medium storing program for executing of parallel building block chain view

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