CN117544631A - Block chain-based data processing method and device and readable storage medium - Google Patents

Block chain-based data processing method and device and readable storage medium Download PDF

Info

Publication number
CN117544631A
CN117544631A CN202311499636.0A CN202311499636A CN117544631A CN 117544631 A CN117544631 A CN 117544631A CN 202311499636 A CN202311499636 A CN 202311499636A CN 117544631 A CN117544631 A CN 117544631A
Authority
CN
China
Prior art keywords
resource
processing function
function
initiator
callable
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311499636.0A
Other languages
Chinese (zh)
Inventor
廖志勇
王宗友
时一防
朱耿良
刘区城
刘汉卿
黄杨峻
聂凯轩
梁军
蔡庆普
吴方
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311499636.0A priority Critical patent/CN117544631A/en
Publication of CN117544631A publication Critical patent/CN117544631A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1059Inter-group management mechanisms, e.g. splitting, merging or interconnection of groups
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • H04L67/1078Resource delivery mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Abstract

The embodiment of the invention discloses a data processing method and device based on a blockchain and a readable storage medium, wherein the data processing method comprises the following steps: the block chain link point obtains a resource processing request sent by an initiator; the resource processing request comprises resource data, a resource processing function identifier in a trusted agent contract and a business contract address; invoking a resource handling function indicated by the resource handling function identification in the trusted agent contract based on the resource handling request; the resource processing function is used for processing the resource data through the receiver parameters added into the resource processing function; the receiver parameter is a business contract address; calling a callable processing function in the service contract indicated by the service contract address through the resource processing function, and executing a service task associated with the resource data through the callable processing function in the service contract; the callable processing function has a binding association relationship with the resource processing function.

Description

Block chain-based data processing method and device and readable storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data processing method and apparatus based on blockchain, and a readable storage medium.
Background
The blockchain platform provides a trusted environment with multiparty maintenance and data non-falsification, and can realize resource transaction among service nodes through intelligent contracts of the blockchain.
The current blockchain network cannot execute other logic codes after performing operations such as transfer or authorization, only one operation can be completed, and if other operations are executed, a transaction must be reinitiated. And each time a transaction is initiated, resources are consumed, so that after transfer or authorization operation, other operations are further executed, which inevitably results in two times of consumed resources, and the cost of interaction with the blockchain network is increased.
Disclosure of Invention
The embodiment of the application provides a data processing method and device based on a blockchain and a readable storage medium, which can reduce the cost of interaction with a blockchain network.
An aspect of an embodiment of the present application provides a data processing method based on a blockchain, including:
the block chain link point obtains a resource processing request sent by an initiator; the resource processing request comprises resource data, a resource processing function identifier in a trusted agent contract and a business contract address;
invoking a resource handling function indicated by the resource handling function identification in the trusted agent contract based on the resource handling request; the resource processing function is used for processing the resource data through the receiver parameters added into the resource processing function; the receiver parameter is a business contract address;
Calling a callable processing function in the service contract indicated by the service contract address through the resource processing function, and executing a service task associated with the resource data through the callable processing function in the service contract; the callable processing function has a binding association relationship with the resource processing function.
An aspect of an embodiment of the present application provides a data processing apparatus based on a blockchain, including:
the first acquisition module is used for acquiring a resource processing request sent by an initiator through the block link point; the resource processing request comprises resource data, a resource processing function identifier in a trusted agent contract and a business contract address;
a first calling module, configured to call a resource processing function indicated by a resource processing function identifier in the trusted agent contract based on the resource processing request; the resource processing function is used for processing the resource data through the receiver parameters added into the resource processing function; the receiver parameter is a business contract address;
the second calling module is used for calling the callable processing function in the business contract indicated by the business contract address through the resource processing function and executing the business task related to the resource data through the callable processing function in the business contract; the callable processing function has a binding association relationship with the resource processing function.
Wherein, the data processing device still includes:
the first transfer module is used for acquiring a signature initiator corresponding to the resource processing request through the first resource transfer function if the resource processing function is the first resource transfer function, and transferring the resource data in the signature initiator to a service contract indicated by the service contract address; the signature initiator refers to an initiator for carrying out digital signature on the resource processing request;
the second calling module is specifically used for calling a callable processing function with a binding association relation in the service contract through the first resource transfer function, determining N digital resource identifiers matched with the transferred resource data through the callable processing function in the service contract, and transferring the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
Wherein, the data processing device still includes:
the second transfer module is used for acquiring a designated initiator of the second resource transfer function if the resource processing function is the second resource transfer function, and transferring the resource data in the designated initiator to the service contract indicated by the service contract address through the second resource transfer function; designating the initiator as the same or different from the initiator;
The second calling module is specifically configured to call a callable processing function with a binding association relationship in the service contract through a second resource transfer function, determine N digital resource identifiers matched with the transferred resource data through the callable processing function in the service contract, and transfer the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
Wherein, the data processing device still includes:
the authorization module is used for authorizing the resource data to the trusted agent contract through the resource authorization function if the resource processing function is the resource authorization function;
the second calling module is specifically configured to call the callable processing function with the binding association relationship in the service contract through the resource authorization function, and execute the service task matched with the authorized resource data through the callable processing function in the service contract.
Wherein, the second calling module includes:
a calling unit for calling the callable processing function in the service contract indicated by the service contract address through the resource processing function;
and the execution unit is used for inputting the execution parameters into the callable processing function and executing the business tasks associated with the execution parameters and the resource data through the callable processing function.
Wherein, the data processing device still includes:
the receiving module is used for receiving the resource detection request sent by the initiator; the resource detection request comprises a business contract address and a verification function identifier;
the third calling module is used for calling the verification function in the trusted agent contract according to the verification function identification;
the first verification module is used for verifying whether the business contracts indicated by the business contract addresses support the callable processing functions according to the verification functions;
the first sending module is used for sending the supportable message to the initiator if the service contract supports the callable processing function; the supportable message is used for indicating that the initiator has the authority of sending a resource processing request capable of calling the callable processing function;
the second sending module is used for sending the unsupported message to the initiator if the service contract does not support the callable processing function; the unsupported message is used to indicate that the initiator does not have the right to send a resource processing request that can invoke the callable processing function.
Wherein, the data processing device still includes:
the second acquisition module is used for acquiring a callable processing function with a binding association relation with the resource processing function;
the second verification module is used for verifying whether the business contracts indicated by the business contract addresses support callable processing functions or not;
And the first return module is used for returning error reporting information aiming at the resource processing request if the business contract does not support the callable processing function.
Wherein, the data processing device still includes:
a third acquisition module, configured to acquire an initiator signature from the resource processing request;
the signature verification module is used for verifying the signature of the initiator;
the execution module is used for notifying the first calling module to execute the resource processing function indicated by the resource processing function identification in the trusted agent contract based on the resource processing request if the signature verification of the initiator is successful;
and the second return module is used for returning error reporting information aiming at the resource processing request if signature verification of the initiator fails.
Wherein, the signature verification module includes:
the decryption unit is used for performing decryption operation on the signature of the initiator based on the public key of the initiator to obtain a hash value to be verified;
a generating unit, configured to generate a target hash value of the resource processing request;
the first determining unit is used for determining that the signature verification is successful if the hash value to be verified is the same as the target hash value;
and the second determining unit is used for determining that the signature verification fails if the hash value to be verified is different from the target hash value.
In one aspect, a computer device is provided, including: a processor, a memory, a network interface;
the processor is connected to the memory and the network interface, where the network interface is used to provide a data communication network element, the memory is used to store a computer program, and the processor is used to call the computer program to execute the method in the embodiment of the present application.
In one aspect, embodiments of the present application provide a computer readable storage medium having a computer program stored therein, the computer program being adapted to be loaded by a processor and to perform a method according to embodiments of the present application.
In one aspect, the embodiments of the present application provide a computer program product or a computer program, where the computer program product or the computer program includes computer instructions, where the computer instructions are stored in a computer readable storage medium, and where a processor of a computer device reads the computer instructions from the computer readable storage medium, and where the processor executes the computer instructions, so that the computer device performs a method in an embodiment of the present application.
According to the method and the device, resource data in a resource processing request, a resource processing function identifier in a trusted agent contract and a service contract address can be obtained through block link points, the resource processing function indicated by the resource processing function identifier is called, the resource data is processed through a receiver parameter added to the resource processing function, and then a callable processing function in the service contract indicated by the service contract address is called through the resource processing function so as to execute a service task associated with the resource data, wherein the callable processing function and the resource processing function have a binding association relation. Therefore, after the processing operation on the resource data is executed by the block link point, the invokable processing function in the business contract is directly invoked by the trusted agent contract to execute the business task associated with the resource data, so that the business initiator can execute different logic codes by only initiating one transaction, namely resources are consumed only once in the process of executing the operation twice, and the cost of interacting with the block chain network is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a blockchain network according to an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a scenario of a data processing method based on a blockchain according to an embodiment of the present application;
FIG. 3 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present disclosure;
FIG. 4 is a flow chart of another method for processing data based on blockchain according to an embodiment of the present application;
FIG. 5 is a flow chart of yet another data processing method based on blockchain provided in an embodiment of the present application;
FIG. 6 is a flow chart of yet another blockchain-based data processing method provided by embodiments of the present application;
FIG. 7 is a schematic diagram of a block chain based data processing apparatus according to an embodiment of the present application;
Fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
For ease of understanding, the following simple explanation of partial nouns is first made:
1. blockchain (Block chain): in a narrow sense, the blockchain is a chain data structure taking a block as a basic unit, and the block uses a digital abstract to verify the transaction history acquired before, so that the blockchain is suitable for the requirements of tamper resistance and expandability in a distributed accounting scene; in a broad sense, blockchain also refers to distributed accounting techniques implemented by blockchain structures, including distributed consensus, privacy and security protection, point-to-point communication techniques, network protocols, smart contracts, and the like.
The goal of the blockchain is to implement a distributed data logging ledger that allows only additions and not deletions. The basic structure of the ledger floor is a linear linked list. The linked list is formed by serially connecting blocks, the Hash value of the preceding block is recorded in the following blocks, and whether each block (and the transaction in the block) is legal or not can be rapidly checked by calculating the Hash value. If a node in the network proposes to add a new block, a consensus acknowledgement must be made for the block via a consensus mechanism.
2. Block (block): the data packet carrying transaction data on the blockchain network is a data structure marked with a timestamp and a hash value corresponding to a preceding block, and the block verifies and confirms the transaction in the block through a consensus mechanism of the network. The Block includes a Block Header (Block Header) and a Block Body (Block Body), where the Block Header can record meta information of the current Block and includes data such as a current version number, a hash value corresponding to a previous Block, a timestamp, a random number, a hash value of a Merkle Root (Merkle Root), and the like. The block may record detailed data generated over a period of time, including all transaction records or other information generated during the creation of the block for which the current block is verified, and may be understood as a representation of the ledger. In addition, the detailed data of the block may include generating a unique Merkle Root record in the block header through a hash process of a Merkle Tree (Merkle Tree).
The successor Block, also called Parent Block (Parent Block), is a Block chain that performs temporal ordering by recording the hash value corresponding to the Block and the hash value corresponding to the Parent Block in the Block header.
3. Hash value (hash): also called information characteristic value or eigenvalue, hash value is generated by converting input data of arbitrary length into a password by hash algorithm and performing fixed output, and original input data cannot be retrieved by decrypting the hash value, which is a one-way encryption function. In a blockchain, each block (except the initial block) contains a hash value of the successor block, which is the potential core foundation and most important aspect in blockchain technology, which preserves the authenticity of the recorded and viewed data, as well as the integrity of the blockchain as a whole.
4. Smart Contract: the concept of intelligent contracts has three major elements of commitment, agreement and digital form, so that the application range of the blockchain can be expanded to all links of transaction, payment, settlement and clearing in the financial industry. Intelligent contracts refer to the immediate execution of corresponding contract terms when a pre-programmed condition is triggered, the working principle of which is similar to the if-then statement of a computer program.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a blockchain network according to an embodiment of the present application. The blockchain network as shown in fig. 1 may include, but is not limited to, a blockchain network to which the federated chain corresponds. The blockchain network may include a plurality of blockchain nodes, and the plurality of blockchain nodes may include a blockchain node 10a, a blockchain node 10b, a blockchain node 10c, a blockchain node 10d, …, and a blockchain node 10n. Each blockchain node can receive data sent by the outside during normal operation, perform blockchain uplink processing based on the received data, and also can send the data to the outside. To ensure data interworking between the various blockchain nodes, a data connection may exist between each blockchain node, such as between blockchain node 10a and blockchain node 10b, between blockchain node 10a and blockchain node 10c, and between blockchain node 10b and blockchain node 10 c.
It will be appreciated that data or block transfer may be performed between the blockchain nodes via the data connections described above. The blockchain network may implement data connection between blockchain nodes based on node identifiers, and for each blockchain node in the blockchain network, each blockchain node may store node identifiers of other blockchain nodes having a connection relationship with itself, so as to broadcast the acquired data or generated blocks to other blockchain nodes according to the node identifiers of the other blockchain nodes, for example, the blockchain node 10a may maintain a node identifier list as shown in table 1, where the node identifier list stores node names and node identifiers of the other nodes:
TABLE 1
Node name Node identification
Node 10a AAA.AAA.AAA.AAA
Node 10b BBB.BBB.BBB.BBB
Node 10c CCC.CCC.CCC.CCC
Node 10d DDD.DDD.DDD.DDD
Node 10n EEE.EEE.EEE.EEE
The node identifier may be any of a protocol (Internet Protocol, IP) address for interconnection between networks, and any other information that can be used to identify a node in a blockchain network, and the IP address is only illustrated in table 1. For example, the blockchain node 10a may send information (e.g., a block) to the blockchain node 10b through the node identification bbb.bbb.bbb.bbb.bbb, and the blockchain node 10b may determine that the information was sent by the blockchain node 10a through the node identification aaa.aaa.aaa.
In a blockchain, a block must be consensus-passed through consensus nodes in the blockchain network before the block is uplink, and the block can be added to the blockchain after the consensus passes. It will be appreciated that not all participating nodes in a blockchain (i.e., blockchain nodes in the blockchain network described above) have sufficient resources and necessity to be consensus nodes of the blockchain. For example, in the blockchain network shown in fig. 1, blockchain node 10a, blockchain node 10b, blockchain node 10c, and blockchain node 10d may be considered as consensus nodes in the blockchain network. The consensus nodes in the blockchain network participate in consensus, namely, consensus is carried out on the blocks (comprising a batch of transactions), namely, voting is carried out on the blocks; while non-consensus nodes do not participate in consensus, but will help propagate block and vote messages, and synchronize status with each other, etc.
It will be appreciated that when the blockchain network employs a bayer consensus mechanism to achieve the consensus of the blocks, the assembly of the blocks and initiation of the consensus is typically done by the master node (also referred to as the out-block node). In this embodiment of the present application, the blockchain network as shown in fig. 1 may implement block consensus using a bayer consensus mechanism, and at this time, the blockchain node with the consensus function, for example, the blockchain node 10a, needs to determine the master node corresponding to the block corresponding to the next block height after determining that the block uplink of the current block height is successful, so as to complete the consensus operation for the block of the next block height.
It can be appreciated that the present application may be applied to a blockchain-based data processing scheme in various forms, and the following description will take a case of processing a transfer request initiated by a user (which may be referred to as an initiator) as an example, please refer to fig. 2 together, which is a schematic diagram of a scenario of a blockchain-based data processing method according to an embodiment of the present application. As shown in fig. 2, the blockchain node 20b may receive a resource detection request and a resource processing request sent by the user terminal 20a, and the application is exemplified by a transfer service, where the blockchain node 20b may be any blockchain node corresponding to the blockchain network shown in fig. 1, and for example, the blockchain node may be the blockchain node 10a in the blockchain network shown in fig. 1.
As shown in fig. 2, the user terminal 20a may initiate a resource handling request to the blockchain node 20b, which is illustrated herein as a transfer request. The blockchain node 20b receives a transfer request initiated by the user terminal 20a, where the transfer request may include resource data, a resource handling function identifier in the trusted agent contract 20d, a service contract address, and an initiator signature 20c, and the blockchain node 20b performs a signature verification operation on the initiator signature 20 c. Specifically, the blockchain node 20b decrypts the initiator signature 20c based on the public key of the user terminal 20a to obtain the hash value to be verified; generating a target hash value of the resource processing request through a hash function; if the hash value to be verified is different from the target hash value, determining that the signature verification fails, and returning error reporting information aiming at the resource processing request to the user terminal 20a to indicate that the signature verification of the resource processing request fails; if the hash value to be verified is the same as the target hash value, the verification is determined to be successful, and the resource processing function 20e indicated by the resource processing function identifier in the trusted agent contract 20d is called based on the resource processing request.
Further, after the verification of the initiator signature 20c by the blockchain node 20b is successful, the resource processing function 20e indicated by the resource processing function identifier in the trusted agent contract 20d is called according to the resource processing request, where the resource processing function 20e is configured to process the resource data through a receiver parameter (the receiver parameter may also be referred to as a to parameter) added to the resource processing function 20e, where the receiver parameter may be a user account address or a contract address, and this application describes that the receiver parameter is a service contract address. Note that, the resource processing function 20e may be a first resource transfer function 20f (the first resource transfer function 20f may also be referred to as a transferring and adding method), and the signature initiator 20i corresponding to the resource processing request is obtained according to the first resource transfer function 20f, where the signature initiator 20i is an initiator that digitally signs the resource processing request, and in this embodiment of the present application, the signature initiator 20i is taken as an example of the user terminal 20 a. After determining that the signature initiator 20i is the user terminal 20a, the blockchain node 20b transfers the resource data in the user terminal 20a to the address indicated by the receiver parameter, which in the embodiment of the present application includes the service contract address, that is, transfers the resource data to the indicated service contract 20 k.
Further, the blockchain node 20b invokes the callable processing function 20m with the binding association relationship in the service contract 20k through the first resource transfer function 20f, for example, the callable processing function 20m with the binding association relationship in the first resource transfer function 20f is an ontransfer received method, and executes the service task 20N associated with the resource data through the callable processing function 20m in the service contract 20k, which is not limited by the present application, and only the resource data transfer service is taken as an example for explanation, the blockchain node 20b determines N digital resource identifiers 20o (the digital resource identifiers may also be referred to as digital collections) matched with the transferred resource data, transfers the attribution authority of the N digital resource identifiers 20o to the user terminal 20a, and it is required to specify that the N is a positive integer for indicating the number of the digital resource identifiers 20o, and the number N will be matched with a specific value according to the actually transferred resource data.
Alternatively, the resource handling function 20e may be a second resource transfer function 20g (the second resource transfer function 20g may be referred to as a transferfrom and method), and the blockchain node 20b obtains the designated initiator 20j according to the second resource transfer function 20g, where the designated initiator 20j is an address included in a designated initiator parameter (the designated initiator parameter may be referred to as a from parameter) in the second resource transfer function 20g, and the designated initiator 20j may be the same as a signature initiator in the resource handling request or may be different from a signature initiator in the resource handling request. The blockchain node 20b will transfer the resource data indicated in the resource processing request from the designated initiator 20j to the address indicated by the receiver parameter, in this embodiment, the transfer to the service contract 20k is described as an example.
Further, the blockchain node 20b may call the callable processing function 20m in the service contract 20k having the binding association relationship with the second resource transfer function 20g, for example, the callable processing function 20m in the second resource transfer function 20g having the binding association relationship may also be an onTransferReceived method, similar to the first resource transfer function 20f, the service task 20N associated with the resource data may also be executed through the callable processing function 20m in the service contract 20k, the present application does not limit the service task, only takes the transfer service as an example, the blockchain node 20b determines N digital resource identifiers 20o (the digital resource identifiers 20o may also be referred to as digital collections) matching the transferred resource data, and the attribution authority of the N digital resource identifiers 20o is transferred to the user terminal 20 a.
Alternatively, the resource processing function 20e may be a resource authorization function 20h (the resource authorization function 20h may also be referred to as an approvided method), where the resource authorization function 20h is used to authorize resource data to the trusted agent contract 20d, so that the trusted agent contract 20d has the authority to manage the authorized resource data. Specifically, the blockchain node 20b receives an authorization request, where the authorized party address is stored in an authorized party address parameter (the authorized party address parameter may also be referred to as a value parameter), and the authorization request may further include a pre-authorized resource data parameter (the pre-authorized resource data parameter may also be referred to as a value parameter), where the blockchain node 20b invokes the resource authorization function 20h to perform an authorization operation according to the authorization request, and after the authorization is successful, the authorized party may perform the related service task 20n through the service contract 20 k. If the resource handling function is a resource authorization function, the callable handling function 20m may be a callback function associated with the resource authorization function (the callback function may also be referred to as the callable handling function 20m, and may also be referred to as an onApprovalReceived method). By the callable processing function 20m described above, business tasks matching authorized resource data, such as transfer of data resources, etc., can be performed.
It should be noted that, the authorized party address may be an account address or a contract address, which is not limited in the application, when executing the service task 20n, the blockchain node 20b checks whether the authorized address has the authority to use the resource data, and if the verification is successful, the resource data is transferred to the service contract 20 k.
Optionally, the resource processing request may further carry an execution parameter 20l (the execution parameter may also be referred to as a data parameter). In the case that the resource processing request carries the execution parameter 20l, the execution parameter 20l is transmitted when the resource processing function 20e is called, so as to instruct the resource processing function 20e to execute the service indicated by the execution parameter 20l, for example, may be a timing transaction, a staged transaction, or the like, which is not limited in this application. The execution parameters 20l may also be passed into the callable processing function 20m for instructing the callable processing function 20m to execute the business task 20n associated with the execution parameters 20l and the data resource. It should be understood that, the execution parameter 20l is used to instruct the trusted agent contract 20d to perform the special service task 20n, and the execution parameter 20l is not required to be carried if only the original function of the callable processing function is required, and it should be noted that, if the execution parameter 20l is empty, that is, the execution parameter 20l does not carry information, the operation performed by the trusted agent contract 20d will be consistent with the operation that does not carry the execution parameter 20 l.
Alternatively, the user terminal 20a may send a resource detection request to the blockchain node 20b, where the resource detection request may include a service contract address and an identification of a verification function, where the resource detection request is used to detect whether the service contract 20k supports a callable processing function 20m, where the callable processing function 20m is used to execute callback logic code, that is, execute logic code associated with a service task after performing operations such as transferring or authorizing in a transaction. If the service contract 20k supports the callable processing function 20m, the user terminal 20a has authority to transmit a resource processing request for calling the callable processing function; if the service contract 20k does not support the callable processing function 20m, the user terminal 20a does not have authority to transmit a resource processing request for calling the callable processing function.
Specifically, the blockchain node 20b invokes the validation function 20p (the validation function 20p may also be referred to as a suppport interface method) in the trusted agent contract 20d according to the validation function identifier included in the resource detection request, and verifies whether the callable processing function 20m is supported by the service contract 20k indicated by the service contract address included in the resource detection request according to the validation function 20 p. If the service contract 20k supports the callable processing function 20m, generating a supportable message 20q, and sending the supportable message 20q to the user terminal 20a, where the supportable message 20q is used to instruct the user terminal 20a to have a right to send a resource processing request capable of calling the callable processing function 20 m; if the service contract 20k does not support the callable processing function 20m, a non-supportable message 20r is generated, and the non-supportable message 20r is sent to the user terminal 20a, where the non-supportable message 20r is used to instruct the user terminal 20a not to have the authority to send the resource processing request for calling the callable processing function 20m.
It should be noted that, the authority of the user terminal 20a having the resource processing request for sending the callable processing function 20m means that the user terminal 20a has the authority of executing the callback logic code for calling the callable processing function after the operations such as transferring or authorizing are executed in the same transaction, so as to implement the callback function; if the user terminal 20a does not have the authority to send the resource processing request capable of calling the callable processing function 20m, the original function of the service contract 20k can be called, so that the functions of original transfer or authorization and the like can be realized without callback operation.
Alternatively, the blockchain node 20b may verify, when receiving the resource processing request, whether the address indicated by the receiver parameter supports the callable processing function 20m, and if the user terminal 20a does not have the authority to send the resource processing request for calling the callable processing function 20m, or if the receiver address does not support the callable processing function 20m, the blockchain node 20b may return the error information.
Therefore, the embodiment of the application can acquire the resource data in the resource processing request, the resource processing function identifier in the trusted agent contract and the service contract address through the block link point, call the resource processing function indicated by the resource processing function identifier, process the resource data through the receiver parameter added to the resource processing function, and call the callable processing function in the service contract indicated by the service contract address through the resource processing function so as to execute the service task associated with the resource data, wherein the callable processing function and the resource processing function have a binding association relation. Therefore, after the processing operation on the resource data is executed by the block link point, the invokable processing function in the business contract is directly invoked by the trusted agent contract to execute the business task associated with the resource data, so that the business initiator can execute different logic codes by only initiating one transaction, namely resources are consumed only once in the process of executing the operation twice, and the cost of interacting with the block chain network is reduced.
Further, referring to fig. 3, fig. 3 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present application, and a blockchain node will be described below as an example of an execution body.
Step S101, a block chain link point acquires a resource processing request sent by an initiator; the resource handling request includes resource data, a resource handling function identification in the trusted agent contract, and a business contract address.
Specifically, the initiator may be an address such as a user account address or a contract address, where the resource data may be stored, which is not limited in this application. The block link point receives a resource processing request sent by an initiator, where the resource processing request may be a service request such as a data resource transfer request that may be supported by a trusted agent contract, and the application is not limited thereto, where the resource processing request may include resource data, a resource processing function identifier in the trusted agent contract, and a service contract address, where the resource processing function identifier is used to indicate a resource processing function, and the service contract address may be an address stored in a receiver parameter and used to receive the processed resource data.
Step S102, calling a resource processing function indicated by a resource processing function identifier in the trusted agent contract based on the resource processing request; the resource processing function is used for processing the resource data through the receiver parameters added into the resource processing function; the recipient parameter is a service contract address.
Specifically, the block link point invokes the resource processing function indicated by the resource processing function identifier according to the resource processing function identifier of the trusted agent contract in the resource processing request, where the resource processing function may be used to process resource data through a receiver parameter added to the resource processing function, where the resource processing function may include a first resource transfer function (the first resource transfer function may also be referred to as a transferand method) that directly performs a service task between a signature initiator and a service contract, or may be a second resource transfer function (the second resource transfer function may also be referred to as a transferfrom and method) that performs a service task between a designated initiator and a service contract, or may be a resource authorization function (the resource authorization function may also be referred to as an approvand method) that may authorize the trusted agent contract to manage the initiator resource data, where the application does not limit this.
Step S103, calling a callable processing function in the business contract indicated by the business contract address through the resource processing function, and executing a business task associated with the resource data through the callable processing function in the business contract; the callable processing function has a binding association relationship with the resource processing function.
Specifically, the blockchain node calls, through the resource processing function, a callable processing function in the service contract indicated by the service contract address, where the callable processing function and the resource processing function have a binding association relationship, for example, if the resource processing function is a first resource transfer function, the callable processing function is a callback function of the first resource processing function (the callback function of the first resource processing function may also be referred to as an onTransferreceived method); if the resource processing function is a resource authorization function, the callable processing function is a callback function of the callable processing function (the callback function of the callable processing function may also be referred to as an onappvalreceived method). The service tasks associated with the resource data may be executed by the callable processing function in the service contract, for example, after the resource data transferred by the initiator is received, the digital resource identifier matched with the resource data is transferred to the initiator, which is not limited in this application.
To sum up, it can be seen that in the embodiments of the present application, the resource data in the resource processing request, the resource processing function identifier in the trusted agent contract, and the service contract address may be obtained through the block link point, the resource processing function indicated by the resource processing function identifier is called, the resource data is processed through the receiver parameter added to the resource processing function, and then the callable processing function in the service contract indicated by the service contract address is called through the resource processing function, so as to execute the service task associated with the resource data, where the callable processing function and the resource processing function have a binding association relationship. Therefore, after the processing operation on the resource data is executed by the block link point, the invokable processing function in the business contract is directly invoked by the trusted agent contract to execute the business task associated with the resource data, so that the business initiator can execute different logic codes by only initiating one transaction, namely resources are consumed only once in the process of executing the operation twice, and the cost of interacting with the block chain network is reduced.
Further, referring to fig. 4, fig. 4 is a flowchart of another data processing method based on blockchain according to an embodiment of the present application. The data processing method is used to complete the operations performed by the blockchain node in the embodiment corresponding to fig. 3, and the data processing method may be performed by the blockchain node, for example, any blockchain node in the blockchain network in the embodiment corresponding to fig. 1. As shown in fig. 4, the method may include:
step S201, receiving a resource detection request sent by an initiator; the resource detection request comprises a business contract address and a verification function identifier; invoking a validation function in the trusted agent contract according to the validation function identification; verifying whether the business contract indicated by the business contract address supports the callable processing function according to the verification function; if the service contract supports the callable processing function, sending a supportable message to the initiator; the supportable message is used for indicating that the initiator has the authority of sending a resource processing request capable of calling the callable processing function; if the service contract does not support the callable processing function, sending an unsupported message to the initiator; the unsupported message is used to indicate that the initiator does not have the right to send a resource processing request that invokes the callable processing function described above.
Specifically, referring to fig. 5, fig. 5 is a flowchart of another block chain-based data processing method according to an embodiment of the present application. The initiator 50a may send a resource check request to the blockchain node 50b for checking whether the service contract 50e supports a callable processing function, where the resource check request may include a service contract address for indicating the service contract 50e to be verified, and an authentication function identifier for calling the authentication function 50d (the authentication function 50d may also be referred to as a supplicant interface method) in the trusted agent contract 50c, where the callable processing function is used to perform a service task associated with the resource data. The blockchain node 50b invokes the validation function 50d in the trusted agent contract 50c to validate the business contract 50e through the validation function identification described above.
Specifically, if the blockchain node 50b verifies that the service function does not support the callable processing function, an unsupported message 50f is generated, and the unsupported message 50f is returned to the initiator 50a, where the unsupported message 50f is used to indicate that the initiator does not have permission to send a resource processing request capable of calling the callable processing function, that is, the initiator cannot execute its callback logic through the callable processing function, and only can implement the original transaction function through the original function; if the blockchain node 50b verifies that the service function supports the callable processing function, a supportable message 50g is generated, and the supportable message 50g is returned to the initiator 50a, where the supportable message 50g is used to indicate that the initiator has authority to send a resource processing request capable of calling the callable processing function, that is, the initiator 50a may execute its callback logic through the callable processing function, for example, if the initiator 50a can support the callable processing function, the callable processing function may be called through the trusted agent contract 50c, after transferring the resource data of the initiator to the service contract, the service contract matches a digital resource identifier matched with the resource data, and sends the digital resource identifier back to the initiator, that is, executes the callback logic; if the initiator does not support the callable processing function, the transaction only supports the original function of the initiator 50a to transfer the resource data to the business contract, and cannot perform the operation of transferring the matched digital resource identification to the initiator by the business contract.
Step S202, a block chain link point acquires a resource processing request sent by an initiator; the resource handling request includes resource data, a resource handling function identification in the trusted agent contract, and a business contract address.
Specifically, please refer to the description of step S101 in the embodiment shown in fig. 3, and the description thereof will not be repeated here. Optionally, when the block link point receives the resource processing request sent by the initiator, it may be verified whether the service contract supports the callable processing function, and the specific steps may be: acquiring a callable processing function with a binding incidence relation with a resource processing function; verifying whether the business contract indicated by the business contract address supports a callable processing function; and if the business contract does not support the callable processing function, returning error reporting information for the resource processing request.
Specifically, the block link point acquires a callable processing function having a binding relationship with the resource processing function, for example, if the resource processing function is a first resource transfer function (the first resource transfer function may also be referred to as a transiterand method), the callable processing function having a binding relationship may be a callback function of the first resource transfer function (the callback function of the first resource transfer function may also be referred to as an ontransitivoreceived method), if the resource processing function is a second resource transfer function, the callable processing function having a binding relationship may be a callback function of the second resource transfer function (the callback function of the second resource transfer function may also be referred to as an ontransitivoreceived method), and if the resource processing function is a resource grant function, the callable processing function having a binding relationship may be a callback function of the first resource transfer function (the callback function of the first resource transfer function may also be referred to as an ontransitivoreceived method).
Further, the blockchain node verifies whether the service contract indicated by the service contract address supports the callable processing function, if the service contract does not support the callable processing function, that is, the service contract only supports the original function of the trusted agent contract, such as transferring of resource data, and the like, but does not support the callback function, the original function collides with the resource processing request sent by the initiator and indicating to call the callable processing function, and then error reporting information for the resource processing request is returned to the initiator; and if the business contract supports the callable processing function, executing the signature checking operation aiming at the resource processing request.
Step S203, obtaining an initiator signature from the resource processing request; checking the signature of the initiator; if signature verification of the initiator is successful, executing a step of calling a resource processing function indicated by a resource processing function identifier in the trusted agent contract based on the resource processing request; if signature verification fails, error reporting information for the resource processing request is returned.
Specifically, the blockchain node obtains an initiator signature from the resource processing request, where the initiator signature is obtained by signing the resource processing request with its private key by the initiator. Then, the blockchain node performs a signature verification operation on the initiator signature, and it can be understood that the blockchain node can perform a decryption operation on the initiator signature based on the public key of the initiator, so as to obtain a hash value to be verified; generating a target hash value for the resource processing request through a hash function; finally, comparing the hash value to be verified with a target hash value, if the hash value to be verified is different from the target hash value, determining that the signature verification fails, and returning error reporting information aiming at the resource processing request to an initiator by the block chain node, wherein the error reporting information is used for indicating that the signature verification of the resource processing request fails; if the hash value to be verified is the same as the target hash value, determining that the verification is successful, and executing the resource processing function indicated by the resource processing function identifier in the trusted agent contract called based on the resource processing request by the blockchain node.
Step S204, calling the resource processing function indicated by the resource processing function identification in the trusted agent contract based on the resource processing request; the resource processing function is used for processing the resource data through the receiver parameters added into the resource processing function; the recipient parameter is a service contract address.
Specifically, referring to fig. 6, fig. 6 is a flowchart of another data processing method based on blockchain according to an embodiment of the present application. As shown in fig. 6, the blockchain node 60b receives the resource processing request sent by the initiator 60a, and invokes the resource processing function 60d indicated by the resource processing function identifier in the trusted agent contract 60c based on the resource processing request after the signature verification of the initiator signature is successful, where the blockchain node 60b receives the resource processing request sent by the initiator 60a and the signature verification operation of the initiator signature is referred to the descriptions in the steps S202 and S203, and will not be repeated herein. The resource processing function 60d is configured to process resource data through a receiver parameter (the receiver parameter may also be referred to as a to parameter) added to the resource processing function 60d, for example, operations such as data resource transfer, data resource authorization, etc., which are not limited in this application, and the receiver parameter may store a service contract address.
Step S205, if the resource processing function is a first resource transfer function, acquiring a signature initiator corresponding to the resource processing request through the first resource transfer function, and transferring the resource data in the signature initiator to a service contract indicated by the service contract address; the signature initiator refers to an initiator that digitally signs a resource processing request.
Specifically, referring to fig. 6 again, as shown in fig. 6, the blockchain node 60b invokes the resource processing function 60d, where the resource processing function 60d may be a first resource transfer function 60e (the first resource transfer function 60e may also be referred to as a transferand method), where the first resource transfer function 60e is used to obtain a signature initiator 60f corresponding to the resource processing request, and when the initiator is not specified in the resource processing request, the trusted agent contract 60c determines the signature initiator 60f as an initiator by default, and then transfers the resource data in the signature initiator 60f to a service contract 60h indicated by the service contract address, where it is understood that the signature initiator 60f is an initiator that digitally signs the resource processing request.
Step S206, calling the callable processing function with the binding association relation in the service contract through the first resource transfer function, determining N digital resource identifiers matched with the transferred resource data through the callable processing function in the service contract, and transferring the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
Specifically, if the resource processing function 60d is the first resource processing function 60e, after transferring the resource data from the signature initiator 60f to the service contract 60h, the callable processing function 60i is called to execute the service task 60j associated with the resource data and executed by the callable processing function 60 i.
Step S207, calling, by the resource processing function, a callable processing function in the service contract indicated by the service contract address, and executing, by the callable processing function in the service contract, a service task associated with the resource data, where the callable processing function and the resource processing function have a binding association relationship.
Specifically, if the above-mentioned resource processing function is the first resource transfer function 60e, the callable processing function may be a callback function (the callback function may also be referred to as an onTransferreceived method) having a binding association relationship with the first resource transfer function 60e, and after the resource data indicated in the resource processing request is transferred to the service contract 60h, the blockchain node 60b determines N digital resource identifiers (the digital resource identifiers may also be referred to as digital collection) that match the transferred resource data, or may be other resource data available for transaction, which is not limited in this application, and then the attribution authority of the N digital resource identifiers is transferred to the initiator 60 a.
Alternatively, the resource processing function 60d may be a second resource transfer function (the second resource transfer function may also be referred to as a transferfroma ndcal method), and the operation steps may be: if the resource processing function is a second resource transfer function, acquiring a designated initiator of the second resource transfer function, and transferring the resource data in the designated initiator to a business contract indicated by a business contract address through the second resource transfer function; the designated initiator may be the same as the initiator or different from the initiator.
Specifically, the blockchain node 60b obtains the specified initiator according to the second resource transfer function, where the specified initiator address is stored in a specified initiator parameter (the specified initiator parameter may also be referred to as a from parameter) in the second resource transfer function, where the specified initiator may be the same as the initiator of the resource processing request or may be different from the initiator of the resource processing request, which is not limited in this application. The blockchain node 60b then transfers the resource data indicated by the resource processing request from the designated initiator to the address indicated by the receiver parameter, and the receiver parameter is not limited in this application, and only the service contract 60h is taken as an example for illustration.
Further, if the resource processing function is the second resource transfer function, after transferring the resource data from the designated initiator to the service contract 60h, the callable processing function 60i is called to execute the service task 60j associated with the execution of the callable processing function and the resource data, which may specifically include the following steps: the second resource transfer function calls a callable processing function with a binding association relationship in the service contract, determines N digital resource identifiers matched with the transferred resource data through the callable processing function in the service contract, and transfers the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
Specifically, if the resource processing function is the second resource transfer function, the callable processing function may be a callback function having a binding association relationship with the second resource transfer function (the callback function may also be referred to as an onTransferReceived method). It should be noted that, the first resource transfer function 60e is different from the second resource transfer function in that the signature initiator of the first resource transfer function 60e is the initiator, and the signature initiator of the second resource transfer function is different from the designated initiator. Similar to the above-mentioned first resource transfer function 60e, the second resource transfer function may also execute the service task 60j associated with the resource data by calling the processing function 60i, where the blockchain node 60b may determine N digital resource identifiers matched with the transferred resource data, transfer the attribution authority of the N digital resource identifiers to the designated initiator, where the N is a positive integer to indicate the number of the digital resource identifiers, and may match a specific value according to the actual transaction data, and the digital resource identifiers may also be replaced with other resource data available for transaction, which is not limited in this application.
Alternatively, the resource processing function 60d may be a resource authorization function (the resource authorization function may be also referred to as an approvedcall method), and the operation steps thereof may be: and if the resource processing function is a resource authorization function, authorizing the resource data to the trusted agent contract through the resource authorization function.
Specifically, the above-described resource authorization function is used to authorize resource data to the trusted agent contract 60c, so that the trusted agent contract 60c has the authority to manage the resource data to be authorized. It will be appreciated that the blockchain node 60b receives an authorization request, where the authorization request may include an authorized party address stored in an authorized party address parameter (the authorized party address parameter may also be referred to as a value parameter) and a pre-authorized resource data parameter indicating the number to be authorized (the pre-authorized resource data parameter may also be referred to as a value parameter), and the blockchain node 60b invokes the resource authorization function to perform an authorization operation according to the authorization request.
Further, if the above-mentioned resource processing function is a resource authorization function, after the authorization is successful, the authorized party address may replace the initiator 60a, and initiate an application for calling the resource processing function 60d, so as to call the above-mentioned callable processing function 60i to execute the service task 60j associated with the execution of the callable processing function and the resource data, which may specifically include the following steps: and calling the callable processing function with the binding association relation in the service contract through the resource authorization function, and executing the service task matched with the authorized resource data through the callable processing function in the service contract.
Specifically, if the resource processing function is a resource authorization function, the resource authorization function may be a callback function having a binding association relationship with the resource authorization function (the callback function may also be referred to as an onappingvalid received method). By the callable processing function 60i described above, business tasks matching authorized resource data, such as transfer of data resources, etc., can be performed. It should be noted that, the service task 60j indicated by the resource processing application initiated by the authorized party address is implemented by storing the authorized data resource of the designated party in the blockchain node, and then transferring to the service contract 60h according to the indication. It should be noted that the authorized party address may be an account address, alternatively, may be a contract address. When executing the service task 60j, the blockchain node 60b checks whether the authorized address has the authority to use the resource data, and if the authentication is successful, the resource data is transferred to the service contract 60 h.
Optionally, the resource processing function 60d may further carry an execution parameter 60g (the execution parameter may also be referred to as a data parameter), and the specific operation steps may be: and acquiring the execution parameters from the resource processing request, inputting the execution parameters into the resource processing function, and processing the resource data according to the resource processing function, the business contract address and the execution parameters.
It will be appreciated that the execution parameters 60g may be custom derived by the initiator. If it is identified that the execution parameter 60g is carried by the resource processing request, the execution parameter 60g is transmitted to the resource processing function 60d together with other parameters, so as to instruct the resource processing function 60d to execute the special service indicated by the execution parameter 60g, for example, the special service may be a special service of a timing transaction, that is, a timestamp of the expected execution may be written in the execution parameter 60g, and the resource processing function 60d may execute the special service at a time indicated by the timestamp, or may be another service task such as a staged transaction, which is not limited in this application. The execution parameters 60g may also be passed into the callable processing function 60i for instructing the callable processing function 60i to execute the business task 60j associated with the execution parameters 60g and the resource data. It should be noted that, the execution parameter 60g is used to indicate a special service, and if only the original function of the callable processing function is used, the execution parameter 60g is not required to be carried, and it is understood that if the execution parameter 60g is empty, that is, the execution parameter 60g carries blank information, the operation performed by the trusted agent contract 60c is consistent with the operation performed by the non-carried execution parameter 60 g.
Specifically, the description of the resource processing function 60d may be as shown in table 2:
TABLE 2
/>
/>
The method shown in table 2 is pre-extended in the corresponding interface, for example, the above-mentioned transferand method is extended in the transferer interface; the transferring from and method is obtained by expanding in a transferring from interface; the approverdCall method is extended in the approve interface.
Further, when the method is called, a corresponding callable processing function in the description can be called, for example, after the transferand or transferfrom and method is called, a corresponding onTransferReceived method can be called; after the approvided method is called, a corresponding onApprovalReceived method can be called.
It should be noted that, the parameters shown in table 2 may be parameters transmitted when the above method is called, for example, when the above transferand method is called, the address parameter of the receiver and the data resource value parameter need to be transmitted, optionally, the parameters may also carry special transaction operation data parameters, and the special transaction operation data parameters may be transmitted together when the ontransferreceive method is called; when the above-mentioned transfer and communication method is called, it needs to transmit the address parameter of sender, the address parameter of receiver and the data resource value parameter, optionally, it also can carry special transaction operation data parameter, and the above-mentioned special transaction operation data parameter is transferred together when the on transfer received method is called; when the approvidean method is called, the authorized party address parameter and the authorized data resource value parameter need to be transmitted, optionally, special transaction operation data parameters can be carried, and the special transaction operation data parameters are transmitted when the onapprovidereceived method is called.
It will be appreciated that the return values shown in table 2 are variable parameters generated after the above method is called, and are used to indicate whether the above method is successfully called, for example, after the above-mentioned transferring and method, transferring from and method or apphandcall method is called, the value is returned successfully, otherwise the false is returned.
Therefore, the embodiment of the application can acquire the resource data in the resource processing request, the resource processing function identifier in the trusted agent contract and the service contract address through the block link point, call the resource processing function indicated by the resource processing function identifier, process the resource data through the receiver parameter added to the resource processing function, and call the callable processing function in the service contract indicated by the service contract address through the resource processing function so as to execute the service task associated with the resource data, wherein the callable processing function and the resource processing function have a binding association relation. Therefore, after the processing operation on the resource data is executed by the block link point, the invokable processing function in the business contract is directly invoked by the trusted agent contract to execute the business task associated with the resource data, so that the business initiator can execute different logic codes by only initiating one transaction, namely resources are consumed only once in the process of executing the operation twice, and the cost of interacting with the block chain network is reduced.
Fig. 7 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an embodiment of the present application. The data processing means may be a computer program (comprising program code) running on a computer device, for example the data processing means is an application software; the device can be used for executing corresponding steps in the method provided by the embodiment of the application. As shown in fig. 7, the data processing apparatus 1 may include: a first acquisition module 101, a first call module 102, a second call module 103.
A first obtaining module 101, configured to obtain, by using a block link point, a resource processing request sent by an initiator; the resource processing request comprises resource data, a resource processing function identifier in a trusted agent contract and a business contract address;
a first calling module 102, configured to call a resource processing function indicated by a resource processing function identifier in the trusted agent contract based on the resource processing request; the resource processing function is used for processing the resource data through the receiver parameters added into the resource processing function; the receiver parameter is a business contract address;
a second calling module 103, configured to call, through the resource processing function, a callable processing function in the service contract indicated by the service contract address, and execute, through the callable processing function in the service contract, a service task associated with the resource data; the callable processing function has a binding association relationship with the resource processing function.
The specific implementation manner of the function of the first obtaining module 101 may refer to step S101 in the embodiment corresponding to fig. 3; the specific function implementation manner of the first calling module 102 may refer to step S102 in the embodiment corresponding to fig. 3; the specific function implementation manner of the second invoking module 103 may refer to step S103 in the embodiment corresponding to fig. 3, and will not be described herein.
Referring to fig. 7 again, the data processing apparatus 1 may further include: a first transfer module 104.
The first transfer module 104 is configured to, if the resource processing function is a first resource transfer function, obtain a signature initiator corresponding to the resource processing request through the first resource transfer function, and transfer resource data in the signature initiator to a service contract indicated by the service contract address; the signature initiator refers to an initiator for carrying out digital signature on the resource processing request;
the second invoking module 103 is specifically configured to invoke, by using the first resource transfer function, an callable processing function having a binding association relationship in the service contract, determine, by using the callable processing function in the service contract, N digital resource identifiers that match the transferred resource data, and transfer the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
The specific implementation of the function of the first transfer module 104 may be referred to the description of step S205 in the embodiment corresponding to fig. 4, or may be referred to the embodiment corresponding to fig. 6; the specific function implementation manner of the second invoking module 103 may refer to step S103 in the embodiment corresponding to fig. 3, or may refer to the description of the first resource transfer function in step S206 in the embodiment corresponding to fig. 4, which is not repeated herein.
Referring to fig. 7 again, the data processing apparatus 1 may further include: a second transfer module 105.
A second transfer module 105, configured to obtain a designated initiator of the second resource transfer function if the resource processing function is the second resource transfer function, and transfer the resource data in the designated initiator to the service contract indicated by the service contract address through the second resource transfer function; designating the initiator as the same or different from the initiator;
the second invoking module 103 is specifically configured to invoke, by using a second resource transfer function, an callable processing function having a binding association relationship in a service contract, determine, by using the callable processing function in the service contract, N digital resource identifiers that match the transferred resource data, and transfer the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
The specific implementation manner of the second transfer module 105 may be referred to the description of the second resource transfer function in step S206 in the embodiment corresponding to fig. 4; the specific function implementation manner of the second invoking module 103 may refer to step S103 in the embodiment corresponding to fig. 3, or may refer to the description of the second resource transfer function in step S206 in the embodiment corresponding to fig. 4, which is not repeated herein.
Referring to fig. 7 again, the data processing apparatus 1 may further include: an authorization module 106.
An authorization module 106, configured to authorize the resource data to the trusted agent contract through the resource authorization function if the resource processing function is the resource authorization function;
the second invoking module 103 is specifically configured to invoke, by using the resource authorization function, an callable processing function having a binding association relationship in the service contract, and execute, by using the callable processing function in the service contract, a service task matching with the authorized resource data.
The specific implementation of the function of the authorization module 106 may be described in step S206 in the embodiment corresponding to fig. 4; the specific function implementation manner of the second invoking module 103 may refer to step S103 in the embodiment corresponding to fig. 3, or may refer to the description of the resource authorization function in step S206 in the embodiment corresponding to fig. 4, which is not described herein.
Referring to fig. 7, the second invoking module 103 may further include: call unit 1031 and execute unit 1032.
A calling unit 1031 for calling, through the resource processing function, a callable processing function in the service contract indicated by the service contract address;
and an execution unit 1032 for inputting the execution parameters into the callable processing function, and executing the business tasks associated with the execution parameters and the resource data through the callable processing function.
The specific implementation of the functions of the calling unit 1031 and the executing unit 1032 may refer to the description of the execution parameters in step S206 in the embodiment corresponding to fig. 4, which is not described herein.
Referring to fig. 7 again, the data processing apparatus 1 may further include: the device comprises a receiving module 107, a third calling module 108, a first verification module 109, a first sending module 110 and a second sending module 111.
A receiving module 107, configured to receive a resource detection request sent by an initiator; the resource detection request comprises a business contract address and a verification function identifier;
a third calling module 108, configured to call the verification function in the trusted agent contract according to the verification function identifier;
a first verification module 109, configured to verify, according to a verification function, whether the service contract indicated by the service contract address supports a callable processing function;
A first sending module 110, configured to send a supportable message to the initiator if the service contract supports the callable processing function; the supportable message is used for indicating that the initiator has the authority of sending a resource processing request capable of calling the callable processing function;
a second sending module 111, configured to send an unsupported message to the initiator if the service contract does not support the callable processing function; the unsupported message is used to indicate that the initiator does not have the right to send a resource processing request that can invoke the callable processing function.
The specific function implementation manners of the receiving module 107, the third invoking module 108, the first verifying module 109, the first sending module 110, and the second sending module 111 may refer to step S201 in the embodiment corresponding to fig. 4, or refer to the embodiment corresponding to fig. 5, which is not described herein again.
Referring to fig. 7 again, the data processing apparatus 1 may further include: a second acquisition module 112, a second verification module 113, a first return module 114.
A second obtaining module 112, configured to obtain a callable processing function having a binding association relationship with a resource processing function;
a second verification module 113, configured to verify whether the service contract indicated by the service contract address supports a callable processing function;
The first return module 114 is configured to return error reporting information for the resource processing request if the service contract does not support the callable processing function.
The specific functional implementation manner of the second obtaining module 112, the second verifying module 113, and the first returning module 114 may refer to the description of the verifying operation in step S202 in the embodiment corresponding to fig. 4, which is not described herein.
Referring to fig. 7 again, the data processing apparatus 1 may further include: a third acquisition module 115, a signature verification module 116, an execution module 117, and a second return module 118.
A third obtaining module 115, configured to obtain an initiator signature from the resource processing request;
the signature verification module 116 is configured to verify the signature of the initiator;
the execution module 117 is configured to notify the first calling module 102 to execute the resource processing function indicated by the resource processing function identifier in the trusted agent contract based on the resource processing request if the signature verification of the initiator is successful;
the second return module 118 is configured to return error reporting information for the resource processing request if signature verification fails for the initiator signature.
The specific function implementation manners of the third obtaining module 115, the signature verification module 116, the executing module 117, and the second returning module 118 may refer to step S203 in the embodiment corresponding to fig. 4, which is not described herein again.
Referring to fig. 7, the signature verification module 116 may further include: decryption unit 1161, generation unit 1162, first determination unit 1163, second determination unit 1164.
A decryption unit 1161, configured to decrypt the signature of the initiator based on the public key of the initiator, to obtain a hash value to be verified;
a generating unit 1162, configured to generate a target hash value of the resource processing request;
the first determining unit 1163 is configured to determine that the signing verification is successful if the hash value to be verified is the same as the target hash value;
the second determining unit 1164 is configured to determine that the verification fails if the hash value to be verified is different from the target hash value.
The specific functional implementation manner of the decryption unit 1161, the generation unit 1162, the first determination unit 1163, and the second determination unit 1164 may refer to step S203 in the embodiment corresponding to fig. 4, which is not described herein.
By the method provided by the embodiment of the application, the transaction cost can be reduced.
Fig. 8 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 8, the computer device 1000 may include: processor 1001, network interface 1004, and memory 1005, and in addition, the above-described computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 8, an operating system, a network communication module, a user interface module, and a device control application may be included in a memory 1005, which is a type of computer-readable storage medium.
In the computer device 1000 shown in FIG. 8, the network interface 1004 may provide network communication functions; while user interface 1003 is primarily used as an interface for providing input to a user; and the processor 1001 may be used to invoke a device control application stored in the memory 1005 to implement:
acquiring a user address in a resource query request sent by a terminal device;
if the resource issuing variable associated with the user address indicates that the resource is not issued, acquiring query error information; the resource issuing variable associated with the user address is used for indicating the issuing state of the business party on the resource data provided by the user address;
acquiring signed resource information by inquiring a gateway address indicated by the error information; the signed resource information comprises resource data provided by the service party and signature information, wherein the signature information is obtained by signing the resource data based on a private key of the service party; the resource data is data which is not issued in the blockchain network;
signing verification is carried out on signature information in the signed resource information based on a public key of the service party;
if the signature verification is successful, determining a total resource value corresponding to the user address based on the resource data in the signed resource information and the on-chain resource data of the user address on the blockchain network, and sending the total resource value to the terminal equipment so that the terminal equipment displays the total resource value; the resource data in the signed resource information is for being issued to a user address on the blockchain network when the terminal device initiates a transaction service.
It should be understood that the computer device 1000 described in the embodiments of the present application may perform the description of the data processing method in any of the foregoing embodiments corresponding to any of fig. 2, 3, 4, 5, and 6, and will not be described herein. In addition, the description of the beneficial effects of the same method is omitted.
Furthermore, it should be noted here that: the embodiments of the present application further provide a computer readable storage medium, where the computer readable storage medium stores a computer program executed by the aforementioned data processing apparatus 1, where the computer program includes program instructions, when executed by the processor, can execute the description of the data processing method in any of the embodiments corresponding to fig. 2, 3, 4, 5, and 6, and therefore, a detailed description will not be given here. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application.
The computer readable storage medium may be the data processing apparatus provided in any one of the foregoing embodiments or an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Furthermore, it should be noted here that: embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the method provided by any of the corresponding embodiments of fig. 2, 3, 4, 5, 6, previously described.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (13)

1. A blockchain-based data processing method, comprising:
the block chain link point obtains a resource processing request sent by an initiator; the resource processing request comprises resource data, a resource processing function identifier in a trusted agent contract and a business contract address;
invoking a resource handling function indicated by the resource handling function identification in the trusted agent contract based on the resource handling request; the resource processing function is used for processing the resource data through the receiver parameters added to the resource processing function; the receiver parameter is the business contract address;
invoking a callable processing function in a business contract indicated by the business contract address through the resource processing function, and executing a business task associated with the resource data through the callable processing function in the business contract; and the callable processing function and the resource processing function have a binding association relation.
2. The method as recited in claim 1, further comprising:
if the resource processing function is a first resource transfer function, acquiring a signature initiator corresponding to the resource processing request through the first resource transfer function, and transferring the resource data in the signature initiator to a service contract indicated by the service contract address; the signature initiator refers to an initiator for carrying out digital signature on the resource processing request;
the calling, by the resource processing function, a callable processing function in a business contract indicated by the business contract address, the executing, by the callable processing function in the business contract, a business task associated with the resource data, comprising:
invoking a callable processing function with a binding association relationship in the service contract through the first resource transfer function, determining N digital resource identifiers matched with the transferred resource data through the callable processing function in the service contract, and transferring the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
3. The method of claim 1, wherein the resource processing request further comprises a designated initiator; the method further comprises the steps of:
If the resource processing function is a second resource transfer function, acquiring an appointed initiator of the second resource transfer function, and transferring the resource data in the appointed initiator to a service contract indicated by the service contract address through the second resource transfer function; the designated initiator is the same as or different from the initiator;
the calling, by the resource processing function, a callable processing function in a business contract indicated by the business contract address, the executing, by the callable processing function in the business contract, a business task associated with the resource data, comprising:
invoking a callable processing function with a binding association relationship in the service contract through the second resource transfer function, determining N digital resource identifiers matched with the transferred resource data through the callable processing function in the service contract, and transferring the attribution authority of the N digital resource identifiers to the initiator; n is a positive integer.
4. The method as recited in claim 1, further comprising:
if the resource processing function is a resource authorization function, authorizing the resource data to the trusted agent contract through the resource authorization function;
The calling, by the resource processing function, a callable processing function in a business contract indicated by the business contract address, the executing, by the callable processing function in the business contract, a business task associated with the resource data, comprising:
and calling a callable processing function with a binding association relation in the service contract through the resource authorization function, and executing a service task matched with the authorized resource data through the callable processing function in the service contract.
5. The method of claim 1, wherein the resource processing request further comprises an execution parameter; the method further comprises the steps of:
and acquiring the execution parameters from the resource processing request, inputting the execution parameters into the resource processing function, and processing the resource data according to the resource processing function, the business contract address and the execution parameters.
6. The method as recited in claim 1, further comprising:
receiving a resource detection request sent by the initiator; the resource detection request comprises the service contract address and a verification function identifier;
Invoking a validation function in the trusted agent contract according to the validation function identifier;
verifying whether the service contract indicated by the service contract address supports the callable processing function according to the verification function;
if the service contract supports the callable processing function, sending a supportable message to the initiator; the supportable message is used for indicating that the initiator has the authority of sending a resource processing request capable of calling the callable processing function;
if the service contract does not support the callable processing function, sending an unsupported message to the initiator; the unsupported message is to indicate that the initiator does not have the authority to send a resource processing request that can invoke the callable processing function.
7. The method as recited in claim 1, further comprising:
acquiring the callable processing function with a binding association relationship with the resource processing function;
verifying whether a business contract indicated by the business contract address supports the callable processing function;
and if the business contract does not support the callable processing function, returning error reporting information aiming at the resource processing request.
8. The method of claim 1, wherein the resource processing request further carries an initiator signature, the initiator signature being obtained by digitally signing the resource processing request with a private key of the initiator; the method further comprises the steps of:
acquiring an initiator signature from the resource processing request;
verifying the signature of the initiator;
if signature verification of the initiator is successful, executing the step of calling the resource processing function indicated by the resource processing function identifier in the trusted agent contract based on the resource processing request;
and if signature verification of the initiator fails, returning error reporting information aiming at the resource processing request.
9. The method of claim 8, wherein signing the initiator signature comprises:
based on the public key of the initiator, performing decryption operation on the signature of the initiator to obtain a hash value to be verified;
generating a target hash value of the resource processing request;
if the hash value to be verified is the same as the target hash value, determining that the signature verification is successful;
if the hash value to be verified is different from the target hash value, determining that signature verification fails.
10. A blockchain-based data processing device, comprising:
the first acquisition module is used for acquiring a resource processing request sent by an initiator through the block link point; the resource processing request comprises resource data, a resource processing function identifier in a trusted agent contract and a business contract address;
a first calling module, configured to call, based on the resource processing request, a resource processing function indicated by the resource processing function identifier in the trusted agent contract; the resource processing function is used for processing the resource data through the receiver parameters added to the resource processing function; the receiver parameter is the business contract address;
a second calling module, configured to call, by using the resource processing function, a callable processing function in a service contract indicated by the service contract address, and execute, by using the callable processing function in the service contract, a service task associated with the resource data; and the callable processing function and the resource processing function have a binding association relation.
11. A computer device, comprising: a processor, a memory, and a network interface;
The processor is connected to the memory, the network interface for providing data communication functions, the memory for storing program code, the processor for invoking the program code to perform the method of any of claims 1-9.
12. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program adapted to be loaded by a processor and to perform the method of any of claims 1-9.
13. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the method of any of claims 1-9.
CN202311499636.0A 2023-11-09 2023-11-09 Block chain-based data processing method and device and readable storage medium Pending CN117544631A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311499636.0A CN117544631A (en) 2023-11-09 2023-11-09 Block chain-based data processing method and device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311499636.0A CN117544631A (en) 2023-11-09 2023-11-09 Block chain-based data processing method and device and readable storage medium

Publications (1)

Publication Number Publication Date
CN117544631A true CN117544631A (en) 2024-02-09

Family

ID=89781853

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311499636.0A Pending CN117544631A (en) 2023-11-09 2023-11-09 Block chain-based data processing method and device and readable storage medium

Country Status (1)

Country Link
CN (1) CN117544631A (en)

Similar Documents

Publication Publication Date Title
CN112446785B (en) Cross-chain transaction method, system, device, equipment and storage medium
CN111970129B (en) Data processing method and device based on block chain and readable storage medium
CN111429254B (en) Business data processing method and device and readable storage medium
CN111444273B (en) Data authorization method and device based on block chain
CN110177124B (en) Identity authentication method based on block chain and related equipment
CN110263579B (en) Data processing method, system and related equipment
CN112115205B (en) Cross-chain trust method, device, equipment and medium based on digital certificate authentication
CN101527718B (en) Method for building ternary-equally recognizing credible network connecting architecture
CN110740044B (en) Data processing method, device, system and storage medium
US20200169389A1 (en) Creating a blockchain account and verifying blockchain transactions
CN111476573B (en) Account data processing method, device, equipment and storage medium
CN113255014B (en) Data processing method based on block chain and related equipment
CN110855688B (en) Block chain information processing method and related equipment
CN117311985A (en) Block chain-based data processing method and device and readable storage medium
CN117544631A (en) Block chain-based data processing method and device and readable storage medium
CN115409511A (en) Personal information protection system based on block chain
CN114301912A (en) Information interaction method and device based on block chain
CN111414588B (en) Authorization key generation method, authorization key generation device and authorization server
CN117557261A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN117032998B (en) Block chain-based data processing method and device and readable storage medium
CN111198763A (en) Resource reuse detection method, terminal and computer-readable storage medium
CN111369332A (en) Data processing method and device based on block chain
US20230222509A1 (en) Method, terminal, and coin register for transmitting electronic coin data sets
US20240054459A1 (en) Systems and methods for securely sharing public blockchain addresses
CN117459237A (en) Block chain-based data processing method, equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication