Computer-implemented method for protecting sensitive data in a transaction based on a smart contract deployed in a blockchain
A computer-based bidding system, computer readable medium and method is provided for bidding on a project or service. A first client creates a project specification. Second clients bid on the project. A second client encrypts bid information immediately after creating a bid information file, calculates a first hash value for the bid information file, and submits the first hash value for linking as a block in a blockchain. A blockchain system performs a second encryption upon receiving the encrypted bid information, calculates a second hash value for the encrypted bid file, and submits the second hash value for linking as a block in the blockchain. The second client performs a third encryption when the bid information file is opened to generate an encrypted opened bid information file. The second client performs a bidding process with the first client using the bid information file.
1 . A computer-implemented method for enhancing data confidentiality in a blockchain, comprising:
maintaining the blockchain via a blockchain computer system, the blockchain computer system including a plurality of blockchain network nodes, the plurality of blockchain network nodes being connected to form a blockchain network, the blockchain being stored as copies of a distributed ledger on the blockchain network, the plurality of blockchain network nodes performing consensus-based verification to add a new block into the blockchain;
coupling a first computer to the blockchain as a first client device, wherein the first client device is configured to create a transaction specification, the transaction specification including an access condition for a protected transaction;
coupling a plurality of second computers to the blockchain as a plurality of second client devices, wherein each one of the plurality of second client devices is configured to submit a sensitive transaction file to participate in the protected transaction;
deploying a smart contract in the blockchain, the smart contract including a plurality of smart contract functions configured to protect the sensitive transaction files from being inappropriately modified or viewed;
upon the sensitive transaction file being submitted by at least one of the plurality of second computers, via the at least one of the plurality of second computers, executing a first encryption on the submitted sensitive transaction file to generate a first encrypted sensitive transaction file C1, calculating a first hash value H1 for the sensitive transaction file and a submitting time of the sensitive transaction file, and calling a smart contract function of the smart contract to add the first hash value H1 as a block B1 into the blockchain;
upon the first encrypted sensitive transaction file C1 being received by the first computer, via the blockchain computer system, performing a second encryption on the first encrypted sensitive transaction file C1 to generate a second encrypted sensitive transaction file C2, calculating a second hash value H2 for the first encrypted sensitive transaction file C1 and a receiving time of the first encrypted sensitive transaction file C1, and calling the smart contract function to add the second hash value H2 as a block B2 into the blockchain;
upon the access condition for the protected transaction being met, via the blockchain computer system, performing a decryption on the second encrypted sensitive transaction file C2 to obtain a decrypted sensitive transaction file, verifying the decryption by comparing the decrypted sensitive transaction file against the first encrypted sensitive transaction file C1, and upon determining that the decrypted sensitive transaction file matches with the first encrypted sensitive transaction file C1, sending to the at least one second computer a request for opening the decrypted sensitive transaction file;
upon receiving the request, via the at least one second computer, performing a decryption on the decrypted sensitive transaction file to generate an opened sensitive transaction file, comparing a new hash value calculated for the opened sensitive transaction file and the submitting time against the first hash value H1 in the block B1, and upon determining that the new hash value matches with the first hash value H1, calculating a third hash value H3 for the opened sensitive transaction file and the opening time, and calling the smart contract function to add the third hash value H3 as a block B3 into the blockchain;
via the blockchain computer system, performing a three-step verification for the sensitive transaction file, including:
a first verification based on the first hash value H1 in the block B1, to verify whether the sensitive transaction file was submitted at a correct time,
a second verification based on the second hash value H2 in the block B2, to verify whether the sensitive transaction file was received at a correct time, and
a third verification based on the third hash value H3 in the block B3, to verify whether the sensitive transaction file was opened at a correct time;
when any of the first, second, and third verifications obtains a negative result, marking the sensitive transaction file as having been inappropriately modified or viewed, and when the first, second, and third verifications all obtain positive results, determining that the sensitive transaction file was not inappropriately modified or viewed, and generating a digital signature based on the first hash value H1, the second hash value H2, and the third hash value H3; and
upon the digital signature being generated for the sensitive transaction file, via the blockchain computer system, calling the smart contract function to add the sensitive transaction file as a block B4 into the blockchain.
2 . The method of claim 1 , wherein the blockchain computer system further comprises a database,
wherein when the at least one of the second computers creates the sensitive transaction file, the at least one second computer generates a second private key and a second public key, encrypts, during the first encryption, the sensitive transaction file using the second public key to generate the first encrypted sensitive transaction file C1, and transmits the first encrypted sensitive transaction file C1 to the blockchain computer system, and
wherein the blockchain computer system is configured to encrypt, during the second encryption, the first encrypted sensitive transaction file C1 using a first public key to generate the second encrypted sensitive transaction file C2, and store the second encrypted sensitive transaction file C2 in the database.
3 . The method of claim 2 , wherein the first computer is configured to generate a first private key and the first public key,
wherein the protected transaction is associated with an access condition that includes a deadline, such that when the deadline expires, it is determined that the access condition for the protected transaction is met,
and wherein the blockchain computer system decrypts the second encrypted sensitive transaction file C2 using the first private key to obtain the decrypted sensitive transaction file, and the at least one second computer decrypts the decrypted sensitive transaction file using the second private key to obtain the opened sensitive transaction file.
4 . The method of claim 3 , wherein the digital signature is generated by:
calculating a fourth hash value for the first hash value H1, the second hash value H2, and the third hash value H3, and
encrypting the fourth hash value using the first private key,
and wherein the digital signature is saved in the database for the sensitive transaction file to show that this opened sensitive transaction file is valid to be used in the protected transaction.
5 . The method of claim 1 , wherein
the blockchain computer system performs a consensus algorithm to add each of the blocks B1, B2, B3, and B4 into the blockchain.
6 . The method of claim 5 , wherein the consensus algorithm is proof of work.
7 . The method of claim 5 , wherein the consensus algorithm is proof of stake.
8 . The method of claim 1 , wherein the first encryption is performed using a different encryption function than the second encryption.
9 . The method of claim 1 , wherein the first encryption is performed using RSA encryption, whereas the second encryption is performed using elliptic curve encryption.
10 . A non-transitory computer-readable storage medium storing program instructions when executed by a computer system, the program instructions causing the computer system to perform a method for enhancing data confidentiality in a blockchain, the method comprising:
maintaining the blockchain via a blockchain computer system, the blockchain computer system including a plurality of blockchain network nodes, the plurality of blockchain network nodes being connected to form a blockchain network, the blockchain being stored as copies of a distributed ledger on the blockchain network, the plurality of blockchain network nodes performing consensus-based verification to add a new block into the blockchain;
coupling a first computer being to the blockchain as a first client device, wherein the first client device is configured to create a transaction specification, the transaction specification including an access condition for a protected transaction;
coupling a plurality of second computers to the blockchain as a plurality of second client devices, wherein each one of the plurality of second client devices is configured to submit a sensitive transaction file to participate in the protected transaction;
deploying a smart contract in the blockchain, the smart contract including a plurality of smart contract functions configured to protect the sensitive transaction files from being inappropriately modified or viewed;
upon the sensitive transaction file being submitted by at least one of the plurality of second computers, via the at least one of the plurality of second computers, executing a first encryption on the submitted sensitive transaction file to generate a first encrypted sensitive transaction file C1, calculating a first hash value H1 for the sensitive transaction file and a submitting time of the sensitive transaction file, and calling a smart contract function of the smart contract to add the first hash value H1 as a block B1 into the blockchain;
upon the first encrypted sensitive transaction file C1 being received by the first computer, via the blockchain computer system, performing a second encryption on the first encrypted sensitive transaction file C1 to generate a second encrypted sensitive transaction file C2, calculating a second hash value H2 for the first encrypted sensitive transaction file C1 and a receiving time of the first encrypted sensitive transaction file C1, and calling the smart contract function to add the second hash value H2 as a block B2 into the blockchain;
upon the access condition for the protected transaction being met, via the blockchain computer system, performing a decryption on the second encrypted sensitive transaction file C2 to obtain a decrypted sensitive transaction file, verifying the decryption by comparing the decrypted sensitive transaction file against the first encrypted sensitive transaction file C1, and upon determining that the decrypted sensitive transaction file matches with the first encrypted sensitive transaction file C1, sending to the at least one second computer a request for opening the decrypted sensitive transaction file;
upon receiving the request, via the at least one second computer, performing a decryption on the decrypted sensitive transaction file to generate an opened sensitive transaction file, comparing a new hash value calculated for the opened sensitive transaction file and the submitting time against the first hash value H1 in the block B1, and upon determining that the new hash value matches with the first hash value H1, calculating a third hash value H3 for the opened sensitive transaction file and the opening time, and calling the smart contract function to add the third hash value H3 as a block B3 into the blockchain;
via the blockchain computer system, performing a three-step verification for the sensitive transaction file, including:
a first verification based on the first hash value H1 in the block B1, to verify whether the sensitive transaction file was submitted at a correct time,
a second verification based on the second hash value H2 in the block B2, to verify whether the sensitive transaction file was received at a correct time, and
a third verification based on the third hash value H3 in the block B3, to verify whether the sensitive transaction file was opened at a correct time;
when any of the first, second, and third verifications obtains a negative result, marking the sensitive transaction file as having been inappropriately modified or viewed, and when the first, second, and third verifications all obtain positive results, determining that the sensitive transaction file was not inappropriately modified or viewed, and generating a digital signature based on the first hash value H1, the second hash value H2, and the third hash value H3; and
upon the digital signature being generated for the sensitive transaction file, via the blockchain computer system, calling the smart contract function to add the sensitive transaction file as a block B4 into the blockchain.
11 . The computer-readable storage medium of claim 10 , wherein the blockchain computer system further comprises a database,
wherein when the at least one of the second computers creates the sensitive transaction file, the at least one second computer generates a second private key and a second public key, encrypts, during the first encryption, the sensitive transaction file using the second public key to generate the first encrypted sensitive transaction file C1, and transmits the first encrypted sensitive transaction file C1 to the blockchain computer system, and
wherein the blockchain computer system is configured to encrypt, during the second encryption, the first encrypted sensitive transaction file C1 using a first public key to generate the second encrypted sensitive transaction file C2, and store the second encrypted sensitive transaction file C2 in the database.
12 . The computer-readable storage medium of claim 11 , wherein the first computer is configured to generate a first private key and the first public key,
wherein the protected transaction is associated with an access condition that includes a deadline, such that when the deadline expires, it is determined that the access condition for the protected transaction is met,
and wherein the blockchain computer system decrypts the second encrypted sensitive transaction file C2 using the first private key to obtain the decrypted sensitive transaction file, and the at least one second computer decrypts the decrypted sensitive transaction file using the second private key to obtain the opened sensitive transaction file.
13 . The computer-readable storage medium of claim 12 , wherein the digital signature is generated by:
calculating a fourth hash value for the first hash value H1, the second hash value H2, and the third hash value H3, and
encrypting the fourth hash value using the first private key,
and wherein the digital signature is saved in the database for the sensitive transaction file to show that this opened sensitive transaction file is valid to be used in the protected transaction.
14 . The computer-readable storage medium of claim 10 , wherein the blockchain computer system performs a consensus algorithm to add each of the blocks B1, B2, B3, and B4 into the blockchain.
15 . The computer-readable storage medium of claim 14 , wherein the consensus algorithm is proof of work.
16 . The computer-readable storage medium of claim 14 , wherein the consensus algorithm is proof of stake.
17 . The computer-readable storage medium of claim 10 , wherein the first encryption is performed using a different encryption function than the second encryption.
18 . The computer-readable storage medium of claim 10 , wherein the first encryption is performed using RSA encryption, and the second encryption is performed using elliptic curve encryption.