Oracle frame transmission method

By constructing oracle frames that include contract addresses, oracle values, and constraint coefficients, the problem of untimely dissemination of important information in blockchain asset transactions is solved, ensuring timely confirmation of transaction status and improving transaction efficiency and user experience.

CN121262218APending Publication Date: 2026-01-02WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511396165.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-28
Publication Date
2026-01-02

AI Technical Summary

Technical Problem

In blockchain asset trading, the untimely dissemination of important information leads to a poor user experience, and the inability to obtain unsynchronized transaction status in a timely manner can cause transactions to fail.

Method used

By constructing oracle frames, including contract address, oracle value, and constraint coefficient, and sorting and transmitting oracle frames according to constraint coefficient, important information is transmitted first, ensuring timely confirmation of transaction status.

Benefits of technology

It enables the timely transmission of important information, avoids issues such as transaction failures and poor user experience, and improves transaction efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121262218A_ABST
    Figure CN121262218A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an oracle frame transmission method, and relates to the technical field of block chains, and the method comprises the steps: determining first indication information of an oracle data slot position in state data of a first intelligent contract according to a first contract address in a first asset transaction; wherein the indication information for predicting the data slot position is used for indicating the data slot position needing to be predicted; constructing a first oracle frame according to the first data slot position indicated by the first indication information; the first oracle frame comprises a first contract address, a first oracle value and a first constraint coefficient; the first oracle value is a predicted value determined after the first intelligent contract is executed according to a first asset value in the first asset transaction; the first constraint coefficient is determined according to the oracle direction and the first block height of the local chain when the first oracle frame is constructed by the first node; and according to the first constraint coefficient corresponding to the first oracle frame, determining an oracle sequence of the first oracle frame in each oracle frame received by the first node, and transmitting according to the oracle sequence.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of blockchain technology, and in particular to a method for transmitting oracle frames. Background Technology

[0002] Blockchain is a decentralized distributed ledger that is stored in a block-chain format, is immutable, secure, and reliable. Due to its advantages such as transparency, security, decentralization, and immutability, blockchain technology is widely used in the financial field.

[0003] When using blockchain for asset transactions in the financial sector, the confirmation of the transaction status after a node changes the transaction data requires a multi-level process of "packaging-broadcasting-consensus-network synchronization". Undetermined transactions or unsynchronized status changes cannot be obtained by all nodes in real time. Furthermore, due to network latency, bandwidth differences, and block propagation time between nodes, there is a time lag in information synchronization. Because the importance of information is not distinguished, some important information is blocked, further exacerbating the delay. Summary of the Invention

[0004] This application provides a oracle frame transmission method to address the issue of accelerating the propagation of important information in blockchain data transmission.

[0005] In a first aspect, embodiments of this application provide a oracle frame transmission method, applied to a first node, comprising:

[0006] Based on the first contract address in the first asset transaction, determine the first indication information of the oracle data slot in the state data of the first smart contract; wherein, the indication information of the oracle data slot is used to indicate the data slot that needs to be oracleed.

[0007] A first oracle frame is constructed based on the first data slot indicated by the first instruction information; the first oracle frame includes the first contract address, a first oracle value, and a first constraint coefficient; the first oracle value is the predicted value after executing the first smart contract, determined based on the first asset value in the first asset transaction; the first constraint coefficient is determined based on the oracle direction and the first block height of the local chain when the first node constructs the first oracle frame;

[0008] The order of oracle frames for the first oracle frame among the oracle frames received by the first node is determined according to the first constraint coefficient corresponding to the first oracle frame, and the oracle frames are transmitted in the order of oracle frames.

[0009] In this embodiment, the data slots that need to be predicted are indicated, and a prediction frame is constructed based on the data slots. The prediction frame includes a contract address, constraint coefficient, and prediction value. The prediction frames are sorted according to the constraint coefficient. Since the constraint coefficient reflects the importance of the prediction value in the prediction frame, the most important prediction frames can be transmitted first to avoid the problem of poor user experience or "ghost orders" or "invalid orders" in asset transactions due to the untimely dissemination of important information.

[0010] Optionally, constructing the first oracle frame according to the first data slot indicated by the indication information includes:

[0011] Obtain the first confirmation value in the first data slot indicated by the indication information from the local chain of the first node;

[0012] The first prediction direction is determined based on the first confirmed value and the first prediction value;

[0013] Based on the first block height of the first node's local chain and the first oracle direction, the first constraint coefficient is determined, thereby constructing a first oracle frame containing the first contract address, the first oracle value, and the first constraint coefficient.

[0014] In this embodiment of the application, when determining the constraint coefficient, the oracle direction is first determined based on the confirmation value and the oracle value, and then the constraint coefficient is determined based on the block height of the local chain and the oracle direction, so that the constraint coefficient in the oracle frame can cover multiple factors and the constraint coefficient can more comprehensively reflect the importance of the oracle frame, thereby more accurately determining whether the oracle frame needs to be accelerated.

[0015] Optionally, determining the first constraint coefficient based on the first block height of the first node's local chain and the first oracle direction includes:

[0016] Determine the number of hops the first oracle frame has made in the blockchain system;

[0017] The first constraint coefficient is determined based on the first block height of the local chain when the first node constructs the first oracle frame, the propagation hop count of the first oracle frame, and the first oracle direction.

[0018] In this embodiment, the constraint coefficient is determined based on the propagation hop count of the oracle frame in the blockchain system, the block height of the oracle frame, and the direction of the oracle frame. This constraint coefficient includes multiple characteristics of the oracle frame, so that when accelerating the propagation of the oracle frame, multiple characteristics of the oracle frame are comprehensively considered before accelerating the propagation. This avoids the problem of inaccurate acceleration of the oracle frame caused by accelerating the propagation based on a single or few characteristics.

[0019] Optionally, determining the first divination direction based on the first confirmation value and the first divination value includes:

[0020] If the difference between the first oracle value and the first confirmed value conforms to the operation mode specified by the first smart contract, then the first oracle direction is determined to be the positive direction representing a positive value.

[0021] If the difference between the first oracle value and the first confirmation value does not conform to the operating mode specified by the first smart contract, then the first oracle direction is determined to be the negative direction representing the negative value.

[0022] In this embodiment, the difference between the oracle value and the confirmation value is used as the oracle direction, and the oracle direction is determined based on its alignment with the smart contract's operation mode, making the determination of the oracle direction more intuitive. By first determining whether the oracle direction is consistent with the specified direction of the smart contract's operation mode, it is possible to initially determine whether the oracle frame needs to be accelerated, thus improving the efficiency of accelerated oracle frame transmission and avoiding wasting resources by still calculating other content in the oracle frame when accelerated transmission is not required.

[0023] Optionally, the more propagation hops, the larger the constraint coefficient;

[0024] Determining the oracle order of the first oracle frame among the oracle frames received by the first node according to the first constraint coefficient corresponding to the first oracle frame includes:

[0025] For each oracle frame received by the first node, sort them according to the constraint coefficient from smallest to largest to determine the oracle order corresponding to each oracle frame.

[0026] In this embodiment, by sorting the oracle frames according to their constraint coefficients, and transmitting the oracle frames according to the magnitude of the constraint coefficients, the oracle frames can be transmitted according to their importance, thus achieving the effect of prioritizing the transmission of important oracle frames.

[0027] Optionally, the order of oracle frames received by the first node is determined in the following ways:

[0028] For any received oracle frame, after the oracle frame meets the propagation requirements, the first node generates the constraint coefficients for the oracle frame.

[0029] For each prophecy frame that meets the propagation requirements, the order of the prophecies in each prophecy frame is determined according to the constraint coefficient.

[0030] In this embodiment, the constraint coefficient of the oracle frame is generated based on whether the oracle frame meets the propagation requirements. This avoids the situation where the constraint coefficient of the oracle frame is still calculated when it does not meet the constraint coefficient, which would increase the amount of invalid computation in the system and waste resources.

[0031] Optionally, determining the order of oracle frames among those received by the first node includes:

[0032] If the first constraint coefficient does not conform to the operation direction specified by the first smart contract, then the first oracle frame is removed;

[0033] If the first constraint coefficient conforms to the operation direction specified by the first smart contract, determine whether each oracle frame received by the first node includes a second oracle frame that is the same as the asset transaction of the first smart contract.

[0034] If included, when the second oracle value in the second oracle frame does not conform to the operation direction specified by the first smart contract compared with the first oracle value, the second oracle frame is removed and the oracle order of the first oracle frame in each oracle frame received by the first node is determined according to the first constraint coefficient.

[0035] If the second oracle value in the second oracle frame conforms to the operation direction specified by the first smart contract compared to the first oracle value, then the first oracle frame is removed.

[0036] In this embodiment, the first constraint coefficient of the first oracle frame in the first smart contract is first determined to be consistent with the specified operation direction, thereby quickly determining whether to remove the first oracle frame and improving the sorting speed of oracle frames; then, if the first constraint coefficient in the first smart contract is consistent with the specified operation direction, it is determined whether there is a second oracle frame, and the second oracle value in the second oracle frame and the first oracle value in the first oracle frame are used to determine whether to remove the first oracle frame or the second oracle frame, thereby improving the sorting speed of the oracle frame oracle order.

[0037] Optionally, after transmitting according to the oracle order, the method further includes: using the first oracle value as the modification value of the state data of the first data slot in the first smart contract;

[0038] The first asset transaction is packaged into blocks.

[0039] In this embodiment, after the oracle frames are transmitted in the order of oracle prediction, the first oracle value is used as the modification value of the state data of the first data slot, and then the first asset transaction is packaged. This achieves the effect of prioritizing the transmission of oracle frames, that is, prioritizing the transmission of important information, and avoiding the problem of asset transaction failure due to untimely transmission of important information.

[0040] Optionally, it also includes:

[0041] Receive the third oracle frame sent by the second node;

[0042] Based on the second contract address in the third oracle frame, determine the second indication information of the oracle data slot in the state data of the second smart contract;

[0043] If the second indication information indicates that there is a second data slot that needs to be predicted, then the second block height of the second node is determined according to the third prediction frame when constructing the third prediction frame;

[0044] If the height of the second block is less than the height of the local chain block of the first node, then the third oracle frame is removed.

[0045] In this embodiment of the application, when receiving an oracle frame sent by another node, the block height of the node's own blockchain is compared with the block height of other nodes to determine whether to accept the oracle frame from other nodes and add it to the oracle frame sorting. This avoids the problem of sorting even though the block height does not meet the requirements, and thus avoids the problem of oracle frame acceleration transmission errors.

[0046] Optionally, it also includes:

[0047] If the height of the second block is not less than the height of the local chain block of the first node, then update the second constraint coefficient in the third oracle frame;

[0048] The order of oracle frames corresponding to the third oracle frame in the first node is determined based on the updated second constraint coefficient.

[0049] In this embodiment of the application, when receiving an oracle frame sent by another node, if the block height of the other node is not less than the block height of the local chain, the block height in the local chain is updated by the oracle frame of the other node, and the updated constraint coefficient is used as the corresponding oracle frame to sort in the oracle frame queue. This ensures that the oracle frames in the oracle frame queue of the node are always the latest and most important oracle frames, thus guaranteeing the transmission of the latest oracle frames when transmitting oracle frames.

[0050] Optionally, determining the oracle order of the third oracle frame in each oracle frame of the first node based on the updated second constraint coefficient includes:

[0051] If the second oracle direction represented by the second constraint coefficient changes before and after the update, then the third oracle frame is discarded;

[0052] If the second oracle value of the second oracle frame conforms to the operation direction specified by the second smart contract compared with the third oracle value, then the fourth oracle frame corresponding to the third oracle value is removed; the asset transaction corresponding to the fourth oracle frame is the asset transaction of the second smart contract.

[0053] In this embodiment of the application, by determining whether the oracle direction has reversed, it can be determined whether the corresponding oracle frame conforms to the operation direction. If it conforms to the operation direction, the oracle frames are sorted to avoid putting oracle frames that do not conform to the operation direction into the oracle frame queue and transmitting them, which would cause oracle frame transmission errors and avoid the situation where important information is not transmitted.

[0054] Secondly, embodiments of this application provide a oracle frame transmission apparatus, comprising:

[0055] The determination module is used to determine the first indication information of the oracle data slot in the state data of the first smart contract based on the first contract address in the first asset transaction; wherein, the indication information of the oracle data slot is used to indicate the data slot that needs to be oracleed.

[0056] A construction module is used to construct a first oracle frame according to the first data slot indicated by the first indication information; the first oracle frame includes the first contract address, a first oracle value, and a first constraint coefficient; the first oracle value is the predicted value after executing the first smart contract, determined based on the first asset value in the first asset transaction; the first constraint coefficient is determined based on the oracle direction and the first block height of the local chain when the first node constructs the first oracle frame;

[0057] The transmission module is used to determine the oracle order of the first oracle frame among the oracle frames received by the first node according to the first constraint coefficient corresponding to the first oracle frame, and to transmit the oracle frame according to the oracle order.

[0058] Optionally, the building module is specifically used for:

[0059] Obtain the first confirmation value in the first data slot indicated by the indication information from the local chain of the first node;

[0060] The first prediction direction is determined based on the first confirmed value and the first prediction value;

[0061] Based on the first block height of the first node's local chain and the first oracle direction, the first constraint coefficient is determined, thereby constructing a first oracle frame containing the first contract address, the first oracle value, and the first constraint coefficient.

[0062] Optionally, the building module is specifically used for:

[0063] Determine the number of hops the first oracle frame has made in the blockchain system;

[0064] The first constraint coefficient is determined based on the first block height of the local chain when the first node constructs the first oracle frame, the propagation hop count of the first oracle frame, and the first oracle direction.

[0065] Optionally, the building module is specifically used for:

[0066] If the difference between the first oracle value and the first confirmed value conforms to the operation mode specified by the first smart contract, then the first oracle direction is determined to be the positive direction representing a positive value.

[0067] If the difference between the first oracle value and the first confirmation value does not conform to the operating mode specified by the first smart contract, then the first oracle direction is determined to be the negative direction representing the negative value.

[0068] Optionally, the more propagation hops, the larger the constraint coefficient;

[0069] The transmission module is specifically used for:

[0070] For each oracle frame received by the first node, sort them according to the constraint coefficient from smallest to largest to determine the oracle order corresponding to each oracle frame.

[0071] Optionally, the transmission module is specifically used for:

[0072] For any received oracle frame, after the oracle frame meets the propagation requirements, the first node generates the constraint coefficients for the oracle frame.

[0073] For each prophecy frame that meets the propagation requirements, the order of prophecies in each prophecy frame is determined according to the constraint coefficient.

[0074] Optionally, the transmission module is specifically used for:

[0075] If the first constraint coefficient does not conform to the operation direction specified by the first smart contract, then the first oracle frame is removed;

[0076] If the first constraint coefficient conforms to the operation direction specified by the first smart contract, determine whether each oracle frame received by the first node includes a second oracle frame that is the same as the asset transaction of the first smart contract.

[0077] If included, when the second oracle value in the second oracle frame does not conform to the operation direction specified by the first smart contract compared with the first oracle value, the second oracle frame is removed and the oracle order of the first oracle frame in each oracle frame received by the first node is determined according to the first constraint coefficient.

[0078] If the second oracle value in the second oracle frame conforms to the operation direction specified by the first smart contract compared to the first oracle value, then the first oracle frame is removed.

[0079] Optionally, it also includes:

[0080] Use the first oracle value as the modification value of the state data of the first data slot in the first smart contract;

[0081] The first asset transaction is packaged into blocks.

[0082] Optionally, it also includes:

[0083] Receive the third oracle frame sent by the second node;

[0084] Based on the second contract address in the third oracle frame, determine the second indication information of the oracle data slot in the state data of the second smart contract;

[0085] If the second indication information indicates that there is a second data slot that needs to be predicted, then the second block height of the second node is determined according to the third prediction frame when constructing the third prediction frame;

[0086] If the height of the second block is less than the height of the local chain block of the first node, then the third oracle frame is removed.

[0087] Optionally, the transmission module is specifically used for:

[0088] If the height of the second block is not less than the height of the local chain block of the first node, then update the second constraint coefficient in the third oracle frame;

[0089] The order of oracle frames corresponding to the third oracle frame in the first node is determined based on the updated second constraint coefficient.

[0090] Optionally, the transmission module is specifically used for:

[0091] If the second oracle direction represented by the second constraint coefficient changes before and after the update, then the third oracle frame is discarded;

[0092] If the second oracle value of the second oracle frame conforms to the operation direction specified by the second smart contract compared with the third oracle value, then the fourth oracle frame corresponding to the third oracle value is removed; the asset transaction corresponding to the fourth oracle frame is the asset transaction of the second smart contract.

[0093] Thirdly, embodiments of this application provide a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of any of the methods described above.

[0094] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of any of the methods described above.

[0095] Fifthly, this application provides a computer program product comprising a computer program stored on a computer-readable storage medium, the computer program including program instructions that, when executed by a computer device, cause the computer device to perform the steps of any of the methods described above. Attached Figure Description

[0096] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0097] Figure 1 A system architecture diagram provided for an embodiment of this application;

[0098] Figure 2 A flowchart illustrating a oracle frame transmission method provided in an embodiment of this application;

[0099] Figure 3 A flowchart illustrating a method for determining oracle frame constraint coefficients provided in an embodiment of this application;

[0100] Figure 4 A flowchart (I) illustrating a method for determining the oracle order of oracle frames among the oracle frames received by a node, as provided in an embodiment of this application;

[0101] Figure 5 A flowchart (II) illustrating a process for determining the oracle order of oracle frames among the oracle frames received by a node, as provided in an embodiment of this application;

[0102] Figure 6 This is a schematic diagram of the structure of a oracle frame transmission device provided in an embodiment of this application;

[0103] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0104] To make the objectives, technical solutions, and beneficial effects of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0105] To facilitate understanding of this solution, its application scenarios are described below.

[0106] In current blockchain asset trading systems, the asset trading process can be abstracted into the following steps:

[0107] Step 101: The user uses a client (such as various app wallets) to construct a transaction request for a specific operation (such as buying, selling, bidding, etc.) targeting a specific asset (such as asset A), and then signs this transaction request. The signed transaction request is called a signed transaction. The key elements of a signed transaction are shown in Table 1:

[0108] Fields type Asset Address String Operation type (or function name) String Operation value numerical values Initiator's address String Initiator's signature String

[0109] Table 1

[0110] Step 102: The client sends a signed transaction to the blockchain node (or gateway).

[0111] Step 103: After receiving the signed transaction, the node verifies the signature. Once the signature transaction passes verification, the node broadcasts the signed transaction to the entire network and adds it to its own transaction pool.

[0112] Step 104: The node retrieves signed transactions from the transaction pool according to certain rules (such as Gas from high to low), takes the operation (operation type and operation value) in the signed transaction as input, executes the smart contract of the specific asset (contract address is the asset address), and converts the operation request for the specific asset into modification of specific data on the blockchain.

[0113] Step 105: The node repeats step 104. After accumulating a certain number of blockchain modifications, these modifications are packaged into blocks and propagated throughout the network according to specific consensus rules.

[0114] Step 106: After all network nodes reach a consensus and accept the block containing the specific asset (such as asset A), the data modifications for the specific asset (such as asset A) will take effect, and the on-chain asset transaction will end.

[0115] For example, taking an on-chain asset auction as an example, suppose user UserA (address 0x123) wants to bid on asset AssetA (address 0x456). The current price of asset AssetA is X1, and user UserA needs to increase the bid to X2. The general process in the blockchain transaction system is as follows:

[0116] Step 101: User A uses a client (such as wallet APP1) to construct a transaction request for bidding against asset AssetA (address 0x456) to X2, and then signs this transaction request. The signed transaction request is called the signed transaction SA. The key elements of the signed transaction SA are shown in Table 2:

[0117] Fields type value Asset Address String 0x456 Operation type (or function name) String bid Operation value numerical values <![CDATA[X2]]> Initiator's address String 0x123 Initiator's signature String 0x123456789

[0118] Table 2

[0119] Step 102: The client (wallet APP1) sends the signed transaction SA from step 1 to the blockchain node (or gateway).

[0120] Step 103: After receiving the signed transaction SA, the node verifies whether the signature of the signed transaction SA (i.e., the initiator signature field value 0x123456789) belongs to user UserA (address is 0x123). If the signature verification fails, the node will ignore the signed transaction SA, and the entire process will end; if the signature verification succeeds, the node will broadcast the transaction SA to the entire network and add it to its own transaction pool.

[0121] Step 104: Retrieve the signed transaction SA from the transaction pool. The node takes the operation in the signed transaction SA (operation type is bid, and operation value is X2) as input and executes the smart contract of asset AssetA (address is 0x456). That is, the operation request in SA (operation type is bid, and operation value is X2) is converted into a modification of the current price data of the asset at address 0x456 in the blockchain data - changing it from X1 to X2.

[0122] Step 105: The node repeats step 4. After accumulating a certain number of blockchain modifications, these modifications are packaged into block BlockA and propagated throughout the network according to specific consensus rules.

[0123] Step 106: After all network nodes reach a consensus and accept Block A containing AssetA, the change of the current price of AssetA from X1 to X2 will take effect, and the on-chain asset transaction will end.

[0124] In the aforementioned blockchain transaction process, from constructing a transaction request to reaching blockchain consensus, a node goes through the following steps: signing and verifying the transaction, broadcasting the transaction, executing the smart contract, packaging the block, and propagating the block. When other nodes receive the packaged block (such as Block A), they need to go through the following steps: signing and verifying the signature, executing the smart contract, and comparing the root hash of the block with the root hash of the received block (such as Block A).

[0125] However, the following problem is prone to occur in the above-mentioned blockchain transactions: invalid bids.

[0126] If the current highest bid in an auction contract is highestBid = 15 assets, the change in the current price of asset AssetA from X1 to X2 can only be confirmed on other nodes (such as node B) after the latest block is stored on the blockchain. During this process, blockchain nodes also need to consider block rollback. Even if node B executes steps 1-3 above to change the previous price of asset AssetA from X1 to X2, it will not immediately confirm this change, but will wait for several blocks to be synchronized before confirming it. Therefore, from the time user UserA uses the client to submit a bid of X2 for asset AssetA (address 0x456) to other nodes (such as node B) for confirmation, a lengthy process will occur. During this process, if the user initiates a transaction relying on incompletely synchronized old state information obtained from the local node, it is highly likely to fail. For example, if node B fails to confirm the asset transaction in block N+1 (which contains the new bid highestBid = 20 assets, block height N) due to the aforementioned delay, the user will still see the old bid of 15 assets in node A's client. A user initiates a bid of 16 assets based on the old state and submits the transaction. When the transaction is executed on-chain, the bid becomes invalid because the actual highest bid is already 20 assets, which does not exceed the current highest value.

[0127] To address the problems existing in the aforementioned blockchain asset transactions, this application provides a method for packaging block data, which avoids issues such as "invalid bids" and poor user experience.

[0128] See Figure 1 This is a system architecture diagram provided in an embodiment of the present application. The system architecture includes a terminal device 101 and a server 102.

[0129] Terminal device 101 is pre-installed with a business application for text matching, which may be a client application, a web application, a mini-program application, etc. Terminal device 101 can be a smartphone, POS machine, desktop laptop, computer, etc., but is not limited to these. The business application may be a wallet app for operating asset transactions, etc.

[0130] Server 102 serves as the backend server for business applications, and each node in the blockchain system can be a server 102. Server 102 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0131] The following section first introduces data storage in Ethereum. Block data in Ethereum is stored in LevelDB, and each chain has three LevelDB instances: 1) BlockDB: Block Database; 2) StateDB: State Database; 3) ExtrasDB: Auxiliary Database.

[0132] The contract's state variables are stored in StateDB. StateDB stores three Merkle hash trees: a state tree, a storage tree, and a transaction tree. The Merkle hash trees are ultimately stored in StateDB using RLP encoding, with the key being the hash value corresponding to the stored data.

[0133] The following steps are required to locate the contract's state variables:

[0134] 1. Calculate the hash of the contract address and use the first 160 bits as the lookup key.

[0135] 2. Retrieve the corresponding value from the StateDB using the query key. After deserialization using RLP, you can obtain the contract account's state data, such as nonce, balance, storageRoot, and codeHash. StorageRoot is the hash of the root node of the storage tree of the queried contract.

[0136] 3. The corresponding value is retrieved from the StateDB through storageRoot. After deserialization by RLP, the content information of the root node of the storage tree of the queried contract account (node ​​type, node data, child node hash, etc.) can be obtained.

[0137] 4. Starting from the root node, the hash of the child node can be used as the key to find the content information of the child node in the StateDB. By recursively going down, the entire storage tree of the queried contract can be traversed.

[0138] 5. Traverse the storage tree until you find a storage tree node that matches the slot hash of the storage slot containing the state value of the queried contract. The value stored in this node is the state variable value of the contract to be queried.

[0139] For example, suppose there is an auction contract as follows:

[0140] Contract AuctionContract{

[0141] uint256 currentPrice;

[0142] ...

[0143] }

[0144] The current price is the first field of this auction contract, currentPrice, which is the current auction price. It is a 256-bit unsigned integer. Assume that the auction contract is located at address 0x456 on Ethereum.

[0145] First, retrieve the contract account status data from LevelDB:

[0146] 1. Based on the hash of the contract address 0x456, take the first 160 bits as the query key, assuming the query key is k1.

[0147] 2. Retrieve the corresponding value from StateDB using k1. After deserialization using RLP, the hash of the root node of the contract's storage tree (address 0x456) can be obtained, assuming that the hash of this root node is k2.

[0148] 3. Retrieve the corresponding value from StateDB using k2. After deserialization using RLP, the root node content of the contract's (address 0x456) storage tree can be obtained, assuming the hash of its child nodes is k. 21 ,k 22 ,…,k 2n .

[0149] 4. Through k 21 ,k 22 ,…,k 2n By retrieving the corresponding value from the StateDB and recursively traversing the entire storage tree of the queried contract (address 0x456), the process can be completed.

[0150] 5. Since the auction price `currentPrice` of this auction contract (address 0x456) is a 256-bit unsigned integer and is the first defined state field, according to Ethereum's storage slot allocation rules, this variable should be allocated to storage slot 0. The hash of slot 0 is calculated as `k3`. When the hash of the traversed node matches `k3`, the value of that node is the auction price `currentPrice` of this auction contract (address 0x456).

[0151] This invention modifies the contract account status data in StateDB based on the above rules. The original structure of the contract account status data in StateDB is shown in Table 3:

[0152] Fields meaning type nonce Number of subcontracts created Numerical balance ETH balance Numerical storageRoot Root hash of the contract storage tree String type codeHash Contract bytecode hash String type

[0153] Table 3

[0154] This invention adds a new field: predictLocation

[0155] Fields meaning type nonce Number of subcontracts created Numerical balance ETH balance Numerical storageRoot Root hash of the contract storage tree String type codeHash Contract bytecode hash String type predictLocation Data slots that need to be predicted Numerical

[0156] Table 4

[0157] Since the block has not yet started to be packaged and confirmed synchronously across the network, the storage value at the propagation storage slot "predictLocation" can be considered as a prediction value of the corresponding state variable of the future contract. Therefore, this invention refers to this prediction value as "oracle".

[0158] The specific operation steps of the embodiments of this application are described in detail below:

[0159] See Figure 2 This is a flowchart illustrating a block data packaging method provided in an embodiment of this application, applied to a first node (taking node A as an example), and includes the following steps:

[0160] Step 201: Based on the first contract address in the first asset transaction, determine the first indication information of the oracle data slot in the state data of the first smart contract; wherein, the indication information of the oracle data slot is used to indicate the data slot that needs to be oracleed.

[0161] In one optional implementation, the blockchain includes multiple asset transactions, such as auction transactions and sales transactions. Different asset transactions are distinguished by "first" and "second," which will be used for differentiation in the following text. For example, transactions involving asset Asset A, as mentioned above, are all first asset transactions. Asset transactions not involving Asset A are second or third asset transactions. Each asset transaction includes a contract address, which indicates the addresses of the two parties involved in the transaction. The smart contract includes multiple state data points. The first indication information for the oracle data slot is determined from the state data. The oracle data slot is the "predictLocation" field in Table 4.

[0162] Generally, when deploying a smart contract, the user specifies the `predictLocation` value through deployment parameters. A `predictLocation` value of `x` indicates that the smart contract needs to predict the state variable at storage slot `x`, and its predicted value is the value stored at storage slot `x`. If the `predictLocation` value is not specified during contract deployment, it defaults to -1, meaning the contract does not need to predict any state variables. Since contract deployment is based on network consensus, once the contract is successfully deployed, the `predictLocation` setting will take effect in the StateDB of all nodes across the network.

[0163] Step 202: Construct a first oracle frame according to the first data slot indicated by the first instruction information; the first oracle frame includes a first contract address, a first oracle value, and a first constraint coefficient; the first oracle value is the predicted value after executing the first smart contract, determined based on the first asset value in the first asset transaction; the first constraint coefficient is determined based on the oracle direction and the first block height of the local chain when the first node constructs the first oracle frame.

[0164] In one optional implementation, the first indication information indicates the data slot to be predicted, i.e., the first data slot, and an oracle frame is constructed based on the data slot. The data structure of the oracle frame is shown in Table 5:

[0165] Fields type Contract address String prophecy String constraint coefficient floating-point numbers

[0166] Table 5

[0167] The process involves filling the contract address into the "Contract Address" field of the oracle frame; encoding the predictLocation value using RLP and filling it into the "Omen" field of the oracle frame; and calculating the constraint coefficient according to certain rules and filling it into the "Constraint Coefficient" field. The calculation of the constraint coefficient is described below.

[0168] The first oracle frame is constructed by node A based on the first asset transaction. The first contract address in the first oracle frame is the contract address in the first asset transaction. The first oracle value is the predicted value, that is, the estimated bid / auction price for the first asset in the first asset transaction. For example, if the starting price in the first asset transaction AssetA is X1, and node A bids X2, then X2 is the first oracle value in the first asset transaction AssetA.

[0169] Step 203: Determine the order of oracle frames in the first node according to the first constraint coefficient corresponding to the first oracle frame, and transmit them in the order of oracle frames.

[0170] In one optional implementation, after sorting the oracle frames according to constraint coefficients, the oracle frames are stored in an oracle frame queue, which is a queue built by each node for storing oracle frames. The node then transmits the oracle frames according to their oracle order in the oracle frame queue.

[0171] For example, the first node, node A, contains 10 oracle frames. These 10 oracle frames are sorted according to their constraint coefficients, such as placing the oracle frames with smaller constraint coefficients at the head of the queue and the oracle frames with larger constraint coefficients at the tail of the queue. When transmitting oracle frames, the oracle frame at the head of the queue is transmitted first.

[0172] In some embodiments, a first oracle frame is constructed based on the first data slot indicated by the indication information, such as... Figure 3As shown, it includes the following steps:

[0173] Step 301: Obtain the first confirmation value in the first data slot indicated by the indication information from the local chain of the first node.

[0174] In one alternative implementation, the first verification value is a value that has been approved in the first node. For example, in node A, in the first asset transaction AssetA, the current auction price has been approved as "15", and "15" is the first verification value.

[0175] Step 302: Determine the first prediction direction based on the first confirmed value and the first prediction value.

[0176] In one alternative implementation, if the first confirmation value is "15" and the first oracle value is "20", then the first oracle direction is "incrementing", that is, under the first asset transaction, the first oracle direction is that the bid gradually increases.

[0177] Step 303: Based on the first block height of the local chain of the first node and the first oracle direction, determine the first constraint coefficient, thereby constructing the first oracle frame containing the first contract address, the first oracle value and the first constraint coefficient.

[0178] In one optional implementation, the local chain block height of the first node represents the number of verified transactions within that node. A higher block height indicates more verified transactions. The constraint coefficient is related to the local chain block height and the oracle direction. The first node constructs its first oracle frame based on the contract address, oracle value, and constraint coefficient. This method is used to construct oracle frames for any node in the blockchain.

[0179] In some embodiments, determining a first constraint coefficient based on the first block height of the first node's local chain and the first oracle direction includes: determining the propagation hop count of the first oracle frame in the blockchain system; and determining the first constraint coefficient based on the first block height of the local chain when the first node constructs the first oracle frame, the propagation hop count of the first oracle frame, and the first oracle direction.

[0180] In one optional implementation, the constraint coefficient L is calculated according to formula (1):

[0181] L=K×(N-2 -n )...Formula (1)

[0182] Where L is the constraint coefficient, K is the oracle direction, N is the block height of the local chain when the node constructs the oracle frame, and n is the number of hops for the oracle frame propagation.

[0183] The predicted direction K is shown in formula (2):

[0184]

[0185] Where k is the prediction value of the storage slot predictLocation, and k0 is the confirmation value in the storage slot predictLocation.

[0186] The propagation hop count is shown in formula (3):

[0187]

[0188] Where L0 is the constraint coefficient parsed by the node after receiving the oracle frame during the propagation process. Specifically, it is stipulated that n = 1 initially.

[0189] N is the block height of the block when the oracle frame is constructed, and the value of N is shown in formula (4).

[0190]

[0191] Specifically, it is stipulated that N is initially taken as the height of the current node's synchronization block.

[0192] To make it easier to understand, the calculation of constraint coefficients will be explained using three specific scenarios below:

[0193] Scenario 1: Calculation of constraint coefficients when the first node initially constructs the oracle frame.

[0194] Taking the auction scenario of the first asset transaction, AssetA, as an example, if the starting price is 100, when the first node A initially constructs the oracle frame, the value (i.e., the confirmation value) in the storage slot predictLocation is 100. Node A receives the user's signed transaction, and the user attempts to change the bid to 101. At this time, the first oracle value k in the storage slot predictLocation is 101, and the first confirmation value k0 in the storage slot predictLocation is 100.

[0195] The prediction direction is calculated as follows:

[0196]

[0197] Assuming the block height is 1000 when a node initially constructs its oracle frame, and the oracle frame received by node A has a propagation hop count of 1, then the constraint coefficients for node A are as follows:

[0198] L=K×(N-2 -n )=1×(1000-2 -1 ) = 999.5

[0199] At this point, the first oracle value in the oracle frame constructed by node A is 101, and the constraint coefficient is 999.5.

[0200] Scenario 2: Calculation of constraint coefficients when the second node receives the oracle frame from the first node and the oracle direction matches the operation direction.

[0201] When another node B has the same block height as node A, node B receives an oracle frame from node A with an oracle value of 101 and a constraint coefficient of 999.5. At this point, it attempts to update the storage slot based on this oracle frame.

[0202] k0 is the confirmation value in the storage slot predictLocation. Since the block height of node B is the same as that of node A, the contents of the storage slot are also the same, that is, the confirmation value is also 100.

[0203]

[0204] A prophecy direction K greater than 0 means that updating the storage slot `predictLocation` based on the prophecy frame will continuously increase the current price, consistent with the operational pattern of an auction scenario. The propagation hop count in this case is:

[0205]

[0206] L=K×(N-2 -n )=1×(1000-2 -2 ) = 999.75

[0207] Scenario 3: Calculation of constraint coefficients when the second node receives an oracle frame from the first node and the oracle mode does not conform to the operation direction.

[0208] When the value in the predictLocation storage slot of node A is 102, which means the starting bid price for the current asset transaction is 102, a prediction frame with a prediction value of 101 and a constraint coefficient of 999.5 is received from node C.

[0209] Since we are currently attempting to update the storage slot based on the oracle frame of node C (oracle value 101, constraint coefficient 999.5), the oracle direction K is:

[0210]

[0211] If the oracle direction K is less than 0, it means that updating the storage slot predictLocation based on the oracle frame will result in the current price becoming smaller and smaller, which is inconsistent with the operation direction in an auction scenario. At this point...

[0212] L=K×(N-2 -n )=-1×(1000-2 -2 ) = -999.75

[0213] In some embodiments, determining the first oracle direction based on the first confirmed value and the first oracle value includes: if the difference between the first oracle value and the first confirmed value conforms to the operating mode specified by the first smart contract, then the first oracle direction is determined to be a positive direction representing a positive value; if the difference between the first oracle value and the first confirmed value does not conform to the operating mode specified by the first smart contract, then the first oracle direction is determined to be a negative direction representing a negative value.

[0214] In one optional implementation, as shown in the formula for calculating the constraint coefficient above, the oracle direction is determined based on the confirmed value and the oracle value. The operating mode characterizes the transaction pattern for different scenarios. For example, in asset trading, in an auction scenario, the operating mode should be a gradual increase in price. Therefore, the corresponding smart contract operating mode in this scenario is "highest bidder wins." Thus, when the oracle value should be greater than the confirmed value, the oracle direction conforms to the operating mode, and the oracle direction is positive; when the oracle value is less than the confirmed value, the oracle direction does not conform to the operating mode, and the oracle direction is negative. In a discounted sale scenario, the operating mode should be a gradual decrease in price. Therefore, the corresponding smart contract operating mode in this scenario is "lowest bidder wins." Thus, when the oracle value is less than the confirmed value, the oracle direction conforms to the operating mode, and the oracle direction is positive; when the oracle value is greater than the confirmed value, the oracle direction does not conform to the operating mode, and the oracle direction is negative.

[0215] In some embodiments, the more propagation hops, the larger the constraint coefficient; determining the packaging order of the first asset transaction in each transaction received by the first node according to the first constraint coefficient corresponding to the first oracle frame includes: sorting each transaction received by the first node in ascending order of constraint coefficients to obtain the packaging order corresponding to each transaction.

[0216] In one optional implementation, the propagation hop count is the number of times the oracle frame propagates between nodes. For example, if oracle frame 1 travels through nodes A, B, and C during its propagation, then the propagation hop count for oracle frame 1 is 3. The constraint coefficient is positively correlated with the propagation hop count; the larger the propagation hop count, the larger the constraint coefficient; and the smaller the propagation hop count, the smaller the constraint coefficient. The propagation hop count also characterizes the importance of the oracle frame. If an oracle frame has fewer propagation hops, it indicates that the oracle frame is the most recent, and therefore the oracle value in the oracle frame is more important. If an oracle frame has more propagation hops, it indicates that the oracle frame has undergone multiple propagations, and therefore the oracle value in the oracle frame is considered unimportant.

[0217] Each node has its own oracle frame queue, which stores oracle frames for different smart contracts in different scenarios. When a node receives a new oracle frame, it sorts the frames according to their constraint coefficients, from smallest to largest. Since a smaller constraint coefficient indicates fewer propagation hops, the transaction with the smallest constraint coefficient is considered the most recent. Therefore, by packaging all transactions in ascending order of constraint coefficients, the newest and most important oracle frames are sent and broadcast first.

[0218] In some embodiments, the order of oracles in each oracle frame received by the first node is determined in the following manner: for any received oracle frame, after the oracle frame meets the transmission requirements, a constraint coefficient for the first node is generated for the oracle frame; for each oracle frame that meets the transmission requirements, the order of oracles in each oracle frame is determined according to the constraint coefficient.

[0219] In one optional implementation, a node constructs its own oracle frame or receives oracle frames sent by other nodes. Regarding the oracle frame constructed by the first node mentioned above, this embodiment describes the first node receiving oracle frames sent by other nodes, such as the first node receiving oracle frames sent by a second node. There can be one or more second nodes.

[0220] For any received oracle frame, the first node first determines whether the oracle frame meets the transmission requirements. If it does, it generates the corresponding constraint coefficient; otherwise, it does not generate the corresponding constraint coefficient. The transmission requirements can be whether the oracle frame conforms to the operation direction specified by the smart contract, or whether the oracle frame conforms to the block height of the local chain, etc.

[0221] For oracle frames that meet the transmission requirements, the constraint coefficients of each oracle frame are calculated, and the oracle frames are sorted according to the constraint coefficients and stored in the oracle frame queue in sequence.

[0222] In some embodiments, the order of oracle oracle frames received by the first node is determined, such as... Figure 4 As shown, it includes the following steps:

[0223] Step 401: If the first constraint coefficient does not conform to the operation direction specified by the first smart contract, then remove the first oracle frame.

[0224] In one optional implementation, the smart contract's operation direction specifies the actual operation under the corresponding business scenario's operation mode. For example, in an auction scenario, the operation mode is "highest bidder wins," meaning the later bid should be higher than the earlier bid; in a discounted sale scenario, the operation mode is "lowest bidder wins," meaning the later bid should be lower than the earlier bid. If the above operation mode is met, the oracle direction is positive; if it is not met, the oracle direction is negative. As shown in formula (1) for calculating the constraint coefficient, the sign of the constraint coefficient is only related to the oracle direction. Therefore, if the oracle direction does not conform to the operation direction, the constraint coefficient does not conform to the operation direction, and the oracle frame corresponding to the constraint coefficient that does not conform to the operation direction is removed.

[0225] Step 402: If the first constraint coefficient conforms to the operation direction specified by the first smart contract, determine whether the oracle frames received by the first node include a second oracle frame that is the same as the asset transaction of the first smart contract.

[0226] In one optional implementation, after the constraint coefficients conform to the operation direction specified by the smart contract, it is then determined whether there is a oracle frame among the various oracle frames received by the node that is the same as the asset transaction corresponding to the smart contract.

[0227] Taking the example of a first node receiving a oracle frame from a second node: In the first node, the smart contract for asset transaction A is the first smart contract, and its own oracle frame is the first oracle frame. The first node then receives a second oracle frame from the second node, also for asset transaction A. The second oracle frame can be a oracle frame constructed by the second node itself, or it can be a oracle frame sent by other nodes. There can be one or more second nodes.

[0228] Step 403: If included, when the second oracle value in the second oracle frame does not conform to the operation direction specified by the first smart contract compared with the first oracle value, the second oracle frame is removed and the oracle order of the first oracle frame in each oracle frame received by the first node is determined according to the first constraint coefficient.

[0229] In one optional implementation, if there are oracle frames for the same asset transaction, the second oracle value in the second oracle frame is compared with the first oracle value in the first oracle frame. If the second oracle value does not conform to the operation direction compared with the first oracle value, the second oracle frame corresponding to the second oracle value is removed, and the oracle order in the oracle frame queue of the first node is determined according to the first constraint coefficient of the first oracle frame.

[0230] The second oracle value does not conform to the operation direction compared to the first oracle value. This can be because the second oracle value is not greater than the first oracle value, or the ratio of the second oracle value to the first oracle value is less than 1, etc. Removing the second oracle frame corresponding to the second oracle value can be done by directly deleting the second oracle frame, or by not sorting the second oracle frame in the node's oracle frame queue, etc. It should be understood that the above method is merely one implementation method provided by this application for understanding the solution, and is not intended to limit the solution.

[0231] Step 404: If the second oracle value in the second oracle frame conforms to the operation direction specified by the first smart contract compared with the first oracle value, then remove the first oracle frame.

[0232] In one alternative implementation, if the second oracle value in the second oracle frame matches the operation direction compared to the first oracle value, then the first oracle frame is removed.

[0233] The second oracle value conforms to the operation direction when compared with the first oracle value. This can be because the second oracle value is greater than the first oracle value, or the ratio of the second oracle value to the first oracle value is greater than 1, etc. Removing the first oracle frame can be done by deleting the first oracle frame, or by not sorting the first oracle frame in the node's oracle frame queue, etc.

[0234] In some embodiments, after the transmission is performed in the order of the oracle, the method further includes: using the first oracle value as the modification value of the state data of the first data slot in the first smart contract; and packaging the first asset transaction into a block.

[0235] In one optional implementation, after the oracle frames are transmitted in oracle order, the state data of the first data slot in the first smart contract is modified to the first oracle value, and then the first asset transaction is packaged into a block. Since the first oracle value in the state data of the first data slot already represents the latest state data of the current asset transaction, the first oracle value is used as the state data of the first asset transaction when packaging the first asset transaction.

[0236] In some embodiments, such as Figure 5 As shown, it also includes the following steps:

[0237] Step 501: Receive the third oracle frame sent by the second node;

[0238] Step 502: Based on the second contract address in the third oracle frame, determine the second indication information of the oracle data slot in the state data of the second smart contract;

[0239] Step 503: If the second indication information indicates that there is a second data slot that needs to be predicted, then determine the second block height of the second node when constructing the third prediction frame according to the third prediction frame;

[0240] Step 504: If the height of the second block is less than the height of the local chain block of the first node, then remove the third oracle frame.

[0241] In one alternative implementation, the first node receives oracle frames sent by other nodes.

[0242] Different smart contracts exist in different scenarios. The first node receives the second oracle frame sent by the second node. The second oracle frame also includes the contract address (i.e., the second contract address). Based on the second contract address, the indication information (i.e., the second indication information) of the oracle data slot (such as "predictLocation") in the state data of the second smart contract is determined. If the second indication information indicates the data slot that needs to be oracleed, the first node determines the second block height when the second node constructs its own oracle frame (i.e., the second oracle frame) based on the second oracle frame sent by the second node. If the second block height is less than the first block height of the first node, the second oracle frame is removed.

[0243] For example, let's say the first node is node A. When node A constructs its first oracle frame, the first block height is 100. Taking asset transactions as an example, the block height represents the number of transactions that node has reached consensus on, which can also be understood as the number of transactions that have reached consensus across the entire network. The second node is node B. When node B constructs its second oracle frame, its second block height is assumed to be the same as the first node's first block height, which is 100. If node B's third oracle frame indicates the existence of data slots that need to be oracleed, then the block height in node B is compared with the block height in node A. If the block height in node B is less than the block height in node A, then the third oracle frame corresponding to node B is removed.

[0244] In some embodiments, the following steps are also included:

[0245] If the height of the second block is not less than the height of the local chain block of the first node, then update the second constraint coefficient in the third oracle frame; determine the oracle order of the third oracle frame in each oracle frame of the first node based on the updated second constraint coefficient.

[0246] In one optional implementation, if the height of the second block is not less than the height of the local chain block of the first node, then the third oracle frame sent by the second node corresponding to the height of the second block is the latest oracle frame. Therefore, the second constraint coefficient in the third oracle frame is calculated, and the second constraint coefficient is updated using the third oracle frame. The constraint coefficients are sorted in the first node according to the updated second constraint coefficients, and the third oracle frames corresponding to the second constraint coefficients are sorted according to the oracle order.

[0247] In some embodiments, determining the oracle order of the third oracle frame in each oracle frame of the first node based on the updated second constraint coefficient includes:

[0248] If the second oracle direction represented by the second constraint coefficient changes before and after the update, the third oracle frame is discarded; if the second oracle value of the second oracle frame conforms to the operation direction specified by the second smart contract compared with the third oracle value, the fourth oracle frame corresponding to the third oracle value is removed; the asset transaction corresponding to the fourth oracle frame is the asset transaction of the second smart contract.

[0249] In one optional implementation, the second oracle direction of the second constraint coefficient before and after the update is determined. If the second oracle direction changes, such as from a positive value to a negative value, or from a negative value to a positive value, then the third oracle frame is removed.

[0250] If the second oracle value of the second oracle frame conforms to the operation direction specified by the second smart contract compared with the third oracle value, then the fourth oracle frame corresponding to the third oracle frame is removed. The asset transaction corresponding to the fourth oracle frame is compatible with the asset transactions corresponding to the first oracle frame, the second oracle frame, and the third oracle frame.

[0251] To facilitate understanding of this solution, the embodiments of this application are explained below through specific scenarios, including the following steps:

[0252] Scenario 1: The scenario where the first node constructs the first oracle frame:

[0253] Step 601: The user sends a signed transaction to the first node. The transaction format is shown in Table 1 and Table 2.

[0254] Step 602: After receiving the signed transaction, the first node parses it and obtains the following content:

[0255] The transaction To address, which is the first asset transaction address and also the deployment address of the AuctionContract contract, is 0x456;

[0256] Transaction parameters: The function name is updatePrice, and the function parameter is X_2;

[0257] Step 603: The first node finds the corresponding contract's BinCode in the StateDB state tree of the blockchain ledger based on the first contract address 0x456 obtained in step 601.

[0258] Step 604: Load BinCode. Based on the signed transaction parsed in Step 1, locate the function named updatePrice in BinCode. Execute this function to change the current price (i.e., the first confirmed value) currentPrice to the value passed to the function, price (at this point, price = X_2). This yields the instruction to modify the current price currentPrice, i.e.:

[0259] Modify the stored value of the first data slot of the first smart contract at address 0x456, which is currently 0, to X_2.

[0260] Step 605: Locate the data slot that needs to be predicted in the state data of the first smart contract based on the address of the first contract, and obtain the extended field "predictLocation", as shown in Table 4.

[0261] Step 606: If it is not equal to -1, then after modifying the stored data in step 604 above, the stored value of the first data slot "predictLocation" is propagated according to certain rules.

[0262] Since the block has not yet started to be packaged and confirmed across the entire network, the stored value in the propagation storage slot "predictLocation" can be considered as a prediction of the state variable corresponding to the first smart contract in the future. Therefore, this prediction is called "oracle".

[0263] Step 607: Construct the first oracle frame, as shown in Table 5. Fill the first contract address into the contract address field of the first oracle frame; perform RLP encoding on the values ​​stored in the storage slots covered by "predictLocation" and fill them into the oracle field of the first oracle frame; calculate the first constraint coefficient and fill it into the constraint coefficient field.

[0264] Step 608: Sort the first oracle frames according to the magnitude of their constraint coefficients. The smaller the constraint coefficient, the closer it is to the head of the oracle frame queue. For an oracle frame to be inserted into the oracle frame queue, the following steps are required for insertion:

[0265] 6081. Traverse the oracle frame queue and find out if there is an oracle frame in the queue that has the same contract address as the oracle frame to be inserted.

[0266] 6082. If it exists, compare the values ​​of the oracle field.

[0267] If the constraint coefficient is greater than 0, and the oracle value of the oracle frame to be inserted is greater than the oracle value of the oracle frame with the same contract address in the oracle frame queue, then the oracle frame in the oracle frame queue will be deleted, and the oracle frame to be inserted will be inserted into the oracle frame queue.

[0268] If the constraint coefficient is less than 0, and the oracle value of the oracle frame to be inserted is less than the oracle value of the oracle frame with the same contract address in the queue, then the oracle frame in the oracle frame queue is deleted, and the oracle frame to be inserted is inserted into the oracle frame queue.

[0269] 6083. If it does not exist, insert the oracle frame directly into the oracle frame queue.

[0270] 609. The first node starts an independent thread Th to retrieve the oracle frame at the head of the oracle frame queue.

[0271] 6091. If empty data is retrieved, it means that the oracle frame queue is empty at this time. The thread pauses for one block synchronization time and then repeats steps 604-608.

[0272] 6092. If the retrieved data is not empty, the thread immediately propagates to the blockchain network and repeats steps 604-608.

[0273] Scenario 2: The first node receives the second oracle frame from the second node:

[0274] 701. Locate the first smart contract state data structure in StateDB based on the contract address of the second oracle frame.

[0275] 702. Locate the "predictLocation" field in the first smart contract state data structure. If predictLocation is not equal to -1, continue; otherwise, the process ends.

[0276] 703. Calculate the block height N of the second node's oracle frame based on the second constraint coefficient in the second oracle frame of the second node. If the block height of the first node is not less than N, it indicates that the oracle has been confirmed and the process ends.

[0277] 704. If the block height of the first node is less than N, calculate the new constraint coefficient. If the constraint coefficient is greater than 0, but the constraint coefficient of the received oracle frame in the second node is less than 0; or the constraint coefficient is less than 0, but the constraint coefficient L_0 of the received oracle frame in the second node is greater than 0, then the oracle direction has been reversed, and the process ends.

[0278] 705. If the prediction direction has not reversed, then fill the second constraint coefficient into the prediction frame, and insert the second prediction frame into the prediction frame queue, following the same rules as above:

[0279] 7051. If the constraint coefficient is greater than 0, and the oracle value of the second oracle frame to be inserted is greater than the oracle value of the first oracle frame with the same contract address in the oracle frame queue, then delete the first oracle frame in the oracle frame queue and add the second oracle frame to be inserted into the oracle frame queue.

[0280] 7052. If the constraint coefficient is less than 0, and the oracle value of the second oracle frame to be inserted is less than the oracle value of the first oracle frame with the same contract address in the queue, then delete the first oracle frame in the oracle frame queue and add the second oracle frame to be inserted into the oracle frame queue.

[0281] 706. The first node starts an independent thread to retrieve the oracle frame at the head of the oracle frame queue.

[0282] 7061. If empty data is retrieved, it means that the oracle frame queue is empty at this time. Thread T pauses for one block synchronization time and then repeats steps 703-705.

[0283] If the retrieved item is not empty, the thread immediately propagates to the blockchain network and repeats steps 703-705.

[0284] Based on the same technical concept, embodiments of this application provide a oracle frame transmission device, such as... Figure 6 As shown, the device 600 includes:

[0285] The determining module 601 is used to determine the first indication information of the oracle data slot in the state data of the first smart contract based on the first contract address in the first asset transaction; wherein, the indication information of the oracle data slot is used to indicate the data slot that needs to be oracleed.

[0286] The construction module 602 is used to construct a first oracle frame according to the first data slot indicated by the first indication information; the first oracle frame includes the first contract address, a first oracle value, and a first constraint coefficient; the first oracle value is the predicted value after executing the first smart contract, determined based on the first asset value in the first asset transaction; the first constraint coefficient is determined based on the oracle direction and the first block height of the local chain when the first node constructs the first oracle frame;

[0287] The transmission module 603 is used to determine the oracle order of the first oracle frame among the oracle frames received by the first node according to the first constraint coefficient corresponding to the first oracle frame, and to transmit the oracle frame according to the oracle order.

[0288] Optionally, the construction module 602 is specifically used for:

[0289] Obtain the first confirmation value in the first data slot indicated by the indication information from the local chain of the first node;

[0290] The first prediction direction is determined based on the first confirmed value and the first prediction value;

[0291] Based on the first block height of the first node's local chain and the first oracle direction, the first constraint coefficient is determined, thereby constructing a first oracle frame containing the first contract address, the first oracle value, and the first constraint coefficient.

[0292] Optionally, the construction module 602 is specifically used for:

[0293] Determine the number of hops the first oracle frame has made in the blockchain system;

[0294] The first constraint coefficient is determined based on the first block height of the local chain when the first node constructs the first oracle frame, the propagation hop count of the first oracle frame, and the first oracle direction.

[0295] Optionally, the construction module 602 is specifically used for:

[0296] If the difference between the first oracle value and the first confirmed value conforms to the operation mode specified by the first smart contract, then the first oracle direction is determined to be the positive direction representing a positive value.

[0297] If the difference between the first oracle value and the first confirmation value does not conform to the operating mode specified by the first smart contract, then the first oracle direction is determined to be the negative direction representing the negative value.

[0298] Optionally, the more propagation hops, the larger the constraint coefficient;

[0299] The transmission module 603 is specifically used for:

[0300] For each oracle frame received by the first node, sort them according to the constraint coefficient from smallest to largest to determine the oracle order corresponding to each oracle frame.

[0301] Optionally, the transmission module 603 is specifically used for:

[0302] For any received oracle frame, after the oracle frame meets the propagation requirements, the first node generates the constraint coefficients for the oracle frame.

[0303] For each prophecy frame that meets the propagation requirements, the order of the prophecies in each prophecy frame is determined according to the constraint coefficient.

[0304] Optionally, the transmission module 603 is specifically used for:

[0305] If the first constraint coefficient does not conform to the operation direction specified by the first smart contract, then the first oracle frame is removed;

[0306] If the first constraint coefficient conforms to the operation direction specified by the first smart contract, determine whether each oracle frame received by the first node includes a second oracle frame that is the same as the asset transaction of the first smart contract.

[0307] If included, when the second oracle value in the second oracle frame does not conform to the operation direction specified by the first smart contract compared with the first oracle value, the second oracle frame is removed and the oracle order of the first oracle frame in each oracle frame received by the first node is determined according to the first constraint coefficient.

[0308] If the second oracle value in the second oracle frame conforms to the operation direction specified by the first smart contract compared to the first oracle value, then the first oracle frame is removed.

[0309] Optionally, it also includes:

[0310] Use the first oracle value as the modification value of the state data of the first data slot in the first smart contract;

[0311] The first asset transaction is packaged into blocks.

[0312] Optionally, it also includes:

[0313] Receive the third oracle frame sent by the second node;

[0314] Based on the second contract address in the third oracle frame, determine the second indication information of the oracle data slot in the state data of the second smart contract;

[0315] If the second indication information indicates that there is a second data slot that needs to be predicted, then the second block height of the second node is determined according to the third prediction frame when constructing the third prediction frame;

[0316] If the height of the second block is less than the height of the local chain block of the first node, then the third oracle frame is removed.

[0317] Optionally, the transmission module 603 is specifically used for:

[0318] If the height of the second block is not less than the height of the local chain block of the first node, then update the second constraint coefficient in the third oracle frame;

[0319] The order of oracle frames corresponding to the third oracle frame in the first node is determined based on the updated second constraint coefficient.

[0320] Optionally, the transmission module 603 is specifically used for:

[0321] If the second oracle direction represented by the second constraint coefficient changes before and after the update, then the third oracle frame is discarded;

[0322] If the second oracle value of the second oracle frame conforms to the operation direction specified by the second smart contract compared with the third oracle value, then the fourth oracle frame corresponding to the third oracle value is removed; the asset transaction corresponding to the fourth oracle frame is the asset transaction of the second smart contract.

[0323] Based on the same technical concept, embodiments of this application provide a computer device, which may be a terminal or a server, such as... Figure 7 As shown, it includes at least one processor 701 and a memory 702 connected to at least one processor. In this embodiment, the specific connection medium between the processor 701 and the memory 702 is not limited. Figure 7Taking the connection between processor 701 and memory 702 via a bus as an example, the bus can be divided into address bus, data bus, control bus, etc.

[0324] In this embodiment of the application, the memory 702 stores instructions that can be executed by at least one processor 701. By executing the instructions stored in the memory 702, at least one processor 701 can perform the steps included in the above-described cosmic ray removal method.

[0325] The processor 701 is the control center of the computer device, capable of connecting various parts of the computer device via various interfaces and lines. It executes instructions stored in the memory 702 and retrieves data stored in the memory 702. Optionally, the processor 701 may include one or more processing units. The processor 701 may integrate an application processor and a modem processor. The application processor primarily handles the operating system, user interface, and applications, while the modem processor primarily handles wireless communication. It is understood that the modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip; in other embodiments, they may be implemented on separate chips.

[0326] The processor 701 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0327] Memory 702, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 702 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 702 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 702 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0328] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program executable by a computer device, which, when run on the computer device, causes the computer device to perform the steps of the above-described cosmic ray removal method.

[0329] Based on the same inventive concept, this application provides a computer program product, characterized in that the computer program product includes a computer program stored on a computer-readable storage medium, the computer program including program instructions, which, when executed by a computer device, cause the computer device to perform the steps of the above-described cosmic ray removal method.

[0330] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can 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, etc.) containing computer-usable program code.

[0331] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0332] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0333] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0334] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for transmitting oracle frames, characterized in that, Applied to the first node, including: Based on the first contract address in the first asset transaction, determine the first indication information of the oracle data slot in the state data of the first smart contract; wherein, the indication information of the oracle data slot is used to indicate the data slot that needs to be oracleed. A first oracle frame is constructed based on the first data slot indicated by the first instruction information; the first oracle frame includes the first contract address, a first oracle value, and a first constraint coefficient; the first oracle value is the predicted value after executing the first smart contract, determined based on the first asset value in the first asset transaction; the first constraint coefficient is determined based on the oracle direction and the first block height of the local chain when the first node constructs the first oracle frame; The order of oracle frames for the first oracle frame among the oracle frames received by the first node is determined according to the first constraint coefficient corresponding to the first oracle frame, and the oracle frames are transmitted in the order of oracle frames.

2. The method as described in claim 1, characterized in that, The step of constructing a first oracle frame based on the first data slot indicated by the indication information includes: Obtain the first confirmation value in the first data slot indicated by the indication information from the local chain of the first node; The first prediction direction is determined based on the first confirmed value and the first prediction value; Based on the first block height of the first node's local chain and the first oracle direction, the first constraint coefficient is determined, thereby constructing a first oracle frame containing the first contract address, the first oracle value, and the first constraint coefficient.

3. The method as described in claim 2, characterized in that, The step of determining the first constraint coefficient based on the first block height of the first node's local chain and the first oracle direction includes: Determine the number of hops the first oracle frame has made in the blockchain system; The first constraint coefficient is determined based on the first block height of the local chain when the first node constructs the first oracle frame, the propagation hop count of the first oracle frame, and the first oracle direction.

4. The method as described in claim 3, characterized in that, Determining the first prediction direction based on the first confirmation value and the first prediction value includes: If the difference between the first oracle value and the first confirmed value conforms to the operation mode specified by the first smart contract, then the first oracle direction is determined to be the positive direction representing a positive value. If the difference between the first oracle value and the first confirmation value does not conform to the operating mode specified by the first smart contract, then the first oracle direction is determined to be the negative direction representing the negative value.

5. The method as described in claim 3, characterized in that, The more propagation hops, the larger the constraint coefficient; Determining the oracle order of the first oracle frame among the oracle frames received by the first node according to the first constraint coefficient corresponding to the first oracle frame includes: For each oracle frame received by the first node, sort them according to the constraint coefficient from smallest to largest to determine the oracle order corresponding to each oracle frame.

6. The method according to any one of claims 1 to 5, characterized in that, The order of oracle frames received by the first node is determined in the following ways: For any received oracle frame, after the oracle frame meets the transmission requirements, the first node generates the constraint coefficients for the oracle frame. For each oracle frame that meets the transmission requirements, the order of oracle predictions in each oracle frame is determined according to the constraint coefficient.

7. The method as described in any one of claims 1 to 5, characterized in that, Determining the order of oracle frames received by the first node for the first oracle frame includes: If the first constraint coefficient does not conform to the operation direction specified by the first smart contract, then the first oracle frame is removed; If the first constraint coefficient conforms to the operation direction specified by the first smart contract, determine whether each oracle frame received by the first node includes a second oracle frame that is the same as the asset transaction of the first smart contract. If included, when the second oracle value in the second oracle frame does not conform to the operation direction specified by the first smart contract compared with the first oracle value, the second oracle frame is removed and the oracle order of the first oracle frame in each oracle frame received by the first node is determined according to the first constraint coefficient. If the second oracle value in the second oracle frame conforms to the operation direction specified by the first smart contract compared to the first oracle value, then the first oracle frame is removed.

8. The method as described in any one of claims 1 to 5, characterized in that, After transmitting the oracle in the oracle order, the method further includes: using the first oracle value as the modification value of the state data of the first data slot in the first smart contract; The first asset transaction is packaged into blocks.

9. The method as described in any one of claims 1 to 5, characterized in that, Also includes: Receive the third oracle frame sent by the second node; Based on the second contract address in the third oracle frame, determine the second indication information of the oracle data slot in the state data of the second smart contract; If the second indication information indicates that there is a second data slot that needs to be predicted, then the second block height of the second node is determined according to the third prediction frame when constructing the third prediction frame; If the height of the second block is less than the height of the local chain block of the first node, then the third oracle frame is removed.

10. The method as described in claim 9, characterized in that, Also includes: If the height of the second block is not less than the height of the local chain block of the first node, then update the second constraint coefficient in the third oracle frame; The order of oracle frames corresponding to the third oracle frame in the first node is determined based on the updated second constraint coefficient.

11. The method as described in claim 10, characterized in that, Determining the oracle order of the third oracle frame in each oracle frame of the first node based on the updated second constraint coefficient includes: If the second oracle direction represented by the second constraint coefficient changes before and after the update, then the third oracle frame is discarded; If the second oracle value of the second oracle frame conforms to the operation direction specified by the second smart contract compared with the third oracle value, then the fourth oracle frame corresponding to the third oracle value is removed; the asset transaction corresponding to the fourth oracle frame is the asset transaction of the second smart contract.