Calling of smart contract
By deducting fuel fees from the remaining fuel deduction fee of the target contract, the complexity and inefficiency of fuel fee payment in smart contract calls are solved, and efficient and safe contract calls are achieved.
Patent Information
- Application Number
- PCT/CN2024/128943
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-29
- Filing Date
- 2024-10-31
- Publication Date
- 2025-07-03
AI Technical Summary
In the existing blockchain technology, smart contract calls require payment of fuel fees, resulting in costs for each interaction between users, and the fuel fee deduction mechanism increases operational complexity and inefficiency.
By deducting the contract fuel fee from the remaining fuel fee held in the target contract, the deduction steps are simplified, the call efficiency is improved, and security is ensured through the deduction authority description information.
It simplifies the fuel fee deduction process, improves the efficiency of smart contract calling, reduces operational complexity, and ensures the security of contract calling.
Smart Images

Figure CN2024128943_03072025_PF_FP_ABST
Abstract
Description
Smart contract call Technical Field
[0001] The embodiments of this specification belong to the field of blockchain technology, and in particular to the calling of smart contracts. Background Art
[0002] Blockchain technology, also known as distributed ledger technology, is an emerging technology that enables multiple computing devices to jointly maintain a complete distributed database. Due to its decentralized, transparent nature, the ability of each computing device to participate in database recording, and the rapid synchronization of data between computing devices, blockchain technology has been widely applied in numerous fields.
[0003] Blockchains implement related functions and data interactions through transactions, with each object participating in a transaction through a corresponding account. Account types can be categorized as external accounts and contract accounts. External accounts are typically controlled by individuals or organizations and generate and initiate transactions. Contract accounts correspond to smart contracts on the blockchain. Smart contracts are contracts on the blockchain that can be triggered and executed by transactions and are defined in code.
[0004] There is a fuel fee (gas) mechanism in the blockchain. This mechanism requires that when a transaction calls a smart contract, the initiator's account needs to spend the corresponding fuel fee, thereby raising the threshold for calling smart contracts and preventing arbitrary calls to smart contracts.
[0005] Summary of the Invention
[0006] The purpose of this specification is to provide a method and device for calling a smart contract.
[0007] According to a first aspect of one or more embodiments of the present specification, a method for calling a smart contract is proposed, the method comprising: in response to an acquired blockchain transaction, determining a target contract that the blockchain transaction instructs to call; wherein, the target contract holds the remaining withholding fuel fee pre-pledged by an associated pledge account, and corresponding withholding authority description information exists for the remaining withholding fuel fee; when it is determined based on the withholding authority description information that the initiator account of the blockchain transaction has withholding authority, deducting at least a portion of the contract fuel fee required for the blockchain transaction to call the target contract from the remaining withholding fuel fee of the target contract, and completing the call of the target contract by the blockchain transaction.
[0008] According to a second aspect of one or more embodiments of the present specification, a device for calling a smart contract is proposed, the device comprising: a determination unit: in response to an acquired blockchain transaction, determining a target contract that the blockchain transaction instructs to call; wherein, the target contract holds the remaining withheld fuel fee pre-pledged by an associated pledge account, and corresponding withholding authority description information exists for the remaining withheld fuel fee; a deduction unit: when it is determined based on the withholding authority description information that the initiator account of the blockchain transaction has withholding authority, deducting at least a portion of the contract fuel fee required for the blockchain transaction to call the target contract from the remaining withheld fuel fee of the target contract, and completing the calling of the target contract by the blockchain transaction.
[0009] According to a third aspect of one or more embodiments of this specification, an electronic device is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the method described in the first aspect by running the executable instructions.
[0010] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0011] In the embodiments of this specification, the contract fuel fee is not deducted from the withholding account, but rather from the remaining withholding fuel fee held by the target contract. Since the remaining withholding fuel fee is pre-pledged to the target contract by the associated pledge account and is held by the target contract, the target contract does not need to access any withholding account and can withhold the contract fuel fee by itself. On the one hand, since there is no need to access any withholding account and there is no need to determine whether the balance of the withholding account meets the contract fuel fee, the withholding steps are simplified, the withholding efficiency is improved, and thus the calling efficiency of the smart contract is improved; on the other hand, the withholding authority of the initiator account of the blockchain transaction is verified through the withholding authority description information corresponding to the remaining withholding fuel fee, so that accounts without withholding authority cannot call the target contract through withholding, thereby ensuring the security of the contract withholding. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0013] FIG1 is a schematic diagram of a blockchain system provided by an exemplary embodiment.
[0014] FIG2 is a schematic diagram of withholding fuel fees in a related technology provided by an exemplary embodiment.
[0015] FIG3 is a flowchart of a method for calling a smart contract provided by an exemplary embodiment.
[0016] FIG4 is a flowchart of another method for calling a smart contract provided by an exemplary embodiment.
[0017] FIG5 is a schematic structural diagram of a device provided by an exemplary embodiment.
[0018] FIG6 is a block diagram of a device for invoking a smart contract provided by an exemplary embodiment. DETAILED DESCRIPTION
[0019] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments in this specification without creative work should fall within the scope of protection of this specification.
[0020] Figure 1 is a schematic diagram of a blockchain system provided by an exemplary embodiment. As shown in Figure 1, a blockchain system is a distributed network built with multiple nodes. Any two nodes can communicate at the application layer through a peer-to-peer (P2P) network. For example, any two nodes from nodes n1 to n5 can communicate at the application layer through a P2P network. The blockchain system utilizes a chained block structure to construct a decentralized (or multi-centralized) distributed ledger, which is stored on each node (or most nodes, such as consensus nodes) in the distributed blockchain network. Therefore, the blockchain system needs to address the consistency and correctness of the ledger data on each of the multiple nodes in the decentralized (or multi-centralized) network. To address this, each node in the blockchain system runs a blockchain program. Under certain fault-tolerance requirements, a consensus mechanism is used to ensure that all loyal nodes have the same transactions, thereby ensuring that all loyal nodes have consistent execution results for the same transactions. Transactions are then packaged into blocks, and the world state is updated based on the execution results of the same transactions. The current mainstream consensus mechanisms include but are not limited to: Proof of Work (POW), Proof of Stake (POS), Practical Byzantine Fault Tolerance (PBFT) algorithm, HoneyBadgerBFT algorithm, etc.
[0021] Accounts in blockchain systems are typically categorized into two types: user accounts / externally owned accounts and contract accounts. Contract accounts store the contract code and associated state values of smart contracts and can typically only be activated and called through external accounts. The design of external and contract accounts essentially maps account addresses to account states. Account state typically includes, but is not limited to, fields such as Nonce, Balance, StorageRoot, and CodeHash. Nonce and Balance exist for both external and contract accounts, while CodeHash and StorageRoot are typically only valid for contract accounts. Among these fields, Nonce represents a counter. For external accounts, its value represents the number of transactions sent from the account address; for contract accounts, its value represents the number of smart contracts created by the account. Balance represents the amount of digital resources owned by the corresponding external account. StorageRoot represents the hash of the root node of a Merkle Patricia Tree (MPT), which organizes the storage of the contract account's state variables. CodeHash represents the hash value of the contract code. For a contract account, it is the code of the smart contract that is hashed and stored. For an external account, since it does not include a smart contract, it can be an empty string or a string of all zeros.
[0022] The MPT tree is a tree structure that combines the Merkle tree and the Patricia tree (a compressed prefix tree, a more space-efficient Trie tree, also known as a dictionary tree). The Merkle tree algorithm calculates a hash value for each transaction, then hashes each transaction again, until the top-level Merkle root is reached. Ethereum uses a modified MPT tree, such as a hexadecimal tree structure, often referred to as an MPT tree. The data structure of the Ethereum MPT tree includes a state trie.
[0023] The state trie contains key-value pairs for the storage content corresponding to each Ethereum account. A "key" in the state trie can be a 160-bit identifier (such as an Ethereum account address), distributed across the storage from the root node to the leaf nodes of the state trie. The "value" in the state trie is generated by encoding the Ethereum account information using Recursive-Length Prefix encoding (RLP). As mentioned earlier, for external accounts, values can include Nonce and Balance; for contract accounts, values can include Nonce, Balance, CodeHash, and StorageRoot.
[0024] A contract account is used to store the state associated with a smart contract. Once a smart contract is deployed in a blockchain system, it is assigned a corresponding contract account. This contract account typically has a number of states, defined by state variables within the smart contract and generating new state values during the creation and execution of the smart contract. As used in this specification, a smart contract generally refers to a digitally defined, self-executing contract within a blockchain environment. Once an event triggers a clause in the contract (e.g., the execution condition is met), the code automatically executes.
[0025] The blockchain incorporates a gas fee mechanism, which requires the initiator's account to pay a corresponding gas fee when invoking a smart contract. This raises the bar for invoking smart contracts and prevents their arbitrary invocation. However, this gas fee mechanism incurs a gas fee every time a user interacts with a contract (the contracts referred to in this specification are smart contracts). Each operation carries a cost, and users must consider whether the gas fee is worthwhile before conducting a transaction.
[0026] Related art has proposed a method for withholding fuel fees. This involves adding signatures from both the initiator's account and the withholding account to the transaction invoking a contract, so that the contract fuel fee for invoking the contract is withheld from the withholding account. As shown in Figure 2, a blockchain system 22 contains multiple blockchain nodes, including blockchain nodes 201-204. A target contract is deployed on blockchain node 202. Initiator account 21 can send a transaction to blockchain node 202 to invoke the target contract. This transaction includes signatures from both initiator account 21 and withholding account 23 (the signature method can be pre-negotiated between initiator account 21 and withholding account 23). Based on the execution logic of the target contract, blockchain node 202 can query withholding account 23 to determine whether the balance in withholding account 23 meets the target contract's contract fuel fee. If so, withholding account 23 transfers the contract fuel fee to the target contract, completing the fuel fee withholding. After the withholding is complete, blockchain node 202 allows initiator account 21 to invoke the target contract.
[0027] During this process, blockchain node 202 needs to verify that the balance of the withholding account meets the contract gas fee. Furthermore, in the web3 scenario, transactions are sent to the blockchain by the initiator's account, and the transaction hash value is already determined. Adding the withholding party's signature requires modifying the transaction content, which in turn requires changing the hash value, thus increasing the complexity of the operation.
[0028] To address the deficiencies in related technologies, this specification proposes a method for calling a smart contract.
[0029] FIG3 is a flowchart of a method for calling a smart contract provided by an exemplary embodiment. As shown in FIG3 , the method at least includes the following steps 302 to 304 .
[0030] Step 302: In response to the acquired blockchain transaction, determine the target contract that the blockchain transaction indicates to call; wherein the target contract holds the remaining withheld fuel fees pre-pledged by the associated pledge account, and the remaining withheld fuel fees have corresponding withholding permission description information.
[0031] The execution entity of this method can be any blockchain node on the blockchain. The acquired blockchain transaction can be uploaded directly to the blockchain node by the initiator's account, or forwarded to any of the aforementioned blockchain nodes by the initiator's account via another blockchain node. Blockchain transactions in this specification can utilize smart contracts to implement relatively complex processing logic. The smart contract utilized by a blockchain transaction is the target contract that the blockchain transaction instructs to invoke. The number of contracts invoked by a single blockchain transaction is unlimited and can be one or multiple contracts. Each contract invoked by the blockchain transaction can serve as a target contract.
[0032] During the transaction execution process, a blockchain node can determine the target contract to be called by a blockchain transaction instruction. Specifically, the target contract is determined based on the contract address contained in the "to" field of the transaction.
[0033] Before executing a transaction, a blockchain node can also determine the target contract through pre-execution of the transaction. Specifically, the blockchain node can pre-execute the blockchain transaction to obtain a pre-execution read-write set for the blockchain transaction. This pre-execution read-write set can record the contract address of the contract involved in the target transaction. The target transaction can then determine the target contract to be invoked by the blockchain transaction based on the recorded contract address. This embodiment determines the smart contract involved in the blockchain transaction through the pre-execution read-write set. Because pre-execution consumes less resources and time than actual transaction execution, determining the target contract through pre-execution is more efficient.
[0034] The target contract holds the remaining withheld fuel fees, previously pledged by an associated pledge account, and the corresponding withholding permission information is available for this remaining withheld fuel fee. The associated pledge account can be the initiator's account of the blockchain transaction or an account distinct from the initiator's account. Of course, there can be one or more associated pledge accounts. If there are multiple associated pledge accounts, both the initiator's account and accounts distinct from the initiator's account can serve as associated pledge accounts. The remaining withheld fuel fees can be pledged to the target contract through transactions from one or more associated pledge accounts. This will be explained in detail later and will not be repeated here.
[0035] The remaining withheld fuel fees have corresponding permission description information. Specifically, the withholding permission description information includes at least one of the following: a set of accounts with withholding permission, a set of accounts without withholding permission, characteristic description information of accounts with withholding permission, and characteristic description information of accounts without withholding permission. The characteristic description information can include the account address, account name, or public key information uploaded by the account. This specification does not limit the specific content of the characteristic description information.
[0036] In one embodiment, the withholding authority description information and the remaining withheld fuel fee are maintained in the contract account of the target contract, or in an associated party account recorded in the contract account of the target contract.
[0037] When the withholding permission description information and the remaining withheld fuel fee are maintained in the contract account of the target contract, the target contract can avoid accessing other accounts and independently complete the withholding permission judgment, saving account access time, thereby improving the efficiency of fuel fee withholding and further improving the execution efficiency of transactions.
[0038] If the withholding permission description information and the remaining withholding fuel fee are maintained in the associated party account recorded in the contract account of the target contract, the target contract can maintain the account information of the associated party account. If a blockchain transaction that calls the target contract is obtained, the target contract can access the associated party account based on the account information it maintains to determine the remaining withholding fuel fee and withholding permission description information corresponding to the target contract, and then determine whether the blockchain transaction has withholding permission. In this case, the target contract stores the withholding permission description information and the remaining withholding fuel fee in the associated party account, saving its own storage space.
[0039] Furthermore, the associated party account includes at least one of the following: a contract deployer and a contract manager. The contract manager can be the contract deployer or another user with administrative privileges distinct from the contract deployer, such as a blockchain system administrator or a person with administrative privileges in a relevant department. Compared to other accounts, the contract deployer and contract manager of the target contract have a lower risk of information leakage or tampering. The contract deployer or contract manager of the target contract maintains the descriptive information of the withholding permissions and the remaining withheld fuel fee, thereby ensuring maximum information security.
[0040] Furthermore, in the case where the withholding authority description information and the remaining withholding fuel fee are maintained in the contract account of the target contract, the withholding authority description information is maintained in the storage field of the contract account of the target contract, and the remaining withholding fuel fee is maintained in the account balance field and / or storage field of the contract account of the target contract; in the case where the withholding authority description information and the remaining withholding fuel fee are maintained in the associated party account, the withholding authority description information and the remaining withholding fuel fee are maintained in the storage field of the associated party account.
[0041] As shown in Table 1, the account status of a contract account generally includes the "Balance" field, the "Nonce" field, the "CodeHash" field, and the "StorageRoot" field. The "Balance" field corresponds to the aforementioned balance field, and the "StorageRoot" field corresponds to the aforementioned storage field. As previously mentioned, StorageRoot represents the hash of the root node of an MPT tree, which is used to organize the storage of the state variables of the contract account. When the remaining withheld fuel fee and / or withheld permission description information is maintained in a storage field, the remaining withheld fuel fee and / or withheld permission description information can be stored in a node of the MPT tree.
[0042] Table 1
[0043] When the withholding permission description information and the remaining withheld fuel fee are maintained in the contract account of the target contract, the target contract can directly determine the amount of the remaining withheld fuel fee based on the content recorded in its own balance field, and can also determine whether the initiator account has the withholding permission based on the withholding permission description information stored in the storage field.
[0044] If the withholding permission description information and the remaining withholding fuel fee are maintained in the associated account, the target contract can request the withholding permission description information and the remaining withholding fuel fee from the associated account. Alternatively, the target contract can send a permission determination request containing the initiator's account information to the associated account, and the associated account will determine the initiator's withholding permission and receive feedback from the associated account.
[0045] Step 304: When it is determined based on the withholding authority description information that the initiator account of the blockchain transaction has the withholding authority, at least a portion of the contract fuel fee required for the blockchain transaction to call the target contract is deducted from the remaining withheld fuel fee of the target contract, and the blockchain transaction's call to the target contract is completed.
[0046] The contract fuel fee may be the fuel fee required to call the target contract, and at least a portion of the contract fuel fee may be the entire contract fuel fee or a portion of the contract fuel fee.
[0047] Specifically, deducting at least a portion of the contract fuel fee required for the blockchain transaction to call the target contract from the remaining withheld fuel fee of the target contract includes: deducting all the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fee of the target contract; or deducting a portion of the contract fuel fee required for the blockchain transaction to call the target contract from the remaining withheld fuel fee of the target contract, and deducting the remaining portion of the contract fuel fee from the account balance of the initiator account of the blockchain transaction.
[0048] Furthermore, the deduction of at least a portion of the contract fuel fee required for the blockchain transaction to call the target contract from the remaining withheld fuel fee of the target contract includes: when the remaining withheld fuel fee of the target contract is lower than the contract fuel fee, deducting the remaining withheld fuel fee of the target contract and deducting the remaining contract fuel fee from the account balance of the initiator account; or deducting the contract fuel fee from the remaining withheld fuel fee of the target contract and the account balance of the initiator account according to a predefined ratio
[0049] In the case where the contract fuel fee is divided into two parts, which are deducted from the remaining withheld fuel fee and the account balance of the initiator's account respectively, the two parts of the fuel fee can be deducted according to a preset ratio. For example, the preset deduction ratio can be 1:1. If the contract fuel fee is 10, then 5 can be deducted from the remaining withheld fuel fee and 5 from the account balance of the initiator's account. Of course, the deduction of the fuel fee does not need to be proportional. The contract fuel fee can be deducted from the remaining withheld fuel fee first. In the case that the remaining withheld fuel fee is insufficient, the remaining withheld fuel fee can be deducted first, or deducted to a preset threshold (such as 5% of the original remaining withheld fuel fee or a fixed fuel amount of 10), and then the remaining part of the contract fuel fee can be deducted from the account balance of the initiator's account. This manual does not limit the specific deduction method.
[0050] In this embodiment, the contract fuel fee is not deducted from the withholding account, but rather from the remaining withholding fuel fee held by the target contract. Since the remaining withholding fuel fee is pre-pledged to the target contract by the associated pledge account and is held by the target contract, the target contract does not need to access any withholding account and can withhold the contract fuel fee by itself. On the one hand, since there is no need to access any withholding account, and there is no need to determine whether the balance of the withholding account meets the contract fuel fee, the withholding steps are simplified, the withholding efficiency is improved, and thus the calling efficiency of the smart contract is improved; on the other hand, the withholding authority of the initiator account of the blockchain transaction is verified through the withholding authority description information corresponding to the remaining withholding fuel fee, so that accounts without withholding authority cannot call the target contract through withholding, thereby ensuring the security of the contract withholding.
[0051] A blockchain node can be understood as a logical entity combining software and hardware. The software includes a blockchain instance, which runs on a device and implements its corresponding functions through the code contained in the blockchain instance (i.e., chaincode). The hardware can be understood as the device where the blockchain instance is deployed and runs, or the hardware resources actually occupied by the device.
[0052] In related technologies, the transaction execution logic defined by chaincode states that when executing a transaction, fuel fees are deducted from the transaction initiator's account. However, this specification implements underlying optimizations to the chaincode. Based on this optimized chaincode, when executing a transaction, blockchain nodes no longer deduct fuel fees directly from the transaction initiator's account. Instead, they deduct fuel fees from the contract account of the smart contract invoked by the transaction.
[0053] In one embodiment, the chaincode's fuel fee deduction logic can be modified to: in all cases, when executing a transaction, fuel fees are deducted from the contract account of the smart contract invoked by the transaction. In other embodiments, the chaincode's fuel fee deduction logic can be modified to determine, based on the current situation, whether to deduct fuel fees from the transaction initiator's account or the contract account of the smart contract invoked by the transaction, or even from both accounts. Of course, if the contract account is selected as the deduction target, it is necessary to further determine whether the transaction initiator's account has deduction permission. This will be discussed in detail below and is not detailed here.
[0054] Specifically, the blockchain node can determine the object of fuel fee deduction based on the transaction identifier of the transaction and / or the contract identifier of the smart contract.
[0055] In one embodiment, the blockchain transaction includes a transaction identifier; wherein the prerequisite for deducting at least a portion of the contract fuel fee from the remaining withheld fuel fee of the target contract includes: the transaction identifier indicates that the blockchain transaction supports fuel fee withholding. A blockchain node can determine whether the blockchain transaction supports fuel fee withholding based on the transaction identifier of the blockchain transaction. The transaction identifier can be a field included in the blockchain transaction, which includes a first field value and a second field value. The first field value specifies that the blockchain transaction supports fuel fee withholding, and the second field value specifies that the blockchain transaction does not support fuel fee withholding. When executing a transaction, the blockchain node can identify the field value of the field included in the blockchain transaction and further determine the object of fuel fee deduction. When the field value is the first field value, the object of deduction is the contract account of the smart contract invoked by the transaction; when the field value is the second field value, the object of deduction is the account of the transaction initiator.
[0056] In another case, the target contract has a corresponding contract identifier; wherein, the prerequisite for deducting at least a portion of the contract fuel fee from the remaining withheld fuel fee of the target contract includes: the contract identifier indicates that the target contract supports fuel fee withholding. The blockchain node can determine whether the smart contract supports fuel fee withholding based on the contract identifier of the smart contract. The contract identifier can be a field set in the contract account or contract code, and whether the smart contract supports fuel fee withholding can be determined based on the field value of the field. For example, the field contains a third field value and a fourth field value, the third field value specifies that the smart contract supports fuel fee withholding, and the fourth field value specifies that the smart contract does not support fuel fee withholding. If the contract identifier of the smart contract indicates that the smart contract does not support fuel fee withholding, even if the smart contract contains the remaining withheld fuel fee, the fuel fee cannot be deducted from the remaining withheld fuel fee. Then, when executing a transaction, the blockchain node can identify the smart contract called by the transaction and take the value based on the contract account of the smart contract or the contract identifier in the contract code: if it is the third field value, the deduction object is the contract account of the smart contract; if it is the fourth field value, the deduction object is the account of the transaction initiator.
[0057] Of course, the two aforementioned scenarios can be combined, where the transaction includes a transaction identifier and the smart contract also has a corresponding contract identifier. The prerequisite for deducting at least a portion of the contract fuel fee from the remaining withheld fuel fee of the target contract includes: the transaction identifier indicating that the blockchain transaction supports fuel fee withholding, and the contract identifier indicating that the target contract supports fuel fee withholding. For example, when executing a transaction, a blockchain node first checks the value of the transaction identifier. If the transaction identifier is the second field value, the deduction can be directly determined to be the account of the transaction initiator. If the transaction identifier is the first field value, the contract identifier is further checked. If the contract identifier is the third field value, the deduction is determined to be the contract account of the smart contract; if it is the fourth field value, the deduction is determined to be the account of the transaction initiator. In other words, if both the blockchain transaction and the smart contract support fuel fee withholding, the fuel fee deduction can be determined to be the contract account of the smart contract. If either the transaction identifier or the contract identifier does not support fuel fee withholding, the fuel fee deduction is determined to be the account of the blockchain transaction initiator.
[0058] In this embodiment, by optimizing the chain code of the blockchain, the blockchain node can determine the object of fuel fee deduction based on the transaction identifier of the blockchain transaction and / or the contract identifier of the smart contract called by the transaction, thereby avoiding limiting the deduction object to the transaction initiator and realizing the deduction of fuel fees from the contract account of the smart contract.
[0059] In one embodiment, the target contract has multiple corresponding groups of remaining withheld fuel fees and withholding authority description information corresponding to each group of remaining withheld fuel fees, and deducting at least a portion of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract includes: deducting the at least a portion of the contract fuel fees from one or at least two groups of the multiple groups of remaining withheld fuel fees.
[0060] As shown in Table 2, the remaining withheld fuel fees can be grouped according to the associated pledged accounts. The withholding permission description information corresponding to different groups of remaining withheld fuel fees can be the same or different. For example: the associated pledged account 0x1 pre-pledges a fuel fee of 100. The withholding permission description information corresponding to this fuel fee is the account address "0x1, 0x5, 0x6" of the account with withholding permission. The associated pledged account itself may also have withholding permission for this fuel fee. In addition, the other two groups of fuel fees recorded in Table 2 are 200 pre-pledged by the associated pledged account 0x2 and 1000 pre-pledged by the associated pledged account 0x3. The withholding permission description information corresponding to the fuel fee of 200 is "0x2, 0x5", and the withholding permission description information corresponding to the fuel fee of 1000 is "0x7, 0x8".
[0061] Table 2
[0062] Withholding permission description information can be limited by the associated pledge account. In other words, the associated pledge account can limit the accounts that have withholding permission for its own pledged fuel fees. Specifically, the associated pledge account can send the corresponding withholding permission description information to the target contract when staking fuel fees.
[0063] In this embodiment, the remaining withheld fuel fees are grouped according to the associated pledged accounts, so that the associated pledged accounts can limit the accounts that have withholding authority for the pledged fuel fees.
[0064] Of course, the remaining deducted fuel fees can also be grouped in other ways, such as grouping according to the geographical region where the associated pledged account is located (such as grouping the associated pledged accounts in the southern region into one group), or grouping according to the amount of fuel fees pre-pledged by the associated pledged account (such as grouping fuel fees below 100 into one group). This instruction manual does not limit this.
[0065] Furthermore, deducting the at least part of the contract fuel fee from at least two groups of remaining withheld fuel fees includes: determining each group of remaining withheld fuel fees for which the initiator account of the blockchain transaction has withholding authority; when the fees in each group of remaining withheld fuel fees or the fees in each group of remaining withheld fuel fees that the initiator account of the blockchain transaction is allowed to use are lower than the at least part of the contract fuel fee, selecting at least two groups of remaining withheld fuel fees and deducting the at least part of the contract fuel fee therefrom.
[0066] As shown in Table 2, the account with the account address "0x5" has the withholding authority for both groups of remaining withholding fuel fees. If the contract fuel fee is 300, which is higher than the remaining withholding fuel fee of any group for which the account has withholding authority, the target contract can deduct the contract fuel fee from both groups of remaining withholding fuel fees, that is, deduct 100 from the remaining withholding fuel fee of the first group and 200 from the remaining withholding fuel fee of the second group.
[0067] In this embodiment, although the remaining withheld fuel fees are divided into multiple groups, the deduction of the contract fuel fees is not limited to the same group of remaining withheld fuel fees. By deducting the contract fuel fees from multiple groups of remaining withheld fuel fees with withholding authority, flexible deduction of fuel fees is achieved.
[0068] In one embodiment, the method further includes: determining whether the target contract has a corresponding withholding permission identifier; if it is determined that the target contract has the withholding permission identifier, determining whether the initiator account of the blockchain transaction has the withholding permission based on the withholding permission description information.
[0069] The "withholding allowed flag" may be an additional field maintained for the target contract, which records whether the target contract allows withholding. This additional field may be a fifth field in the contract status in addition to the four fields mentioned above.
[0070] The withholding permission flag can also be maintained in the MPT tree corresponding to the "StorageRoot" field of the target contract. For example, it can be a preset parameter. The blockchain node can determine whether the target contract allows withholding based on the value of the parameter.
[0071] If the target contract has a flag that allows withholding, the blockchain node can further determine whether the initiator's account has the withholding authority; if the target contract does not have a flag that allows withholding, the blockchain node can notify the initiator's account that the transaction has failed, or the blockchain node can deduct the contract fuel fee from the account balance of the initiator's account.
[0072] In this embodiment, whether the target contract allows withholding is distinguished by the withholding permission flag, thereby avoiding the implementation of the withholding mechanism for contracts that do not allow withholding.
[0073] In one embodiment, the method further includes: in response to a fuel fee pledge transaction for the target contract, determining the associated pledge account and pledge fuel fee described in the fuel fee pledge transaction; deducting the pledge fuel fee from the account balance of the determined associated pledge account and adding it to the remaining withheld fuel fee of the target contract.
[0074] A fuel pledge transaction is essentially a simple transfer transaction: the linked pledge account transfers funds to the contract account of the target contract. The amount transferred is the pledged fuel fee. Specifically, the fuel pledge transaction can include a special field to describe the transaction type. After receiving the transaction, the blockchain node can parse the received transaction. If the transaction type is a fuel pledge transaction, the pledged fuel fee can be deducted from the account balance of the transaction initiator and added to the remaining withheld fuel fee of the target contract.
[0075] As mentioned above, the remaining withheld fuel fees can be grouped by associated pledged accounts. Associated pledged accounts can be limited by the withholding permission description information corresponding to the pledged fuel fees they have previously pledged. The fuel fee pledge transaction sent by the associated pledged accounts can include the corresponding withholding permission description information. The target contract can then associate and maintain the pledged fuel fees and withholding permission description information.
[0076] In this embodiment, through the fuel fee pledge transaction, the associated pledge account can pre-pledge the pledged fuel fee to the target contract, so that the target contract can implement the withholding mechanism by using the pledged fuel fee as the remaining withheld fuel fee.
[0077] In one embodiment, the method further includes: allocating incentive resources to the associated pledge account in response to the contract fuel fee deducted from the remaining withheld fuel fee according to the blockchain transaction.
[0078] To incentivize accounts to actively stake fuel in contracts, blockchain nodes can allocate incentive resources to associated staking accounts after the target contract call is completed. Incentive resources can be allocated based on the ratio of the fuel fees staked by the associated staking accounts. For example, if there are two associated staking accounts, the first staking fuel fee is 100, and the second staking fuel fee is 200, then the ratio of incentive resources received by these two associated staking accounts is 1:2. Of course, incentive resources can also be allocated according to other allocation rules, such as an equal distribution or only allocating incentive resources to the associated staking account with the highest fuel fee. This manual does not limit the specific allocation rules.
[0079] Incentive resources can be fuel fees, other on-chain resources (such as points, data, and permissions associated with the target contract), or proof of ownership of off-chain resources (such as property certificates, mobile phone redemption coupons, etc.). If the incentive resource is online points, the associated staking account can redeem corresponding rewards offline based on the points.
[0080] In this embodiment, in order to incentivize accounts to actively pledge fuel fees in the contract, a reward mechanism is set up to allocate corresponding incentive resources to the associated pledge account after the target contract call is completed, thereby incentivizing accounts to actively pledge fuel fees.
[0081] The above-mentioned embodiment is comprehensively introduced below in conjunction with FIG4 . FIG4 is a flowchart of another method for calling a smart contract provided by an exemplary embodiment. As shown in FIG4 , the method at least includes the following steps 402 to 418 .
[0082] Step 402: Determine the target contract corresponding to the blockchain transaction. The blockchain node obtains the blockchain transaction and obtains the pre-execution read / write set of the blockchain transaction by pre-executing the blockchain transaction. Based on the pre-execution read / write set, the node determines the contract to be called in the blockchain transaction and uses the determined contract as the target contract.
[0083] Step 404: Identify whether the target contract has a flag that allows withholding. Determine if the target contract contains a field that indicates whether the target contract allows withholding. If the field indicates that the target contract allows withholding, the target contract has a flag that allows withholding. The process then proceeds to step 406: Determine whether the initiator's account has withholding authority. The blockchain node determines whether the withholding authority description information held by the target contract contains the account address of the initiator's account. If it does, it indicates that the initiator's account has withholding authority. The process then proceeds to step 408: Deduct the contract fuel fee from the remaining withheld fuel fee. Step 410: Complete the call to the target contract in the blockchain transaction. Step 412: Allocate incentive resources to the associated pledged account. The blockchain node can allocate incentive resources in proportion to the pledged fuel fee pledged by the associated pledged account.
[0084] If, in step 404, the field records that the target contract does not allow withholding, it indicates that the target contract does not have a withholding permission flag, and the process proceeds to step 414. If, in step 406, the withholding permission description information does not include the account address of the initiator account, it indicates that the initiator account does not have withholding permission, and the process also proceeds to step 414.
[0085] Step 414, determine whether the account balance of the initiator's account meets the contract fuel fee. The condition for meeting the contract fuel fee can be that the account balance of the initiator's account is higher than the contract fuel fee of the target contract, or the account balance of the initiator's account after deducting the contract fuel fee is higher than a preset threshold, or the contract fuel fee of the target contract is lower than the account balance of the initiator's account by a preset percentage. This specification does not limit this. If the account balance of the initiator's account meets the contract fuel fee, step 416 is entered to deduct the contract fuel fee from the account balance of the initiator's account, and then step 410 is entered; if the account balance of the initiator's account does not meet the contract fuel fee, step 418 is entered, the transaction fails, and the blockchain node can notify the initiator account of the transaction failure and inform the reason for the failure.
[0086] In this embodiment, the contract fuel fee is not deducted from the withholding account, but rather from the remaining withholding fuel fee held by the target contract. Since the remaining withholding fuel fee is pre-pledged to the target contract by the associated pledge account and is held by the target contract, the target contract does not need to access any withholding account and can withhold the contract fuel fee by itself. On the one hand, since there is no need to access any withholding account, and there is no need to determine whether the balance of the withholding account meets the contract fuel fee, the withholding process is simplified and the withholding efficiency is improved. On the other hand, the withholding authority of the initiator account of the blockchain transaction is verified through the withholding authority description information corresponding to the remaining withholding fuel fee, so that accounts without withholding authority cannot call the target contract through withholding, thereby ensuring the security of the contract withholding.
[0087] FIG5 is a schematic structural diagram of a device provided by an exemplary embodiment. Referring to FIG5 , at the hardware level, the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510, and may also include hardware required for other functions. One or more embodiments of this specification may be implemented based on software, such as the processor 502 reading the corresponding computer program from the non-volatile memory 510 into the memory 508 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or logic devices.
[0088] As shown in Figure 6, Figure 6 is a block diagram of a smart contract calling device provided by an exemplary embodiment, which can be applied to the device shown in Figure 6 to implement the technical solution of this specification; it includes: a first determination unit 602, which is used to determine the target contract that the blockchain transaction indicates to call in response to the acquired blockchain transaction; wherein, the target contract holds the remaining withholding fuel fee pre-pledged by the associated pledge account, and the remaining withholding fuel fee has corresponding withholding authority description information; a deduction unit 604, which is used to deduct at least a part of the contract fuel fee required for the blockchain transaction to call the target contract from the remaining withholding fuel fee of the target contract when it is determined based on the withholding authority description information that the initiator account of the blockchain transaction has the withholding authority, and complete the calling of the target contract by the blockchain transaction.
[0089] Optionally, the blockchain transaction includes a transaction identifier; wherein, the prerequisite for deducting at least a portion of the contract fuel fee from the remaining withheld fuel fee of the target contract includes: the transaction identifier indicates that the blockchain transaction supports fuel fee withholding; or, the target contract has a corresponding contract identifier; wherein, the prerequisite for deducting at least a portion of the contract fuel fee from the remaining withheld fuel fee of the target contract includes: the contract identifier indicates that the target contract supports fuel fee withholding; or, the blockchain transaction includes a transaction identifier and the target contract has a corresponding contract identifier; wherein, the prerequisite for deducting at least a portion of the contract fuel fee from the remaining withheld fuel fee of the target contract includes: the transaction identifier indicates that the blockchain transaction supports fuel fee withholding, and the contract identifier indicates that the target contract supports fuel fee withholding.
[0090] Optionally, the associated pledge account is the initiator account of the blockchain transaction, or another account different from the initiator account.
[0091] Optionally, the withholding authority description information includes at least one of the following: a set of accounts with withholding authority, a set of accounts without withholding authority, characteristic description information of accounts with withholding authority, and characteristic description information of accounts without withholding authority.
[0092] Optionally, the withholding authority description information and the remaining withheld fuel fee are maintained in the contract account of the target contract, or in an associated party account recorded in the contract account of the target contract.
[0093] Optionally, the associated party account includes at least one of the following: a contract deployer and a contract manager.
[0094] Optionally, when the withholding authority description information and the remaining withholding fuel fee are maintained in the contract account of the target contract, the withholding authority description information is maintained in the storage field of the contract account of the target contract, and the remaining withholding fuel fee is maintained in the account balance field and / or storage field of the contract account of the target contract; when the withholding authority description information and the remaining withholding fuel fee are maintained in the associated party account, the withholding authority description information and the remaining withholding fuel fee are maintained in the storage field of the associated party account.
[0095] Optionally, the target contract has corresponding multiple groups of remaining withheld fuel fees and withholding authority description information corresponding to each group of remaining withheld fuel fees, and the deduction unit 604 is specifically used to deduct at least a portion of the contract fuel fee from one or at least two groups of the multiple groups of remaining withheld fuel fees.
[0096] Optionally, the deduction unit 604 is specifically used to: determine each group of remaining withheld fuel fees for which the initiator account of the blockchain transaction has withholding authority; when the fees in each group of remaining withheld fuel fees or the fees in each group of remaining withheld fuel fees that the initiator account of the blockchain transaction is allowed to use are lower than at least a portion of the contract fuel fees, select at least two groups of remaining withheld fuel fees and deduct at least a portion of the contract fuel fees from them.
[0097] Optionally, the deduction unit 604 is specifically used to: deduct all the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract; or, deduct a part of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract, and deduct the remaining part of the contract fuel fees from the account balance of the initiator account of the blockchain transaction.
[0098] Optionally, the deduction unit 604 is specifically used to: when the remaining withheld fuel fee of the target contract is lower than the contract fuel fee, deduct the remaining withheld fuel fee of the target contract and deduct the remaining contract fuel fee from the account balance of the initiator account; or, deduct the contract fuel fee from the remaining withheld fuel fee of the target contract and the account balance of the initiator account according to a predefined ratio.
[0099] Optionally, the device also includes: a second determination unit 606, used to determine whether the target contract has a corresponding withholding permission identifier; a third determination unit 608, used to determine whether the initiator account of the blockchain transaction has withholding authority based on the withholding authority description information when it is determined that the target contract has the withholding permission identifier.
[0100] Optionally, the device also includes: a fourth determination unit 610, used to determine the associated pledge account and pledge fuel fee described in the fuel fee pledge transaction in response to the fuel fee pledge transaction for the target contract; an addition unit 612, used to deduct the pledge fuel fee from the account balance of the determined associated pledge account and add it to the remaining withheld fuel fee of the target contract.
[0101] Optionally, the device further includes: an allocation unit 614, configured to allocate incentive resources to the associated pledge account in response to the contract fuel fee deducted from the remaining withheld fuel fee according to the blockchain transaction.
[0102] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0103] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as both a software module implementing the method and a structure within the hardware component.
[0104] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a server system. Of course, the present invention does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0105] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.
[0106] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0107] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.
[0108] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0109] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0110] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0111] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0112] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0113] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0114] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In distributed computing environments, program modules may be located in local and remote computer storage media, including storage devices.
[0115] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.
[0116] The foregoing is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification shall be included within the scope of the claims.
Claims
1. A method for invoking a smart contract, the method comprising: In response to a blockchain transaction obtained, determining a target contract indicated to be invoked by the blockchain transaction; wherein, the target contract holds the remaining withheld fuel fees pre-withheld by an associated pledged account, and there is corresponding withholding permission description information for the remaining withheld fuel fees; When it is determined that the initiating party account of the blockchain transaction has the withholding permission based on the withholding permission description information, deducting at least a part of the contract fuel fees required for the blockchain transaction to invoke the target contract from the remaining withheld fuel fees of the target contract, and completing the invocation of the target contract by the blockchain transaction.
2. The method according to claim 1, The blockchain transaction includes a transaction identifier; among them, The preconditions for deducting the at least a part of the contract fuel fees from the remaining withheld fuel fees of the target contract include: the transaction identifier indicates that the blockchain transaction supports fuel fee withholding; or, The target contract has a corresponding contract identifier; wherein, the preconditions for deducting the at least a part of the contract fuel fees from the remaining withheld fuel fees of the target contract include: the contract identifier indicates that the target contract supports fuel fee withholding; or, The blockchain transaction includes a transaction identifier and the target contract has a corresponding contract identifier; wherein, the preconditions for deducting the at least a part of the contract fuel fees from the remaining withheld fuel fees of the target contract include: the transaction identifier indicates that the blockchain transaction supports fuel fee withholding, and the contract identifier indicates that the target contract supports fuel fee withholding.
3. The method according to claim 1, wherein the associated pledged account is the initiating party account of the blockchain transaction, or another account different from the initiating party account.
4. The method according to claim 1, wherein the withholding permission description information includes at least one of the following: a set of accounts with withholding permission, a set of accounts without withholding permission, characteristic description information of accounts with withholding permission, and characteristic description information of accounts without withholding permission.
5. The method according to claim 1, wherein the withholding permission description information and the remaining withheld fuel fees are maintained in the contract account of the target contract, or in the associated party account recorded in the contract account of the target contract.
6. The method according to claim 5, wherein the associated party account includes at least one of the following: a contract deployer, a contract manager.
7. The method according to claim 5, When the withholding permission description information and the remaining withheld fuel fees are maintained in the contract account of the target contract in this case, the withholding permission description information is maintained in the storage field of the contract account of the target contract, and the remaining withheld fuel fees are maintained in the account balance field and / or the storage field of the contract account of the target contract; When the withholding permission description information and the remaining withheld fuel fees are maintained in the associated party account, the withholding permission description information and the remaining withheld fuel fees are maintained in the storage field of the associated party account.
8. According to the method described in claim 1, for the target contract, there are corresponding multiple sets of remaining withheld fuel fees and withholding permission description information corresponding to each set of remaining withheld fuel fees. Deducting at least a part of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract includes: Deducting the at least a part of the contract fuel fees from one set or at least two sets of the multiple sets of remaining withheld fuel fees.
9. According to the method described in claim 8, deducting the at least a part of the contract fuel fees from at least two sets of remaining withheld fuel fees includes: Determining the sets of remaining withheld fuel fees for which the initiating party account of the blockchain transaction has withholding permission; In the case where the fees available for the initiating party account of the blockchain transaction in each set of remaining withheld fuel fees or each set of remaining withheld fuel fees are all lower than the at least a part of the contract fuel fees, selecting at least two sets of remaining withheld fuel fees and deducting the at least a part of the contract fuel fees therefrom.
10. According to the method described in claim 1, deducting at least a part of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract includes: Deducting all of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract; Or, Deducting a part of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract, and deducting the remaining part of the contract fuel fees from the account balance of the initiating party account of the blockchain transaction.
11. According to the method described in claim 10, deducting a part of the contract fuel fees required for the blockchain transaction to call the target contract from the remaining withheld fuel fees of the target contract, and deducting the remaining part of the contract fuel fees from the account balance of the initiating party account of the blockchain transaction includes: In the case where the remaining withheld fuel fees of the target contract are lower than the contract fuel fees, deducting the remaining withheld fuel fees of the target contract, and deducting the remaining part of the contract fuel fees from the account balance of the initiating party account; or, deducting the contract fuel fees from the remaining withheld fuel fees of the target contract and the account balance of the initiating party account according to a predefined ratio.
12. According to the method described in claim 1, the method further includes: Determining whether there is a corresponding withholding permission flag for the target contract; In the case where it is determined that the target contract has the withholding permission flag, based on the withholding permission description information Determining whether the initiating party account of the blockchain transaction has withholding permission.
13. According to the method described in claim 1, the method further includes: In response to a fuel fee pledge transaction for the target contract, determining the associated pledge account and pledged fuel fees described in the fuel fee pledge transaction; Deducting the pledged fuel fees from the account balance of the determined associated pledge account and adding them to the remaining withheld fuel fees of the target contract.
14. According to the method described in claim 1, the method further includes: Allocating incentive resources to the associated pledge account in response to the contract fuel fee deducted from the remaining withheld fuel fees according to the blockchain transaction.
15. An apparatus for invoking a smart contract, the apparatus comprising: A determination unit: in response to a blockchain transaction obtained, determining a target contract indicated to be invoked by the blockchain transaction; wherein the target contract holds remaining withheld fuel fees pre-withheld by an associated pledge account, and there is corresponding withholding permission description information for the remaining withheld fuel fees; A deduction unit: in the case where it is determined based on the withholding permission description information that the initiating party account of the blockchain transaction has the withholding permission, deducting at least a part of the contract fuel fee required for the blockchain transaction to invoke the target contract from the remaining withheld fuel fees of the target contract, and completing the invocation of the target contract by the blockchain transaction.
16. An electronic device, comprising: A processor; A memory for storing instructions executable by the processor; Wherein, the processor realizes the method according to any one of claims 1-14 by running the executable instructions.
17. A computer-readable storage medium, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method according to any one of claims 1-14 are realized.
Citation Information
Patent Citations
Payment withholding method and device based on a block chain, electronic equipment and storage medium
CN110163590A
Method and device for realizing asset withholding on block chain through smart contract
CN111369257A
Fuel withholding method and device, electronic equipment and storage medium
CN112581110A
Intelligent contract calling method and device
CN118014567A
Method and system for providing a transaction forwarding service in blockchain implementations
US20180097779A1