Note: Descriptions are shown in the official language in which they were submitted.
CA 03161753 2022-05-16
BLOCKCHAIN-SMART-CONTRACT DEBUGGING AND RELEASING METHOD
AND SYSTEM THEREOF
BACKGROUND OF THE INVENTION
Technical Field
[0001] The present invention relates to the technical field of blockchain, and
more particularly
to a blockchain-smart-contract debugging and releasing method and a system
thereof.
Description of Related Art
[0002] With the emergence and development of blockchain technology, there have
been more
and more businesses and organizations trying to explore landing application of
blockchain technology in diverse commercial and living scenarios and expect
the new
technology to bring tangible benefits to various producing and living
activities in the
society. As a foundational platform that provides upper services with
environments to run
contracts and with technical supports, a blockchain platform has to ensure its
own
operational stability while supporting and securing stability and availability
of its upper-
layer services.
[0003] At present, blockchain technology has been extensively used in many
fields, like finance,
logistics, copyright protections and more. Because of the complexity and
variability of
the upper layer services, smart contracts deployed on blockchains usually need
repeated
revision and test to be verified as matching requirements for their respective
business
operations. The typical practice in a blockchain platform is to repeatedly
revise and
repeatedly deploy its smart contract, and this can lead to two problems:
[0004] 1. Every time the smart contract is revised and deployed, consensus has
to be reached for
its content in the transaction channel, making workload of every participating
party in the
blockchain even heavier; and
1
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
[0005] 2. For the same reason, there are a huge amount of useless test data in
the transaction
channel, leading to inefficient query and storage of blocks and transactions
in the channel.
SUMMARY OF THE INVENTION
[0006] To solve the problems in the prior art, one embodiment of the present
invention provides
a blockchain-smart-contract debugging and releasing method which solves
problems in
the prior art about heavy workload for participating parties in a blockchain
caused by
frequent revision and deployment of smart contracts, and about inefficient
query and
storage of blocks and transactions in transaction channels due to the presence
of useless
test data accumulated in transaction channels.
[0007] In one aspect, the present invention provides a blockchain-smart-
contract debugging and
releasing method, comprising the following steps:
[0008] Si: automatically creating a test channel while creating a transaction
channel, and
entering or leaving a user with respect to the test channel synchronously when
the user
enters or leaves the transaction channel;
[0009] S2: deploying a to-be-tested smart contract into the test channel, so
that all users in the
test channel jointly perform a business test on content of the contract;
[0010] S3: determining whether the smart contract passes the test, if yes,
proceeding with the
step S4, if no, returning the smart contract to its developer for revising or
selecting another
smart contract and then going back to the step S2 to test the smart contract
again; and
[0011] S4: waiting for all the users in the test channel to reach consensus on
the content of the
smart contract, and after a feedback of agreement on deployment is received,
deploying
the smart contract into the transaction channel.
[0012] Further, the to-be-tested smart contract includes a newly submitted
smart contract and/or
a smart contract of a historical version.
[0013] Further, the step S3 comprises:
[0014] if the newly submitted smart contract passes the test, performing the
step S4, and if the
newly submitted smart contract does not pass the test, returning the smart
contract to the
2
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
developer for revising and then going back to the step S2 to test the smart
contract again;
and/or,
[0015] if the smart contract of a historical version passes the test,
performing the step S4, and if
the smart contract of a historical version does not pass the test, selecting
another smart
contract and then going back to the step S2 to test the smart contract again.
[0016] Further, the step S2 further comprises:
[0017] recording test data generated when the smart contract is operated in
the test channel into
the test channel, so that the test data become queriable to the users in the
test channel.
[0018] Further, in the step S2 comprises:
[0019] after the consensus is reached among all the users in the test channel,
the test data can be
deleted.
[0020] Further, the step S4 further comprises:
[0021] recording a block and/or transaction data generated when the smart
contract is operated
in the transaction channel into the transaction channel, so that the block
and/or the
transaction data become queriable to the users in the transaction channel.
[0022] In another aspect, the present invention provides a blockchain-smart-
contract debugging
and releasing system, at least comprising:
[0023] a creation module, for a user to operate to create a transaction
channel, and for
automatically creating a test channel while creating the transaction channel;
[0024] a registration module, for the user to operate to enter or leave the
transaction channel, and
for entering or leaving the user with respect to the test channel when the
user enters or
leaves the transaction channel;
[0025] a test module, for deploying a to-be-tested smart contract into the
test channel, so that all
users in the test channel jointly perform a business test on content of the
contract;
[0026] a determination module, for determining whether the smart contract
passes the test, if yes,
sending the to-be-tested smart contract to a release module, if no, returning
the smart
contract to its developer for revising or selecting another smart contract and
then sending
to the test module to test the smart contract again; and
[0027] the release module, for waiting for all the users in the test channel
to reach consensus on
3
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
the content of the smart contract, and after a feedback of agreement on
deployment is
received, deploying the smart contract into the transaction channel.
[0028] Further, the system further comprises:
[0029] a first storage module, for recording test data generated when the
smart contract is
operated in the test channel into the test channel; and
[0030] a first query module, for the user to operate to query the test data in
the test channel.
[0031] Further, the system further comprises:
[0032] a deletion module, for deleting the test data after the consensus is
reached among all the
users in the test channel.
[0033] Further, the system further comprises:
[0034] a second storage module, for recording a block and/or transaction data
generated when
the smart contract is operated in the transaction channel into the transaction
channel; and
[0035] a second query module, for the user to operate to query the block
and/or transaction data
in the transaction channel.
[0036] The technical schemes of the embodiments of the present invention
provide the following
beneficial effects:
[0037] 1. When a user creates a transaction channel, the blockchain-smart-
contract debugging
and releasing method and system provided by the embodiments of the present
invention
system automatically create a test channel having the same participating
parties as the
transaction channel so as to provide an environment for performing test before
formal
deployment of a contract and eliminate the need for consensus verification
every time a
test is deployed because the content of the smart contract is verified to be
matching the
businesses of participating parties in the transaction channel, thereby
reducing workload
for the participating parties and shortening the operational cycle for
updating the contract;
[0038] 2. The blockchain-smart-contract debugging and releasing method and
system provided
by the embodiments of the present invention store test data and transaction
data separately,
so as to prevent mutual interference between the two sets of data, thereby
effectively
improving operational and query efficiency of the underlying network of the
blockchain
and enhancing stability; and
4
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
[0039] 3. The blockchain-smart-contract debugging and releasing method and
system provided
by the embodiments of the present invention introduce the concept of process
specification and manageability in software development engineering into the
debugging
and releasing process for a smart contract of a blockchain channel, thereby
reducing costs
for maintaining the contract and maximizing teamwork efficiency.
BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The accompanying drawings are provided herein for better understanding
of the present
invention and form a part of this disclosure. The illustrative embodiments and
their
descriptions are for explaining the present invention and by no means form any
improper
limitation to the present invention, wherein:
[0041] FIG. 1 is a flowchart of a blockchain-smart-contract debugging and
releasing method
according to one exemplary embodiment of the present invention; and
[0042] FIG. 2 is a structural diagram of a blockchain-smart-contract debugging
and releasing
system according to one exemplary embodiment of the present invention.
DETAILED DESCRIPTION OF THE INVENTION
[0043] To make the foregoing objectives, features, and advantages of the
present invention
clearer and more understandable, the following description will be directed to
some
embodiments as depicted in the accompanying drawings to detail the technical
schemes
disclosed in these embodiments. It is, however, to be understood that the
embodiments
referred herein are only a part of all possible embodiments and thus not
exhaustive. Based
on the embodiments of the present invention, all the other embodiments can be
conceived
without creative labor by people of ordinary skill in the art, and all these
and other
embodiments shall be encompassed in the scope of the present invention.
[0044] FIG. 1 is a flowchart of a blockchain-smart-contract debugging and
releasing method
according to one exemplary embodiment of the present invention. As shown, the
method
comprises the following steps.
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
[0045] At the step Si, the method involves automatically creating a test
channel while creating
a transaction channel, and entering or leaving a user with respect to the test
channel
synchronously when the user enters or leaves the transaction channel.
[0046] Specifically, a user of a blockchain may create a transaction channel
according to his/her
business needs. When a user uses the system to create a transaction channel,
the system
automatically creates a test channel having the same participating users for
the user at the
same time. When the new blockchain user enters or leaves the transaction
channel, he/she
will enter or leave the corresponding test channel synchronously.
[0047] The step S2 is about deploying a to-be-tested smart contract into the
test channel, so that
all users in the test channel jointly perform a business test on content of
the contract.
[0048] Specifically, a user in a blockchain may deploy a to-be-tested smart
contract submitted
by a contract developer into the test channel, so that all users in the test
channel jointly
perform a business test on content of the contract. It is to be noted that, in
the embodiment
of the present invention, the content of the smart contract content has only
to be verified
by the participating parties in the test channel (who are also the
participating parties in
the transaction channel) that it matches their business during testing,
without the need the
need for consensus verification every time a test is deployed. This helps
reduce workload
for every participating party and shorten the operational cycle for updating
the contract.
[0049] To verify whether the content of the smart contract matches the
respective businesses of
the individual participating parties, the following process can be performed:
[0050] acquiring a smart contract code corresponding to the to-be-tested smart
contract, and
compiling the smart contract code, so as to obtain a compilation file;
[0051] analyzing the compilation file to generate a function testing page;
[0052] after the user input test parameters to the function testing page,
performing a function test
on the to-be-tested smart contract.
[0053] Further, the method comprises recording test data generated when the
smart contract is
operated in the test channel into the test channel, so that the test data
become queriable to
the users in the test channel.
[0054] Specifically, before the smart contract is formally deployed into the
transaction channel,
6
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
the test data generated when it is run in the test channel are recorded in the
test channel
for query and display. In other words, users can query the test data in the
test channel.
[0055] Further, in the disclosed method, after the consensus is reached among
all the users in the
test channel, the test data can be deleted.
[0056] Specifically, deletion of any data in the blockchain is prohibited
unless consensus on this
among all users in the channel is reached. For example, when the data capacity
of a
blockchain is about to reach its limit, a user in a channel in which test data
occupy more
space than other channels may initiate a request to delete the test data. Only
when
consensus on agreement to the request is reached, can the storage space taken
by the test
data be released. This helps protect data in the blockchain from unauthorized
deletion.
[0057] It is to be noted that, in the embodiment of the present invention, an
application is allowed
to call an SDK to write transactions into the test channel, and a limit about
how fast the
transactions can be submitted may be set in the SDK, so as to prevent testing
operation
in the test channel from interfering the performance of the transaction
channel.
[0058] The step S3 is for determining whether the smart contract passes the
test, if yes,
proceeding with the step S4, if no, returning the smart contract to its
developer for
revising or selecting another smart contract and then going back to the step
S2 to test the
smart contract again.
[0059] Specifically, after all users in the test channel jointly perform a
business test on content
of the contract, according to the test results, it can be determined whether
the to-be-tested
smart contract passes the test. If it does, the method is proceeded with the
step S4. If it
fails in the test, the smart contract is transferred to its developer for
revising or reselection
of another smart contract. Then the revised or newly selected smart contract
is subjected
to the step S2 where it is tested again.
[0060] At S4, the method comprises waiting for all the users in the test
channel to reach
consensus on the content of the smart contract, and after a feedback of
agreement on
deployment is received, deploying the smart contract into the formal
transaction channel
for use.
[0061] Specifically, after passing the test, the smart contract has to get
consensus on its content
7
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
from all the users in the test channel and receive a feedback of agreement on
deployment
before it can be to deployed into the transaction channel.
[0062] Further, recording a block and/or transaction data generated when the
smart contract is
operated in the transaction channel into the transaction channel, so that the
block and/or
the transaction data become queriable to the users in the transaction channel.
[0063] Specifically, the block and/or transaction data generated when the
smart contract is run
in the transaction channel are recorded in the transaction channel, and the
block and/or
transaction data can be queryd and displayed in the transaction channel, so
the user can
query the block and/or transaction data in the transaction channel. It is to
be noted that
both the data of the transaction channel and the data of the test channel have
the
characteristic of being incorruptible as all data in a blockchain, an since
they are stored
separately, the two sets of data are prevented from interfering each other,
thereby
effectively improving operational and query efficiency of the underlying
network of a
blockchain, and in turn enhancing stability.
[0064] Further, the to-be-tested smart contract includes a newly submitted
smart contract and/or
a smart contract of a historical version.
[0065] Further, the step S3 comprises:
[0066] if the newly submitted smart contract passes the test, performing the
step S4, and if the
newly submitted smart contract does not pass the test, returning the smart
contract to the
developer for revising and then going back to the step S2 to test the smart
contract again;
and/or,
[0067] if the smart contract of a historical version passes the test,
performing the step S4, and if
the smart contract of a historical version does not pass the test, selecting
another smart
contract and then going back to the step S2 to test the smart contract again.
[0068] Specifically, in the embodiment of the present invention, the to-be-
tested smart contract
may include a newly submitted smart contract and/or a smart contract of
historical
versions. In either case, if the smart contract passes the test, the method
goes to the step
S4. However, if the smart contract fails the test, the subsequent progress is
different. To
be specific, if the newly submitted smart contract fails the test, the smart
contract is
8
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
returned to the developer for revision and then subjected to the step S2,
where it is tested
again. If the smart contract of a historical version fails the test, another
smart contract is
selected and then the method goes back to the step S2 to test the smart
contract again.
[0069] That is to say, if the content of the smart contract needs to be
changed according to
business needs and therefore needs to be updated or rolled back to an earlier
version,
users in the blockchain may select to deploy a new smart contract submitted by
the
developer or a smart contract of an earlier version that once used in the
present transaction
channel into the test channel, so that all the users of the test channel
perform a business
test on the content of the contract in the test channel. If the smart contract
fails the test,
the newly submitted smart contract can be transferred to its developer for
revising,
resubmission and retesting. As to a smart contract of a historical version,
since it cannot
be altered, the only solution is to select another smart contract for re-
deployment and
retesting in the test channel. At this time, in the transaction channel, there
is still the
previous formally deployed contract running. If the test has a positive
result, all the users
in the channel try to reach consensus in the content of the smart contract and
after a
feedback of agreement on deployment is received, the updated contract is
formally
deployed into the transaction channel for use.
[0070] All of the foregoing alternative technical scheme may be combined in an
arbitrary manner
to form an alternative embodiment of the present invention, and these possible
combinations are not exhaustively described herein.
[0071] FIG. 2 is a structural diagram of a blockchain-smart-contract debugging
and releasing
system according to an exemplary embodiment of the present invention. As
shown, the
system at least comprises the following modules.
[0072] A creation module is for a user to operate to create a transaction
channel, and for
automatically creating a test channel when the user creates the transaction
channel.
Therein, the test channel and the transaction channel correspond to each
other.
[0073] A registration module is for the user to operate to enter or leave the
transaction channel,
and for entering or leaving the user with respect to the test channel when the
user enters
or leaves the transaction channel.
9
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
[0074] A test module is for deploying a to-be-tested smart contract into the
test channel, so that
all users in the test channel jointly perform a business test on content of
the contract.
[0075] Specifically, in the embodiment of the present invention, the content
of the smart contract
content has only to be verified by the participating parties in the test
channel (who are
also the participating parties in the transaction channel) that it matches
their businesses
during testing, without the need the need for consensus verification every
time a test is
deployed. This helps reduce workload for every participating party and shorten
the
operational cycle for updating the contract.
[0076] A determination module is for determining whether the smart contract
passes the test, if
yes, sending the to-be-tested smart contract to a release module, if no,
returning the smart
contract to its developer for revising or selecting another smart contract and
then sending
to the test module to test the smart contract again.
[0077] It is to be noted that the to-be-tested smart contract may include a
newly submitted smart
contract and/or a smart contract of a historical version. If the newly
submitted smart
contract does not pass the testing, it may be transferred the developer of the
contract for
revision for subsequent resubmission and test. A smart contract of the
historical version
cannot be revised, so the only solution is to select another smart contract
and deploy it
into the test channel for testing.
[0078] The release module is for waiting for all the users in the test channel
to reach consensus
on the content of the smart contract, and after a feedback of agreement on
deployment is
received, deploying the smart contract into the transaction channel.
[0079] Further, the system further comprises:
[0080] a first storage module, for recording test data generated when the
smart contract is
operated in the test channel into the test channel; and
[0081] a first query module, for the user to operate to query the test data in
the test channel;
[0082] a deletion module, for deleting the test data after the consensus is
reached among all the
users in the test channel;
[0083] a second storage module, for recording a block and/or transaction data
generated when
the smart contract is operated in the transaction channel into the transaction
channel; and
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
[0084] a second query module, for the user to operate to query the block
and/or transaction data
in the transaction channel.
[0085] Specifically, in the embodiment of the present invention, both the data
of the transaction
channel and the data of the test channel have the characteristic of being
incorruptible as
all data in a blockchain, an since they are stored separately, the two sets of
data are
prevented from interfering each other, thereby effectively improving
operational and
query efficiency of the underlying network of a blockchain, and in turn
enhancing stability.
[0086] It is to be noted that implementation of the blockchain-smart-contract
debugging and
releasing system may be based on the blockchain-smart-contract debugging and
releasing
method as described previously.
[0087] To sum up, the technical schemes of the embodiments of the present
invention provide
the following beneficial effects:
[0088] 1. When a user creates a transaction channel, the blockchain-smart-
contract debugging
and releasing method and system provided by the embodiments of the present
invention
system automatically create a test channel having the same participating
parties as the
transaction channel so as to provide an environment for performing test before
formal
deployment of a contract and eliminate the need for consensus verification
every time a
test is deployed because the content of the smart contract is verified to be
matching the
businesses of participating parties in the transaction channel, thereby
reducing workload
for the participating parties and shortening the operational cycle for
updating the contract;
[0089] 2. The blockchain-smart-contract debugging and releasing method and
system provided
by the embodiments of the present invention store test data and transaction
data separately,
so as to prevent mutual interference between the two sets of data, thereby
effectively
improving operational and query efficiency of the underlying network of the
blockchain
and enhancing stability; and
[0090] 3. The blockchain-smart-contract debugging and releasing method and
system provided
by the embodiments of the present invention introduce the concept of process
specification and manageability in software development engineering into the
debugging
and releasing process for a smart contract of a blockchain channel, thereby
reducing costs
11
Date Recue/Date Received 2022-05-16
CA 03161753 2022-05-16
for maintaining the contract and maximizing teamwork efficiency.
[0091] It is to be noted that work division among the foregoing functional
modules for the
blockchain-smart-contract debugging and releasing system of the present
embodiment to
implement debugging and releasing services is merely exemplary. In practical
implementations, the work division may be made among different functional
modules. In
other words, the internal architecture of the order-based phoning system may
be
reconfigured with different functional modules to perform all or a part of the
functions as
described previously. In addition, since the order-based phoning system of the
present
embodiment and the disclosed order-based phoning method in the previous
embodiment
stem from the same conception, the details of its implementation can be
learned from the
description made to the method of the previous embodiment, and no repetition
is made
herein.
[0092] As will be appreciated by people of ordinary skill in the art,
implementation of all or a
part of the steps of the method of the present invention as described
previously may be
realized by having a program instruct related hardware components. The program
may
be stored in a computer-readable storage medium, and the program is about
performing
the individual steps of the methods described in the foregoing embodiments.
The storage
medium may be a ROM, a hard drive, an optical disk, or the like.
[0093] The preferred embodiments of the present invention described previously
are not intended
to limit the present invention. Any modification, equivalent replacement, and
improvement made under the spirit and principle of the present invention shall
be
embraces in the scope of the present invention.
12
Date Recue/Date Received 2022-05-16