CN115170312A - Asset state information changing method and device on block chain - Google Patents

Asset state information changing method and device on block chain Download PDF

Info

Publication number
CN115170312A
CN115170312A CN202210793141.8A CN202210793141A CN115170312A CN 115170312 A CN115170312 A CN 115170312A CN 202210793141 A CN202210793141 A CN 202210793141A CN 115170312 A CN115170312 A CN 115170312A
Authority
CN
China
Prior art keywords
asset
transaction
asset state
state machine
state information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210793141.8A
Other languages
Chinese (zh)
Inventor
冯冠杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202210793141.8A priority Critical patent/CN115170312A/en
Publication of CN115170312A publication Critical patent/CN115170312A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Development Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Technology Law (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Computing Systems (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a method and a device for changing asset state information on a block chain, which relate to the technical field of block chains, wherein the method comprises the following steps: receiving a transaction request submitted by a user, and processing the transaction request to obtain transaction information; sending the transaction information to a blockchain; calling an intelligent contract on the block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset by the intelligent contract; according to the asset state machine corresponding to the transaction asset type, verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action; and after the verification is passed, according to the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action, changing the asset state information corresponding to the transaction asset type on the blockchain. The invention can be used for developing the intelligent contract of state flow transfer of different types of assets, and reduces the development cost of the intelligent contract.

Description

Asset state information changing method and device on block chain
Technical Field
The invention relates to the technical field of block chains, in particular to a method and a device for changing asset state information on a block chain.
Background
This section is intended to provide a background or context to the embodiments of the invention that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section.
With the rapid development of the blockchain technology, some physical assets with non-currency attributes in the real world can be converted into virtual assets capable of being circulated on the blockchain.
At present, assets are circulated in a blockchain, and business terms are mainly realized by a developer through programming and fixing in intelligent contract codes. The method needs to compile intelligent contracts according to the business circulation rules of each type of assets, and due to the limitation of the underlying technology and the characteristic of high coupling with the business rules of the assets, the cost for compiling the intelligent contracts is high, and the efficiency is low.
Disclosure of Invention
The embodiment of the invention provides an asset state information change method on a block chain, which is used for setting asset state machines corresponding to a plurality of asset types in an intelligent contract, carrying out asset state change on the block chain according to the asset state machines, rapidly realizing development of the intelligent contract for state flow transfer of different types of assets, reducing the cost of compiling the intelligent contract and improving the efficiency of compiling the intelligent contract, and comprises the following steps:
receiving a transaction request submitted by a user, processing the transaction request to obtain transaction information, wherein the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system;
sending the transaction information to a blockchain;
calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type;
according to an asset state machine corresponding to the transaction asset type, verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action;
and after the verification is passed, according to the asset state information before the transaction and the asset state information after the transaction corresponding to the transaction action, changing the asset state information corresponding to the transaction asset type on the blockchain.
The embodiment of the present invention further provides a device for changing asset state information on a block chain, which is used to set asset state machines corresponding to a plurality of asset types in an intelligent contract, and change the asset states on the block chain according to the asset state machines, so that development of the intelligent contract for state flow transfer of assets of different types can be quickly realized, the cost for compiling the intelligent contract is reduced, and the efficiency for compiling the intelligent contract is improved, and the device includes:
the transaction information acquisition module is used for receiving a transaction request submitted by a user and processing the transaction request to obtain transaction information, wherein the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system;
the sending module is used for sending the transaction information to the block chain;
the state machine determining module is used for calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type;
the verification module is used for verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action according to the asset state machine corresponding to the transaction asset type;
and the change module is used for changing the asset state information corresponding to the transaction asset type on the block chain according to the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action after the verification is passed.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the asset state information change method on the block chain.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the method for changing the asset state information on the block chain is realized.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when the computer program is executed by a processor, the method for changing asset state information on a block chain is implemented.
In the embodiment of the invention, a transaction request submitted by a user is received, the transaction request is processed to obtain transaction information, the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system; sending the transaction information to a blockchain; calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type; according to an asset state machine corresponding to the transaction asset type, verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action; and after the verification is passed, according to the asset state information before the transaction and the asset state information after the transaction corresponding to the transaction action, changing the asset state information corresponding to the transaction asset type on the blockchain. Compared with the technical scheme that a developer fixes service terms on an intelligent contract code through programming in the prior art, the asset state machines corresponding to a plurality of asset types are arranged in the intelligent contract, and the asset state change on the block chain is carried out according to the asset state machines, so that the development of the intelligent contract for circulation of the asset states of different types can be quickly realized, the cost for compiling the intelligent contract is reduced, and the efficiency for compiling the intelligent contract is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
fig. 1 is a flowchart of an asset status information change method on a blockchain according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for setting an asset state machine corresponding to an asset type according to an embodiment of the present invention;
FIG. 3 is an exemplary diagram of an asset state machine state flow in an embodiment of the present invention;
fig. 4 is a schematic diagram of an asset status information modification apparatus on a blockchain according to an embodiment of the present invention;
fig. 5 is a schematic diagram of an asset state information modification apparatus on a blockchain according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
In the description of the present specification, the terms "comprising," "including," "having," "containing," and the like are used in an open-ended fashion, i.e., to mean including, but not limited to. Reference to the description of the terms "one embodiment," "a particular embodiment," "some embodiments," "for example," etc., means that a particular feature, structure, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the application. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. The sequence of steps involved in the various embodiments is provided to illustrate the practice of the present application, and the sequence of steps is not limited thereto and can be adjusted as needed.
An intelligent contract is embodied as a code program executed on a blockchain network, and generally defines relevant business rules and terms of a class of assets, and a developer is required to fix the business terms of the contract in the intelligent contract code through programming. Meanwhile, due to the requirement of the block chain technology, the intelligent contract has many more limitations in the development environment compared with the traditional development environment, for example, interfaces related to system levels such as system time, system state and the like are limited, so that the contract can be ensured to obtain the same determined result when the intelligent contract is executed at any time.
Therefore, the limitation of the underlying technology and the characteristic of high coupling with the business rules lead to higher development threshold of the intelligent contract, and the development cost is higher for developing the intelligent contract aiming at each type of assets and the corresponding business rules; due to the distributed deployment form of the intelligent contract on the block chain, once the code of the intelligent contract has errors and bugs, the influence and the repair difficulty are large, and the development efficiency is low.
In order to solve the above technical problem, embodiments of the present invention provide a method and an apparatus for changing asset status information on a block chain, which can define a status change process of an asset in an intelligent contract by using a working mechanism of a state machine, and define a change of the asset in a specific range in a form of a template, thereby reducing a development cost of the intelligent contract and improving reliability of the intelligent contract.
As shown in fig. 1, a flowchart of a method for changing asset state information on a blockchain according to an embodiment of the present invention is applied to each node on the blockchain, where each node on the blockchain is a service system, and the method includes the following steps:
step 101, receiving a transaction request submitted by a user, processing the transaction request to obtain transaction information, wherein the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system;
step 102, sending transaction information to a block chain;
103, calling an intelligent contract on the block chain, and determining an asset state machine corresponding to the transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type;
step 104, according to the asset state machine corresponding to the transaction asset type, verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action;
and 105, after the verification is passed, changing the asset state information corresponding to the transaction asset type on the block chain according to the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action.
In the embodiment of the invention, a transaction request submitted by a user is received, the transaction request is processed to obtain transaction information, the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system; sending the transaction information to a blockchain; calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type; according to an asset state machine corresponding to the transaction asset type, verifying the asset state information before transaction and the asset state information after transaction corresponding to the transaction action; and after the verification is passed, according to the asset state information before the transaction and the asset state information after the transaction corresponding to the transaction action, changing the asset state information corresponding to the transaction asset type on the blockchain. Compared with the technical scheme that a developer fixes service terms on an intelligent contract code through programming in the prior art, the asset state machines corresponding to a plurality of asset types are arranged in the intelligent contract, and the asset state change on the block chain is carried out according to the asset state machines, so that the development of the intelligent contract for circulation of the asset states of different types can be quickly realized, the cost for compiling the intelligent contract is reduced, and the efficiency for compiling the intelligent contract is improved.
In step 101, a plurality of service systems may be accessed to a block chain. When a user carries out transaction through the service system, the service system receives a transaction request submitted by the user, and transaction information is obtained after the transaction request is processed.
The transaction information comprises transaction asset types, transaction actions, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction actions. The asset state information before transaction and the asset state information after transaction corresponding to the transaction action are determined according to the service rules in the service system;
it should be noted that each business system has its own corresponding business rule, and the business rule defines the change of the state of the asset before and after the transaction according to the current transaction action. For example, in a shopping system, if a transaction is "pay", the status of the asset should be changed from "pay" to be paid "according to the corresponding business rules.
In step 102, the transaction information may be sent to the blockchain.
In step 103, an intelligent contract on the blockchain may be called, and an asset state machine corresponding to the transaction asset type may be determined from asset state machines corresponding to a plurality of asset types preset in the intelligent contract.
Wherein, the asset state machine corresponding to the transaction asset type can be used for indicating the asset state information circulation rule corresponding to the transaction asset type. That is, the assets of the transactional asset type must be circulated according to the asset state circulation rules defined by the asset state machine. For example: the intelligent contract defines a ticket asset, and an asset state machine corresponding to the ticket asset is defined as:
{ drawing a ticket: wait to sign for, invalidate }
{ to sign-in: sign for, invalidate }
{ sign-in: null }
{ abolishing: null }
Registering the bill, newly adding a bill asset, and newly adding the state of the bill asset as a bill drawing; carrying out acceptance operation on the bill, wherein the bill state is changed from bill drawing to receipt waiting; and no transaction operation can directly modify the state of the ticket from the ticket outlet to the receipt.
It should be noted that the asset state machine is a short name of a finite state machine, is a mathematical model abstracted from the operation rules of real things, and determines the operation rules of a transaction by defining the transformation of states under a specific action. In the embodiment of the invention, the asset state machine in the intelligent contract can be a moore type state machine, the next state of the asset is irrelevant to the current input and only relevant to the current state, and the method is mainly used for limiting the rules of state circulation in the action execution process of the asset.
In addition, the asset state machines corresponding to a plurality of asset types in the intelligent contract may be preset in the intelligent contract for the developer, and a specific setting process is described in the following embodiments.
In step 104, the asset state information before transaction and the asset state information after transaction corresponding to the transaction action may be checked according to the asset state transition rule in the asset state machine corresponding to the transaction asset type.
In step 105, after the verification passes, the asset status information corresponding to the type of the traded asset in the blockchain may be changed according to the pre-trading asset status information and the post-trading asset status information corresponding to the trading action.
In this embodiment of the present invention, after the step 104, the method may further include:
and after the verification fails, rejecting the transaction request submitted by the user.
That is, all operations on the asset that involve changes to the state information must satisfy the restrictions on state transitions in the asset state machine, otherwise the blockchain transaction that generated the current asset change will be denied.
In the embodiment of the present invention, as shown in fig. 2, a flowchart of a method for setting an asset state machine corresponding to an asset type provided in the embodiment of the present invention is provided, where the method includes the following steps:
setting an asset state machine corresponding to the transaction asset type by the following steps:
step 201, acquiring an asset state machine template in an intelligent contract;
step 202, performing initialization assignment on an asset state machine template according to a plurality of preset asset state information corresponding to transaction asset types and a preset asset state circulation rule corresponding to the transaction asset types to obtain a first asset state machine;
step 203, sending a plurality of asset state information corresponding to the transaction asset type and the first asset state machine to the block chain, so that each service system on the block chain checks the first asset state machine through a consensus mechanism of the block chain, and after the checking is passed, the asset state machine corresponding to the transaction asset type is obtained.
In the embodiment of the invention, the asset state machine template is stored in an intelligent contract in a key-value key value pair set form;
the step 202 may specifically include: according to a preset asset state circulation rule corresponding to the transaction asset type, taking each asset state information corresponding to the transaction asset type as a key value of each key in a key-value key value pair set to obtain an assigned key-value key value pair set, wherein the assigned key-value key value pair set is a first asset state machine.
The preset asset state circulation rule corresponding to the transaction asset type comprises the following steps: the initial state, the final state of the asset state and the next state corresponding to each current state.
In specific implementation, the business rules of each type of assets are different, and the corresponding asset state transition rules are also different. Therefore, a set of asset state machines can be set for each type of assets to define the valuable value and the circulation method of the asset state.
In particular implementations, the asset state machine template may be a set of key-value pairs, each asset state machine defined in a set of key-value pairs (key-values). Each state corresponds to a key (key) in a key-value pair, and the set of next states to which the state can flow corresponds to a key-value pair value (value) as a list.
That is, the key-value pairs are used to define the property of the asset state machine itself, specifying rules that may be passed between states, such as: the asset state machine template may be:
{ state 1: state 2
{ state 2: state 1, state 3}
{ state 3: null }
The state machine corresponding to the transacted asset type can be derived by initially assigning values to state 1, state 2, and state 3 in the asset state machine template of the above example.
In specific implementation, the key-value pair set can be assigned according to the asset state circulation rule corresponding to the asset type. Specifically, when an asset is newly built, the state of the asset must be initialized and assigned, and the value of the state must be a value (value) corresponding to a key (key) in a state machine, where the key value pair defines an initial state (i.e., an initial state) of the asset when the asset is generated; when the state of the asset is circulated, the value of the state of the asset must be one of the values of keys (keys) of all key value pairs in the asset state machine, and the circulated state must be: the key (key) in the asset state machine is one of values (value) corresponding to the states before the stream. In addition, if the state of the asset flows to the state during circulation, and the value (value) corresponding to the key (key) in the state machine is null, the current state is the final state, and the state of the asset cannot flow to other states.
As shown in table 1, an example of state flow assignments for a state machine.
Table 1 state flow assignment example for state machine
KEY VALUE
INIT A
A B C
B D
C D
D B E
E
The asset state machine state flow diagram corresponding to the state flow assignment example of the state machine in table 1 is shown in fig. 3, with arrows indicating the direction of state flow.
In particular, after the asset state machine template is initially assigned, it needs to be identified and approved by participating organizations (i.e., multiple business systems) on the whole blockchain. Consensus can be achieved in two ways: one is that after the current business system completes the asset state machine initialization assignment operation (namely, the first asset state machine is obtained), other business systems on the block chain perform consensus (checking process), and perform signature approval on the current state machine initialization assignment, and the initialization assignment becomes effective after all the business systems on the block chain complete signature; the other is that all the business system elects a trusted management organization (business system) through a consensus mechanism, and the management organization carries out state machine initialization assignment and directly takes effect.
In the embodiment of the present invention, the method may further include the following steps:
receiving a plurality of asset state information corresponding to a first asset type and sent by other service systems on a block chain, and a second asset state machine, wherein the second asset state machine is obtained by assigning a value to an asset state machine template according to the plurality of asset state information corresponding to the first asset type and an asset state transfer rule corresponding to the first asset type;
auditing the second asset state machine through a consensus mechanism of the block chain;
after the audit is passed, signing the second asset state machine;
and sending the signed second asset state machine to the block chain.
In summary, in the embodiment of the present invention, the asset state machine template is embedded in the intelligent contract, and the operation mode of the assets in the intelligent contract is specified in a templatized manner, so that the intelligent contract does not need to be developed from the beginning for the business rules of different types of assets at each time, and thus, the development efficiency of the intelligent contract can be improved, and the development cost can be reduced.
In addition, in the embodiment of the invention, the asset state machine is defined by setting key value pairs, including the circulation of each state, the initial state and the final state, so that the asset must meet the limitation regulation of the states in the asset state machine in the state circulation, and the possibility of program bugs existing in the intelligent contract is reduced.
In addition, in the embodiment of the invention, the asset state machine of the intelligent contract can be flexibly configured when the contract is deployed so as to meet the requirements of different types of intelligent contract assets, and in addition, in the embodiment of the invention, only the attribute of the state of each type of asset is defined; other attributes of the assets can be customized without limitation, so that the development efficiency of the intelligent contract can be improved, the development cost of the intelligent contract can be reduced, and the flexibility of the intelligent contract can be ensured.
The embodiment of the invention also provides a device for changing the asset state information on the block chain, which is described in the following embodiment. Because the principle of the device for solving the problems is similar to the asset state information changing method on the block chain, the implementation of the device can refer to the implementation of the asset state information changing method on the block chain, and repeated parts are not described again.
As shown in fig. 4, a schematic diagram of an apparatus for changing asset state information in a blockchain according to an embodiment of the present invention is applied to each node in the blockchain, where each node in the blockchain is a service system, and the apparatus includes:
the transaction information acquisition module 401 is configured to receive a transaction request submitted by a user, process the transaction request, and obtain transaction information, where the transaction information includes a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system;
a sending module 402, configured to send the transaction information to the blockchain;
a state machine determining module 403, configured to invoke an intelligent contract on a block chain, and determine an asset state machine corresponding to a transaction asset type from asset state machines corresponding to multiple asset types preset in the intelligent contract, where the asset state machine corresponding to the transaction asset type is used to indicate an asset state information circulation rule corresponding to the transaction asset type;
a verification module 404, configured to verify, according to an asset state machine corresponding to a transaction asset type, pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action;
and a changing module 405, configured to change, after the verification passes, asset state information corresponding to the type of the traded asset in the blockchain according to the pre-trading asset state information and the post-trading asset state information corresponding to the trading action.
In this embodiment of the present invention, as shown in fig. 5, a state machine setting module 501 may further be included, configured to, before the state machine determining module invokes the intelligent contract on the blockchain:
setting an asset state machine corresponding to the transaction asset type by the following steps:
acquiring an asset state machine template in an intelligent contract;
initializing and assigning an asset state machine template according to a plurality of preset asset state information corresponding to the transaction asset types and a preset asset state circulation rule corresponding to the transaction asset types to obtain a first asset state machine;
and sending the plurality of asset state information corresponding to the transaction asset types and the first asset state machine to the block chain, so that each service system on the block chain checks the first asset state machine through a consensus mechanism of the block chain, and obtaining the asset state machine corresponding to the transaction asset types after the checking is passed.
In the embodiment of the invention, the asset state machine template is stored in an intelligent contract in a key-value key value pair set form;
the state machine setting module is specifically further configured to:
according to a preset asset state circulation rule corresponding to the transaction asset type, taking each asset state information corresponding to the transaction asset type as a key value of each key in a key-value key value pair set to obtain an assigned key-value key value pair set, wherein the assigned key-value key value pair set is a first asset state machine.
In an embodiment of the present invention, the preset asset state transition rule corresponding to the transaction asset type includes: the initial state, the final state of the asset state and the next state corresponding to each current state.
In the embodiment of the present invention, the system further includes an auditing module, configured to:
receiving a plurality of asset state information corresponding to a first asset type and sent by other service systems on a block chain, and a second asset state machine, wherein the second asset state machine is obtained by assigning a value to an asset state machine template according to the plurality of asset state information corresponding to the first asset type and an asset state transfer rule corresponding to the first asset type;
auditing the second asset state machine through a consensus mechanism of the block chain;
after the audit is passed, signing the second asset state machine;
and sending the signed second asset state machine to the block chain.
In the embodiment of the present invention, the system further includes a refusal prompt module, configured to, after the verification module verifies, according to the asset state machine corresponding to the transaction asset type, the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action:
and after the verification fails, rejecting the transaction request submitted by the user.
The embodiment of the invention also provides computer equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the computer program to realize the asset state information change method on the block chain.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the method for changing the asset state information on the block chain is realized.
An embodiment of the present invention further provides a computer program product, where the computer program product includes a computer program, and when executed by a processor, the computer program implements the above method for changing asset state information on a block chain.
In the embodiment of the invention, a transaction request submitted by a user is received, the transaction request is processed to obtain transaction information, the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system; sending the transaction information to a blockchain; calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type; according to an asset state machine corresponding to the transaction asset type, verifying the asset state information before transaction and the asset state information after transaction corresponding to the transaction action; and after the verification is passed, according to the asset state information before the transaction and the asset state information after the transaction corresponding to the transaction action, changing the asset state information corresponding to the transaction asset type on the blockchain. Compared with the technical scheme that a developer fixes service terms on an intelligent contract code through programming in the prior art, the asset state machines corresponding to a plurality of asset types are arranged in the intelligent contract, and the asset state change on the block chain is carried out according to the asset state machines, so that the development of the intelligent contract for circulation of the asset states of different types can be quickly realized, the cost for compiling the intelligent contract is reduced, and the efficiency for compiling the intelligent contract is improved.
In the embodiment of the invention, the asset state machine is defined by setting key value pairs, including the circulation of each state, the initial state and the final state, so that the asset must meet the limitation regulation of the states in the asset state machine in the state circulation, and the possibility of program bugs existing in the intelligent contract is reduced.
In the embodiment of the invention, the state machine of the intelligent contract can be flexibly configured when the contract is deployed so as to meet the requirements of different types of intelligent contract assets, and in addition, in the embodiment of the invention, only the attribute of the state of each type of asset is defined; other attributes of the assets can be customized without limitation, so that the development efficiency of the intelligent contract can be improved, the development cost of the intelligent contract can be reduced, and the flexibility of the intelligent contract can be ensured.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are provided to further explain the objects, technical solutions and advantages of the present invention in detail, and it should be understood that the above-mentioned embodiments are only examples of the present invention and should not be used to limit the scope of the present invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (15)

1. A method for changing asset state information on a block chain is applied to each node on the block chain, wherein each node on the block chain is a service system, and the method comprises the following steps:
receiving a transaction request submitted by a user, processing the transaction request to obtain transaction information, wherein the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system;
sending the transaction information to a blockchain;
calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type;
according to an asset state machine corresponding to the transaction asset type, verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action;
and after the verification is passed, according to the asset state information before the transaction and the asset state information after the transaction corresponding to the transaction action, changing the asset state information corresponding to the transaction asset type on the blockchain.
2. The method of claim 1, wherein prior to invoking the intelligent contract on the blockchain, further comprising:
setting an asset state machine corresponding to the transaction asset type by the following steps:
acquiring an asset state machine template in an intelligent contract;
according to a plurality of preset asset state information corresponding to the transaction asset types and a preset asset state circulation rule corresponding to the transaction asset types, carrying out initialization assignment on an asset state machine template to obtain a first asset state machine;
and sending the plurality of asset state information corresponding to the transaction asset types and the first asset state machine to the block chain, so that each service system on the block chain checks the first asset state machine through a consensus mechanism of the block chain, and obtaining the asset state machine corresponding to the transaction asset types after the checking is passed.
3. The method of claim 2, wherein the asset state machine template is stored in a smart contract in a set of key-value pairs;
according to a plurality of preset asset state information corresponding to the transaction asset types and a preset asset state circulation rule corresponding to the transaction asset types, carrying out initialization assignment on an asset state machine template to obtain a first asset state machine, wherein the method comprises the following steps:
according to a preset asset state circulation rule corresponding to the transaction asset type, taking each asset state information corresponding to the transaction asset type as a key value of each key in a key-value key value pair set to obtain an assigned key-value key value pair set, wherein the assigned key-value key value pair set is a first asset state machine.
4. The method of claim 2 or 3, wherein the preset asset state transition rule corresponding to the transaction asset type comprises: the initial state, the final state of the asset state and the next state corresponding to each current state.
5. The method of claim 1, further comprising:
receiving a plurality of asset state information corresponding to a first asset type and sent by other service systems on a block chain, and a second asset state machine, wherein the second asset state machine is obtained by assigning a value to an asset state machine module according to the plurality of asset state information corresponding to the first asset type and an asset state transfer rule corresponding to the first asset type;
auditing the second asset state machine through a consensus mechanism of the block chain;
after the audit is passed, signing the second asset state machine;
and sending the signed second asset state machine to the block chain.
6. The method of claim 1, wherein after verifying the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action according to an asset state machine corresponding to a transaction asset type, further comprising:
and after the verification fails, rejecting the transaction request submitted by the user.
7. An asset state information changing device on a blockchain is applied to each node on the blockchain, wherein each node on the blockchain is a service system, and the device comprises:
the transaction information acquisition module is used for receiving a transaction request submitted by a user and processing the transaction request to obtain transaction information, wherein the transaction information comprises a transaction asset type, a transaction action, and pre-transaction asset state information and post-transaction asset state information corresponding to the transaction action, and the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action are determined according to a service rule in a service system;
the sending module is used for sending the transaction information to the block chain;
the state machine determining module is used for calling an intelligent contract on a block chain, and determining an asset state machine corresponding to a transaction asset type from asset state machines corresponding to a plurality of asset types preset in the intelligent contract, wherein the asset state machine corresponding to the transaction asset type is used for indicating an asset state information circulation rule corresponding to the transaction asset type;
the verification module is used for verifying the asset state information before transaction and the asset state information after transaction corresponding to the transaction action according to the asset state machine corresponding to the transaction asset type;
and the change module is used for changing the asset state information corresponding to the transaction asset type on the block chain according to the pre-transaction asset state information and the post-transaction asset state information corresponding to the transaction action after the verification is passed.
8. The apparatus of claim 7, further comprising a state machine setting module to, prior to the state machine determination module invoking the smart contract on the blockchain:
setting an asset state machine corresponding to the transaction asset type by the following steps:
acquiring an asset state machine template in an intelligent contract;
according to a plurality of preset asset state information corresponding to the transaction asset types and a preset asset state circulation rule corresponding to the transaction asset types, carrying out initialization assignment on an asset state machine template to obtain a first asset state machine;
and sending the plurality of asset state information corresponding to the transaction asset types and the first asset state machine to the block chain, so that each service system on the block chain checks the first asset state machine through a consensus mechanism of the block chain, and obtaining the asset state machine corresponding to the transaction asset types after the checking is passed.
9. The apparatus of claim 8, wherein the asset state machine template is stored in a smart contract in a set of key-value pairs;
the state machine setting module is specifically further configured to:
according to a preset asset state circulation rule corresponding to the transaction asset type, taking each asset state information corresponding to the transaction asset type as a key value of each key in a key-value key value pair set to obtain an assigned key-value key value pair set, wherein the assigned key-value key value pair set is a first asset state machine.
10. The apparatus of claim 8 or 9, wherein the preset asset state transition rule corresponding to the transaction asset type comprises: the initial state, the final state of the asset state and the next state corresponding to each current state.
11. The apparatus of claim 7, further comprising an audit module to:
receiving a plurality of asset state information corresponding to a first asset type and sent by other service systems on a block chain, and a second asset state machine, wherein the second asset state machine is obtained by assigning a value to an asset state machine template according to the plurality of asset state information corresponding to the first asset type and an asset state transfer rule corresponding to the first asset type;
auditing the second asset state machine through a consensus mechanism of the block chain;
after the audit is passed, signing the second asset state machine;
and sending the signed second asset state machine to the block chain.
12. The apparatus of claim 7, further comprising a rejection prompting module to, after the verification module verifies the pre-transaction asset status information and the post-transaction asset status information corresponding to the transaction action according to an asset status machine corresponding to a transaction asset type:
and after the verification fails, rejecting the transaction request submitted by the user.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a processor, implements the method of any of claims 1 to 6.
15. A computer program product, characterized in that the computer program product comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 6.
CN202210793141.8A 2022-07-07 2022-07-07 Asset state information changing method and device on block chain Pending CN115170312A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210793141.8A CN115170312A (en) 2022-07-07 2022-07-07 Asset state information changing method and device on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210793141.8A CN115170312A (en) 2022-07-07 2022-07-07 Asset state information changing method and device on block chain

Publications (1)

Publication Number Publication Date
CN115170312A true CN115170312A (en) 2022-10-11

Family

ID=83491097

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210793141.8A Pending CN115170312A (en) 2022-07-07 2022-07-07 Asset state information changing method and device on block chain

Country Status (1)

Country Link
CN (1) CN115170312A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117527832A (en) * 2024-01-03 2024-02-06 杭州趣链科技有限公司 Transaction ordering method and device for blockchain, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117527832A (en) * 2024-01-03 2024-02-06 杭州趣链科技有限公司 Transaction ordering method and device for blockchain, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109981679B (en) Method and apparatus for performing transactions in a blockchain network
US11915238B2 (en) Blockchain-implemented systems and methods for concurrent bytecode interpretation
CN108595157B (en) Block chain data processing method, device, equipment and storage medium
US10699269B1 (en) System and method for smart contract publishing
US10614454B1 (en) Remote population and redaction of high security data
US20080127303A1 (en) Generating security validation code automatically
JP2020514853A (en) Computer-implemented system and method for enabling complex functionality on a blockchain while maintaining security-based restrictions on script size and opcode limits
CN109447636A (en) A kind of assets transfer method and device
US20230205764A1 (en) Blockchain smart contract method, electronic device, blockchain system, and computer-readable storage medium
CN114612103B (en) Method, device, system, medium and electronic equipment for cross-block chain transaction
WO2021139778A1 (en) System scheduling workflow generation method, system, apparatus, and computer readable storage medium
Liu et al. Towards automated verification of smart contract fairness
CN115131022B (en) Block chain based digital asset transaction method, device, equipment and medium
CN115170312A (en) Asset state information changing method and device on block chain
CN115168341A (en) Service processing method, system, medium and equipment
CN111723102A (en) Intelligent contract updating method and device
CN111831532A (en) Method for constructing test scene and information processing equipment
WO2020028585A1 (en) Anonymous distributed consensus regarding the verification of protocols
CN111399851B (en) Batch processing execution method based on distributed system
US11513815B1 (en) Defining data storage within smart contracts
Moebius et al. Formal verification of application-specific security properties in a model-driven approach
CN115018621A (en) Contract changing method, device, equipment and medium
CN109766268B (en) A kind of sequence assembly instruction program verification method and system
Carroll et al. An incentive-based distributed mechanism for scheduling divisible loads in tree networks
CN111738855A (en) Intelligent contract management method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination