Language selection

Search

Patent 3147339 Summary

Third-party information liability

Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.

Claims and Abstract availability

Any discrepancies in the text and image of the Claims and Abstract are due to differing posting times. Text of the Claims and Abstract are posted:

  • At the time the application is open to public inspection;
  • At the time of issue of the patent (grant).
(12) Patent: (11) CA 3147339
(54) English Title: METHOD AND DEVICE FOR WRITING BLOCKCHAIN DATA IN PARALLEL, COMPUTER EQUIPMENT AND STORAGE MEDIUM THEREOF
(54) French Title: METHODE ET DISPOSITIF D'ECRITURE DE DONNEES SUR LA CHAINE DE BLOCS EN PARALLELE, MATERIEL INFORMATIQUE ET SUPPORT DE STOCKAGE CONNEXE
Status: Granted
Bibliographic Data
(51) International Patent Classification (IPC):
  • G06F 16/23 (2019.01)
  • G06F 16/27 (2019.01)
(72) Inventors :
  • TAO, JINGHONG (China)
  • SHENG, WEI (China)
  • WANG, WANRUI (China)
(73) Owners :
  • 10353744 CANADA LTD. (Canada)
(71) Applicants :
  • 10353744 CANADA LTD. (Canada)
(74) Agent: HINTON, JAMES W.
(74) Associate agent:
(45) Issued: 2023-03-14
(22) Filed Date: 2022-02-01
(41) Open to Public Inspection: 2022-08-01
Examination requested: 2022-04-05
Availability of licence: N/A
(25) Language of filing: English

Patent Cooperation Treaty (PCT): No

(30) Application Priority Data:
Application No. Country/Territory Date
202110140335.3 China 2021-02-01

Abstracts

English Abstract

The present invention makes public a method of writing blockchain data in parallel, corresponding device and computer equipment. The method comprises: employing a first thread to write received current block into structure file of blockchain, employing a second thread to verify transaction endorsement of current block, and obtaining verification result; employing, if verification of transaction endorsement is passed, second thread to write verification result into structure file, and employing a third thread to update status database of blockchain according to current block; if execution results of threads all exhibit successful, employing third thread to update history database of blockchain according to current block. Through coordination of threads, one correct ledger writing-in achieved only when all threads have successfully executed, so ledgers of various nodes are maintained consistent, while enhancing overall transaction performance of blockchain network, reducing transaction delay, flexibly allocating computational tasks, and avoiding waste of computational resources.


French Abstract

La présente invention rend publique une méthode de rédaction de données de chaîne de blocs en parallèle, ainsi que le dispositif et le matériel informatique correspondants. La méthode consiste à : utiliser une première unité dexécution pour rédiger le bloc actuel reçu dans un fichier de structure de la chaîne de blocs, utiliser une deuxième unité dexécution afin de vérifier lapprobation de transaction dun bloc actuel, et obtenir le résultat de la vérification; utiliser, si la vérification de lapprobation de transaction est concluante, la deuxième unité dexécution pour rédiger le résultat de la vérification dans le fichier de structure, et utiliser une troisième unité dexécution pour mettre à jour la base de données du statut de la chaîne de blocs en fonction du bloc actuel; si les résultats dexécution de toutes les unités dexécution sont concluants, utiliser la troisième unité dexécution pour mettre à jour la base de données de lhistorique de la chaîne de blocs en fonction du bloc actuel. En coordonnant les unités dexécution, une écriture réussie au grand livre ne peut être réalisée que lorsque les unités dexécution sont exécutées avec succès, de sorte quon maintient luniformité des registres de nuds variés tout en renforçant le rendement global du réseau de chaînes de blocs, en réduisant le délai de transaction, en attribuant aisément les tâches de calcul et en évitant les pertes de ressources de calcul.

Claims

Note: Claims are shown in the official language in which they were submitted.


Claims:
1. A method comprising:
receiving a current block to be processed;
employing a first thread to write the current block into a structure file of a
blockchain,
simultaneously employing a second thread to verify transaction endorsement of
the
current block;
obtaining a verification result;
employing, if the verification of the transaction endorsement is passed, the
second thread
to write the verification result into the structure file, and simultaneously
employing a
third thread to update a status database of a blockchain according to the
current block;
and
obtaining execution results of the first thread, the second thread and the
third thread, and,
if all the execution results exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block.
2. The method of claim 1, wherein the step of obtaining execution results of
the first thread, the
second thread and the third thread comprises:
employing a preset monitoring thread to monitor the first thread, the second
thread and
the third thread; and
obtaining execution results of the first thread, the second thread and the
third thread.
3. The method of claim 2, further comprises:
notifying, if the preset monitoring thread monitors that any one of the first
thread, the
second thread and the third thread has failed to execute, a plurality of other
successfully
executed threads to perform data rollback.
28
Date Recue/Date Received 2022-08-22

4. The method of any one of claims 1 to 3, wherein employing the first thread
to write the
current block into the structure file of the blockchain, simultaneously
employing the second
thread to verify the transaction endorsement of the current block, and
obtaining the
verification result, further comprises:
employing the third thread to update the history database of the blockchain
according to a
block previous to the current block.
5. The method of claim 4, wherein employing the third thread to update the
status database of
the blockchain according to the current block comprises:
judging whether the operation to update the history database of the blockchain
according
to the block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
6. The method of any one of claims 1 to 3, wherein employing the second thread
to verify
transaction endorsement of the current block comprises:
verifying whether version numbers of all key values in a read/write set of all
transactions
in the current block are consistent with a version number of the current
block.
7. The method of any one of claims 1 to 3, wherein employing the second thread
to write the
verification result into the structure file comprises:
employing the second thread to compile transactions that have passed
verification into a
preset array; and
writing the preset array into the structure file.
8. The method of any one of claims 1 to 7, wherein the verification items of
the read/write set
includes whether results of range query are consistent with the execution
result wherein the
results of range query indicate range query results contained in all
transactions in the
received current block.
29
Date Recue/Date Received 2022-08-22

9. The method of any one of claims 1 to 8, wherein each transaction in the
block contains a
read/write dataset, wherein the read set includes a key-value pair array that
is read from a
ledger during execution of the transaction, and the write set includes a key-
value pair array
that is written to the ledger during execution of the transaction.
10. The method of any one of claims 1 to 9, wherein the second thread compiles
the transactions
that have passed verification into a transaction valid tag array according to
the verification
result of the transaction endorsements of the current block, and subsequently
writes the array
into the local blockchain structure file.
11. The method of any one of claims 1 to 10, wherein a plurality of threads,
including one or
more of the first thread, the second thread, and the third thread, is
preconfigured, to configure
each thread to execute different operations in a ledger writing-in process,
wherein the first
thread executes the local blockchain structure file writing-in operation, the
second thread
executes the operation of verifying the transaction endorsement and the
operation of writing
the verification result, and the third thread executes the operations of
updating the status
database and the history database of the blockchain.
12. The method of any one of claims 1 to 11, wherein the first thread and the
second thread both
involve the writing-in of the local blockchain structure file, wherein the
block itself and the
verification result of the transaction endorsement are respectively stored,
wherein writing-in
is directed to different blockchain structure files.
13. The method of any one of claims 1 to 12, wherein data stored in the status
database includes,
one or more of, a plurality of newest values of all keys after all
transactions contained in a
current ledger have been executed to completion.
14. The method of any one of claims 1 to 13, wherein the history database is
for query by users
only, wherein it is not allowed for users to write, wherein the operation of
updating the
blockchain history database is executed by a fourth thread set up according to
actual business
requirements.
Date Recue/Date Received 2022-08-22

15. The method of any one of claims 1 to 14, wherein data stored in the
history database
includes, one or more of, change in a plurality of versions of keys, wherein a
certain key is
changed in a certain transaction of a certain block, only the change action is
recorded, while
the change itself is not executed.
16. The method of any one of claims 2 to 3, wherein the preset monitoring
thread is embodied as
a separate thread to execute a monitoring operation, and is embodied as a
first thread to
undertake the monitoring operation among other operation, wherein it is freely
selectable by
users as practically required.
17. A device comprising:
a block receiving module, for receiving a current block to be processed;
a first processing module, for employing a first thread to write the current
block into a
structure file of a blockchain;
a second processing module, for:
simultaneously employing a second thread to verify transaction endorsement of
the current block;
obtaining a verification result; and
employing, if the verification of the transaction endorsement is passed, the
second thread to write the verification result into the structure file;
a third processing module, for employing a third thread to update a status
database of the
blockchain according to the current block; and
a thread monitoring module, for obtaining execution results of the first
thread, the second
thread and the third thread;
31
Date Recue/Date Received 2022-08-22

wherein the third processing module is further configured for, if all the
execution results
exhibit successful executions, employing the third thread to update a history
database of
the blockchain according to the current block.
18. The device of claim 17, further comprises a thread monitoring module
configured to:
employ a preset monitoring thread to monitor the first thread, the second
thread and the
third thread; and
obtain execution results of the first thread, the second thread and the third
thread.
19. The device of claim 18, wherein the thread monitoring module is further
configured to notify,
if the preset monitoring thread monitors that any one of the first thread, the
second thread and
the third thread has failed to execute, a plurality of other successfully
executed threads to
perform data rollback.
20. The device of any one of claims 17 to 19, wherein the third processing
module is further
configured to employ the third thread to update the history database of the
blockchain
according to a block previous to the current block.
21. The device of claim 20, wherein the third processing module is further
configured to judge
whether the operation to update the history database of the blockchain
according to a block
previous to the current block has been executed to completion, if yes,
employing the third
thread to update the status database of the blockchain according to the
current block.
22. The device of any one of claims 17 to 19, wherein the second processing
module is
configured to verify whether version numbers of all key values in a read/write
set of all
transactions in the current block are consistent with a version number of the
current block.
23. The device of any one of claims 17 to 19, wherein the second processing
module is
configured to employ the second thread to compile transactions that have
passed verification
into a preset array, and writing the preset array into the structure file.
32
Date Recue/Date Received 2022-08-22

24. The device of any one of claims 17 to 23, wherein the verification items
of the read/write set
includes whether results of range query are consistent with the execution
result wherein the
results of range query indicate range query results contained in all
transactions in the
received current block.
25. The device of any one of claims 17 to 24, wherein each transaction in the
block contains a
read/write dataset, wherein the read set includes a key-value pair array that
is read from a
ledger during execution of the transaction, and the write set includes a key-
value pair array
that is written to the ledger during execution of the transaction.
26. The device of any one of claims 17 to 25, wherein the second thread
compiles the
transactions that have passed verification into a transaction valid tag array
according to the
verification result of the transaction endorsements of the current block, and
subsequently
writes the array into the local blockchain structure file.
27. The device of any one of claims 17 to 26, wherein a plurality of threads,
including one or
more of the first thread, the second thread, and the third thread, is
preconfigured, to configure
each thread to execute different operations in a ledger writing-in process,
wherein the first
thread executes the local blockchain structure file writing-in operation, the
second thread
executes the operation of verifying the transaction endorsement and the
operation of writing
the verification result, and the third thread executes the operations of
updating the status
database and the history database of the blockchain.
28. The device of any one of claims 17 to 27, wherein the first thread and the
second thread both
involve the writing-in of the local blockchain structure file, wherein the
block itself and the
verification result of the transaction endorsement are respectively stored,
wherein writing-in
is directed to different blockchain structure files.
29. The device of any one of claims 17 to 28, wherein data stored in the
status database includes,
one or more of, a plurality of newest values of all keys after all
transactions contained in a
current ledger have been executed to completion.
33
Date Recue/Date Received 2022-08-22

30. The device of any one of claims 17 to 29, wherein the history database is
for query by users
only, wherein it is not allowed for users to write, wherein the operation of
updating the
blockchain history database is executed by a fourth thread set up according to
actual business
requirements.
31. The device of any one of claims 17 to 30, wherein data stored in the
history database
includes, one or more of, change in a plurality of versions of keys, wherein a
certain key is
changed in a certain transaction of a certain block, only the change action is
recorded, while
the change itself is not executed.
32. The device of any one of claims 18 to 19, wherein the preset monitoring
thread is embodied
as a separate thread to execute a monitoring operation, and is embodied as a
first thread to
undertake the monitoring operation among other operation, wherein it is freely
selectable by
users as practically required.
33. A computer equipment comprising:
a memory, wherein the memory includes a nonvolatile storage medium, and an
internal
memory, wherein the nonvolatile storage medium stores therein an operating
system, a
computer program and a database, wherein the internal memory provides
environment for
the running of the operating system and the computer program in the
nonvolatile storage
medium;
a processor, wherein the processor is configured to provide computing and
controlling
capabilities;
a network interface connected to each other via a system bus, wherein the
network
interface is configured to communicate with an external terminal via network
connection;
the computer program stored on the memory and executed by the processor
configured
to:
receive a current block to be processed;
34


employ a first thread to write the current block into a structure file of a
blockchain, simultaneously employing a second thread to verify transaction
endorsement of the current block;
obtain a verification result;
employ, if the verification of the transaction endorsement is passed, the
second
thread to write the verification result into the structure file, and
simultaneously
employing a third thread to update a status database of a blockchain according

to the current block; and
obtain execution results of the first thread, the second thread and the third
thread, and, if all the execution results exhibit successful executions,
employing the third thread to update a history database of the blockchain
according to the current block.
34. The equipment of claim 33, wherein the step of obtaining execution results
of the first thread,
the second thread and the third thread comprises:
employing a preset monitoring thread to monitor the first thread, the second
thread and
the third thread; and
obtaining execution results of the first thread, the second thread and the
third thread.
35. The equipment of claim 34, further comprises:
notifying, if the preset monitoring thread monitors that any one of the first
thread, the
second thread and the third thread has failed to execute, a plurality of other
successfully
executed threads to perform data rollback.
36. The equipment of any one of claims 33 to 35, wherein employing the first
thread to write the
current block into the structure file of the blockchain, simultaneously
employing the second
thread to verify the transaction endorsement of the current block, and
obtaining the
verification result, further comprises:
Date Recue/Date Received 2022-08-22

employing the third thread to update the history database of the blockchain
according to a
block previous to the current block.
37. The equipment of claim 36, wherein employing the third thread to update
the status database
of the blockchain according to the current block comprises:
judging whether the operation to update the history database of the blockchain
according
to the block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
38. The equipment of any one of claims 33 to 35, wherein employing the second
thread to verify
transaction endorsement of the current block comprises:
verifying whether version numbers of all key values in a read/write set of all
transactions
in the current block are consistent with a version number of the current
block.
39. The equipment of any one of claims 33 to 35, wherein employing the second
thread to write
the verification result into the structure file comprises:
employing the second thread to compile transactions that have passed
verification into a
preset array; and
wrifing the preset array into the structure file.
40. The equipment of any one of claims 33 to 39, wherein the verification
items of the read/write
set includes whether results of range query are consistent with the execution
result wherein
the results of range query indicate range query results contained in all
transactions in the
received current block.
41. The equipment of any one of claims 33 to 40, wherein each transaction in
the block contains
a read/write dataset, wherein the read set includes a key-value pair array
that is read from a
ledger during execution of the transaction, and the write set includes a key-
value pair array
that is written to the ledger during execution of the transaction.
36
Date Recue/Date Received 2022-08-22

42. The equipment of any one of claims 33 to 41, wherein the second thread
compiles the
transactions that have passed verification into a transaction valid tag array
according to the
verification result of the transaction endorsements of the current block, and
subsequently
writes the array into the local blockchain structure file.
43. The equipment of any one of claims 33 to 42, wherein a plurality of
threads, including one or
more of the first thread, the second thread, and the third thread, is
preconfigured, to configure
each thread to execute different operations in a ledger writing-in process,
wherein the first
thread executes the local blockchain structure file writing-in operation, the
second thread
executes the operation of verifying the transaction endorsement and the
operation of writing
the verification result, and the third thread executes the operations of
updating the status
database and the history database of the blockchain.
44. The equipment of any one of claims 33 to 43, wherein the first thread and
the second thread
both involve the writing-in of the local blockchain structure file, wherein
the block itself and
the verification result of the transaction endorsement are respectively
stored, wherein
writing-in is directed to different blockchain structure files.
45. The equipment of any one of claims 33 to 44, wherein data stored in the
status database
includes, one or more of, a plurality of newest values of all keys after all
transactions
contained in a current ledger have been executed to completion.
46. The equipment of any one of claims 33 to 45, wherein the history database
is for query by
users only, wherein it is not allowed for users to write, wherein the
operation of updating the
blockchain history database is executed by a fourth thread set up according to
actual business
requirements.
47. The equipment of any one of claims 33 to 46, wherein data stored in the
history database
includes, one or more of, change in a plurality of versions of keys, wherein a
certain key is
changed in a certain transaction of a certain block, only the change action is
recorded, while
the change itself is not executed.
37
Date Recue/Date Received 2022-08-22

48. The equipment of any one of claims 34 to 35, wherein the preset monitoring
thread is
embodied as a separate thread to execute a monitoring operation, and is
embodied as a first
thread to undertake the monitoring operation among other operation, wherein it
is freely
selectable by users as practically required.
49. A readable computer storage medium with computer programs stored thereon,
when
executed by a computer, configured to:
receive a current block to be processed;
employ a first thread to write the current block into a structure file of a
blockchain,
simultaneously employing a second thread to verify transaction endorsement of
the
current block;
obtain a verification result;
employ, if the verification of the transaction endorsement is passed, the
second thread to
write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of a blockchain according to the current
block; and
obtain execution results of the first thread, the second thread and the third
thread, and, if
all the execution results exhibit successful executions, employing the third
thread to
update a history database of the blockchain according to the current block.
50. The storage medium of claim 49, wherein the step of obtaining execution
results of the first
thread, the second thread and the third thread comprises:
employing a preset monitoring thread to monitor the first thread, the second
thread and
the third thread; and
obtaining execution results of the first thread, the second thread and the
third thread.
51. The storage medium of claim 50, further comprises:
38
Date Recue/Date Received 2022-08-22

notifying, if the preset monitoring thread monitors that any one of the first
thread, the
second thread and the third thread has failed to execute, a plurality of other
successfully
executed threads to perform data rollback.
52. The storage medium of any one of claims 49 to 51, wherein employing the
first thread to
write the current block into the structure file of the blockchain,
simultaneously employing the
second thread to verify the transaction endorsement of the current block, and
obtaining the
verification result, further comprises:
employing the third thread to update the history database of the blockchain
according to a
block previous to the current block.
53. The storage medium of claim 52, wherein employing the third thread to
update the status
database of the blockchain according to the current block comprises:
judging whether the operation to update the history database of the blockchain
according
to the block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
54. The storage medium of any one of claims 49 to 53, wherein employing the
second thread to
verify transaction endorsement of the current block comprises:
verifying whether version numbers of all key values in a read/write set of all
transactions
in the current block are consistent with a version number of the current
block.
55. The storage medium of any one of claims 49 to 54, wherein employing the
second thread to
write the verification result into the structure file comprises:
employing the second thread to compile transactions that have passed
verification into a
preset array; and
writing the preset array into the structure file.
39
Date Recue/Date Received 2022-08-22

56. The storage medium of any one of claims 49 to 55, wherein the verification
items of the
read/write set includes whether results of range query are consistent with the
execution result
wherein the results of range query indicate range query results contained in
all transactions in
the received current block.
57. The storage medium of any one of claims 49 to 56, wherein each transaction
in the block
contains a read/write dataset, wherein the read set includes a key-value pair
array that is read
from a ledger during execution of the transaction, and the write set includes
a key-value pair
array that is written to the ledger during execution of the transaction.
58. The storage medium of any one of claims 49 to 57, wherein the second
thread compiles the
transactions that have passed verification into a transaction valid tag array
according to the
verification result of the transaction endorsements of the current block, and
subsequently
writes the array into the local blockchain structure file.
59. The storage medium of any one of claims 49 to 58, wherein a plurality of
threads, including
one or more of the first thread, the second thread, and the third thread, is
preconfigured, to
configure each thread to execute different operations in a ledger writing-in
process, wherein
the first thread executes the local blockchain structure file writing-in
operation, the second
thread executes the operation of verifying the transaction endorsement and the
operation of
writing the verification result, and the third thread executes the operations
of updating the
status database and the history database of the blockchain.
60. The storage medium of any one of claims 49 to 59, wherein the first thread
and the second
thread both involve the writing-in of the local blockchain structure file,
wherein the block
itself and the verification result of the transaction endorsement are
respectively stored,
wherein writing-in is directed to different blockchain structure files.
61. The storage medium of any one of claims 49 to 60, wherein data stored in
the status database
includes, one or more of, a plurality of newest values of all keys after all
transactions
contained in a current ledger have been executed to completion.
Date Recue/Date Received 2022-08-22

62. The storage medium of any one of claims 49 to 61, wherein the history
database is for query
by users only, wherein it is not allowed for users to write, wherein the
operation of updating
the blockchain history database is executed by a fourth thread set up
according to actual
business requirements.
63. The storage medium of any one of claims 49 to 62, wherein data stored in
the history
database includes, one or more of, change in a plurality of versions of keys,
wherein a certain
key is changed in a certain transaction of a certain block, only the change
action is recorded,
while the change itself is not executed.
64. The storage medium of any one of claims 50 to 51, wherein the preset
monitoring thread is
embodied as a separate thread to execute a monitoring operation, and is
embodied as a first
thread to undertake the monitoring operation among other operation, wherein it
is freely
selectable by users as practically required.
41
Date Recue/Date Received 2022-08-22

Description

Note: Descriptions are shown in the official language in which they were submitted.


METHOD AND DEVICE FOR WRITING BLOCKCHAIN DATA IN PARALLEL,
COMPUTER EQUIPMENT AND STORAGE MEDIUM THEREOF
BACKGROUND OF THE INVENTION
Technical Field
[0001] The present invention relates to the field of data processing
technology, and more
particularly to a method and a device for writing blockchain data in parallel,
and
corresponding computer equipment and storage medium.
Description of Related Art
[0002] Blockchain is a decentralized, distributed ledger technology system,
based on linked data
structure. A blockchain ledger consists of a string of blocks associated by
cryptography,
each block contains certain information data and data fingerprints thereof,
and the data
fingerprints are usable to verify the validity of the current block and to
link with the next
block. Through a consensus algorithm, ledger data on each node in the
blockchain system
can be maintained consistent with data on other nodes. The following problems
are
mainly pending in the state of the art when the various nodes of the
blockchain write
received new blocks into the ledger.
[0003] The bottom frame of the mainstream blockchain is low in transaction
throughput and high
in block out delay. Such operations as transaction verification, file writing-
in and database
update in the process for the nodes of the blockchain to execute ledger
writing-in in series
engender serious bottlenecks to the overall transaction performance of the
blockchain
network, great quantities of block data are accumulated at the node cache and
cannot be
timely written into the ledger, it is required for the user to take very long
time to ascertain
whether a certain transaction has been successfully executed, and even such
problems as
severe timeout and repeated transmissions of requests are caused thereby.
1
Date Recue/Date Received 2022-02-01

[0004] The blockchain technology is somehow restricted both in terms of the
fields of application
and the ranges of utilization. Since the blockchain system has not achieved
the transaction
performance that is matched with the currently available database management
system,
it is usually impossible for the blockchain system to directly access to the
real-time data
management system already possessed by enterprises, so the current blockchain
applications are mostly restricted to non-real-time transaction fields.
[0005] The server is relatively low in computational resource utilization.
Currently the entire
flow for writing blockchain ledgers in node ledgers is essentially executed in
full series,
the computational resource of the multi-core CPU or GPU server cannot be fully
utilized,
and it is impossible for the user to achieve marked enhancement of the
transaction
performance by upgrading the server.
[0006] With respect to the above problems, although methods have been proposed
so far to
attempt to optimize the transaction performance at the bottom framework of the

blockchain by the parallel mode, for instance, to employ multiple threads to
execute
blockchain operations, these methods mostly focus on the single link in the
update of the
blockchain status database in the process of writing into the blockchain
ledger, while pay
no attention to the overall optimization of all links in writing into the
ledger, so the
transaction performance has been enhanced in a limited degree.
[0007] In short, it is a technical conundrum to be urgently dealt with as how
to further optimize
the execution efficiency in the link of writing in the blockchain ledger.
SUMMARY OF THE INVENTION
[0008] In order to overcome the problems prevalent in prior-art technology,
embodiments of the
present invention provide a method and a device for writing blockchain data in
parallel,
2
Date Recue/Date Received 2022-02-01

and corresponding computer equipment and storage medium, so as to address the
problems pending in the state of the art in which the blockchain ledger
writing-in flow is
unduly complicated, it takes too long time to write into blockchain structure
files, verify
transactions and update data statuses, and there is a bottleneck in the
overall transaction
performance of the blockchain network.
[0009] To solve one or more of the aforementioned technical problem(s), the
present invention
employs the following technical solutions.
[0010] According to the first aspect, there is provided a method of writing
blockchain data in
parallel, and the method comprises the following steps:
[0011] receiving a current block to be processed, employing a first thread to
write the current
block into a structure file of a blockchain, simultaneously employing a second
thread to
verify transaction endorsement of the current block, and obtaining a
verification result;
[0012] employing, if verification of the transaction endorsement is passed,
the second thread to
write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of the blockchain according to the current
block; and
[0013] obtaining execution results of the first thread, the second thread and
the third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block.
[0014] Further, the step of obtaining execution results of the first thread,
the second thread and
the third thread includes:
[0015] employing a preset monitoring thread to monitor the first thread, the
second thread and
the third thread, and obtaining execution results of the first thread, the
second thread and
the third thread.
[0016] Moreover, the method further comprises:
3
Date Recue/Date Received 2022-02-01

[0017] notifying, if the preset monitoring thread monitors that anyone of the
first thread, the
second thread and the third thread has failed to execute, the other
successfully executed
threads to perform data rollback.
[0018] Further, while employing a first thread to write the current block into
a structure file of a
blockchain, simultaneously employing a second thread to verify transaction
endorsement
of the current block, and obtaining a verification result, the method further
comprises:
[0019] employing the third thread to update the history database of the
blockchain according to
a block previous to the current block.
[0020] Further, the step of employing a third thread to update a status
database of the blockchain
according to the current block includes:
[0021] judging whether the operation to update the history database of the
blockchain according
to a block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
[0022] Further, the step of employing a second thread to verify transaction
endorsement of the
current block includes:
[0023] verifying whether version numbers of all key values in a read/write set
of all transactions
in the current block are consistent with a version number of the current
block.
[0024] Further, the step of employing the second thread to write the
verification result into the
structure file includes:
[0025] employing the second thread to compile transactions that have passed
verification into a
preset array, and writing the preset array into the structure file.
[0026] According to the second aspect, there is provided a device for writing
blockchain data in
parallel, and the device comprises:
4
Date Recue/Date Received 2022-02-01

[0027] a block receiving module, for receiving a current block to be
processed;
[0028] a first processing module, for employing a first thread to write the
current block into a
structure file of a blockchain;
[0029] a second processing module, for simultaneously employing a second
thread to verify
transaction endorsement of the current block, and obtaining a verification
result; and
employing, if verification of the transaction endorsement is passed, the
second thread to
write the verification result into the structure file;
[0030] a third processing module, for employing a third thread to update a
status database of the
blockchain according to the current block; and
[0031] a thread monitoring module, for obtaining execution results of the
first thread, the second
thread and the third thread;
[0032] wherein the third processing module is further used for, if the
execution results all exhibit
successful executions, employing the third thread to update a history database
of the
blockchain according to the current block.
[0033] According to the third aspect, there is provided a computer equipment
that comprises a
memory, a processor and a computer program stored on the memory and operable
on the
processor, and the following steps are realized when the processor executes
the computer
program:
[0034] receiving a current block to be processed, employing a first thread to
write the current
block into a structure file of a blockchain, simultaneously employing a second
thread to
verify transaction endorsement of the current block, and obtaining a
verification result;
[0035] employing, if verification of the transaction endorsement is passed,
the second thread to
write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of the blockchain according to the current
block; and
[0036] obtaining execution results of the first thread, the second thread and
the third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block.
Date Recue/Date Received 2022-02-01

[0037] According to the fourth aspect, there is provided a computer-readable
storage medium
storing a computer program thereon, and the following steps are realized when
the
computer program is executed by a processor:
[0038] receiving a current block to be processed, employing a first thread to
write the current
block into a structure file of a blockchain, simultaneously employing a second
thread to
verify transaction endorsement of the current block, and obtaining a
verification result;
[0039] employing, if verification of the transaction endorsement is passed,
the second thread to
write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of the blockchain according to the current
block; and
[0040] obtaining execution results of the first thread, the second thread and
the third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block.
[0041] The technical solutions provided by the embodiments of the present
invention bring about
the following advantageous effects.
[0042] In the method and device for writing blockchain data in parallel, and
corresponding
computer equipment and storage medium provided by the embodiments of the
present
invention, by receiving a current block to be processed, employing a first
thread to write
the current block into a structure file of a blockchain, simultaneously
employing a second
thread to verify transaction endorsement of the current block, obtaining a
verification
result, employing, if verification of the transaction endorsement is passed,
the second
thread to write the verification result into the structure file,
simultaneously employing a
third thread to update a status database of the blockchain according to the
current block,
obtaining execution results of the first thread, the second thread and the
third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block,
namely,
through coordinated operations of a plurality of threads, the present
invention counts it
as one correct ledger writing-in only when all threads have successfully
executed, so that
6
Date Recue/Date Received 2022-02-01

ledgers of various nodes are maintained consistent, while the overall
transaction
performance of the blockchain network is enhanced, transaction delay is
reduced,
computational tasks of the blockchain are flexibly allocated, plural CPUs are
allowed to
simultaneously process received plural pieces of transaction data, and waste
of
computational resources of the server is avoided.
[0043] Moreover, in the method and device for writing blockchain data in
parallel, and
corresponding computer equipment and storage medium provided by the
embodiments
of the present invention, by employing a first thread to write the current
block into a
structure file of a blockchain, simultaneously employing a second thread to
verify
transaction endorsement of the current block, obtaining a verification result,
and
employing the third thread to update the history database of the blockchain
according to
a block previous to the current block, writing-in operations of two adjacent
blocks can as
well be partially concurrently executed, whereby transaction processing speed
of
blockchain nodes is enhanced, so that the blockchain technology can be applied
to such
highly concurrent and quasi real-time transaction fields as the traditional
retail payment,
and application scenarios of the blockchain technology are broadened.
BRIEF DESCRIPTION OF THE DRAWINGS
[0044] To more clearly describe the technical solutions in the embodiments of
the present
invention, drawings required to illustrate the embodiments will be briefly
introduced
below. Apparently, the drawings introduced below are merely directed to some
embodiments of the present invention, while persons ordinarily skilled in the
art may
further acquire other drawings on the basis of these drawings without spending
creative
effort in the process.
[0045] Fig. 1 is a view schematically illustrating the transaction flow of the
currently available
blockchain network according to an exemplary embodiment;
7
Date Recue/Date Received 2022-02-01

[0046] Fig. 2 is a flowchart illustrating the ledger writing-in link in the
transaction flow of the
currently available blockchain network according to an exemplary embodiment;
[0047] Fig. 3 is a flowchart illustrating threads interaction in the method of
writing blockchain
data in parallel according to an exemplary embodiment;
[0048] Fig. 4 is a flowchart illustrating the method of writing blockchain
data in parallel
according to an exemplary embodiment;
[0049] Fig. 5 is a flowchart illustrating the method of writing blockchain
data in parallel
according to another exemplary embodiment;
[0050] Fig. 6 is a view schematically illustrating the structure of the device
for writing
blockchain data in parallel according to an exemplary embodiment; and
[0051] Fig. 7 is a view schematically illustrating the internal structure of
the computer equipment
according to an exemplary embodiment.
DETAILED DESCRIPTION OF THE INVENTION
[0052] To make more lucid and clear the objectives, technical solutions and
advantages of the
present invention, the technical solutions in the embodiments of the present
invention will
be clearly and comprehensively described below with reference to the
accompanying
drawings in the embodiments of the present invention. Apparently, the
embodiments as
described are merely partial, rather than the entire, embodiments of the
present invention.
Any other embodiments makeable by persons ordinarily skilled in the art on the
basis of
the embodiments in the present invention without creative effort shall all
fall within the
protection scope of the present invention.
8
Date Recue/Date Received 2022-02-01

[0053] Fig. 1 is a view schematically illustrating the transaction flow of the
currently available
blockchain network according to an exemplary embodiment. With reference to
Fig. 1, the
currently available blockchain network mainly includes the four roles, i.e. a
client end,
an endorsing node, a sorting node, and a bookkeeping node, of which the client
end
includes an application program and an SDK, through which client end the user
can
initiate a transaction and submit a transaction proposal; the endorsing node
is mainly
responsible for verifying and endorsing the transaction proposal, calculating
a simulated
result of transaction execution and returning a response result of the
transaction proposal
to the client end; the sorting node is mainly responsible for receiving the
transaction
proposal from the client end, sorting and arranging the transaction proposal
as blocks,
and thereafter broadcasting the blocks to the bookkeeping node for processing;
and the
bookkeeping node is responsible for rechecking transaction legitimacy after
having
received the blocks, and writing the blocks into the blockchain structure.
[0054] Fig. 2 is a flowchart illustrating the ledger writing-in link in the
transaction flow of the
currently available blockchain network according to an exemplary embodiment.
With
reference to Fig. 2, the conventional blockchain ledger writing-in process
mainly includes
five steps, i.e., verifying the transaction endorsement, updating the
verification result to
the local blockchain structure file, writing blocks into the local blockchain
structure file,
updating the blockchain status database and updating the blockchain history
database.
With further reference to Fig. 2, the current blockchain ledger writing-in
mode is writing
in series, thereby on the one hand, the process proceeds with the writing-in
operation of
the next block only when all steps of the previous block have been executed to
completion;
on the other hand, the five steps in the ledger writing-in process must also
be sequentially
executed, and this causes a severe bottleneck in the transaction performance
of the
blockchain network, whereby block data cannot be timely written into the
ledger, lots of
client ends wait for feedback from the bookkeeping node, and even such
problems as
severe timeout and repeated transmissions are caused thereby.
9
Date Recue/Date Received 2022-02-01

[0055] In order to solve the above problems, a method of writing blockchain
data in parallel is
creatively proposed in the embodiments of the present invention, the method
mainly
focuses on the process in which the aforementioned blockchain bookkeeping node
detects
transaction legitimacy and writes the legitimate transactions into the
blockchain structure
file after having received the blocks from the sorting node and having
completed
preliminary block format verification, the received blocks are written into
the local
blockchain structure file, verification of transaction endorsement is executed
in parallel
as the blocks are being written into the structure file, the verification
result is written into
the local blockchain structure file after verification of the transaction
endorsement has
ended, the blockchain status database is updated after the verification of the
transaction
endorsement has ended, and the blockchain history database is updated after
the
aforementioned four steps have all been completed.
[0056] Fig. 3 is a flowchart illustrating threads interaction in the method of
writing blockchain
data in parallel according to an exemplary embodiment. With reference to Fig.
3, suppose
the current block to be processed is block X, during specific implementation,
the
operation of writing into the local blockchain structure file is executed
through a first
thread, the operation of verifying the transaction endorsement and the
operation of writing
the verification result are executed through a second thread, and the
operations of
updating the status database and the history database of the blockchain are
executed
through a third thread; it is considered that the new block is successfully
written into the
blockchain ledger only when the three threads have all successfully executed
their
operations, otherwise data rollback is performed, thereby ledgers of various
nodes are
maintained consistent, while transaction delay of the blockchain network is
reduced, and
transaction throughput of the blockchain system is enhanced. The first thread,
the second
thread and the third thread execute their operations all in parallel, the
three threads can
either be pre-existent or newly created, and can be managed by way of a thread
pool.
Date Recue/Date Received 2022-02-01

[0057] Fig. 4 is a flowchart illustrating the method of writing blockchain
data in parallel
according to an exemplary embodiment. With reference to Fig. 4, the process of
writing
data in parallel comprises the following steps.
[0058] Step A ¨ writing a received block into a local blockchain structure
file.
[0059] Specifically, the received current block is written into a local
structure file of a blockchain
through a first thread, in which the structure file includes, but is not
limited to, a Chunk
file, etc. During specific implementation, the first thread adds the current
block to a
preconfigured index database, in which such block data as the block number,
Hash value,
file pointer and transaction offset of the current block are imported.
[0060] Since such operations as update of the blockchain structure file,
verification of the
transaction endorsement, update of the status database and update of the
history database
in the blockchain ledger writing-in process are respectively executed by
different threads
in the embodiments of the present invention, and since a correct ledger
writing-in is
counted only when the aforementioned operations have all been completed, a
monitoring
thread is further disposed in the embodiments of the present invention to
monitor the
circumstances of execution by the first thread, the second thread and the
third thread.
After the first thread has executed the operation of writing the current block
into the
structure file of the local blockchain, it feeds back the execution result to
the monitoring
thread and waits for the later to assign the next task. If the first thread
has successfully
written the received block into the local blockchain structure file, the
monitoring thread
will wait for and summarize the execution results of other threads before
notifying the
first thread; if the execution has failed, the monitoring thread will
immediately notify the
first thread to perform a rollback operation on the local blockchain structure
file and the
index database, return to the status of the previous block and wait for the
renewed
operation of writing the current block.
11
Date Recue/Date Received 2022-02-01

[0061] Step B ¨ executing verification of transaction endorsements in parallel
at the same time
of writing into the structure file.
[0062] Specifically, at the same time as the first thread writes the received
current block into the
local structure file of the blockchain, the second thread verifies one-by-one
transaction
endorsements in the received current block, in which there are two main
verification items
of a transaction read/write set: whether version numbers of all key values
read in the
read/write set are consistent with the current version number, and whether the
results of
range query are consistent with the current execution result. The results of
range query
indicate range query results contained in all transactions in the received
current block
(this item is checked if there is the item of executing range query in the
transactions, while
there is no need to check if there is no item of executing range query in the
transactions),
and are specifically simulated results obtained after the node that generates
the current
block has executed the range query operation. The current execution result
indicates a
simulated execution result obtained after the node that executes the ledger
writing-in
operation has executed again the range query operation by simulation. After
verifications
of all transactions in the current block have been completed, the second
thread writes the
verification result into the local blockchain structure file, simultaneously
forwards the
verification result to the third thread, and notifies it to update the
blockchain status
database.
[0063] Specifically, as should be noted here, in the embodiments of the
present invention, each
transaction in the block contains a read/write dataset, in which the read set
includes a key-
value pair array that should be read from the ledger during execution of the
transaction,
and the write set includes a key-value pair array that should be written to
the ledger during
execution of the transaction.
[0064] Step C ¨ writing a verification result into the local blockchain
structure file after
verifications of the transaction endorsements have ended.
12
Date Recue/Date Received 2022-02-01

[0065] Specifically, the second thread compiles the transactions that have
passed verification
into a transaction valid tag array according to the verification result of the
transaction
endorsements of the current block, and subsequently writes the array into the
local
blockchain structure file. Finally, the second thread feeds back the execution
result to the
monitoring thread and waits for the later to assign the next task.
[0066] Specifically, if the second thread has successfully written the
verification result into the
local blockchain structure file, the monitoring thread will wait for and
summarize the
execution results of other threads before notifying the second thread. If the
execution has
failed, the monitoring thread will immediately notify the second thread to
perform a
rollback operation on the local block file, return to the status of the
previous block, and
wait for the renewed operation of writing the current block.
[0067] Step D ¨ updating the blockchain status database after verifications of
the transaction
endorsements have ended.
[0068] Specifically, in the embodiments of the present invention, it is
required for the third thread
to execute the read/write set of all valid transactions in the current block
according to the
verification result provided by the second thread in Step B and to update the
blockchain
status database after waiting for the complete execution of the operation of
updating the
blockchain history database of the previous block. After the execution has
been
completed, the third thread feeds back the execution result to the monitoring
thread and
waits for the later to assign the next task.
[0069] If the third thread has successfully updated the blockchain status
database, the monitoring
thread will wait for and summarize the execution results of other threads
before notifying
the third thread. If the execution has failed, the monitoring thread will
immediately notify
13
Date Recue/Date Received 2022-02-01

the third thread to perform a rollback operation on the status database,
return to the status
of the previous block, and wait for the renewed operation of writing in the
current block.
[0070] Step E - updating the blockchain history database after the above Steps
A to D have all
been completed.
[0071] Specifically, the monitoring thread waits for the first thread, the
second thread and the
third thread to have completed the above Steps A to D, and thereafter
summarizes the
execution results of the various threads. If all threads have successfully
executed their
operations, the third thread is notified to continue to update the blockchain
history
database according to the current block, and the ledger writing-in flow of the
next block
is started; if anyone of the threads has failed its execution task, the other
threads that have
succeeded their executions are notified to perform data rollback.
[0072] Fig. 5 is a flowchart illustrating the method of writing blockchain
data in parallel
according to another exemplary embodiment. As shown in Fig. 5, the method
comprises
the following steps.
[0073] 51 - receiving a current block to be processed, employing a first
thread to write the current
block into a structure file of a blockchain, simultaneously employing a second
thread to
verify transaction endorsement of the current block, and obtaining a
verification result.
[0074] Specifically, it is possible in the embodiments of the present
invention to preconfigure,
based on practical requirements, a plurality of threads, such as a first
thread, a second
thread, and a third thread, etc., and to configure each thread to execute
different operations
in the ledger writing-in process. As a preferred mode of execution in the
embodiments of
the present invention, the first thread executes the local blockchain
structure file writing-
in operation, the second thread executes the operation of verifying the
transaction
endorsement and the operation of writing the verification result, and the
third thread
14
Date Recue/Date Received 2022-02-01

executes the operations of updating the status database and the history
database of the
blockchain.
[0075] S2 - employing, if verification of the transaction endorsement is
passed, the second thread
to write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of the blockchain according to the current
block.
[0076] Specifically, after the second thread has verified that the transaction
endorsement of the
current block has passed verification, on the one hand, the second thread is
continuously
employed to write the verification result into the structure file, on the
other hand, the third
thread is notified to update the status database of the blockchain according
to the current
block. As should be noted here, since the first thread and the second thread
both involve
the writing-in of the local blockchain structure file, in order to prevent the
same and single
file from being simultaneously written in to cause system error, it is so set
up in the
embodiments of the present invention that the block itself and the
verification result of
the transaction endorsement are respectively stored, that is to say, writing-
in is directed
to different blockchain structure files, whereby the overall writing-in
efficiency of the
blockchain structure is enhanced. As should be noted here, in the embodiments
of the
present invention, data stored in the status database includes, but is not
limited to, the
newest values of all keys after all transactions contained in the current
ledger have been
executed to completion. Taking the newest value of a certain key at the
current time point
as an example, when the transaction is executed, only the change itself is
executed, while
the action changed is not recorded.
[0077] S3 - obtaining execution results of the first thread, the second thread
and the third thread,
and, if the execution results all exhibit successful executions, employing the
third thread
to update a history database of the blockchain according to the current block.
Date Recue/Date Received 2022-02-01

[0078] Specifically, in order to prevent block writing sequence error in the
blockchain ledger
from making it impossible for the blockchain network to reach consensus, the
bookkeeping node performs the ledger writing-in operation on the next block
only after
the four operations, i.e. writing into the structure file of the current
block, verifying the
transaction endorsement, writing the verification result, and updating the
status database,
have been executed to completion. In the embodiments of the present invention,
only the
operation of updating the history database can be executed in the cycle of
execution of
the next block, this is so because the history database is for query by users
only, while it
is not allowed for users to write, and there would be no system collapse due
to its writing
sequence error. In addition, the operation of updating the blockchain history
database can
also be executed by a fourth thread set up according to actual business
requirements, so
as to further enhance the overall transaction performance of the blockchain
network. As
should be noted here, in the embodiments of the present invention, data stored
in the
history database includes, but is not limited to, change in the versions of
keys. For
instance, a certain key is changed in a certain transaction of a certain
block, only the
change action is recorded, while the change itself is not executed.
[0079] As a preferred mode of execution in the embodiments of the present
invention, the step
of obtaining execution results of the first thread, the second thread and the
third thread
includes:
[0080] employing a preset monitoring thread to monitor the first thread, the
second thread and
the third thread, and obtaining execution results of the first thread, the
second thread and
the third thread.
[0081] Specifically, it is monitored through the preset monitoring thread
whether the first thread
has completed the local blockchain structure file writing-in operation,
whether the second
thread has completed the operation of verifying the transaction endorsement
and the
operation of writing the verification result, and whether the third thread has
completed
the operation of updating the blockchain status database. After the monitoring
thread has
16
Date Recue/Date Received 2022-02-01

detected that the aforementioned four tasks of the current block have all been
successfully
executed, the first thread is again enabled to start executing the structure
file writing-in
operation of the next block, and the second thread to start executing the
operation of
verifying the transaction endorsement of the next block, and so on. As should
be noted
here, in the embodiments of the present invention, the preset monitoring
thread can be
embodied as a separate thread to execute the monitoring operation, and can
also be
embodied as a first thread to undertake the monitoring operation among other
operations
¨ this is freely selectable by users as practically required, and no
restriction is made
thereto in this context.
[0082] As a preferred mode of execution in the embodiments of the present
invention, the method
further comprises:
[0083] notifying, if the preset monitoring thread monitors that anyone of the
first thread, the
second thread and the third thread has failed to execute, the other
successfully executed
threads to perform data rollback.
[0084] Specifically, the monitoring thread waits for the first thread, the
second thread and the
third thread to have completed their respective operations, and thereafter
summarizes the
execution results of the various threads. In order to guarantee correct
writing-in of the
block, it is so set in the embodiments of the present invention that one
correct block
writing-in is counted in the case all threads have successfully executed their
operations;
when the monitoring thread monitors that anyone of the first thread, the
second thread
and the third thread has failed execution, the other threads that have
succeeded executions
are notified to perform data rollback.
[0085] As a preferred mode of execution in the embodiments of the present
invention, while
employing a first thread to write the current block into a structure file of a
blockchain,
simultaneously employing a second thread to verify transaction endorsement of
the
current block, and obtaining a verification result, the method further
comprises:
17
Date Recue/Date Received 2022-02-01

[0086] employing the third thread to update the history database of the
blockchain according to
a block previous to the current block.
[0087] Specifically, in order to further enhance the overall transaction
performance of the
blockchain network, in the embodiments of the present invention, while
employing a first
thread to write the current block into a structure file of a blockchain,
simultaneously
employing a second thread to verify transaction endorsement of the current
block, and
obtaining a verification result, the third thread is further employed to
update the history
database of the blockchain according to a block previous to the current block.
That is to
say, in the current block writing-in process, for the operation of updating
the history
database of the blockchain by the third thread, the valid transaction
read/write set in the
block previous to the current block is used and imported into the history
database.
[0088] As a preferred mode of execution in the embodiments of the present
invention, the step
of employing a third thread to update a status database of the blockchain
according to the
current block includes:
[0089] judging whether the operation to update the history database of the
blockchain according
to a block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
[0090] Specifically, it is required for the third thread to wait for the
operation of updating the
blockchain history database according to the block previous to the current
block to have
been executed to completion, and thereafter execute the operation of updating
the status
database of the blockchain according to the current block, so as to prevent
block writing
sequence error in the blockchain ledger from making it impossible for the
blockchain
network to reach consensus.
18
Date Recue/Date Received 2022-02-01

[0091] Specifically, it is so set in another mode of execution that the
operation of updating the
blockchain history database is executed by a fourth thread, so as to further
enhance the
overall transaction performance of the blockchain network. Since the
operations of
updating the blockchain status database and updating the blockchain history
database are
respectively executed by two different threads, it is possible for the third
thread to
immediately execute the task of updating the status database for the next
block of the
current block after receiving the task, without having to wait for the
completion of
updating the history database of the current block.
[0092] As a preferred mode of execution in the embodiments of the present
invention, the step
of employing a second thread to verify transaction endorsement of the current
block
includes:
[0093] verifying whether version numbers of all key values in a read/write set
of all transactions
in the current block are consistent with a version number of the current
block.
[0094] As a preferred mode of execution in the embodiments of the present
invention, the step
of employing the second thread to write the verification result into the
structure file
includes:
[0095] employing the second thread to compile transactions that have passed
verification into a
preset array, and writing the preset array into the structure file.
[0096] Fig. 6 is a view schematically illustrating the structure of the device
for writing
blockchain data in parallel according to an exemplary embodiment. The device
comprises:
[0097] a block receiving module, for receiving a current block to be
processed;
[0098] a first processing module, for employing a first thread to write the
current block into a
structure file of a blockchain;
[0099] a second processing module, for simultaneously employing a second
thread to verify
transaction endorsement of the current block, and obtaining a verification
result; and
employing, if verification of the transaction endorsement is passed, the
second thread to
19
Date Recue/Date Received 2022-02-01

write the verification result into the structure file;
[0100] a third processing module, for employing a third thread to update a
status database of the
blockchain according to the current block; and
[0101] a thread monitoring module, for obtaining execution results of the
first thread, the second
thread and the third thread;
[0102] wherein the third processing module is further used for, if the
execution results all exhibit
successful executions, employing the third thread to update a history database
of the
blockchain according to the current block.
[0103] As a preferred mode of execution in the embodiments of the present
invention, the thread
monitoring module is specifically employed for:
[0104] employing a preset monitoring thread to monitor the first thread, the
second thread and
the third thread, and obtaining execution results of the first thread, the
second thread and
the third thread.
[0105] As a preferred mode of execution in the embodiments of the present
invention, the thread
monitoring module is further employed for:
[0106] notifying, if the preset monitoring thread monitors that anyone of the
first thread, the
second thread and the third thread has failed to execute, the other
successfully executed
threads to perform data rollback.
[0107] As a preferred mode of execution in the embodiments of the present
invention, the third
processing module is further employed for:
[0108] employing the third thread to update the history database of the
blockchain according to
a block previous to the current block.
[0109] As a preferred mode of execution in the embodiments of the present
invention, the third
processing module is specifically employed for:
Date Recue/Date Received 2022-02-01

[0110] judging whether the operation to update the history database of the
blockchain according
to a block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
[0111] As a preferred mode of execution in the embodiments of the present
invention, the second
processing module is specifically employed for:
[0112] verifying whether version numbers of all key values in a read/write set
of all transactions
in the current block are consistent with a version number of the current
block.
[0113] As a preferred mode of execution in the embodiments of the present
invention, the second
processing module is specifically employed for:
[0114] employing the second thread to compile transactions that have passed
verification into a
preset array, and writing the preset array into the structure file.
[0115] Fig. 7 is a view schematically illustrating the internal structure of
the computer equipment
according to an exemplary embodiment. With reference to Fig. 7, the computer
equipment
comprises a processor, a memory, and a network interface connected to each
other via a
system bus. The processor of the computer equipment is employed to provide
computing
and controlling capabilities. The memory of the computer equipment includes a
nonvolatile storage medium, and an internal memory. The nonvolatile storage
medium
stores therein an operating system, a computer program and a database. The
internal
memory provides environment for the running of the operating system and the
computer
program in the nonvolatile storage medium. The network interface of the
computer
equipment is employed to communicate with an external terminal via network
connection.
The computer program realizes a method of optimizing an execution plan when it
is
executed by a processor.
21
Date Recue/Date Received 2022-02-01

[0116] As understandable to persons skilled in the art, the structure
illustrated in Fig. 7 is merely
a block diagram of partial structure relevant to the solution of the present
invention, and
does not constitute any restriction to the computer equipment on which the
solution of
the present invention is applied, as the specific computer equipment may
comprise
component parts that are more than or less than those illustrated in Fig. 7,
or may combine
certain component parts, or may have different layout of component parts.
[0117] As a preferred mode of execution in the embodiments of the present
invention, the
computer equipment comprises a memory, a processor and a computer program
stored
on the memory and operable on the processor, and the following steps are
realized when
the processor executes the computer program:
[0118] receiving a current block to be processed, employing a first thread to
write the current
block into a structure file of a blockchain, simultaneously employing a second
thread to
verify transaction endorsement of the current block, and obtaining a
verification result;
[0119] employing, if verification of the transaction endorsement is passed,
the second thread to
write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of the blockchain according to the current
block; and
[0120] obtaining execution results of the first thread, the second thread and
the third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block.
[0121] As a preferred mode of execution in the embodiments of the present
invention, when the
processor executes the computer program, the following steps are further
realized:
[0122] employing a preset monitoring thread to monitor the first thread, the
second thread and
the third thread, and obtaining execution results of the first thread, the
second thread and
the third thread.
[0123] As a preferred mode of execution in the embodiments of the present
invention, when the
processor executes the computer program, the following step is further
realized:
22
Date Recue/Date Received 2022-02-01

[0124] notifying, if the preset monitoring thread monitors that anyone of the
first thread, the
second thread and the third thread has failed to execute, the other
successfully executed
threads to perform data rollback.
[0125] As a preferred mode of execution in the embodiments of the present
invention, when the
processor executes the computer program, the following step is further
realized:
[0126] employing the third thread to update the history database of the
blockchain according to
a block previous to the current block.
[0127] As a preferred mode of execution in the embodiments of the present
invention, when the
processor executes the computer program, the following steps are further
realized:
[0128] judging whether the operation to update the history database of the
blockchain according
to a block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
[0129] As a preferred mode of execution in the embodiments of the present
invention, when the
processor executes the computer program, the following step is further
realized:
[0130] verifying whether version numbers of all key values in a read/write set
of all transactions
in the current block are consistent with a version number of the current
block.
[0131] As a preferred mode of execution in the embodiments of the present
invention, when the
processor executes the computer program, the following steps are further
realized:
[0132] employing the second thread to compile transactions that have passed
verification into a
preset array, and writing the preset array into the structure file.
[0133] In the embodiments of the present invention, there is further provided
a computer-
readable storage medium storing thereon a computer program, and the following
steps
are realized when the computer program is executed by a processor:
23
Date Recue/Date Received 2022-02-01

[0134] receiving a current block to be processed, employing a first thread to
write the current
block into a structure file of a blockchain, simultaneously employing a second
thread to
verify transaction endorsement of the current block, and obtaining a
verification result;
[0135] employing, if verification of the transaction endorsement is passed,
the second thread to
write the verification result into the structure file, and simultaneously
employing a third
thread to update a status database of the blockchain according to the current
block; and
[0136] obtaining execution results of the first thread, the second thread and
the third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block.
[0137] As a preferred mode of execution in the embodiments of the present
invention, when the
computer program is executed by a processor, the following steps are further
realized:
[0138] employing a preset monitoring thread to monitor the first thread, the
second thread and
the third thread, and obtaining execution results of the first thread, the
second thread and
the third thread.
[0139] As a preferred mode of execution in the embodiments of the present
invention, when the
computer program is executed by a processor, the following step is further
realized:
[0140] notifying, if the preset monitoring thread monitors that anyone of the
first thread, the
second thread and the third thread has failed to execute, the other
successfully executed
threads to perform data rollback.
[0141] As a preferred mode of execution in the embodiments of the present
invention, when the
computer program is executed by a processor, the following step is further
realized:
[0142] employing the third thread to update the history database of the
blockchain according to
a block previous to the current block.
[0143] As a preferred mode of execution in the embodiments of the present
invention, when the
computer program is executed by a processor, the following steps are further
realized:
24
Date Recue/Date Received 2022-02-01

[0144] judging whether the operation to update the history database of the
blockchain according
to a block previous to the current block has been executed to completion, if
yes,
employing the third thread to update the status database of the blockchain
according to
the current block.
[0145] As a preferred mode of execution in the embodiments of the present
invention, when the
computer program is executed by a processor, the following step is further
realized:
[0146] verifying whether version numbers of all key values in a read/write set
of all transactions
in the current block are consistent with a version number of the current
block.
[0147] As a preferred mode of execution in the embodiments of the present
invention, when the
computer program is executed by a processor, the following steps are further
realized:
[0148] employing the second thread to compile transactions that have passed
verification into a
preset array, and writing the preset array into the structure file.
[0149] To sum it up, the technical solutions provided by the embodiments of
the present
invention bring about the following advantageous effects.
[0150] In the method and device for writing blockchain data in parallel, and
corresponding
computer equipment and storage medium provided by the embodiments of the
present
invention, by receiving a current block to be processed, employing a first
thread to write
the current block into a structure file of a blockchain, simultaneously
employing a second
thread to verify transaction endorsement of the current block, obtaining a
verification
result, employing, if verification of the transaction endorsement is passed,
the second
thread to write the verification result into the structure file,
simultaneously employing a
third thread to update a status database of the blockchain according to the
current block,
obtaining execution results of the first thread, the second thread and the
third thread, and,
if the execution results all exhibit successful executions, employing the
third thread to
update a history database of the blockchain according to the current block,
namely,
Date Recue/Date Received 2022-02-01

through coordinated operations of a plurality of threads, the present
invention counts it
as one correct ledger writing-in only when all threads have successfully
executed, thereby
ledgers of various nodes are maintained consistent, while the overall
transaction
performance of the blockchain network is enhanced, transaction delay is
reduced,
computational tasks of the blockchain are flexibly allocated, plural CPUs are
allowed to
simultaneously process received plural pieces of transaction data, and waste
of
computational resources of the server is avoided.
[0151] Moreover, in the method and device for writing blockchain data in
parallel, and
corresponding computer equipment and storage medium provided by the
embodiments
of the present invention, by employing a first thread to write the current
block into a
structure file of a blockchain, simultaneously employing a second thread to
verify
transaction endorsement of the current block, obtaining a verification result,
and
employing the third thread to update the history database of the blockchain
according to
a block previous to the current block, writing-in operations of two adjacent
blocks can as
well be partially concurrently executed, whereby transaction processing speed
of
blockchain nodes is enhanced, so that the blockchain technology can be applied
to such
highly concurrent and quasi real-time transaction fields as the traditional
retail payment,
and application scenarios of the blockchain technology are broadened.
[0152] As should be noted, when the device for writing blockchain data in
parallel provided by
the aforementioned embodiment triggers a writing-in business, it is merely
exemplarily
described with its division into the aforementioned various functional
modules, whereas
in actual application it is possible to base on requirements to assign the
aforementioned
functions to different functional modules for completion, that is to say, the
internal
structure of the device is divided into different functional modules to
complete the entire
or partial functions as described above. In addition, the device for writing
blockchain data
in parallel provided by the aforementioned embodiment pertains to the same
inventive
conception as the method of writing blockchain data in parallel, in other
words, the device
26
Date Recue/Date Received 2022-02-01

is based on the method of writing blockchain data in parallel ¨ see the method

embodiment for its specific implementation process, while no repetition will
be made in
this context.
[0153] As comprehensible to persons ordinarily skilled in the art, the entire
or partial steps in the
aforementioned embodiments can be completed via hardware, or via a program
instructing relevant hardware, the program can be stored in a computer-
readable storage
medium, and the storage medium can be a read-only memory, a magnetic disk or
an
optical disk, etc.
[0154] The foregoing embodiments are merely preferred embodiments of the
present invention,
and they are not to be construed as restrictive to the present invention. Any
amendment,
equivalent substitution, and improvement makeable within the spirit and
principle of the
present invention shall all fall within the protection scope of the present
invention.
27
Date Recue/Date Received 2022-02-01

Representative Drawing
A single figure which represents the drawing illustrating the invention.
Administrative Status

For a clearer understanding of the status of the application/patent presented on this page, the site Disclaimer , as well as the definitions for Patent , Administrative Status , Maintenance Fee  and Payment History  should be consulted.

Administrative Status

Title Date
Forecasted Issue Date 2023-03-14
(22) Filed 2022-02-01
Examination Requested 2022-04-05
(41) Open to Public Inspection 2022-08-01
(45) Issued 2023-03-14

Abandonment History

There is no abandonment history.

Maintenance Fee

Last Payment of $100.00 was received on 2023-12-15


 Upcoming maintenance fee amounts

Description Date Amount
Next Payment if small entity fee 2025-02-03 $50.00
Next Payment if standard fee 2025-02-03 $125.00

Note : If the full payment has not been received on or before the date indicated, a further fee may be required which may be one of the following

  • the reinstatement fee;
  • the late payment fee; or
  • additional fee to reverse deemed expiry.

Patent fees are adjusted on the 1st of January every year. The amounts above are the current amounts if received by December 31 of the current year.
Please refer to the CIPO Patent Fees web page to see all current fee amounts.

Payment History

Fee Type Anniversary Year Due Date Amount Paid Paid Date
Application Fee 2022-02-01 $407.18 2022-02-01
Advance an application for a patent out of its routine order 2022-04-05 $508.98 2022-04-05
Request for Examination 2026-02-02 $814.37 2022-04-05
Final Fee 2022-02-01 $306.00 2023-02-02
Maintenance Fee - Patent - New Act 2 2024-02-01 $100.00 2023-12-15
Owners on Record

Note: Records showing the ownership history in alphabetical order.

Current Owners on Record
10353744 CANADA LTD.
Past Owners on Record
None
Past Owners that do not appear in the "Owners on Record" listing will appear in other documentation within the application.
Documents

To view selected files, please enter reCAPTCHA code :



To view images, click a link in the Document Description column. To download the documents, select one or more checkboxes in the first column and then click the "Download Selected in PDF format (Zip Archive)" or the "Download Selected as Single PDF" button.

List of published and non-published patent-specific documents on the CPD .

If you have any difficulty accessing content, you can call the Client Service Centre at 1-866-997-1936 or send them an e-mail at CIPO Client Service Centre.


Document
Description 
Date
(yyyy-mm-dd) 
Number of pages   Size of Image (KB) 
New Application 2022-02-01 6 223
Description 2022-02-01 27 1,242
Claims 2022-02-01 3 117
Abstract 2022-02-01 1 27
Drawings 2022-02-01 6 520
Request for Examination / Amendment / Special Order 2022-04-05 19 765
Acknowledgement of Grant of Special Order 2022-05-12 1 181
Claims 2022-04-05 14 566
Examiner Requisition 2022-06-23 4 206
Representative Drawing 2022-08-25 1 36
Cover Page 2022-08-25 1 67
Amendment 2022-08-22 35 1,405
Claims 2022-08-22 14 808
Final Fee 2023-02-02 3 66
Representative Drawing 2023-02-24 1 33
Cover Page 2023-02-24 1 66
Electronic Grant Certificate 2023-03-14 1 2,527