Blockchain digital asset state processing method and system
By generating asset keys in the blockchain and storing the state of digital assets in the reserved storage space of the target user's account, the problem of asset state being easily tampered with in the contract storage model is solved, achieving higher security and consistency.
Patent Information
- Application Number
- CN202611301694.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-24
AI Technical Summary
In the existing blockchain digital asset system, under the contract storage model, the status of users' assets is easily tampered with illegally, lacking the protection of the underlying storage layer.
By generating asset keys and using preset addressing rules, the digital asset state data is stored in the reserved storage space of the target user account, isolating the contract storage space from writes, and using proxy execution paths or pre-compiled paths for transaction processing to ensure data consistency and security.
It enhances the security of blockchain digital asset state storage, reduces the risk of contract storage overwriting and malicious tampering, and ensures the integrity and consistency of asset state.
Smart Images

Figure CN123158671A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a method and system for processing the state of digital assets in a blockchain. Background Technology
[0002] As blockchain technology continues to be implemented in scenarios such as consortium blockchain government collaboration and trusted digital management, digital assets, as one of the core data objects in the blockchain system, have gradually evolved from early on-chain ledger units into a crucial infrastructure carrying the capabilities of credentials, ownership confirmation, authorization, identity mapping, and multi-party collaborative governance. In a blockchain execution environment, digital assets typically rely on smart contracts for definition and management. Users initiate calls to digital asset contracts to achieve authorization approvals, update ownership status, and other asset states.
[0003] Existing blockchain digital asset systems typically employ a "contract storage + contract execution" model in their engineering implementation. That is, asset ownership, operator authorization, and metadata are usually stored in the storage space under the digital asset contract account; updates to the asset status are then accomplished by executing the contract bytecode deployed on the blockchain. For example, a user's digital asset is stored in the storage tree of the digital asset contract account, and the user is merely an index item in the contract's stored data. In other words, while the user's assets belong to the user, their on-chain storage ownership and modification control remain attached to the contract account. If the contract code contains logical vulnerabilities or backdoors, or if the logic implementation pointed to by the proxy contract is replaced, the user's corresponding asset status, authorization status, and even ownership status may be illegally tampered with, making it difficult for the user to obtain underlying security at the storage level commensurate with their asset ownership. Summary of the Invention
[0004] To address or partially address the problems existing in related technologies, this invention provides a method and system for processing the state of digital assets in a blockchain.
[0005] The first aspect of this invention provides a method for processing the state of digital assets in a blockchain, the method comprising: Receive a transaction request for a target asset, and determine at least one target asset based on the transaction request. The node determines the target asset identifier based on the transaction request. The target asset identifier includes at least an asset contract address and a digital asset number. It then determines the status items of the target asset, which include at least one of quantity status, authorization status, routing status, ownership status, or metadata status. Based on the target asset identifier and the status items, it generates an asset key corresponding to each status item. For each target user account, the node determines a corresponding reserved storage location in the reserved storage space of each target user account according to a preset addressing rule and the asset key. Based on the transaction request, the node determines the status change requirement of the target asset and processes the target asset status data in the reserved storage location based on the status change requirement. Finally, the node reads the target asset's status data before the change from the reserved storage location and writes the target asset's status data after the change into the reserved storage location.
[0006] In the above method, generating the asset key corresponding to the corresponding status item based on the target asset identifier and the status item includes: when the status item is a quantity status item or a routing status item, performing a hash operation by concatenating the base slot, the asset contract address, and the digital asset number to generate a quantity key or a routing key; when the status item is an authorization status item, first performing a first hash operation by concatenating the base slot, the asset contract address, and the digital asset number to obtain an intermediate key, and then performing a second hash operation by concatenating the intermediate key with the authorized party address to generate an authorization key.
[0007] In the above method, the node determines the reserved storage location based on the asset key according to a preset addressing rule, including: concatenating the version tag, the status field identifier and the asset key and performing a hash operation to generate an addressing result for determining the reserved storage location; wherein, the status field identifier includes at least one of the following: quantity status field, authorization status field, routing status field, ownership status field and metadata status field; different status items are mapped to different status fields respectively.
[0008] The above method also includes: storing business data generated during contract execution in the contract account.
[0009] In the ordinary storage space; the reserved storage space of the target user account is isolated from the ordinary storage space of the contract account, so that the contract's writing to the ordinary storage space does not directly change the digital asset state data in the reserved storage space of the target user account.
[0010] The above method also includes: recording the status changes of the reserved storage location corresponding to each target user account during the transaction execution process, and uniformly submitting the status changes corresponding to this transaction when the transaction is successfully executed, and uniformly rolling back the status changes corresponding to this transaction when the transaction fails.
[0011] In the above method, the transaction request is executed through a proxy execution path or a pre-compiled execution path.
[0012] For the same target asset, when the transaction request is executed via a proxy execution path or via a pre-compiled execution path, the nodes determine the reserved storage location according to the same preset addressing rules, and perform read and write operations on the reserved storage space of the target user account through the same internal state access mechanism.
[0013] In the above method, the transaction request corresponds to a proxy execution path or a pre-compiled execution path, including: querying whether the target proxy is marked as a malicious proxy; querying whether the target user account is configured for the target asset in a pre-compiled execution mode; when the target proxy is marked as a malicious proxy, and / or the target user account is configured for the target asset in a pre-compiled execution mode, the pre-compiled execution path is determined to be used; otherwise, the proxy execution path is determined to be used.
[0014] In the above method, the malicious labeling information of the target agent is stored in the target user account.
[0015] The metadata status field corresponding to the storage space is retained, and the malicious marking information cannot be deleted, cleared, or tampered with through the normal storage writing method of the contract.
[0016] In the above method, when the transaction request is executed via the pre-compiled execution path, The node parses the function selection information and calling parameters in the transaction request and executes the corresponding asset processing logic according to the preset asset standard semantics. When the transaction request is executed via the proxy execution path, the contract executes the contract business logic corresponding to the transaction request. The determination of the storage location of the target asset and the reading and writing of its status involved in the contract business logic are all executed by the node.
[0017] A second aspect of the present invention provides a digital asset state processing system in a blockchain, comprising: a processor; and a memory storing executable code thereon, wherein when the executable code is executed by the processor, the processor performs any of the methods described above.
[0018] Compared to related technologies that uniformly store the states of various digital assets in the storage space of a digital asset contract account, this invention obtains a target asset identifier containing the asset contract address and digital asset number through transaction request parsing. It then generates a unique corresponding asset key by matching multiple asset state items such as quantity, authorization, ownership, and metadata. Finally, through node-preset addressing rules, the asset state data is stored in the reserved storage space of the target user account, strengthening the consistency between the digital asset and the corresponding holder's account. Furthermore, compared to the shortcomings of existing technologies that uniformly and publicly store contracts, this invention relies on a dedicated storage mechanism combining asset keys, exclusive addressing rules, and reserved storage space in the user account. This reduces security risks such as contract storage overwriting, malicious tampering, and data corruption at the underlying storage architecture level, thereby improving the security of blockchain digital asset state storage.
[0019] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0020] The above and other objects, features and advantages of the present invention will become more apparent from the more detailed description of exemplary embodiments of the invention in conjunction with the accompanying drawings, wherein the same reference numerals generally represent the same parts.
[0021] Figure 1 This is a flowchart illustrating a method for handling the state of digital assets in a blockchain, as shown in an embodiment of the present invention. Figure 2 This is a schematic diagram of the asset key derivation calculation process shown in an embodiment of the present invention; Figure 3 This is a schematic diagram illustrating the principle of typed path dual namespace addressing in an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the state submission and state root calculation process in an embodiment of the present invention; Figure 5 This is another schematic diagram of the process for handling the state of digital assets in a blockchain, as illustrated in an embodiment of the present invention. Detailed Implementation
[0022] Embodiments of the invention will now be described in more detail with reference to the accompanying drawings. While embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that the invention will be more thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
[0023] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The singular forms “a,” “the,” and “the” used in this invention and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0024] It should be understood that although the terms "first," "second," "third," etc., may be used in this invention to describe various information, this information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this invention, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, features defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means two or more, unless otherwise explicitly specified.
[0025] The technical solutions of the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0026] This invention provides a method for handling the state of digital assets in a blockchain. Digital assets refer to digitized asset units registered in the blockchain system and capable of being held and controlled by an account. The state of a digital asset includes, but is not limited to, authorization status, routing configuration, individual ownership, metadata, and management tags.
[0027] Figure 1 This is a flowchart illustrating a method for handling the state of digital assets in a blockchain, as shown in an embodiment of the present invention.
[0028] See Figure 1 The method includes the following steps: Step S1: Receive a transaction request for the target asset, and determine at least one target asset based on the transaction request. User account.
[0029] The target user account refers to the account that initiates, receives, or is involved in changes to the current target asset's status.
[0030] In different implementations, it can be an external account (EOA) or another execution entity with account semantics. When a transaction request involves multiple account state changes, the target user account includes all the accounts involved; when the transaction request involves state changes such as authorization or routing configuration, the target user account only involves a single account.
[0031] In this embodiment, the node first receives a transaction request from the target user account for the target asset. This transaction request can be an asset operation request initiated by the user through a client, gateway service, or on-chain internal call mechanism. For example, it can be an authorization of digital assets, or a call related to asset management such as route switching, malicious tag configuration, or metadata update.
[0032] Step S2: Determine the target asset identifier based on the transaction request. The target asset identifier includes at least the asset contract address and the digital asset number.
[0033] When a node receives a transaction request, it first determines the target asset identifier from the request context. The target asset identifier includes at least the asset contract address and the digital asset number. The asset contract address uniquely identifies the contract entity or agent address to which the asset belongs, while the digital asset number distinguishes a specific entry within the asset category. For different scenarios, the digital asset number can take different preset values, such as 0 or token_id; for special state semantics, a reserved number range or special value encoding method can be used for unified expression.
[0034] Step S3: Determine the status items of the target asset based on the transaction request. The status items include at least one of the following: quantity status item, authorization status item, routing status item, ownership status item, or metadata status item. Generate the asset key corresponding to the corresponding status item based on the target asset identifier and the status item.
[0035] In this embodiment, the node identifies the status items involved in the current operation based on the transaction request. Different asset operations correspond to different status items. For example, authorization may involve authorization status items; switching execution paths may involve routing status items; malicious tags, feature sets, deployer information, names, symbols, etc., can be categorized into metadata status items. After identifying the status items, the node generates the asset key corresponding to the corresponding status item by combining it with the target asset identifier.
[0036] It should be noted that the asset key in this embodiment of the invention is not a contract storage slot in the ordinary sense, but rather an intermediate positioning parameter used to further derive the reserved storage location. The purpose of this design is to decouple the asset business semantics from the final underlying tree path in a layered manner, thereby unifying the state semantics, expanding the addressing rules, and providing a foundation for subsequent reserved storage isolation.
[0037] Step S4: For each target user account, the node, according to the preset addressing rules, determines the asset key...
[0038] The corresponding reserved storage location is determined within the reserved storage space of the target user account.
[0039] In this embodiment, after obtaining the asset key, the node determines the reserved storage location for each target user account according to the same preset addressing rules. Unlike existing technologies that directly use computable slots as SSTORE write locations, this embodiment inputs the asset key into the node's dedicated addressing logic to generate a reserved storage location within the target user account's reserved storage space. In other words, the digital asset state is no longer written to the digital asset contract account's ordinary storage, but rather to the reserved storage space under the target user account. Thus, the storage ownership of the digital asset shifts from being attached to the contract to being attached to the holder's account.
[0040] In practice, the preset addressing rule can be determined according to the actual situation, and this embodiment does not impose any limitations on it.
[0041] In this embodiment, when multiple accounts are involved, the asset key and the reserved storage path value used by each account can be the same. The node uses each account as the storage owner account and accesses the reserved storage path in the storage tree of its respective account.
[0042] Step S5: Determine the target asset's state change requirement based on the transaction request, and process the target asset's state data in the reserved storage location based on the state change requirement. Specifically, the node reads the target asset's state data before the change from the reserved storage location and writes the target asset's state data after the change into the reserved storage location.
[0043] In this embodiment, the node further determines the state change requirement of the target asset based on the transaction request. For example, in routing switching or malicious marking scenarios, this manifests as an update of the management state in the corresponding reserved storage location.
[0044] In this embodiment, the status changes of the reserved storage location corresponding to each target user account can also be recorded during the transaction execution process, and the status changes corresponding to this transaction can be submitted uniformly when the transaction is successfully executed, and the status changes corresponding to this transaction can be rolled back uniformly when the transaction fails.
[0045] When a node processes a state change, it first reads the target asset's state data before the change from the reserved storage location, then calculates the changed state data based on the state change requirements, and writes the changed state data back to the reserved storage location. In practice, this read and write process can be implemented through the node's internal state access mechanism, rather than through the ordinary SSTORE / SLOAD path that can be directly called by the user contract bytecode.
[0046] State change logging can be implemented using execution engine logs, change logs, checkpoint mechanisms, or other rollbackable change buffer structures. If a transaction is ultimately executed successfully, the state changes corresponding to this transaction are committed; if a transaction fails, is rolled back, or an internal call exception occurs, the state changes corresponding to this transaction are rolled back based on the recorded old values and access order, restoring the state in the reserved storage location to the state before the transaction began.
[0047] It should be noted that, in practice, when there are two or more target user accounts, a status change or rollback should be performed for each target user account.
[0048] In practice, the method in this embodiment can be run on the blockchain node side, or on the consortium blockchain execution node or other blockchain environments with account status management and transaction execution engines.
[0049] Compared to related technologies that uniformly store the states of various digital assets in the storage space of a digital asset contract account, this invention, through transaction request parsing, obtains a target asset identifier containing the asset contract address and digital asset number. It then matches multiple asset state items, such as authorization, ownership, and metadata, to generate a unique corresponding asset key. Finally, through node-preset addressing rules, the asset state data is stored in the reserved storage space of the target user account, strengthening the consistency between the digital asset and the corresponding holder's account. Furthermore, compared to the shortcomings of existing technologies that uniformly and publicly store contracts, this invention, relying on a dedicated storage mechanism combining asset keys, dedicated addressing rules, and reserved storage space in the user account, reduces security risks such as contract storage overwriting, malicious tampering, and data corruption at the underlying storage architecture level, thereby improving the security of blockchain digital asset state storage.
[0050] In some embodiments, generating an asset key corresponding to the corresponding status item based on the target asset identifier and the status item includes: When the status item is a quantity status item or a routing status item, the base slot, asset contract address and digital asset number are concatenated and then hashed to generate a quantity key or a routing key. When the status item is an authorized status item, the basic slot, asset contract address and digital asset number are concatenated and then subjected to the first hash operation to obtain the intermediate key. Then, the intermediate key is concatenated with the authorized party address and subjected to the second hash operation to generate the authorization key. The target asset identifier is an asset identifier consisting of the asset contract address and the digital asset number.
[0051] In this embodiment, nodes are pre-configured with multiple basic slots. These basic slots are not the actual storage locations for storing state data, but rather fixed starting point constants used to distinguish state semantic categories. For example, they could be quantity basic slots, authorization basic slots, and routing basic slots. Basic slots can be derived from a fixed string through hashing; for example, calculating keccak256 using the chain identifier string and the state category string yields a corresponding 32-byte constant.
[0052] When the status item is an asset quantity status item or a routing status item, the node concatenates the corresponding base slot, asset contract address, and asset number, and then performs a hash operation to generate a quantity key or routing key. This method ensures that for any given asset, the quantity status and routing status can be stably mapped to a unique asset key under the same asset identification system through their respective independent base slot starting points.
[0053] When the status item is an authorized status item, since the authorized status has two-level semantics of asset and authorized party, this embodiment of the invention adopts a two-level hash derivation. First, the authorization base slot, asset contract address, and digital asset number are concatenated and subjected to a first hash operation to obtain an intermediate key; then, this intermediate key is concatenated with the authorized party address and subjected to a second hash operation to generate the final authorization key. Through this two-level derivation structure, different authorized objects can be stably distinguished, avoiding status confusion between multiple authorized parties under the same asset.
[0054] In more specific implementations, embodiments of the present invention can also reuse the aforementioned derived functions through special values of digital asset numbers to uniformly express the semantics of different asset standards. For example, for the quantity of the first digital asset, the digital asset number can be 0; for the single ownership of the second digital asset, the digital asset number can be the token_id of the corresponding digital asset; for the holding count of the second digital asset, a reserved special value, such as U256::MAX, can be used; for the single authorization of the second digital asset, it can be expressed in conjunction with a zero address or a reserved number in the authorization semantics; for the operator authorization of the digital asset, it can also be uniformly expressed by combining a special number range or a special value with the authorized party. In this way, multiple semantics such as authorization, routing, counting, and ownership can be implemented in a smaller number of derived functions.
[0055] In one specific implementation, see Figure 2 The derivation of an asset key involves the following three steps: 1) Foundation trench calculation: Quantity base slot = keccak256("chainmaker.balance") Authorization base slot = keccak256("chainmaker.allowance") The basic routing slot is set to keccak256 ("chainmaker.routing").
[0056] In this embodiment, the basic slots are three fixed 32-byte constants, which serve only as the starting point for derived asset keys and are not the actual storage location for written data. The three are recorded as extended fields in the execution engine's account information structure, so that each account (including external accounts) has native asset storage capabilities from creation without the need to deploy contracts.
[0057] 2) Asset Key Derivation: Define the asset identifier AssetId = {asset contract address, digital asset number token_id}; Quantity key / routing key = keccak256(base slot || contract address || token_id); The authorization key is generated by concatenating the authorized party's address with the inner hash to perform a second-level keccak256 hash operation. This involves concatenating the intermediate key and the authorized party's address in a fixed byte order (e.g., intermediate key first, authorized party's address last), performing the second-level keccak256 hash operation, and generating the final authorization key. The authorization key generation uses a two-level hashing approach. Step 1: Middle key = keccak256 (Authorization base slot | Asset contract address | Token_id); Step 2: Authorization key = keccak256 (Middle key | Authorized party address).
[0058] The "‖" symbol indicates that bytes are concatenated in the order they are written, and the hash operation uses the keccak256 algorithm.
[0059] 3) Unified addressing of token_id special value: In order to enable all state variables of the three types of digital assets to reuse the same two derived functions, the high-order special value of token_id is used to distinguish the purpose, and the specific mapping is shown in the table below.
[0060]
[0061] The normal token_id range (with the highest bit being 0) and the special-purpose range (with the highest bit being 1) do not conflict. Through this rule, the ownership, counting, single authorization, and operator authorization semantics of the three types of digital assets share two asset key derived functions to achieve a unified expression; the proxy path and the pre-compiled path call the same set of derived functions, ensuring that the addressing of the two execution paths is completely consistent, and that routing switching does not cause data gaps.
[0062] This embodiment achieves a unified, deterministic, and scalable state addressing pre-abstraction by distinguishing between asset quantity / routing and authorization asset key derivation paths. For quantity and routing, a single-layer hash is sufficient to establish asset-level uniqueness; for authorization, due to the introduction of the authorization object dimension, a double-layer hash further ensures fine-grained differentiation between different authorization relationships. This embodiment not only improves the consistency and feasibility of address derivation but also provides support for using completely consistent addressing logic for the same asset under different execution paths.
[0063] In some embodiments, a node determines the reserved storage location based on an asset key according to a preset addressing rule, including: concatenating a version tag, a state field identifier, and an asset key and then performing a hash operation to generate an addressing result for determining the reserved storage location. Different state items are mapped to different state fields, and the state field identifier includes at least one of the following: quantity state field, authorization state field, routing state field, ownership state field, and metadata state field.
[0064] In this embodiment, the node does not directly use the asset key as a regular storage slot. Instead, it concatenates the version tag, state field identifier, and asset key, then performs a hash operation to generate an addressing result. This addressing result serves as an identifier for the reserved storage location or as a key value for locating that reserved storage location.
[0065] The version flag is used to identify the version of the current addressing rule. It can be a single-byte value, such as 0x01, or a multi-byte reservation tag. The significance of setting the version flag is twofold: firstly, it enables the current reserved storage addressing mechanism to evolve with version; secondly, it reserves different encoding space for other future system-level reserved subsystems, avoiding addressing conflicts.
[0066] State field identifiers are used to distinguish namespaces for different types of state items. In a preferred implementation, quantity state items are mapped to the quantity state field, authorization state items to the authorization state field, routing state items to the routing state field, ownership state items to the ownership state field, and malicious flags, feature sets, deployers, names, symbols, etc., are mapped to the metadata state field. Each state field identifier can be derived from a fixed string through hashing to form a stable 32-byte field value.
[0067] The combined addressing of version tag + status field identifier + asset key has two effects: First, even if the same asset key appears repeatedly in different status fields, it will be mapped to different reserved storage locations due to the different status fields, avoiding alias conflicts between fields; Second, unlike the ordinary SSTORE slot path which is hashed after a single 32-byte input, the reserved storage addressing input structure of this embodiment has different input components and semantic prefixes, thus forming a structural distinction from the ordinary storage path.
[0068] In practical implementation, the node memory structure or account runtime structure can maintain both ordinary storage mappings and reserved storage mappings in parallel. Ordinary storage mappings respond to the SLOAD / SSTORE statements in the contract bytecode; reserved storage mappings are only used by the node's internal state access interface. Ultimately, during the state root calculation phase, ordinary and reserved storage paths can be merged into a unified leaf set of the same account storage tree, thus maintaining overall compatibility without adding new state trees. Alternatively, a separate storage tree can be used for reserved storage paths.
[0069] In this embodiment, the derivation formula for the asset key is public, and any contract can calculate the same value. Therefore, this embodiment does not directly use the asset key as a regular slot in the account storage; otherwise, a malicious contract could also calculate this position and overwrite the asset data using the SSTORE instruction. This embodiment stores all asset data on a reserved storage path further mapped from the asset key. The reserved storage namespace carrying this path is structurally inaccessible to the SSTORE instruction, thus achieving write isolation within the same account storage tree.
[0070] In one specific implementation, see Figure 3 Account storage is divided into two namespaces and two tree-down paths. Normal SSTORE: Log records (address, slot32), leaf path = keccak256(slot32) when committing, hash input is 32 bytes. Reserved for writes: The hash input is 65 bytes. The log record (address, path32) enters the reserved storage namespace. When committing to the tree, path32 is directly used as the leaf path and no longer hashed twice.
[0071] The version tag is a default value (the attached diagram and implementation both use a single byte 0x01 as an example), domain32 is a 32-byte domain hash, and key32 is a 32-byte asset key. The two namespaces are carried in the account memory structure by two separate mappings, account.storage and account.reserved_storage, and are invisible to each other.
[0072] Security Principle (Secondary Preimage Isolation): An attacker wants to overwrite some reserved data using SSTORE. Even if they fully know its path32, when executing SSTORE(path32, forged value), the write operation is treated as a normal slot, and the tree path is keccak256(path32) ≠ path32. The attacker must find slot32 such that keccak256(slot32) = keccak256(0x01‖domain32‖key32). This is the secondary preimage problem of keccak256, which is difficult to attack. Even if there are N reserved entries on the chain (in a multi-target scenario), the probability of hitting any target is only [missing information]. At the same time, it retains the use of a full 256-bit hash space for storing internal keys, maintaining birthday security against internal collisions. The isolation mechanism does not weaken the isolation. In addition, the keccak256 sponge structure uses different filling and absorbing cycles for 32-byte and 65-byte inputs, so the two types of inputs cannot produce the same intermediate state, providing structural protection for isolation; the version tag 0x01 further reserves non-conflicting namespaces for other subsystems in the future (such as 0x02).
[0073] Domain isolation: The internal storage is divided into five domains based on data type. Each domain's domain32 is derived from a fixed string hash (e.g., keccak256("chainmaker.reserved.balance")). The quantity domain protects the quantity of each asset; the authorization domain protects authorization / approval; the routing domain protects asset routing configuration; the ownership domain protects individual ownership of secondary digital assets; and the metadata domain protects against malicious proxy markings, feature set bitmasks, deployers, names / symbols, etc. Different domains, even with the same key, map to different paths, avoiding internal alias conflicts. Future additions to system modules only require allocating new domains. Path calculation is encapsulated in a unified function: typed_path(domain, key) = keccak256(0x01‖domain hash‖key). All reserved reads and writes by the asset execution module are addressed through this function.
[0074] Attack Surface Coverage: This mechanism can comprehensively block 11 types of attack scenarios, including: A1. Forging asset quantities in the contract SSTORE; A2. Writing back asset status within the same transaction after a legitimate state change; A3. Pre-writing asset quantities in a new contract; A4. Writing EIP-7702 delegate code into the EOA (Externally-Owned Account) context; A5. Forging authorization; A6. Tampering with routing configuration; B1. Proxy clearing its own malicious marker; B2. Proxy self-privilege escalation function set; B3. Tampering with deployer records; B4. Illegally tampering with single ownership status; C1. Redeployment pre-writing using SELFDESTRUCT (contract self-destruct opcode) + CREATE2 (deterministic contract creation opcode). In all scenarios, the attacker's SSTORE falls within the ordinary namespace, while the reserved namespace still reads the real value (or zero), rendering the attack ineffective.
[0075] This embodiment further maps asset keys to reserved storage locations through version tags and state domain identifiers, forming a domain-segmentable, evolvable, and isolable addressing system. Different state items are mapped to different state domains, avoiding path overlap between different business semantics; the introduction of version tags enhances system upgrade and expansion capabilities. In addition, this addressing rule structurally distinguishes reserved storage from ordinary storage, not only isolating them spatially but also preventing reserved storage from being tampered with by ordinary storage.
[0076] In some embodiments, the state data of the target asset is stored in the reserved storage space of the target user account; business data generated during contract execution is stored in the ordinary storage space of the contract account; the reserved storage space of the target user account and the ordinary storage space of the contract account are isolated from each other, so that the contract's writing to the ordinary storage space does not directly change the digital asset state data in the reserved storage space of the target user account.
[0077] In this embodiment, the reserved storage space refers to a dedicated storage namespace reserved on the account side for the node's built-in asset state processing logic. This space is isolated from the ordinary storage space used by ordinary contract operations and is used to carry digital asset state data written by the node according to preset addressing rules.
[0078] In existing technologies, digital asset-related state data is often centrally stored in the ordinary storage space of the digital asset contract or proxy contract account, with the contract code responsible for reading and writing. This invention adjusts this model: the core state data of the target asset is stored in the reserved storage space of the target user account, while ordinary business data generated during contract execution remains stored in the ordinary storage space of the corresponding contract account. In other words, asset state and contract business data are processed separately at both the account ownership and namespace levels.
[0079] For example, information such as the quantity of a digital asset, its authorized limit, and the user's routing configuration for that asset can be stored in the reserved storage space of user account A; while the digital asset contract's own ordinary business variables, temporary configurations, and other business logic-related storage data remain in the ordinary storage space of the digital asset contract account. As another example, the holding status and authorization status of a digital asset can be expressed by the reserved storage space under the current holder or related user account, while the digital asset contract's own business control data remains on the contract's ordinary storage side.
[0080] The mutual isolation in this embodiment is not only a logical conceptual distinction, but also a distinction in node execution semantics and internal access paths. The contract writes to the ordinary storage space of the account corresponding to the current execution context via SSTORE, and cannot directly locate and rewrite the reserved storage space of the target user account. Even if an attacker knows the addressing logic of a certain asset state, they can only write to the ordinary storage space through the ordinary storage write path, and cannot directly change the actual state of the asset in the reserved storage space through contract writes.
[0081] This embodiment achieves separation of account ownership and namespace isolation between asset status and contract data storage by storing the target asset status in the reserved storage space of the target user account and storing contract business data in the ordinary storage space of the contract account. This ensures that even if the contract logic is upgradable, replaceable, or even maliciously exploited, its writes to the ordinary storage space cannot directly affect the asset status in the reserved storage of the target user account, thereby improving the asset status's ability to withstand contract-side risks.
[0082] In some embodiments, the node reads and writes state data to the reserved storage location, including: the node loading the target user account state when executing a transaction request; and the node accessing the reserved storage space of the target user account according to the reserved storage location to read the target asset state data before the update and write the updated target asset state data.
[0083] In one embodiment, when a node begins processing a transaction request, it first loads the target user account state associated with the current transaction. This account state includes traditional account information such as account random number, account asset quantity, contract code hash, and ordinary storage root hash. During execution, it can also extend this state with runtime fields related to reserved storage, such as reserved storage cache, reserved storage preheating flags, and basic slot constant references.
[0084] After loading the account state, the node accesses the reserved storage space of the target user account based on the aforementioned reserved storage location. This access process can be implemented through an internal state access interface. For example, the node can provide dedicated access functions such as `reserved_sload` (reserved storage read function) and `reserved_sstore` (reserved storage write function) to read old values from the reserved storage and write new values, respectively. This access interface can also be combined with internal abstractions such as `touch_account` (touch account) and `load_account` (load account) to complete account loading, cold / hot state maintenance, logging, and commit / rollback within the same execution framework.
[0085] In practice, the read process can involve multiple layers of fallback. Nodes first read the latest value of the target storage location from the execution log cache that has not yet been committed for this transaction; if a miss occurs, they can read from the cross-transaction cache within the block; if still a miss occurs, they query from the underlying state database or historical state provider. During write operations, the node first writes to the log or memory cache corresponding to the current execution context, recording the old value. This old value is then committed uniformly upon successful transaction completion; otherwise, it is restored to its original value.
[0086] Regarding Gas semantics and execution consistency, embodiments of the present invention are also compatible with existing hot and cold access semantics. For example, reserved storage access can maintain a hot and cold set according to the dimension of "account address + namespace + key", so that even if ordinary storage slots and reserved storage paths have the same value, they are billed and managed as two different access objects.
[0087] This embodiment specifically implements reserved storage access as the loading of the target user account state by the node during the execution phase and reading and writing according to the reserved storage location. This achieves a complete state access mechanism that is executable, rollbackable, and cacheable, avoiding security risks such as malicious overwriting, state tampering, and pre-falsification of asset states caused by contract storage. It restricts the reading and writing of digital asset states to the reserved storage space dedicated to the holder's account, improving the isolation and security of the asset state access process.
[0088] In some embodiments, a transaction request corresponds to a proxy execution path or a pre-compiled execution path. For the same target asset, regardless of whether the transaction request is executed via a proxy execution path or a pre-compiled execution path, the node generates an asset key based on the same target asset identifier and determines the reserved storage location according to the same preset addressing rules. It also performs read and write operations on the reserved storage space of the target user account through the same internal state access mechanism.
[0089] Furthermore, the node determines whether the transaction request should use a proxy execution path or a pre-compiled execution path, including: checking whether the target proxy is marked as a malicious proxy; checking whether the target user account is configured for pre-compiled execution for the target asset; when the target proxy is marked as a malicious proxy and / or the target user account is configured for pre-compiled execution for the target asset, the node determines to use the pre-compiled execution path; otherwise, the node determines to use the proxy execution path.
[0090] See Figure 5 This invention provides two interchangeable execution implementations for the same digital asset: one is a proxy contract deployed on the chain, offering flexible business logic but at the risk of malicious replacement; the other is a pre-compiled implementation built into the node program, providing standard functions such as authorization. Its code is compiled within the node software, making on-chain transactions tamper-proof. The routing decision engine is a new judgment step added to the node when executing each asset operation call. The engine first checks if the target proxy has been marked as malicious: if not, it proceeds normally, and the call is still forwarded by the proxy contract to the logic contract for execution; if it has been marked, and the user has actively upgraded their routing configuration for that asset to pre-compiled, the engine intercepts the call and delegates it to the node's built-in pre-compiled implementation. The returned result format is completely consistent with the contract execution, requiring no modification from the upper-layer application. Regardless of the path taken, asset data is read and written to the same native account storage in the above manner and submitted uniformly through the execution engine logs, supporting rollback in case of transaction failure. Therefore, the asset quantity, authorization, and other data queried by the user before and after the path switch are completely consistent.
[0091] In practice, an asset operation may be executed either along the on-chain proxy / logic contract path or, under certain conditions, by the node's built-in pre-compiled path. Regardless of which path the transaction request ultimately takes, the node's addressing and state reading / writing methods for the target asset state remain consistent. That is, for the same target asset, nodes generate asset keys based on the same target asset identifier, determine the reserved storage location according to the same preset addressing rules, and perform read and write operations on the target user account's reserved storage space through the same internal state access mechanism. This ensures that there is no state disconnect between the proxy path and the pre-compiled path, and that inconsistencies in authorization, routing, or metadata reading will not occur due to path switching.
[0092] The malicious proxy flag can be triggered by system administrators, governance modules, preset security monitoring processes, or manual review results. Once the logic implementation corresponding to a proxy contract is identified as malicious, abnormal, attacked and replaced, or clearly no longer trustworthy, the administrator can set a malicious flag for that proxy.
[0093] In one embodiment, upon receiving a transaction request, the node does not immediately follow the fixed proxy execution path, but instead executes routing decision logic first. This decision logic involves at least two factors: first, whether the target proxy is marked as a malicious proxy; and second, whether the target user account is configured for pre-compiled execution mode for the target asset.
[0094] For example, a user might normally allow calls to digital assets through a proxy contract, which would then be routed to the proxy execution path. However, if the proxy is subsequently deemed high-risk and the user enables pre-compiled execution, the same call semantics can be handled by the pre-compiled execution path. Since both paths use identical asset identifiers and asset key derivations, the number of assets and authorization status observed by the user before and after the switch are consistent, avoiding migration, mirror synchronization, or dual-write consistency issues.
[0095] This embodiment provides an operable path selection mechanism for dual-path execution. By introducing two triggering conditions—malicious proxy marking and user execution mode configuration—the system no longer passively relies on a single contract path but can quickly switch to a more trusted execution implementation when risks are exposed, thereby improving its ability to respond to risks such as proxy tampering and logic replacement. Furthermore, pre-compiled contracts: contracts compiled within the node program and executed in the host language's native code, without going through the EVM bytecode interpreter, and their logic cannot be tampered with by on-chain transactions.
[0096] Furthermore, the malicious labeling information of the target agent is stored in the metadata state field corresponding to the reserved storage space of the target user account, and the malicious labeling information cannot be deleted, cleared or tampered with through the normal storage writing method of the contract.
[0097] In this embodiment, the malicious labeling information of the target agent is stored in the metadata state field of the target user account's reserved storage space. The reason for choosing the metadata state field is that malicious labeling is essentially asset operation management information rather than direct business status such as authorization or ownership. By including it in the metadata state field, it can be managed in a unified manner with other management attributes, such as feature set bitmasks, deployer information, names, symbols, etc.
[0098] More importantly, this malicious tagging information resides in reserved storage space, not in the regular contract storage space. Therefore, neither the proxy contract itself nor any code executing within a regular contract context can delete, clear, or tamper with this malicious tagging information through normal storage writes. Even if the proxy logic is malicious, it cannot remove the malicious tag by modifying regular storage variables itself, thus preventing attackers from gaining reverse control over the system's routing decisions.
[0099] In a more specific implementation, the administrator's action of setting a malicious flag can be triggered by a dedicated management interface, governance interface, or a node's built-in management function. This write process directly calls the node's reserved storage write path, landing in the corresponding reserved storage location according to the addressing rules of the metadata state field. Afterwards, any rewriting in the ordinary SSTORE sense is not directly equivalent to writing to this reserved location.
[0100] This embodiment stores malicious tagging information in the metadata state field of the target user account's reserved storage space, making it impossible for it to be tampered with by ordinary contract storage writing methods. This means that once the system identifies a certain agent as having malicious risks, its malicious tag will not be easily cleared by the agent itself, thereby ensuring the security of the storage location of the malicious agent tagging information.
[0101] In the above embodiments, when a transaction request is executed via a pre-compiled execution path, the node parses the function selection information and calling parameters in the transaction request and executes the corresponding asset processing logic according to the preset asset standard semantics; when a transaction request is executed via a proxy execution path, the node executes the contract business logic corresponding to the transaction request; wherein, regardless of the execution path used, the target asset status read and write involved in the asset processing logic are directed to the reserved storage space of the target user account, rather than the ordinary storage space of the contract account.
[0102] When a transaction request is executed via the pre-compiled execution path, the node parses the function selection information and call parameters from the call data. The function selection information can be a 4-byte function selector in ABI encoding, and the call parameters are the set of parameters corresponding to the function. The node then executes the relevant asset processing logic according to the preset asset standard semantics.
[0103] During pre-compiled execution, all asset processing logic is handled by the node's built-in native code, without relying on on-chain contract bytecode interpretation, thus enhancing execution reliability. Meanwhile, state reads and writes are still directed to the target user's reserved storage space through an internal state access mechanism.
[0104] When a transaction request is executed via the proxy execution path, the node executes the contract business logic corresponding to that request. Executing the contract business logic here does not mean reverting to the old model where all states are written to the contract's ordinary storage. Instead, this embodiment of the invention requires that even under the proxy execution path, state reads and writes involving asset processing logic should be directed to the target user account's reserved storage space, rather than the contract account's ordinary storage space. In other words, the proxy path only retains the contract execution method at the level of business orchestration, functional flexibility, or interface compatibility, but the underlying asset state storage location is still uniformly controlled by the node.
[0105] In one implementation, contracts in the proxy execution path can access reserved storage through node-extended Host interfaces, dedicated system calls, internal pre-compiled bridge interfaces, or other controlled mechanisms, but cannot directly write these asset states through a regular SSTORE.
[0106] In this embodiment, the pre-compilation is stateful. Specifically, the EVM abstraction layer exposes four types of internal state interfaces to the pre-compilation: account loading (including basic slot reading), account modification marking, reserved reading, and reserved writing. The pre-compilation reads, writes, and stores data through this abstraction layer; all changes are entered into the execution engine log, sharing the same commit path as ordinary contract execution, ensuring transaction atomicity. At a fixed pre-compilation address, complete standard interfaces (authorization, query, batch operations, metadata) and management interfaces (malicious proxy marking, feature set registration / update, route forced upgrade / reset / query) are implemented using native node code. The entry function extracts a 4-byte function selector from calldata for distribution; parameter and return value encoding strictly adheres to the Solidity ABI, allowing upper-layer contracts to directly call via standard interfaces without any adaptation.
[0107] In one specific implementation, the same asset simultaneously possesses both a proxy contract path and a pre-compiled path. Upon detecting malicious proxy behavior, the administrator calls `markProxyMalicious` to set a malicious flag in the reserved storage metadata field. The user proactively calls `forceAssetUpgrade` to switch their routing configuration for that asset to pre-compiled mode (recorded in the routing field). Subsequently, the routing decision engine intercepts asset operations via this proxy during the CALL processing flow, constructs input containing calldata and caller information, and forwards it to the corresponding pre-compiled execution. The return format is completely consistent with contract execution, requiring no modification from the upper layer. The marking and switching are executed in two steps by different entities, with the user retaining the final decision-making power. In fallback mode, the function bitmask automatically downgrades to a basic function set containing only basic state operations and queries (the principle of least privilege). Because the malicious flag, function set, deployer, and routing configuration are all stored in reserved storage, the proxy contract cannot tamper with this management data using `SSTORE` (blocking B1 / B2 / B3 / A6 attacks), ensuring the reliability of the fallback mechanism itself. The engine independently checks different digital assets, allowing the same proxy to have independent security states across different digital asset types.
[0108] In one specific implementation, the state submission and state root calculation process is as follows: Figure 4 As shown.
[0109] This embodiment employs a dual-storage field account model. The execution engine account structure adds a reserved storage mapping (with a 32-byte path key) alongside the original ordinary storage mapping. The two mappings are not visible to each other in the memory structure; the original storage key type definition and all existing usage are unaffected.
[0110] Logs and Rollback. Two new variants have been added to the log entries: Reservation Storage Change entries (recording the path, old value, and account address for restoring the old value during rollback) and Reservation Storage Warm-up entries (marking the first access as cold → hot). When a transaction fails or an internal revert call occurs, reservation storage and regular storage are rolled back synchronously in a Last-In-First-Out (LIFO) manner. Cold / hot access sets are distinguished by (address, namespace, key), and regular slots and reservation paths have independent cold / hot status and Gas billing even if their values are the same (compatible with EIP-2929 semantics).
[0111] Cross-transaction readback within the same block. Data written by transaction 1 within the same block must be readable by transaction 2. A new reserved storage cache field has been added to the account cache of the state cache layer; a new reserved storage query method has been added to the database abstract interface, which will fall back to the underlying database when the cache is not hit. Readback priority: This transaction's log cache → Cross-transaction cache within the same block → Underlying database.
[0112] Block-level aggregation and persistence. For example... Figure 4 As shown, after block execution is complete, each level of the structure carries the retained storage changes in parallel; in particular, accounts that only have retained storage changes (account information and ordinary storage remain unchanged) are also forcibly included in the summary to prevent write loss. Persistent reuse of existing hash storage tables: the path itself is retained as a subkey of this table, and writing to disk does not require creating a new table or changing the protocol.
[0113] State root merging calculation. Before calculating the storage root, two types of entries are merged: ordinary storage entries are converted into leaf paths using keccak256(slot) (existing behavior remains unchanged); the paths of retained entries are already leaf paths and are used directly. Both are chained and fed into the same Merkle tree, producing the same storageRoot. The subsequent account tree and global state root calculation logic remain completely unchanged. The parallel state root calculation task (sparse tree + multiple proof acceleration) also incorporates retained changes to ensure that the parallel results are consistent with sequential execution.
[0114] Multi-layered state readback chain. The complete chain for pre-compiled blocks to read historically retained data in new blocks is as follows: log cache → block execution state cache → state provider database bridge → memory overlay layer (non-persistent blocks) → latest / historical state provider (reading the hash storage table, path is directly used as a subkey for lookup). The payload builder's read cache layer also forwards retained queries to ensure that miners read consistent data and gas usage during block construction and validator replay.
[0115] Synchronization is compatible with and does not modify the list. Entries are retained as ordinary leaf nodes in the storage tree. Snapshot synchronization downloads the data exactly as per the original protocol and verifies the Merkel proof along the same tree, requiring no protocol modifications. The SSTORE / SLOAD opcode processor, Host interface, storage key type definition, account structure serialization encoding, storage root / state root calculation logic, and snapshot synchronization protocol all remain unchanged; isolation is purely structural.
[0116] The method in the embodiments of the present invention was tested as follows: This embodiment is fully implemented based on an open-source execution layer client and the EVM execution engine, and integrated as a chain-level infrastructure into the Chang'an Chain EVM-compatible execution layer. Unit tests cover log writing-readback-rollback-commit, cross-transaction readback within the same block and anti-aliasing (read retention returns 0 when ordinary keys have the same value), domain isolation and anti-aliasing (different paths for the same key in different domains, the retained path is not equal to the slot hash). System-level testing, consisting of 9 test suites and 144 test cases, all passed, covering functional bitmasks, access control, rollback mechanisms, events, batch operations, and boundary conditions for three digital asset standards. In terms of security, an attacker overwriting retained data via SSTORE must solve the keccak256 quadratic preimage, with a difficulty of [insert difficulty here]. Preserve internal birthday security. In terms of performance, the normal path only adds one malicious mark read (cold slot about 2100 gas), the fallback path adds two reads about 4200 gas, and asset read and write itself has no additional gas overhead.
[0117] This invention also provides a digital asset state processing system in a blockchain, comprising: a processor; And a memory on which executable code is stored, which, when executed by the processor, causes the processor to perform any of the methods described above.
[0118] In practical implementation, the processor can be configured with: an account extension module: which stores account information in the execution engine.
[0119] The system maintains three basic slot fields: quantity, authorization, and routing. It also maintains ordinary storage mappings and reserved storage mappings in parallel within the account structure. The slot derivation module provides pure functions for basic slot calculation, quantity / authorization / routing key derivation, and unified addressing of the token_id special value. The typed path module provides typed_path(domain, key) calculation and five-domain management. The asset execution module includes state pre-compilation and its selector distribution, ABI encoding / decoding, and event publishing units. The internal state access module (EvmInternals) provides the asset execution module with interfaces for load_account, touch_account, reserved_sload, and reserved_sstore. The routing decision engine embeds a CALL instruction processing flow, switches between proxy paths and pre-compiled paths based on malicious flags and user routing configurations, and performs function bitmask permission downgrading. The logging and rollback module records reserved storage... The system includes: a storage change / preheating module that supports checkpoint commits and reverse rollbacks, maintaining independent cold and hot states in dual namespaces; a caching and aggregation module that preserves storage cache across transactions within the same block and a block-level transfer / aggregation account pipeline (including allowing only change accounts to pass); a state root merging and persistence module that merges the keccak256 (slot) path and the reserved path into the same storage tree to calculate the storage root, stores the hash table on disk, and supports parallel state root calculation; and a multi-layer state readback module that connects the log cache, block cache, memory overlay layer, latest / historical state provider, and block producer read cache's preserved storage query chain.
[0120] In this embodiment, two namespaces, ordinary storage and reserved storage, are set up within the same account storage tree; the ordinary SSTORE write path is keccak256(slot32) (32-byte input), and the system reserved write path is... (tag is a preset version label, example uses 0x01; 65 bytes input) directly used as leaf path without secondary hashing; intersection of two types of paths is equivalent to solving the keccak256 quadratic preimage ( This achieves structured write isolation without modifying the SSTORE opcode semantics, adding account fields, adding a new state tree, or incurring additional gas overhead.
[0121] Digital asset states (such as routing, ownership, and metadata) are stored in the storage tree of the holder's own account. The asset key is derived from the three basic slots (derived from the fixed string keccak256) extended from the account information, plus the hash of "basic slot || asset contract address || token_id", which serves as the input for typed path calculation to complete unified addressing. The two derived functions are reused with the special value of token_id (0 / U256::MAX / U256::MAX-1 / U256::MAX-2 / spender=zero address) to uniformly express the semantics of digital asset ownership, counting, single token authorization, and operator authorization.
[0122] Authorization, routing, ownership, and metadata are each identified by a fixed string hash. Different domains with the same key are mapped to different paths, and a complete 256-bit hash space is maintained within each domain (birthday security). Version tags reserve non-conflicting coding space for future subsystems.
[0123] The internal state access abstraction layer (load_account / touch_account / reserved_sload / reserved_sstore) enables the node's built-in pre-compiled state read and write capabilities. It fully implements three digital asset standards and management interfaces with native code, and the coding strictly follows the Solidity ABI. State changes are logged by the execution engine and share the same commit / rollback path with ordinary contracts.
[0124] Dual-storage field account model; log addition of retained change / preheat entries and symmetric rollback; independent cold and hot billing for dual namespaces; cross-transaction cache readback within the same block; block-level summary pipeline carrying retained changes and allowing "accounts with only retained changes" to proceed; merging ordinary key hash paths and retained paths into the same storage tree to calculate the storage root (including parallel state root consistency); reused hash storage table persistence (path is the subkey); multi-layer readback link connecting block production and verification; snapshot synchronization with zero protocol changes.
[0125] Malicious proxy markers, feature set bitmasks, deployer and user routing configurations are all stored in reserved storage, and the proxy contract cannot tamper with its own management data in SSTORE; the routing engine transparently switches asset operations to the pre-compiled path according to the markers and configurations in the CALL processing flow, and automatically performs feature degradation.
[0126] For more specific implementation methods of this system embodiment, please refer to the above method embodiment; this embodiment will not be repeated here.
[0127] The embodiments of the present invention have the following beneficial effects: First, this embodiment of the invention migrates the asset state from the storage tree of the digital asset contract back to the storage tree of the holder's own account, and entrusts the core operations to the native execution module built into the node. Since the pre-compiled code is compiled into the node program and cannot be replaced by any on-chain transaction, even if the proxy logic is maliciously tampered with, the user can still securely operate the asset using the pre-compiled path via route rollback; furthermore, since malicious marking and routing configuration are stored in reserved storage, attackers cannot use SSTORE to remove the marking or tamper with the route, ensuring a complete protection loop. Compared to pre-audit and off-chain monitoring, this embodiment of the invention provides runtime protection that takes effect the moment an attack occurs.
[0128] Secondly, this embodiment of the invention does not modify the semantics of the SSTORE / SLOAD opcodes, nor does it generate hash space truncation or a tracking structure that grows by account; it does not centralize data to the system address, maintaining the original ownership of asset accounts and avoiding the expansion of a single-address storage tree and approximately 10% dual-write gas overhead; it does not add a second state tree, and the state root calculation and consensus layer remain completely unchanged; it does not extend the storage key length, and requires no new opcodes or adaptation to the entire toolchain. Simultaneously, the account structure serialization remains unchanged, the synchronization protocol remains unchanged, and asset read / write operations incur zero additional gas. The engineering implementation cost is a symmetrical expansion alongside the existing storage pipeline. Testing showed that 100% of the 144 test cases passed.
[0129] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, nor are they limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or improvement of the technology in the market, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A method for processing the state of digital assets in a blockchain, characterized in that, include: Receive a transaction request for a target asset, and determine at least one target asset based on the transaction request. Account; The target asset identifier is determined based on the transaction request. The target asset identifier includes at least the asset... Contract address and digital asset number; The status item of the target asset is determined based on the transaction request, and the status item includes the asset quantity. At least one of the following: status item, authorization status item, routing status item, ownership status item, or metadata status item. The target asset identifier and the status item are used to generate an asset key corresponding to the corresponding status item; For each target user account, the node, according to a preset addressing rule, determines the asset key based on... A corresponding reserved storage location is determined in the reserved storage space of each target user account; The state change requirement of the target asset is determined according to the transaction request, and the state data of the target asset in the reserved storage location is processed based on the state change requirement; The node reads the state data of the target asset before the change from the reserved storage location, and writes the state data of the target asset after the change into the reserved storage location.
2. The method according to claim 1, characterized in that, The step of generating the asset key corresponding to the corresponding status item based on the target asset identifier and the status item includes: When the status item is an asset quantity status item or a routing status item, the basic slot, the asset contract address and the digital asset number are concatenated and then hashed to generate a quantity key or a routing key. When the status item is an authorized status item, the basic slot, the asset contract address and the digital asset number are concatenated and then subjected to a first hash operation to obtain an intermediate key. Then, the intermediate key is concatenated with the authorized party address and subjected to a second hash operation to generate an authorization key.
3. The method according to claim 1 or 2, characterized in that, The node determines the reserved storage location based on the asset key according to a preset addressing rule, including: The version tag, status field identifier, and asset key are concatenated and then hashed to generate an addressing result for determining the reserved storage location; The state domain identifier includes at least one of the following: quantity state domain, authorization state domain, routing state domain, ownership state domain, and metadata state domain; different state items are mapped to different state domains.
4. The method according to claim 1, characterized in that, Also includes: Business data generated during contract execution is stored in the contract account's regular storage space; The reserved storage space for the target user account is isolated from the regular storage space for the contract account, so as to ensure that the contract account is in a safe and secure environment. Writes to ordinary storage space do not directly change the state data of digital assets in the target user account's retained storage space.
5. The method according to claim 1, characterized in that, Also includes: During the transaction execution process, the status changes of the reserved storage location corresponding to each target user account are recorded, and the status changes corresponding to this transaction are uniformly submitted when the transaction is successfully executed, and the status changes corresponding to this transaction are uniformly rolled back when the transaction fails.
6. The method according to any one of claims 1 to 5, characterized in that, The transaction request is executed via a proxy execution path or a pre-compiled execution path; For the same target asset, when the transaction request is executed via a proxy execution path, or When executed via the pre-compiled execution path, all nodes determine the reserved storage location according to the same preset addressing rules, and perform read and write operations on the reserved storage space of the target user account through the same internal state access mechanism.
7. The method according to claim 6, characterized in that, The transaction request corresponds to a proxy execution path or pre-compiled execution path, including: Check if the target proxy has been marked as a malicious proxy; Check whether the target user account is configured for pre-compiled execution mode for the target asset; When the target proxy is marked as a malicious proxy, and / or the target user account is configured for pre-compiled execution mode for the target asset, the pre-compiled execution path is determined to be used; otherwise, the proxy execution path is determined to be used.
8. The method according to claim 7, characterized in that, The malicious labeling information of the target agent is stored in the reserved storage space of the target user account. The malicious marking information cannot be deleted, cleared, or tampered with in the corresponding metadata status field through the contract's normal storage writing method.
9. The method according to claim 6, characterized in that, In response to the transaction request being executed via the pre-compiled execution path, the node parses the data. The transaction request contains function selection information and calling parameters, and executes the corresponding asset processing logic according to the preset asset standard semantics; When the transaction request is executed via the proxy execution path, the contract executes the contract business logic corresponding to the transaction request. The determination of the storage location of the target asset and the reading and writing of its status involved in the contract business logic are all executed by the node.
10. A digital asset state processing system in a blockchain, characterized in that, include: processor; as well as A memory having executable code stored thereon, which, when executed by the processor, causes the processor to perform the method as described in any one of claims 1-9.
