CN110992182A - Transaction method and system of block chain wallet - Google Patents

Transaction method and system of block chain wallet Download PDF

Info

Publication number
CN110992182A
CN110992182A CN201911226055.3A CN201911226055A CN110992182A CN 110992182 A CN110992182 A CN 110992182A CN 201911226055 A CN201911226055 A CN 201911226055A CN 110992182 A CN110992182 A CN 110992182A
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.)
Granted
Application number
CN201911226055.3A
Other languages
Chinese (zh)
Other versions
CN110992182B (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, which comprise the following steps: the Merck tree server acquires Merck tree information in a block chain; establishing connection between the block chain wallet and a forwarding server; the blockchain wallet sends transaction information to the blockchain, and meanwhile, the account balance is updated; 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 blockchain wallet implementation mode, so that a wallet server does not need to crawl transaction information on a blockchain, the transaction of the wallet is not influenced by large blocks, the transaction efficiency is improved, and the operation cost of a wallet service provider is reduced.

Description

Transaction method and system of block chain wallet
Technical Field
The application relates to the technical field of blockchain, in particular to a transaction method and a transaction system for a blockchain wallet.
Background
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. The Blockchain (Blockchain) is an important concept of bitcoin, which is essentially a decentralized database, and is used as the underlying technology of bitcoin, and is a series of data blocks which are associated by using a cryptographic method, wherein each data block contains information of a batch of bitcoin network transactions, and the information is used for verifying the validity of the information and generating the next block.
In the blockchain, there is no concept of a balance account, the balance of the account is composed of a plurality of UTXO (unspent transaction Output) records, each income is one UTXO, the whole UTXO needs to be spent when spent, if any, a new UTXO needs to be generated, and the amount information in the UTXO cannot be changed. Due to the characteristics of blockchains, it cannot provide a centralized service to query the balance and history of each subscriber. In this case, a software is needed to help the user manage the assets on the blockchain, which is a wallet whose main functions include public and private key management, history inquiry, balance inquiry, sending and receiving transactions, etc. The wallet in the market at present has the following two main implementation modes:
in the first mode, a background service crawls all transaction information on a blockchain, then analyzes the transaction of each address, stores the transaction into a relational database, updates the balance of a user if the transaction related to the current wallet user is crawled, and requests data in the relational database from a server when a wallet client inquires the balance or a history. When the wallet sends the transaction, the wallet requests a set of UTXOs from the server, and then constructs the transaction to be sent to the blockchain network. Unlike traditional centralized wallets, this implementation is not possible for wallet providers to directly obtain information about user balance changes, but only to screen out user-related transactions from the vast number of transactions on the blockchain.
In current bitcoin blockchains, the number of blocks exceeds 60 million, the number of transactions exceeds 3 hundred million, and address-dependent pipelining exceeds 20 hundred million. The block size limit of the block chain is 1M (megabyte), 8M, 128M, 256M. There have been very large blockchains with a size of over 1GB (GB gigabytes) per chunk, a size of 10TB (TB stands for terabytes) for the entire blockchain, and a number of transactions per ten minutes of over five million. In the near future, the limitation of the block size will be cancelled, the transaction amount and the size of the whole chain will grow exponentially, and only the oversized block with the unlimited size can bear massive transactions in the real world and various data which need to be permanently stored, cannot be tampered and are convenient to audit. In this case, maintaining all nodes of a block chain and crawling data from all nodes has the following problems: 1. crawling all transactions inside a block requires a large amount of computation; 2. storage transactions require a large amount of storage space; 3. low efficiency, and untimely transaction update; 4. in order to realize efficient storage and query, a database-dividing and table-dividing scheme of the relational database is complex. Both of these problems result in increased operating costs for the wallet operator.
In a second mode, for example, the BIP 270 and paymail modes, a third-party server is adopted to perform unified centralized management on wallets, and when a transaction occurs between wallets, a payment template needs to be inquired from a server corresponding to a mailbox domain name according to an email box of an opposite party, then the template is filled, the transaction is constructed, and the server submits the transaction. The problem of this method is that a third-party server is required to do a lot of work, the third-party server needs to have a domain name corresponding to a mailbox, needs to support payment template generation, and needs to manage UTXO and history records of a receiving end. In addition, the wallet of the user excessively depends on the third-party server, so that the safety of the assets cannot be guaranteed, and the wallet cannot be freely migrated.
Therefore, how to reduce the operation cost and manage the blockchain wallet efficiently and flexibly is one of the problems that the wallet provider is in urgent need to solve at present.
Disclosure of Invention
One of the objectives of the present invention is to overcome the above disadvantages and provide a point-to-point transaction method for a blockchain wallet, so that the wallet service end does not need to crawl the blockchain transaction, and thus the transaction of the wallet is not affected by large blocks, and the transaction efficiency of the wallet is improved.
In order to solve the technical problem, the invention provides a transaction method of a blockchain wallet, which comprises the following steps:
the Merck tree server acquires and stores the Merck tree information of each block in the block chain;
the block chain wallet uses a 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 a transaction number, an initiator public key, a receiver public key and transaction amount information;
the transaction initiator blockchain wallet updates account balance and transaction history;
the transaction initiator blockchain wallet queries the Merck tree server for Merck path information for 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 provides a point-to-point transaction method of the blockchain wallet, transaction parties carry out transaction communication through a forwarding server, and meanwhile, the Merck tree information of the blockchain is obtained and the blockchain transaction information is verified according to the Merck tree information, so that a wallet service end does not need to crawl the transaction information on the blockchain, the transaction efficiency is improved, the disk storage space is reduced, the transaction of the wallet is not affected by a large block, and the operation cost of a wallet service provider is reduced. In addition, through a public key-based authenticated communication model, wallets of various facilitators can communicate with each other through this communication model.
Further, the step of "the merck tree server obtaining and storing the merck tree information of each block in the block chain" includes the specific steps of:
acquiring the numbers of all transactions in a block according to the recorded sequence;
starting from the first transaction number, combining every two adjacent odd transaction numbers and even transaction numbers, and calculating to generate a hash value of the previous layer, wherein if the total number of transactions is an odd number, the last transaction number is calculated to generate the hash value of the previous layer;
repeating the operation on the generated hash value until generating a unique hash value to obtain the Merck tree structure of the block;
saving the Merck tree structure and the current block height generated in the previous step.
Further, the number of the forwarding servers is multiple, and each forwarding server sends the received Merck path information and the received transaction information to all other forwarding servers.
By setting the forwarding server cluster, the capacity expansion and load balance of the forwarding server can be conveniently carried out, the message processing capacity and the message processing efficiency are improved, meanwhile, the mutual disaster recovery backup can be realized, and the failure rate is reduced.
Further, the "the blockchain wallet establishes a connection with the forwarding server using the public key as the identity information" specifically includes:
the blockchain wallet respectively establishes long connections with a forwarding server by using all public keys;
or the blockchain wallet establishes a long connection with a wallet proxy by using all public keys, the wallet proxy establishes a long connection with a forwarding server by using a self public key, and meanwhile, the blockchain wallet sets proxy information of all public keys on the forwarding server.
Through the wallet agency mechanism, the connection quantity of the wallet and the forwarding server can be greatly reduced, the design and implementation complexity of the forwarding server is reduced, the operation efficiency is improved, and meanwhile, the access and management of different wallet service providers are facilitated.
Further, the "updating the account balance and the transaction history record by the transaction initiator blockchain wallet" specifically includes:
if the transaction initiator blockchain wallet is directly connected with the forwarding server, locally updating account balance and transaction history;
and if the transaction initiator blockchain wallet is connected with a forwarding server through a wallet proxy, sending the account balance and the transaction history record to the wallet proxy, and updating the account balance and the transaction history record by the wallet proxy.
Further, the "the transaction initiator blockchain wallet sends the merck path information and the transaction information to the forwarding server" specifically includes:
if the transaction initiator blockchain wallet is directly connected with a forwarding server, sending the Merck path information and the transaction information to the forwarding server;
and if the transaction initiator blockchain wallet is connected with a forwarding server through a wallet agent, the Merck path information and the transaction information are sent to the wallet agent, and then the wallet agent sends the Merck path information and the transaction information to the forwarding server.
Further, the "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 includes:
the forwarding server stores the received message;
if the public key of the transaction receiver blockchain wallet specifies agent information, searching corresponding connection according to the public key of the wallet agent, and sending the transaction information and the Merck path information;
if the public key of the transaction receiver blockchain wallet does not specify agent 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 receiver performs transaction verification and transaction confirmation according to the Merck path information, and the method comprises the following steps:
the transaction receiving party acquires and stores the head information of each block in the block chain; the transaction recipient is a blockchain wallet or a 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 acquired 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 acquired from the head information of the corresponding height block, the transaction is considered to be effective, and the account balance and the transaction history are updated.
Accordingly, the present application also provides a transaction system for a blockchain wallet, 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 the Merck tree information of each block in the block chain, and meanwhile, the Merck path information query can be carried out according to the provided transaction number;
the block chain wallet is used for establishing connection with a forwarding server by using a public key as identity information, or establishing long connection with a wallet agent by using all public keys and setting agent information of all public keys on the forwarding server, and is used for sending transaction information to a block chain and updating account balance and transaction history; the Merck path information is used for inquiring the Merck path information of the current transaction from the Merck tree server, and simultaneously the Merck path information and the transaction information are sent to the forwarding server; and the system is used for receiving the Merck path information and the transaction information sent by the forwarding server, and performing transaction verification and confirming the transaction according to the Merck path information.
A forwarding server for authentication and connection management of the blockchain wallet, wallet proxy; the system comprises a first module for receiving the Merck path information and the transaction information sent by a transaction initiator blockchain wallet; the system is used for sending the transaction information and the Merck path information to a transaction receiver according to a receiver public key in the transaction information; the transaction recipient is a blockchain wallet or a wallet proxy;
the wallet agent establishes long connection with the forwarding server by using a self public key, and simultaneously establishes long connection with the blockchain wallet managed by the wallet agent, and is used for updating account balance and transaction history information of the blockchain wallet of the transaction initiator managed by the wallet agent; the system comprises a forwarding server and a block chain wallet management module, wherein the forwarding server is used for sending the Merck path information and the transaction information sent by the block chain wallet of a transaction initiator managed by the forwarding server to the forwarding server; and the system is used for receiving the Merck path information and the transaction information sent by the forwarding server, and performing transaction verification and confirming the transaction according to the Merck path information.
Further, the number of the forwarding servers is multiple, and each forwarding server sends the received Merck path information and the received transaction information to all other forwarding servers.
Different from the prior art, the technical scheme of the invention has the following beneficial effects:
1. the method provides a point-to-point transaction method of the blockchain wallet, transaction parties carry out transaction communication through a forwarding server, and meanwhile, the Merck tree information of the blockchain is obtained and the blockchain transaction information is verified according to the Merck tree information, so that a wallet service end does not need to crawl the transaction information on the blockchain, the transaction efficiency is improved, the disk storage space is reduced, the transaction of the wallet is not affected by a large block, and the operation cost of a wallet service provider is reduced. In addition, through a public key-based authenticated communication model, wallets of various facilitators can communicate with each other through this communication model.
2. By setting the forwarding server cluster, the capacity expansion and load balance of the forwarding server can be conveniently carried out, the message processing capacity and the message processing efficiency are improved, meanwhile, the mutual disaster recovery backup can be realized, and the failure rate is reduced.
3. Through the wallet agency mechanism, the connection quantity of the wallet and the forwarding server can be greatly reduced, the design and implementation complexity of the forwarding server is reduced, the operation efficiency is improved, and meanwhile, the access and management of different wallet service providers are facilitated.
Drawings
Fig. 1 is a flow chart of the steps of a transaction method for a blockchain wallet of the present invention.
FIG. 2 is a schematic diagram of the structure of the Merck tree according to the present invention.
Figure 3 is a block diagram of a transaction system for a blockchain wallet of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, a flow chart of the steps of a transaction method of a blockchain wallet of the present invention includes the following steps:
step 1, a Merck tree server acquires and stores Merck tree information of each block in a block chain;
in a block chain, each block generally 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 previous block, difficulty, generation time, and Merkel root. The Merck tree is a binary tree formed by all transactions in a current block, leaf nodes of the binary tree are numbers of each transaction, a hash value is generated by calculation after pairwise pairing and combination according to a transaction sequence, and a unique hash value is finally obtained by calculation through continuous circulation pairwise pairing, namely the root of the Merck tree. In the present application, the complete tree structure of the merck tree needs to be saved for the transaction verification of the transaction receiver, which is usually saved in a relational database. The specific steps of the Merck tree server for obtaining and storing the Merck tree information of each block in the block chain are as follows:
step 11, acquiring the numbers of all transactions in a block according to the recorded sequence;
step 12, starting from the first transaction number, combining every two adjacent odd transaction numbers and even transaction numbers, and calculating to generate a hash value of the previous layer, and if the total number of transactions is an odd number, calculating to generate a hash value of the previous layer for the last transaction number;
step 13, repeating the above operations on the generated hash value, and continuously generating the hash value of the previous layer until a top layer composed of unique hash values is obtained, wherein the unique hash values are the roots 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;
step 14, saving the Merck tree structure and the current block height generated in the previous step. The block height refers to the sequential number of blocks in the block chain, and increases with the number of blocks. After the Merck tree structure corresponding to each block in the whole block chain and the height of the block are stored, the block chain wallet can independently judge whether a transaction is in one block or not only by knowing the Hash value of the path corresponding to the Merck tree corresponding to the transaction, and verify the transaction.
It should be noted that, since the block height of the block chain is increased continuously during the operation process, the acquisition and storage of the latch tree information of each block in the block chain by the latch tree server must also continuously monitor the block height of the block chain, and whenever a new block is added to the block chain, the latch tree structure information in the block is synchronized accordingly.
Step 2, the block chain 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 the transaction information between 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 wallets 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 a blockchain, and can be divided into a full-node wallet and a light wallet (SPV), wherein the full-node wallet, in addition to managing its own assets, also stores information on all blockchains, can verify whether messages sent by other people are real, and is usually large in size, while the light wallet can only send messages and only verify transactions related to the wallet, and is the most common, portable and efficient, and does not affect daily use of the wallet client, and the wallet is a user of the whole network, so that a commission fee is usually paid for each use. The blockchain wallet must establish a connection with the forwarding server using public keys as identity information, and each public key is a unique identity in the transaction process of the blockchain wallet.
In a preferred embodiment, since one blockchain wallet may have a plurality of public keys, each public key 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 establishes long connection with the wallet proxy by using all public keys of the blockchain wallet, the wallet proxy establishes long connection with the forwarding server by using the public key of the blockchain wallet, and meanwhile the blockchain wallet sets proxy information of all public keys on the forwarding server, so that the forwarding server forwards all transactions related to the public keys of the blockchain wallet to the set wallet proxy, and in practical application, the set proxy information is the one-to-one correspondence relationship between the public keys of the wallet and the public keys of the wallet proxy. Through the wallet agency mechanism, the connection quantity of the wallet and the forwarding server can be greatly reduced, the design and implementation complexity of the forwarding server is reduced, the operation efficiency is improved, and meanwhile, the access and business management of different wallet service providers are facilitated.
Preferably, the forwarding server may also authenticate the public key of the blockchain wallet or wallet proxy, and perform identity verification, allowing only connections to be established through the authenticated blockchain wallet or wallet proxy. Generally, the forwarding server can also charge a certain fee to the blockchain wallet or the wallet agency applying for connection, instead of charging for forwarding transaction, the connection can be established after the fee is successfully charged, a service scheme based on a payment model is provided through the forwarding server, and meanwhile, the forwarding server can be prevented from being attacked from an anonymous wallet end or an illegal wallet.
In another preferred embodiment, a server cluster may be composed of a plurality of forwarding servers, and the blockchain wallet or the wallet proxy may select any one of the forwarding servers in the cluster to connect to, where each forwarding server is configured with address information of all other forwarding servers in the cluster, and the forwarding server forwards the transaction message to all other forwarding servers when receiving the transaction message. By setting the forwarding server cluster, the capacity expansion and load balance of the forwarding server can be conveniently carried out, the message processing capacity and the message processing efficiency are improved, meanwhile, the mutual disaster recovery backup can be realized, and the failure rate is reduced.
Step 3, the transaction initiator blockchain wallet sends transaction information to the blockchain; the transaction initiator blockchain wallet constructs a transaction message, which usually includes a transaction number, a transaction initiator public key, a transaction receiver public key, a transaction amount and other information, and submits the message to a P2P network of the blockchain, and the blockchain confirms the transaction according to an operation mechanism of the blockchain and writes the transaction into a new block.
Step 4, updating account balance and transaction history records by the transaction initiator blockchain wallet;
in the technical scheme of the application, the account balance and the transaction history of the wallet can be stored locally so as to be convenient for inquiry, and the storage mode can be stored through a database or a file. Specifically, if the blockchain wallet is directly connected to the forwarding server, the blockchain wallet locally updates the account balance and transaction history; 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 to the wallet proxy, and the account balance and the transaction history are updated by the wallet proxy. In a specific practical application scenario, one wallet agent generally corresponds to one wallet facilitator, and is responsible for managing all blockchain wallets under the wallet facilitator, receiving transaction information of all blockchain wallets of the facilitator, and simultaneously performing unified management on the balance and transaction history of all blockchain wallets, and the blockchain wallets can request the wallet agent to query the balance and transaction record.
Step 5, the transaction initiator blockchain wallet inquires the Merck path information of the current transaction from the Merck tree server; when the transaction is confirmed by the block chain to be written into the block, the Merck tree server obtains and stores the Merck tree structure of the block. At this time, the transaction initiator blockchain wallet may query the tach path information of the current transaction from the tach tree server, where the tach path information includes the height of the block to which the current transaction belongs and the set of transaction numbers or hash values, and the root of the tach tree may be calculated by using the current transaction number and the queried tach path information. If the transaction initiator blockchain wallet cannot inquire the current transaction's Merck path information from the Merck tree server for a long time, it indicates that the transaction is not confirmed by the blockchain, and the transaction initiator blockchain wallet will perform rollback processing on the transaction. 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 last-layer transaction number of the merck tree with the block height N +2 are stored in the database. If the blockchain wallet needs to query the corresponding Merck path for transaction 5, the Merck tree server will return the height of the block N +2 where transaction 5 is located and a minimum set of transaction 6, second-level hash value 4, and first-level hash value 1. The root of the Merck tree can be calculated from 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 sends 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; and if the transaction initiator blockchain wallet is connected with the forwarding server through the wallet agent, transmitting the queried Merck path information and transaction information to the wallet agent, and transmitting the Merck path information and the transaction information to the forwarding server by the wallet agent.
Step 7, 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;
in a preferred embodiment, a forwarding server cluster may be composed of a plurality of forwarding servers, 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, usually in a relational database;
step 72, if the public key of the transaction receiver blockchain wallet specifies the agent information, that is, the corresponding wallet agent public key is set, searching the corresponding connection according to the public key of the wallet agent, and sending the transaction information and the Merck path information through the connection;
and 73, if the public key of the transaction receiver blockchain wallet does not specify the agent 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 sending the transaction information and the Merck path information through connection.
And 8, the transaction receiver performs transaction verification and confirms the transaction according to the Merck path information, wherein the receiver refers to a blockchain wallet or a wallet agency, if the receiver is the blockchain wallet, the transaction verification and confirmation are performed by the blockchain wallet, and if the receiver is the wallet agency, the transaction verification and confirmation are performed by the wallet agency for all the blockchain wallets managed by the wallet agency. The transaction receiver carries out transaction verification and confirms the transaction, and the method comprises the following steps:
step 81, the transaction receiving party acquires and stores the header information of each block in the block chain; here, the purpose of the transaction receiver to retrieve all the tile header information from the blockchain is to obtain the value of the merck root corresponding to each tile height for verification of the transaction. Since the block height of the block chain is continuously increased, the header information of the newly added block must be synchronously acquired and stored every time a new block is generated. Taking a bitcoin block chain as an example, the head of each block occupies 80 bytes, the height of the current block is about 60 ten thousand, and the total space occupies about 50M, if the transaction receiver is a block chain wallet, the block chain wallet needs to occupy 50M space to store the head information of the block chain, if the transaction receiver is a wallet proxy, the wallet proxy uniformly acquires and stores the head information of each block in the block chain, and each block chain wallet is not used 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, according to the Merck tree in FIG. 2, the step of calculating the root of the Merck tree for Merck path information associated with transaction 5 is: and combining the serial number of the transaction 5 and the serial number of the transaction 6, calculating a hash value to obtain a second-layer hash value 3, combining the second-layer hash value with the second-layer hash value 4, calculating a hash value to obtain a first-layer hash value 2, combining the first-layer hash value with the first-layer hash value 1, and calculating a hash value to obtain the root of the Merck tree.
And step 83, 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 block with the corresponding height, and according to the generation mechanism of the Merck tree, the transaction receiver can autonomously judge whether a transaction is in one block only by knowing 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 transaction place, the transaction receiver can directly obtain the root of the Merck tree from the head information of the block with the corresponding height and compare the root with the calculated root of the Merck tree. If the two are equal, the transaction is considered to be real and effective, and the account balance and the transaction history are updated by the blockchain wallet or the wallet agent; if the data are not equal, the data are illegally modified in the transmission process, and the balance updating and the transaction record are not carried out by the local wallet.
The method provides a point-to-point transaction method of the blockchain wallet, transaction parties carry out transaction communication through a forwarding server, and meanwhile, the Merck tree information of the blockchain is obtained and the blockchain transaction information is verified according to the Merck tree information, so that a wallet service end does not need to crawl the transaction information on the blockchain, the transaction efficiency is improved, the disk storage space is reduced, the transaction of the wallet is not affected by a large block, and the operation cost of a wallet service provider is reduced. In addition, through a public key-based authenticated communication model, wallets of various facilitators 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 the Merck tree information of each block in the block chain, and meanwhile, the Merck path information query can be carried out according to the provided transaction number; the specific steps of the Merck tree server for acquiring and storing the Merck tree information of each block in the block chain are as follows: acquiring the numbers of all transactions in a block according to the recorded sequence; starting from the first transaction number, combining every two adjacent odd transaction numbers and even transaction numbers, and calculating to generate a hash value of the previous layer, wherein if the total number of transactions is an odd number, the last transaction number is calculated to generate the hash value of the previous layer; repeatedly executing the operation on the generated hash value, and continuously generating the hash value of the previous layer until a top layer consisting of a 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; saving the Merck tree structure and the current block height generated in the previous step. The Merck tree server continuously monitors the block height of the block chain, and when a new block is added to the block chain, the Merck tree structure information in the block is synchronized accordingly.
The block chain wallet is a client used for managing assets on a block chain, can be divided into a full-node wallet and a light wallet, is connected with a forwarding server by using a public key as identity information, or is connected with a wallet agent by using all public keys and sets agent information of all public keys on the forwarding server, and is used for sending transaction information to the block chain and updating local account balance and transaction history; the Merck path information is used for inquiring the Merck path information of the current transaction from the Merck tree server, and simultaneously the Merck path information and the transaction information are sent to the forwarding server; and the system is used for receiving the Merck path information and the transaction information sent by the forwarding server, and performing transaction verification and confirming the transaction according to the Merck path information.
A forwarding server for authentication and connection management of the blockchain wallet, wallet proxy; the system is used for receiving the Merck path information and the transaction information sent by a transaction initiator blockchain wallet; the transaction receiver is used for sending the transaction information and the Merck path information to the transaction receiver according to the public key of the transaction receiver block chain wallet; the transaction recipient is a blockchain wallet or a wallet proxy;
the wallet agent, in a specific practical application scenario, generally corresponds to a wallet facilitator, and is responsible for managing all blockchain wallets under the wallet facilitator, receiving transaction information of all blockchain wallets of the facilitator, and simultaneously performing unified management on balance and transaction history of all blockchain wallets, and the blockchain wallets can request the wallet agent to query balance and transaction record. The wallet agent establishes long connection with a forwarding server by using a self public key, and simultaneously establishes long connection with a blockchain wallet managed by the wallet agent, and is used for updating account balance and transaction history information of the blockchain wallet of a transaction initiator managed by the wallet agent; the system comprises a forwarding server, a block chain wallet and a communication module, wherein the forwarding server is used for sending the Merck path information and the transaction information sent by the block chain wallet of a transaction initiator managed by the forwarding server to the forwarding server; and the system is used for receiving the Merck path information and the transaction information sent by the forwarding server, and performing transaction verification and confirming the transaction according to the Merck path information.
Preferably, the number of the forwarding servers in the present application is multiple, and a forwarding server cluster is formed, and each forwarding server sends the received merck path information and the received transaction information to all other forwarding servers.
The above embodiments are merely illustrative of the technical solutions of the present invention, and the present invention is not limited to the above embodiments, and any modifications or alterations according to the principles of the present invention should be within the protection scope of the present invention.

Claims (10)

1. A method of trading a blockchain wallet, comprising the steps of:
the Merck tree server acquires and stores the Merck tree information of each block in the block chain;
the block chain wallet uses a 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 a transaction number, an initiator public key, a receiver public key and transaction amount information;
the transaction initiator blockchain wallet updates account balance and transaction history;
the transaction initiator blockchain wallet queries the Merck tree server for Merck path information for 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 method for trading with a blockchain wallet as claimed in claim 1, wherein the step of the "Merck tree server obtaining and storing the Merck tree information of each block in the blockchain" comprises the following steps:
acquiring the numbers of all transactions in a block according to the recorded sequence;
starting from the first transaction number, combining every two adjacent odd transaction numbers and even transaction numbers, and calculating to generate a hash value of the previous layer, wherein if the total number of transactions is an odd number, the last transaction number is calculated to generate the hash value of the previous layer;
repeating the operation on the generated hash value until generating a unique hash value to obtain the Merck tree structure of the block;
saving the Merck tree structure and the current block height generated in the previous step.
3. The blockchain wallet transaction method of claim 1, wherein the number of the forwarding servers is plural, and each forwarding server transmits the received merck path information and the transaction information to all other forwarding servers.
4. The method of claim 1, wherein the "blockchain wallet establishes a connection with a forwarding server using a public key as identity information" specifically comprises:
the blockchain wallet respectively establishes long connections with a forwarding server by using all public keys;
or the blockchain wallet establishes a long connection with a wallet proxy by using all public keys, the wallet proxy establishes a long connection with a forwarding server by using a self public key, and meanwhile, the blockchain wallet sets proxy information of all public keys on the forwarding server.
5. The method of trading with a blockchain wallet of claim 4, wherein the "the transaction initiator blockchain wallet updates account balance and transaction history" is specifically:
if the transaction initiator blockchain wallet is directly connected with the forwarding server, locally updating account balance and transaction history;
and if the transaction initiator blockchain wallet is connected with a forwarding server through a wallet proxy, sending the account balance and the transaction history record to the wallet proxy, and updating the account balance and the transaction history record by the wallet proxy.
6. The blockchain wallet transaction method of claim 4, wherein the "the transaction initiator blockchain wallet sends the merck path information and the transaction information to the forwarding server" specifically is:
if the transaction initiator blockchain wallet is directly connected with a forwarding server, sending the Merck path information and the transaction information to the forwarding server;
and if the transaction initiator blockchain wallet is connected with a forwarding server through a wallet agent, the Merck path information and the transaction information are sent to the wallet agent, and then the wallet agent sends the Merck path information and the transaction information to the forwarding server.
7. The method for a transaction with a blockchain wallet as claimed in claim 4, wherein said forwarding server sends said transaction information and said Merck path information to a transaction receiver according to a receiver public key in said transaction information, specifically:
the forwarding server stores the received message;
if the public key of the transaction receiver blockchain wallet specifies agent information, searching corresponding connection according to the public key of the wallet agent, and sending the transaction information and the Merck path information;
if the public key of the transaction receiver blockchain wallet does not specify agent 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.
8. The blockchain wallet transaction method of claim 4, wherein the transaction receiver performs transaction verification and transaction confirmation according to the Merck path information, comprising the steps of:
the transaction receiving party acquires and stores the head information of each block in the block chain; the transaction recipient is a blockchain wallet or a 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 acquired 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 acquired from the head information of the corresponding height block, the transaction is considered to be effective, and the account balance and the transaction history are updated.
9. A transaction system for a blockchain wallet 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 the Merck tree information of each block in the block chain, and meanwhile, the Merck path information query can be carried out according to the provided transaction number;
the block chain wallet is used for establishing connection with a forwarding server by using a public key as identity information, or establishing long connection with a wallet agent by using all public keys and setting agent information of all public keys on the forwarding server, and is used for sending transaction information to a block chain and updating account balance and transaction history; the Merck path information is used for inquiring the Merck path information of the current transaction from the Merck tree server, and simultaneously the Merck path information and the transaction information are sent to the forwarding server; the system is used for receiving the Merck path information and the transaction information sent by the forwarding server, and performing transaction verification and confirming the transaction according to the Merck path information;
a forwarding server for authentication and connection management of the blockchain wallet, wallet proxy; the system comprises a first module for receiving the Merck path information and the transaction information sent by a transaction initiator blockchain wallet; the system is used for sending the transaction information and the Merck path information to a transaction receiver according to a receiver public key in the transaction information; the transaction recipient is a blockchain wallet or a wallet proxy;
the wallet agent establishes long connection with the forwarding server by using a self public key, and simultaneously establishes long connection with the blockchain wallet managed by the wallet agent, and is used for updating account balance and transaction history information of the blockchain wallet of the transaction initiator managed by the wallet agent; the system comprises a forwarding server and a block chain wallet management module, wherein the forwarding server is used for sending the Merck path information and the transaction information sent by the block chain wallet of a transaction initiator managed by the forwarding server to the forwarding server; and the system is used for receiving the Merck path information and the transaction information sent by the forwarding server, and performing transaction verification and confirming the transaction according to the Merck path information.
10. The blockchain wallet transaction system of claim 9, wherein the number of forwarding servers is plural, and each forwarding server transmits the received merck path information and the transaction information to all other forwarding servers.
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 true CN110992182A (en) 2020-04-10
CN110992182B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111709735A (en) * 2020-04-28 2020-09-25 上海墨珩网络科技有限公司 Credible transaction processing system and method based on block chain
CN113256289A (en) * 2021-05-17 2021-08-13 网易(杭州)网络有限公司 Block chain judging method and device and electronic equipment

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160292680A1 (en) * 2015-04-05 2016-10-06 Digital Asset Holdings Digital asset intermediary electronic settlement platform
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
US20180330349A1 (en) * 2017-05-10 2018-11-15 Coinplug, Inc. 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
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

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160292680A1 (en) * 2015-04-05 2016-10-06 Digital Asset Holdings Digital asset intermediary electronic settlement platform
US20180330349A1 (en) * 2017-05-10 2018-11-15 Coinplug, Inc. 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
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

Cited By (4)

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

Also Published As

Publication number Publication date
CN110992182B (en) 2023-06-16

Similar Documents

Publication Publication Date Title
US11764950B2 (en) System or method to implement right to be forgotten on metadata driven blockchain using shared secrets and consensus on read
CN111028023B (en) Tax management method, apparatus, medium and electronic device based on block chain system
CN108924092B (en) Public arbitration distributed cloud storage method and system based on block chain
GB2565411A (en) Improved hardware security module management
CN110046894B (en) Erasure code-based block chain establishing method capable of reconstructing groups
WO2019114096A1 (en) Blockchain-based storage system
WO2018228974A1 (en) Expendable cryptographic key access
US20230316273A1 (en) Data processing method and apparatus, computer device, and storage medium
CN104520822A (en) Data storage application programming interface
CN108923932A (en) A kind of decentralization co-verification model and verification algorithm
CN104603740A (en) Archival data identification
CN112835612A (en) Electronic document version management method and device based on block chain
CN110311782A (en) Zero-knowledge proof method, system and the storage medium of personal information
CN108694189A (en) The management of the Database Systems of co-ownership
WO2023011022A1 (en) Blockchain-based data processing method, and device and computer-readable storage medium
CN112101942A (en) Transaction request processing method, system, device and equipment based on block chain
CN112800439A (en) Key management protocol design method and system for secure storage
CN109146677A (en) Method, computer system and the readable storage medium storing program for executing of parallel building block chain view
CN110992182B (en) Transaction method and system of blockchain wallet
Wang et al. Ess: An efficient storage scheme for improving the scalability of bitcoin network
CN114240409A (en) Cross-chain asset interaction method based on improved Hash time lock
CN113011960A (en) Block chain-based data access method, device, medium and electronic equipment
CN112988852B (en) Block chain-based data management method, device and medium
US20220108404A1 (en) Systems and methods for distributed ledger-based auditing
CN117010889A (en) Data processing method, device, equipment, medium and product

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