CN110163754A - Method, client, block chain and the system of transaction of coining are realized in Fabric block chain - Google Patents
Method, client, block chain and the system of transaction of coining are realized in Fabric block chain Download PDFInfo
- Publication number
- CN110163754A CN110163754A CN201910345998.1A CN201910345998A CN110163754A CN 110163754 A CN110163754 A CN 110163754A CN 201910345998 A CN201910345998 A CN 201910345998A CN 110163754 A CN110163754 A CN 110163754A
- Authority
- CN
- China
- Prior art keywords
- coining
- user
- block chain
- utxo
- coin
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/401—Transaction verification
- G06Q20/4014—Identity check for transactions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q40/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Abstract
The invention discloses method, client, block chain and systems that transaction of coining is realized in a kind of Fabric block chain, belong to block chain technical field, it include: client to Fabric block chain transmission request data, to initiate transaction request of coining to Fabric block chain;Receiving node in Fabric block chain calls intelligent contract, to be verified according to identity and signature of the request data to the user that coins, if two verifyings pass through, and whether token quantity is all larger than zero in output data of respectively coining, a corresponding UTXO is then generated according to each output data of coining, and UTXO generated is respectively stored into the database of Fabric block chain with key-value pair mode, and send successful message of coining to client;Otherwise, failure news of coining is sent to client;Client receives whether the message sent from receiving node succeeds to judge to coin, and terminates transaction of coining.The present invention can realize the transaction of coining of safety in Fabric block chain.
Description
Technical field
The invention belongs to block chain technical field, more particularly, to realizing transaction of coining in a kind of Fabric block chain
Method, client, block chain and system.
Background technique
Block chain originates from paper " the Bitcoin:A peer-to-peer electronic cash that middle acute hearing is write
System ", be substantially by the distributed data base for a sustainable growth for participating in safeguarding jointly in many ways, due to its decentralization,
Collective's maintenance, it is open and clear, can not distort, the outstanding features such as quasi- anonymity receive significant attention.Current block chain technology platform
In, it is most representative with bit coin, ether mill and super account book (Hyperledger Fabric).
Fabric block chain (i.e. Hyperledger Fabric) is one with can be inserted into various functional module frameworks
Block platform chain, target are to make the super account book of open source safeguarded jointly by community, and user is facilitated to build enterprise-level
Block chain network, can be with real-time update and inquiry account book using Fabric block chain network user to solve actual business demand
Transaction, and once transaction can not be modified by verifying write-in account book.
Transaction of coining is a kind of special deal in block chain network, realized in block chain network coin transaction can be more
Comprehensively to meet diversified commercialization demand.There is no token in Fabric block chain, also without payment function, therefore can not
Realization is coined transaction.But token function can be realized in Fabric block chain based on chain code (chaincode, also referred to as intelligent contract)
Energy.IBM just gives a solution, successfully realizes token function in Fabric block chain, and further realize
Transaction of coining.In the solution, coin user by client initiation coin trade when, not to coin user into
Row authentication, as long as the member in channel, can call intelligent contract to pass through transaction distribution token of coining.Although
Faith mechanism is good in Fabric block chain, there is the trusting relationship of identity-based between each node, but in the solution
Once there are maloperation or illegal operations, if finding not in time, the token issued can not very likely be recovered after flower goes out,
To compromise the safety of the digital asset of user, the trackability of block chain is also destroyed.In addition, the existing area Fabric
Block chain only checked and verified to the identity of node, and whether the identity that can't verify the user that coins for function of completing to coin closes
Method.
In addition, the storage model of token is that (Unspent Transaction Output, does not spend by account model or UTXO
The transaction output crossed) model, and in Fabric block chain, the storage model of data is key-value pair model, therefore, in Fabric
Transaction of coining is realized in block chain, also needs to solve the problems, such as that data store.
Summary of the invention
In view of the drawbacks of the prior art and Improvement requirement, the present invention provides friendship of coining is realized in a kind of Fabric block chain
Easy method, client, block chain and system, it is intended that realizing the transaction of coining of safety in Fabric block chain.
To achieve the above object, according to the invention to coin in a first aspect, providing and being realized in a kind of Fabric block chain
The method of transaction, comprising:
(1) client sends request data to Fabric block chain, to initiate transaction request of coining to Fabric block chain;
Request data includes that the coin digital certificate of user, M coins output data and the signatures for the user that coins, each
Output data of coining includes receiving the user identifier and corresponding token quantity and token type of coin user;
(2) receiving node that transaction request of coining is received in Fabric block chain calls intelligent contract, according to request
Data verify the identity and signature of the user that coins, if two verifyings pass through, are transferred to step (3);Otherwise, to client
End sends failure news of coining, and is transferred to step (6);
(3) receiving node verifies whether token quantity in output data of respectively coining is all larger than zero, if so, being transferred to step
(4);If it is not, then sending failure news of coining to client, and it is transferred to step (6);
(4) receiving node generates a corresponding UTXO according to each output data of coining, and M UTXO is obtained;
(5) by M UTXO generated respectively with the storage of key-value pair mode into the database of Fabric block chain, to visitor
Family end sends successful message of coining, and is transferred to step (6);
(6) client receives whether the message sent from receiving node succeeds to judge to coin, and terminates transaction of coining;
Wherein, M >=1 is prerecorded with the legitimate digital card for the user that coins corresponding to different token types in intelligent contract
Book.
Further, the content that each UTXO is recorded include: the UTXO UTXO mark, the UTXO it is corresponding coin it is defeated
Data and the cost state of token out;
UTXO mark is used for unique identification UTXO, and records the corresponding pass for output data of coining in the UTXO and transaction of coining
System;The initial time that each UTXO is generated, cost state are not spend.
Further, when storing UTXO with key-value pair mode, the UTXO that the key of key-value pair is the UTXO is identified, and is worth for this
UTXO;Alternatively, the key of key-value pair is the compound keys for recording the corresponding relationship of the UTXO and receipts coin user, it is worth for the UTXO;
Wherein, UTXO mark is used for unique identification UTXO, and records output data of coining in the UTXO and transaction of coining
Corresponding relationship.
Further, the method for transaction of coining is realized in Fabric block chain provided by the present invention, further includes: for
Any one UTXO is over if token therein is spent, its cost state is updated to spend.
Further, the user identifier for receiving coin user is to receive the public key address of coin user.
Further, in step (2), method that receiving node verifies the identity for the user that coins are as follows:
Receiving node is compared after the token type for extracting output data of respectively coining in request data;
If the token type of all output datas of coining is all the same, obtained from intelligent contract opposite with the token type
The digital certificate answered, and from request data extract coin user digital certificate after, by extracted two digital certificates into
Row compares, and the authentication of user of determining to coin when two digital certificates are identical passes through, and does not sentence simultaneously in two digital certificates
Surely the authentication of user of coining does not pass through;
Otherwise, it is determined that the authentication for the user that coins does not pass through.
Further, in step (2), method that receiving node verifies the signature for the user that coins are as follows:
Receiving node will be mentioned after the digital certificate for extracting the user that coins in request data and M output datas of coining
The information and a random number taken is spliced to form the first plaintext data;
Receiving node extracts the public key for the user that coins from the digital certificate for the user that coins, and casting is extracted from request data
After the signature of coin user, extracted signature is decrypted using extracted public key, to obtain the second plaintext data;
If the first plaintext data is identical as the second plaintext data, the signature verification of user of determining to coin passes through;Otherwise, sentence
Surely the signature verification of user of coining does not pass through.
Second aspect according to the invention provides a kind of client, comprising: request initiation module and message sink mould
Block;
Initiation module is requested to be used to send request data to Fabric block chain, to initiate friendship of coining to Fabric block chain
Easily request;Request data includes that the coin digital certificate of user, M coins output data and the signatures for the user that coins, each
Output data of coining includes receiving the user identifier and corresponding token quantity and token type of coin user;
Message reception module is used to receive whether the message sent from receiving node succeeds to judge to coin, and terminates to coin
Transaction;Receiving node is the node that transaction request of coining is received in Fabric block chain;
Wherein, M >=1.
The third aspect according to the invention, provides a kind of Fabric block chain, node include: the first authentication module,
Second authentication module, UTXO generation module and UTXO memory module;
First authentication module be used for receive client initiation coin transaction request when, intelligent contract is called, with root
The identity and signature of the user that coins are verified according to the request data that client is sent, and in any one authentication failed,
Failure news of coining is sent to client;Request data include coin the digital certificate of user, M coin output data and
It coins the signature of user, output data of each coining includes receiving the user identifier and corresponding token quantity and token of coin user
Type, M >=1;
Second authentication module is used for when two verifyings of the first authentication module pass through, and verifying is respectively coined in output data
Whether token quantity is all larger than zero, and obstructed out-of-date verifying, and sends failure news of coining to client;
UTXO generation module is used in the second authentication module when being verified, and is generated according to each output data of coining
One corresponding UTXO, is obtained M UTXO;
UTXO memory module for will M UTXO being generated by UTXO generation module respectively with the storage of key-value pair mode to
In the database of Fabric block chain, and successful message of coining is sent to client;
Wherein, the legitimate digital certificate for the user that coins corresponding to different token types is prerecorded in intelligent contract.
Fourth aspect according to the invention provides the system that transaction of coining is realized in a kind of Fabric block chain, comprising:
Client and Fabric block chain;
Client is used to send request data to Fabric block chain, to ask to Fabric block chain initiation transaction of coining
It asks;Request data includes that the coin digital certificate of user, M coins output data and the signatures for the user that coins, and is each coined
Output data includes receiving the user identifier and corresponding token quantity and token type of coin user;
Fabric block chain, for calling intelligent contract by receiving node therein, with according to request data to use of coining
The identity and signature at family are verified, and obstructed out-of-date in any one verifying, send failure news of coining to client;
Fabric block chain is also used to be verified in the identity to the user that coins with signature by receiving node therein
When, it verifies whether token quantity in output data of respectively coining is all larger than zero, and obstructed out-of-date verifying, coins to client transmission
Failure news;
Fabric block chain, is also used to that token quantity is all larger than zero in output data of respectively coining by receiving node therein
When, a corresponding UTXO is generated according to each output data of coining, M UTXO is obtained;
Fabric block chain is also used to M UTXO generated by receiving node therein respectively with key-value pair mode
In the database for storing Fabric block chain, and successful message of coining is sent to client;
Whether client, be also used to receive and succeeded by the message that receiving node is sent with judging to coin, and terminates to coin friendship
Easily;
Wherein, it is prerecorded with the legitimate digital certificate for the user that coins corresponding to different token types in intelligent contract, connects
Receiving node is the node that transaction request of coining is received in Fabric block chain.
In general, contemplated above technical scheme through the invention, can obtain it is following the utility model has the advantages that
(1) method of transaction of coining, client, block chain are realized in Fabric block chain provided by the present invention and are
The production distribution process of token is converted generation and storing process for UTXO, and generated by intelligent contract by system
UXTO is with the storage of key-value pair mode, to realize the realization for transaction of coining in Fabric block chain.
(2) method of transaction of coining, client, block chain are realized in Fabric block chain provided by the present invention and are
System is prerecorded with legitimate digital certificate corresponding to different token types in intelligent contract, on the one hand, client to
The initiation of Fabric block chain coin transaction request when, can send simultaneously into Fabric block chain includes the identity card of user of coining
Request data including book and signature, on the other hand, receiving node can request data, certificate and intelligence based on the received
Contract carries out stringent verifying to the identity and signature of the user that coins, thereby ensures that the safety for the transaction of coining realized.
(3) method of transaction of coining, client, block chain are realized in Fabric block chain provided by the present invention and are
System, using the compound keys of the corresponding relationship for recording the UTXO and receipts coin user as key, is value with UTXO in its preferred embodiment
By UTXO with key-value pair mode store into the database of Fabric block chain, thus, it is possible to according to user identifier quick search with
Corresponding UTXO, promote transaction quick execution.
(4) method of transaction of coining, client, block chain are realized in Fabric block chain provided by the present invention and are
System, by UTXO storage into the database of Fabric block chain, since the database of Fabric block chain is distributed data
Library is safeguarded jointly by collective after present invention UTXO storage generated, which thereby enhances the safety of storage and management, and look into
It askes more convenient.
Detailed description of the invention
Fig. 1 is the method flow diagram that transaction of coining is realized in Fabric block chain provided in an embodiment of the present invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.As long as in addition, technical characteristic involved in the various embodiments of the present invention described below
Not constituting a conflict with each other can be combined with each other.
To achieve the above object, according to the invention to coin in a first aspect, providing and being realized in a kind of Fabric block chain
The method of transaction, comprising:
(1) client sends request data to Fabric block chain, to initiate transaction request of coining to Fabric block chain;
Request data include coin user digital certificate, M (M >=1) a coin output data and the user that coins label
Name, output data of each coining include receiving the user identifier and corresponding token quantity and token type of coin user;One casting
After the expression of coin output data is coined successfully, receipts coin user obtains the token of the token quantity, the token type, for example, user A
Obtain the token of 5 B types;
In the present embodiment, the user identifier for receiving coin user is to receive the public key address of coin user;
(2) receiving node that transaction request of coining is received in Fabric block chain calls intelligent contract, according to request
Data verify the identity and signature of the user that coins, if two verifyings pass through, are transferred to step (3);Otherwise, to client
End sends failure news of coining, and is transferred to step (6);
Wherein, the legitimate digital certificate for the user that coins corresponding to different token types is prerecorded in intelligent contract;Example
Such as, the corresponding certificate of RMB (CNY) is the digital certificate of " People's Bank of China ", and the corresponding certificate of dollar (USD) is " U.S. connection
Storage " digital certificate, certain company distribution token corresponding to certificate be the said firm digital certificate;
In an optional embodiment, in step (2), side that receiving node verifies the identity for the user that coins
Method specifically:
Receiving node is compared after the token type for extracting output data of respectively coining in request data;
If the token type of all output datas of coining is all the same, obtained from intelligent contract opposite with the token type
The digital certificate answered, and from request data extract coin user digital certificate after, by extracted two digital certificates into
Row compares, and the authentication of user of determining to coin when two digital certificates are identical passes through, and does not sentence simultaneously in two digital certificates
Surely the authentication of user of coining does not pass through;
Otherwise, it is determined that the authentication for the user that coins does not pass through;
In an optional embodiment, in step (2), side that receiving node verifies the signature for the user that coins
Method specifically:
Receiving node is from extracting the digital certificate (including public key information in digital certificate) of user of coining in request data
After M output datas of coining, extracted information and a random number are spliced to form the first plaintext data;The random number can
Oneself is generated, can also be directly using random number entrained by request data;
Receiving node extracts the public key PK for the user that coins from the digital certificate for the user that coins, and extracts from request data
It coins after the signature of user, the signature extracted is decrypted using the public key PK extracted, to obtain the second plaintext data;
If the first plaintext data is identical as the second plaintext data, the signature verification of user of determining to coin passes through;Otherwise, sentence
Surely the signature verification of user of coining does not pass through;
(3) receiving node verifies whether token quantity in output data of respectively coining is all larger than zero, if so, being transferred to step
(4);If it is not, then sending failure news of coining to client, and it is transferred to step (6);
(4) receiving node generates a corresponding UTXO according to each output data of coining, and M UTXO is obtained;
In an optional embodiment, the content that each UTXO is recorded includes: the UTXO mark of the UTXO, is somebody's turn to do
The cost state of UTXO corresponding coin output data and token;
UTXO mark is used for unique identification UTXO, and records the corresponding pass for output data of coining in the UTXO and transaction of coining
System;The initial time that each UTXO is generated, cost state are not spend;
In the present embodiment, UTXO mark is spliced by the transaction id for transaction of coining and the serial number of corresponding output data of coining
It forms;
(5) by M UTXO generated respectively with the storage of key-value pair mode into the database of Fabric block chain, to visitor
Family end sends successful message of coining, and is transferred to step (6);
In an optional embodiment, when storing UTXO with key-value pair mode, the key of key-value pair is the UTXO's
UTXO mark, is worth for the UTXO;
Which user belonged in order to facilitate inquiry UTXO, in another optional embodiment, is deposited with key-value pair mode
When storing up UTXO, the key of key-value pair is the compound keys for recording the corresponding relationship of the UTXO and receipts coin user, is worth for the UTXO;It is multiple
Closing key is specifically made of utilizing the mark of UTXO and the user identifier creation to receivable coin user;
Database is specifically as follows LevelDB database, CouchDB database or other distributed data bases;
(6) client receives whether the message sent from receiving node succeeds to judge to coin, and terminates transaction of coining.
By tracking distribution token service condition, in an optional embodiment, in above-mentioned Fabric block chain
The method for realizing transaction of coining, further includes:
It for any one UTXO, is over if token therein is spent, its cost state is updated to spend;
For any one UTXO, if its cost state is not spend, allow to spend in the transaction of block chain therein
Token;If its cost state is to have spent, do not allow to spend token therein in the transaction of block chain.
The present invention also provides a kind of clients, for realizing the method for realizing transaction of coining in above-mentioned Fabric block chain
The operation of middle client, client provided by the present invention include: request initiation module and message reception module;
Initiation module is requested to be used to send request data to Fabric block chain, to initiate friendship of coining to Fabric block chain
Easily request;Request data includes that the coin digital certificate of user, M coins output data and the signatures for the user that coins, each
Output data of coining includes receiving the user identifier and corresponding token quantity and token type of coin user;
Message reception module is used to receive whether the message sent from receiving node succeeds to judge to coin, and terminates to coin
Transaction;Receiving node is the node that transaction request of coining is received in Fabric block chain;
Wherein, M >=1;
In embodiments of the present invention, the specific embodiment of each module can refer to the description in above method embodiment,
This will no longer be repeated.
The present invention also provides a kind of Fabric block chains, for realizing transaction of coining is realized in above-mentioned Fabric block chain
Method in the block end of the chain operation, in Fabric block chain provided by the present invention, node include: the first authentication module,
Second authentication module, UTXO generation module and UTXO memory module;
First authentication module be used for receive client initiation coin transaction request when, intelligent contract is called, with root
The identity and signature of the user that coins are verified according to the request data that client is sent, and in any one authentication failed,
Failure news of coining is sent to client;Request data include coin the digital certificate of user, M coin output data and
It coins the signature of user, output data of each coining includes receiving the user identifier and corresponding token quantity and token of coin user
Type, M >=1;
Second authentication module is used for when two verifyings of the first authentication module pass through, and verifying is respectively coined in output data
Whether token quantity is all larger than zero, and obstructed out-of-date verifying, and sends failure news of coining to client;
UTXO generation module is used in the second authentication module when being verified, and is generated according to each output data of coining
One corresponding UTXO, is obtained M UTXO;
UTXO memory module for will M UTXO being generated by UTXO generation module respectively with the storage of key-value pair mode to
In the database of Fabric block chain, and successful message of coining is sent to client;
Wherein, the legitimate digital certificate for the user that coins corresponding to different token types is prerecorded in intelligent contract;
In the present embodiment, the specific embodiment of each module can refer to the description in above method embodiment, herein will
No longer repeat.
The present invention also provides the systems that transaction of coining is realized in a kind of Fabric block chain, for executing above-mentioned Fabric
The method for transaction of coining is realized in block chain, comprising: client and Fabric block chain;
Client is used to send request data to Fabric block chain, to ask to Fabric block chain initiation transaction of coining
It asks;Request data includes that the coin digital certificate of user, M coins output data and the signatures for the user that coins, and is each coined
Output data includes receiving the user identifier and corresponding token quantity and token type of coin user;
Fabric block chain, for calling intelligent contract by receiving node therein, with according to request data to use of coining
The identity and signature at family are verified, and obstructed out-of-date in any one verifying, send failure news of coining to client;
Fabric block chain is also used to be verified in the identity to the user that coins with signature by receiving node therein
When, it verifies whether token quantity in output data of respectively coining is all larger than zero, and obstructed out-of-date verifying, coins to client transmission
Failure news;
Fabric block chain, is also used to that token quantity is all larger than zero in output data of respectively coining by receiving node therein
When, a corresponding UTXO is generated according to each output data of coining, M UTXO is obtained;
Fabric block chain is also used to M UTXO generated by receiving node therein respectively with key-value pair mode
In the database for storing Fabric block chain, and successful message of coining is sent to client;The key and value difference of key-value pair
For the mark and content of UTXO;
Client, whether the message for being also used to receive receiving node transmission is succeeded with judging to coin, and terminates transaction of coining;
Wherein, the legitimate digital certificate for the user that coins corresponding to different token types is prerecorded in intelligent contract;It connects
Receiving node is the node that transaction request of coining is received in Fabric block chain;
In the present embodiment, the specific embodiment of client and block chain can refer to specifically retouching for the above various embodiments
It states, will no longer repeat herein.
Application example
Definition data structure is for tissue and records relevant data, and each data structure and the content recorded are as follows:
1, Inputs structural body, for recording the digital certificate for the user that coins, structure is { Certificate },
Certificate is the digital certificate of user of coining;
2, Outputs structural body is coined output datas for recording M, structure be Output1, Output2 ... ...,
OutputM};
Single output data OutputiStructure be { Owner, Amount, Lable }, Owner be receipts coin user user
Mark specially receives the public key address of coin user, and Amount is token quantity, and Label is token type;
3, Request structural body, for recording request data, structure is { Inputs, Outputs, Sigs }, and Sigs is casting
The signature of coin user, specifically by the private key for the user that coins to its digital certificate Inputs, output data of coining Outputs and one
The signature for the character string that a random number nonce is spliced, i.e. Sigs=Signaturesk(Inputs||Outputs||
nonce);Wherein, sk is the private key of user of coining, and nonce can come from transaction data, and Signature is signature function,
Signaturesk(Inputs | | Outputs | | nonce) indicate use coin private key for user sk to character string (Inputs | |
Outputs | | nonce) it signs;
4, UTXOState structural body, for recording the content of UTXO generated, structure be Txid_j, Outputj,
Status }, j indicates the serial number of UTXO corresponding output data of coining in the transaction of coining, and Txid_j is UTXO mark, specifically
It is spliced by the transaction id for transaction of coining and the serial number j of corresponding output data of coining, Outputj is indicated corresponding to the UTXO
It coins output data, Status indicates the cost state of token in UTXO, Status=true, and expression is not spent, Status=
False, expression have been spent.
Based on structural body defined above, the side for transaction of coining is realized in Fabric block chain provided by the present invention
It is as follows to execute process for method:
(S1) client construction Request structural body after, send the Request structural body to Fabric block chain, with to
Fabric block chain initiates transaction request of coining;
(S2) receiving node that transaction request of coining is received in Fabric block chain calls intelligent contract, to the user that coins
It carries out authentication and signature verification and is transferred to step (S3) if two verifyings pass through;Otherwise, it coins to client transmission
Failure news, and it is transferred to step (S6);
Authentication specifically: after the token type Label for extracting output data of coining in Request structural body,
It is compared;
If all token types are all the same, number card corresponding with the token type is obtained from intelligent contract
Book, and the digital certificate of user of coining is extracted from Request structural body, extracted two digital certificates are compared;
For example, obtaining the conjunction of bank " People's Bank of China " corresponding with CNY from intelligent contract when Label is CNY (RMB)
Method digital certificate the certificate is compared with the certificate that client is sent, if two certificates are identical, then it is assumed that coin user
Authentication pass through;Do not pass through in do not determine the to coin simultaneously authentication of user of two certificates;
Otherwise, it is determined that the authentication for the user that coins does not pass through;
Signature verification specifically: extract the letter of identity Inputs for the user that coins from Request structural body and coin defeated
Extracted information and a random number are spliced to form the first plaintext data, from the user that coins of extraction by data Outputs out
Digital certificate in extract public key PK;
The signature that the user that coins is extracted from Request structural body, is decrypted the signature using public key PK is extracted
The second plaintext data is obtained, the first plaintext data and the second plaintext data are compared, if they are the same, then determines to coin user's
Signature verification passes through;Otherwise, it is determined that the signature verification for the user that coins does not pass through;
(S3) the token quantity Amount that each output data of coining is extracted from Request structural body, if being all satisfied
Amount > 0 is then transferred to step (S4);Otherwise, failure news of coining is sent to client, and is transferred to step (S6);
(S4) for each output data Output that coins, the corresponding UTXO for having unique identification is generated, specifically, is led to
The API GetTxID () for crossing intelligent contract in Fabric block chain obtains the transaction Txid of this transaction of coining, this is coined
The serial number j of the Txid of the transaction and output data Output that coins splices, and forms the mark Txid_j of the UTXO, by this coin it is defeated
The content of data Output copies in the output data Output that coins of the UTXO out, and the cost state of the UTXO is initial
Turn to true;
By this step, symbiosis is at M UTXO;
(S5) for each UTXO generated, using the mark Txid_j of the UTXO as key, it is with the content of the UTXO
Value, by writing the PutState () of account book API for the UTXO with the database of key-value pair mode storage to Fabric block chain
In;
In order to facilitate the one's own UTXO of user query, and requiring database is any distributed database, in addition one
Kind be achieved in that, by the API CreateCompositeKey () of intelligent contract create the UTXO mark Txid_j and
The compound keys owerTxid_jIndexKey of corresponding user identifier Owner is value with the content of the UTXO, by writing account book
The PutState () of API stores the key-value pair of the UTXO into the database of Fabric block chain.
As it will be easily appreciated by one skilled in the art that the foregoing is merely illustrative of the preferred embodiments of the present invention, not to
The limitation present invention, any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should all include
Within protection scope of the present invention.
Claims (10)
1. realizing the method for transaction of coining in a kind of Fabric block chain characterized by comprising
(1) client sends request data to Fabric block chain, to initiate transaction request of coining to the Fabric block chain;
The request data includes that the coin digital certificate of user, M coins output data and the signatures of the user that coins,
Output data of each coining includes receiving the user identifier and corresponding token quantity and token type of coin user;
(2) receiving node that the transaction request of coining is received in the Fabric block chain calls intelligent contract, with basis
The request data verifies the identity and signature of the user that coins, if two verifyings pass through, is transferred to step
(3);Otherwise, Xiang Suoshu client sends failure news of coining, and is transferred to step (6);
(3) receiving node verifies whether token quantity in output data of respectively coining is all larger than zero, if so, being transferred to step
(4);If it is not, then sending failure news of coining to the client, and it is transferred to step (6);
(4) receiving node generates a corresponding UTXO according to each output data of coining, and M UTXO is obtained;
(5) M UTXO generated is respectively stored into the database of the Fabric block chain with key-value pair mode, and to
The client sends successful message of coining, and is transferred to step (6);
(6) client receives whether the message sent from the receiving node succeeds to judge to coin, and terminates friendship of coining
Easily;
Wherein, M >=1, it is described intelligence contract in be prerecorded with the user that coins corresponding to different token types legitimate digital card
Book.
2. realizing the method for transaction of coining in Fabric block chain as described in claim 1, which is characterized in that each UTXO institute
The content of record includes: UTXO mark, the cost state of the UTXO corresponding coin output data and token of the UTXO;
The UTXO mark is used for unique identification UTXO, and records pair for output data of coining in the UTXO and the transaction of coining
It should be related to;The initial time that each UTXO is generated, cost state are not spend.
3. realizing the method for transaction of coining in Fabric block chain as claimed in claim 2, which is characterized in that with key-value pair mould
When formula stores UTXO, the UTXO that the key of key-value pair is the UTXO is identified, and is worth for the UTXO;Alternatively, the key of key-value pair is for remembering
It records the UTXO and receives the compound keys of the corresponding relationship of coin user, be worth for the UTXO;
Wherein, the UTXO mark is used for unique identification UTXO, and records to coin in the UTXO and the transaction of coining and export number
According to corresponding relationship.
4. realizing the method for transaction of coining in Fabric block chain as claimed in claim 2, which is characterized in that further include: it is right
It in any one UTXO, is over if token therein is spent, its cost state is updated to spend.
5. realizing the method for transaction of coining in Fabric block chain as claimed in claim 1 or 2, which is characterized in that the receipts
The user identifier of coin user is the public key address for receiving coin user.
6. realizing the method for transaction of coining in Fabric block chain as claimed in claim 1 or 2, which is characterized in that the step
Suddenly in (2), method that the receiving node verifies the identity of the user that coins are as follows:
The receiving node is compared after the token type for extracting output data of coining in the request data;
If the token type of all output datas of coining is all the same, obtained from the intelligent contract opposite with the token type
The digital certificate answered, and after the digital certificate for the user that coins described in extraction in the request data, by extracted two number
Word certificate is compared, and the authentication of user of determining to coin when two digital certificates are identical passes through, in two digital certificates
The authentication of user of not determining to coin simultaneously does not pass through;
Otherwise, it is determined that the authentication of the user that coins does not pass through.
7. realizing the method for transaction of coining in Fabric block chain as claimed in claim 1 or 2, which is characterized in that the step
Suddenly in (2), method that the receiving node verifies the signature of the user that coins are as follows:
The receiving node, will after the digital certificate for the user that coins described in extraction in request data and M output datas of coining
Extracted information and a random number are spliced to form the first plaintext data;
The receiving node is coined the public key of user described in extracting from the digital certificate of the user that coins, and from the request
It coins after the signature of user, extracted signature is decrypted using extracted public key, to obtain described in being extracted in data
Second plaintext data;
If first plaintext data is identical as second plaintext data, the signature verification for the user that coins described in judgement is logical
It crosses;Otherwise, it is determined that the signature verification of the user that coins does not pass through.
8. a kind of client characterized by comprising request initiation module and message reception module;
The request initiation module is used to send request data to Fabric block chain, to initiate to cast to the Fabric block chain
Coin transaction request;The request data includes that the coin digital certificate of user, M coins output data and the users that coin
Signature, output data of each coining includes receiving the user identifier and corresponding token quantity and token type of coin user;
The message reception module is used to receive whether the message sent from receiving node succeeds to judge to coin, and terminates to coin
Transaction;The receiving node is the node that the transaction request of coining is received in the Fabric block chain;
Wherein, M >=1.
9. a kind of Fabric block chain, which is characterized in that its node includes: the first authentication module, the second authentication module, UTXO life
At module and UTXO memory module;
First authentication module be used for receive client initiation coin transaction request when, intelligent contract is called, with root
The identity and signature of the user that coins are verified according to the request data that the client is sent, and in any one authentication failed
When, Xiang Suoshu client sends failure news of coining;The request data includes the digital certificate of the user that coins, M
The signature of output data of coining and the user that coins, output data of each coining include receive coin user user identifier and
Corresponding token quantity and token type, M >=1;
Second authentication module is used for when two verifyings of first authentication module pass through, and verifying, which is respectively coined, exports number
It whether is all larger than zero according to middle token quantity, and obstructed out-of-date verifying, Xiang Suoshu client sends failure news of coining;
The UTXO generation module is used in second authentication module when being verified, according to each output data of coining
A corresponding UTXO is generated, M UTXO is obtained;
The M UTXO that the UTXO memory module is used to be generated by the UTXO generation module is respectively with the storage of key-value pair mode
Successful message of coining is sent into the database of the Fabric block chain, and to the client;
Wherein, the legitimate digital certificate for the user that coins corresponding to different token types is prerecorded in the intelligent contract.
10. realizing the system for transaction of coining in a kind of Fabric block chain characterized by comprising client and the area Fabric
Block chain;
The client is used to send request data to the Fabric block chain, to coin to Fabric block chain initiation
Transaction request;The request data includes that the coin digital certificate of user, M coins and output data and described coin user's
Signature, output data of each coining include receiving the user identifier and corresponding token quantity and token type of coin user;
The Fabric block chain, for calling intelligent contract by receiving node therein, with according to the request data to institute
The identity and signature for stating the user that coins are verified, and obstructed out-of-date in any one verifying, and the transmission of Xiang Suoshu client is coined
Failure news;
The Fabric block chain is also used to be verified in the identity to the user that coins with signature by receiving node therein
By when, whether verifying token quantity in output data of respectively coining is all larger than zero, and is verifying obstructed out-of-date, Xiang Suoshu client
Transmission is coined failure news;
The Fabric block chain, is also used to that token quantity is all larger than zero in output data of respectively coining by receiving node therein
When, a corresponding UTXO is generated according to each output data of coining, M UTXO is obtained;
The Fabric block chain is also used to M UTXO generated by receiving node therein respectively with key-value pair mode
In the database for storing the Fabric block chain, and successful message of coining is sent to the client;
The client, is also used to receive whether the message sent from the receiving node succeeds to judge to coin, and terminates to cast
Coin transaction;
Wherein, the legitimate digital certificate for the user that coins corresponding to different token types, institute are prerecorded in the intelligent contract
Stating receiving node is the node that the transaction request of coining is received in the Fabric block chain.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910345998.1A CN110163754B (en) | 2019-04-26 | 2019-04-26 | Method, client, blockchain and system for realizing coinage transaction in Fabric blockchain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910345998.1A CN110163754B (en) | 2019-04-26 | 2019-04-26 | Method, client, blockchain and system for realizing coinage transaction in Fabric blockchain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110163754A true CN110163754A (en) | 2019-08-23 |
CN110163754B CN110163754B (en) | 2021-07-27 |
Family
ID=67638775
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910345998.1A Active CN110163754B (en) | 2019-04-26 | 2019-04-26 | Method, client, blockchain and system for realizing coinage transaction in Fabric blockchain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110163754B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111369257A (en) * | 2020-03-06 | 2020-07-03 | 上海佩俪信息科技有限公司 | Method and device for realizing asset withholding on block chain through intelligent contract |
CN113726510A (en) * | 2021-08-30 | 2021-11-30 | 无锡井通网络科技有限公司 | Offline transaction method based on block chain |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844976A (en) * | 2017-10-25 | 2018-03-27 | 武汉天喻信息产业股份有限公司 | A kind of card of depositing based on block chain applies transaction system and method |
CN108647101A (en) * | 2018-05-09 | 2018-10-12 | 深圳壹账通智能科技有限公司 | User communication method, device, terminal device and storage medium on block chain |
CN108694575A (en) * | 2018-06-13 | 2018-10-23 | 深圳前海微众银行股份有限公司 | Verification method of transferring accounts, device and storage medium based on block chain |
CN108737106A (en) * | 2018-05-09 | 2018-11-02 | 深圳壹账通智能科技有限公司 | User authentication method, device, terminal device and storage medium on block catenary system |
CN109347941A (en) * | 2018-10-10 | 2019-02-15 | 南京简诺特智能科技有限公司 | A kind of data sharing platform and its implementation based on block chain |
CN109493020A (en) * | 2018-11-08 | 2019-03-19 | 众安信息技术服务有限公司 | Method for secure transactions and device based on block chain |
-
2019
- 2019-04-26 CN CN201910345998.1A patent/CN110163754B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107844976A (en) * | 2017-10-25 | 2018-03-27 | 武汉天喻信息产业股份有限公司 | A kind of card of depositing based on block chain applies transaction system and method |
CN108647101A (en) * | 2018-05-09 | 2018-10-12 | 深圳壹账通智能科技有限公司 | User communication method, device, terminal device and storage medium on block chain |
CN108737106A (en) * | 2018-05-09 | 2018-11-02 | 深圳壹账通智能科技有限公司 | User authentication method, device, terminal device and storage medium on block catenary system |
CN108694575A (en) * | 2018-06-13 | 2018-10-23 | 深圳前海微众银行股份有限公司 | Verification method of transferring accounts, device and storage medium based on block chain |
CN109347941A (en) * | 2018-10-10 | 2019-02-15 | 南京简诺特智能科技有限公司 | A kind of data sharing platform and its implementation based on block chain |
CN109493020A (en) * | 2018-11-08 | 2019-03-19 | 众安信息技术服务有限公司 | Method for secure transactions and device based on block chain |
Non-Patent Citations (1)
Title |
---|
王子钰 等: "基于聚合签名与加密交易的全匿名区块链", 《计算机研究与发展》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111369257A (en) * | 2020-03-06 | 2020-07-03 | 上海佩俪信息科技有限公司 | Method and device for realizing asset withholding on block chain through intelligent contract |
CN113726510A (en) * | 2021-08-30 | 2021-11-30 | 无锡井通网络科技有限公司 | Offline transaction method based on block chain |
Also Published As
Publication number | Publication date |
---|---|
CN110163754B (en) | 2021-07-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109104413B (en) | Method for solving intersection of private data for secure multi-party computation and verification method | |
US11005666B2 (en) | Tampering verification system and method for financial institution certificates based on blockchain | |
KR101904208B1 (en) | Block chain based cryptocurrency and electronic wallet management system | |
CN109639632A (en) | User information management method, electronic equipment and storage medium based on block chain | |
CN107945017B (en) | Hybrid chain accounting method based on multi-stage verification | |
CN112862612A (en) | Method and device for sending resources in cross-link mode | |
CN107886388A (en) | The traffic trip credit and safety service platform and its operation method of multicenter are realized based on alliance's chain | |
CN107705125A (en) | A kind of payment marking method based on block chain | |
CN108876365A (en) | A kind of intelligent contract generating block issue mechanism | |
CN109598504A (en) | Transaction processing method and device, electronic equipment based on block chain | |
CN109684287A (en) | Gateway information sharing query method and system based on block chain | |
CN109829718A (en) | A kind of block chain multi-layer framework and its operation method based on storage application scenarios | |
CN108854077B (en) | Cross-game item circulation method based on block chain technology | |
US11625461B2 (en) | Method and system for safeguarding stored data | |
CN111383114A (en) | Asset information management method and device based on block chain | |
CN111160881A (en) | Method and system for decentralized side-chain issuance of anchored backbone tokens | |
CN110019103B (en) | Cross-chain system and cross-chain implementation method based on block chain | |
CN111639923A (en) | Digital currency transaction accounting method and system based on zero knowledge proof | |
CN108009445A (en) | A kind of trust data management system of half centralization | |
CN109508564A (en) | A kind of digital asset storage system and method based on block chain | |
WO2020000777A1 (en) | Method and apparatus for acquiring individual credit information on the basis of block chain, and computer device | |
CN111402033A (en) | Asset information management method and device based on block chain | |
CN110084604A (en) | Transaction processing method and device, electronic equipment based on block chain | |
CN110163754A (en) | Method, client, block chain and the system of transaction of coining are realized in Fabric block chain | |
KR102125784B1 (en) | Verification method of voice recording data using blockchain |
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 |