CN117032998B - 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
CN117032998B
CN117032998B CN202311298090.2A CN202311298090A CN117032998B CN 117032998 B CN117032998 B CN 117032998B CN 202311298090 A CN202311298090 A CN 202311298090A CN 117032998 B CN117032998 B CN 117032998B
Authority
CN
China
Prior art keywords
resource
user address
information
data
transaction
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.)
Active
Application number
CN202311298090.2A
Other languages
Chinese (zh)
Other versions
CN117032998A (en
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 CN202311298090.2A priority Critical patent/CN117032998B/en
Publication of CN117032998A publication Critical patent/CN117032998A/en
Application granted granted Critical
Publication of CN117032998B publication Critical patent/CN117032998B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

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: 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; acquiring signed resource information by inquiring a gateway address indicated by the error information; 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. By adopting the method and the device, resources consumed on the chain can be saved by storing the resource data to be issued under the chain, so that the service cost is reduced, and the network resources of the block chain can be saved.

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 the intelligent contracts based on the blockchain can be applied to resource transaction among service nodes.
Currently, some business parties issue resource data for a plurality of objects in a blockchain network so as to realize popularization of business. However, the operation of issuing the resource data requires the payment chain to consume the resource, but not every issued resource data is used by the object, so that when the resource data is issued but not used, the resource is wasted, the service cost is increased, and the network resource of the blockchain is wasted by the invalid issuing operation.
Disclosure of Invention
The embodiment of the application provides a data processing method and device based on a block chain and a readable storage medium, which can save network resources of the block chain and reduce service cost.
An aspect of an embodiment of the present application provides a data processing method based on a blockchain, including:
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.
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 user address in a resource query request sent by the terminal equipment;
the second acquisition module is used for acquiring query error information when the resource issuing variable associated with the user address indicates that the resource is not issued; 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;
the third acquisition module is used for acquiring signed resource information through the gateway address indicated by the query 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;
the first signature verification module is used for verifying signature information in the signed resource information based on a public key of the service party;
the first data processing module is used for determining the total resource value corresponding to the user address based on the resource data in the signed resource information and the resource data of the user address on the chain of the block chain network when the signature verification is successful, 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.
The resource query request is used for calling an under-chain resource query interface in an intelligent contract in the blockchain network, and the user address is written into the under-chain resource query interface; the data processing apparatus further includes:
a fourth obtaining module, configured to obtain, through an under-link resource query interface, a resource issuing variable associated with a user address;
the first determining module is used for determining that the resource issuing variable indicates that the resource is not issued when the resource issuing variable is the first identifier;
the second determining module is used for determining that the resource issuing variable indicates that the resource is issued when the resource issuing variable is the second identifier;
the second acquisition module is specifically configured to acquire query error information returned by the intelligent contract when the resource issuing variable is the first identifier; the query error information includes a gateway address associated with the user address.
Wherein, the third acquisition module includes:
the first transmission unit is used for sending the query error information to the terminal equipment so that the terminal equipment obtains signed resource information from the gateway equipment according to the gateway address indicated by the query error information;
the first interface calling unit is used for writing signed resource information and a user address sent by the terminal equipment into the query verification interface based on a call request of the terminal equipment to the query verification interface of the intelligent contract; the inquiry verification interface is used for verifying signature information in the signed resource information.
Wherein the first data processing module comprises:
the first acquisition unit is used for acquiring resource data of the user address on a first chain of the blockchain network by inquiring the user address in the verification interface when the verification is successful;
a first determining unit, configured to determine a sum of resource values corresponding to the resource data in the signed resource information and the resource data on the first chain as a total resource value corresponding to the user address;
and the second transmission unit is used for sending the total resource value to the terminal equipment through the query verification interface so as to enable the terminal equipment to display the total resource value.
Wherein, first tag module includes:
the hash acquisition unit is used for carrying out decryption operation on signature information in the signed resource information based on the public key of the service party to obtain a hash value to be verified;
a hash generation unit for generating a target hash value of the resource data in the signed resource information;
the hash verification unit is used for determining that the verification is successful if the hash value to be verified is the same as the target hash value;
the hash verification unit is further used for determining that the signature verification fails if the hash value to be verified is different from the target hash value, and returning error reporting information to the terminal equipment and the service party.
Wherein, still include:
and the second data processing module is used for acquiring the resource value corresponding to the resource data on the first chain of the user address on the block chain network when the resource issuing variable associated with the user address indicates that the resource has been issued, and sending the resource value corresponding to the resource data on the first chain to the terminal equipment so that the terminal equipment displays the resource value corresponding to the resource data on the first chain.
Wherein, still include:
a fifth obtaining module, configured to obtain a user address in the resource transaction request when the resource transaction request sent by the terminal device is received;
a sixth obtaining module, configured to obtain query error information when a resource issuing variable associated with the user address indicates that the resource is not issued;
a seventh obtaining module, configured to obtain signed resource information by querying a gateway address indicated by the error information;
the second signature verification module is used for verifying signature information in the signed resource information based on the public key of the service party;
the first uplink module is used for issuing the resource data in the signed resource information to the user address in the block chain network when the signature verification is successful, so as to obtain the resource data on the update chain associated with the user address; the resource data on the update chain contains the resource data in the signed resource information;
And the first transaction module is used for executing transaction business indicated by the resource transaction request in the blockchain network by updating the resource data on the chain.
Wherein the resource transaction request is for invoking a transaction interface in an intelligent contract in the blockchain network, the data processing device further comprising:
an eighth obtaining module, configured to obtain a resource issuing variable associated with a user address;
and the second transaction module is used for executing the transaction business indicated by the resource transaction request in the blockchain network through the transaction interface and the resource data of the user address on the first chain of the blockchain network if the resource issuing variable associated with the user address indicates that the resource is issued.
Wherein, seventh acquisition module includes:
the second acquisition unit is used for sending the query error information to the terminal equipment so that the terminal equipment acquires the signed resource information from the gateway equipment according to the gateway address indicated by the query error information;
the second interface calling unit is used for writing signed resource information and a user address sent by the terminal equipment into the transaction verification interface based on a calling request of the terminal equipment to the transaction verification interface of the intelligent contract; the transaction verification interface is used for verifying signature information in the signed resource information.
Wherein, a first uplink module includes:
the first uplink unit is used for issuing the resource data in the signed resource information to the user address through the transaction verification interface when the signature verification is successful;
a second determining unit configured to determine, as update on-chain resource data associated with the user address, a sum of resource data in the issued signed resource information and on-chain resource data in the user address before issuance;
the first transaction module is specifically configured to execute a transaction service indicated by a resource transaction request in the blockchain network through the transaction verification interface and the update of resource data on the chain.
Wherein, first uplink module still includes:
the first updating unit is used for updating the resource issuing variable from the first identifier to the second identifier when the resource data in the signed resource information is successfully issued; the first identifier is used for indicating that the resource is not released by the resource release variable, and the second identifier is used for indicating that the resource is released by the resource release variable.
Wherein the first transaction module comprises:
the third determining unit is used for determining the address of the user participating in the transaction, the address of the user to be transacted and the value of the resource to be transacted in the resource transaction request as the value of the resource to be transacted;
The first signature unit is used for signing the transaction to be uplink based on a private key of the user address to obtain a transaction signature;
the block generation unit is used for packaging the transaction signature and the transaction to be uplink to generate a block to be uplink;
the third transmission unit is used for executing the to-be-uplinked transaction in the to-be-uplinked block to obtain a transaction execution result, and sending the transaction execution result and the to-be-uplinked block to a consensus network in the blockchain network; the transaction execution result comprises resource states respectively corresponding to the user address and the transacted user address after resource transfer based on the value of the resources to be transacted;
and the second updating unit is used for determining the block to be uplinked as the uplinked block when the consensus network successfully consensus the transaction execution result and the block to be uplinked, and carrying out numerical value updating on the resource states corresponding to the user address and the user address to be transacted respectively through the transaction execution result.
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, when the terminal device only initiates a resource query request, the resource state corresponding to the user address is queried through the link resource query interface, if the resource issuing variable indicates that the unpublished link resource data (namely, the resource data provided by the service party in the signed resource information) exists, the link resource data corresponding to the user address is queried, and the sum of the link resource data corresponding to the user address and the link resource data is sent to the terminal device so that the terminal device can display the resource. It can be seen that the service side stores the resource data under the chain without performing on-chain issuing operation, and still can provide the display function of the total resource data (i.e. the sum of the resource data under the chain and the resource data on the chain) for the user with the query requirement. In addition, when the terminal equipment initiates the transaction service, the resource data of the service party can be issued to the user address on the blockchain network, in other words, before the user initiates the transaction, whether the resource data is queried or not can be avoided, the resource consumption and the resource loss on the chain are avoided because the resource data is not used after being issued on the chain, so that the service cost of the service party can be reduced, and the unused resource data under the chain can not be executed for issuing operation on the chain, thereby saving the network resource of the blockchain.
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 schematic diagram of a block chain based data processing apparatus according to an embodiment of the present application;
fig. 7 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
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 when a blockchain is used in some contexts of a government or commercial establishment, not all participating nodes in the blockchain (i.e., blockchain nodes in the blockchain network described above) have sufficient resources and necessity to become 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 understood that the present application may be applied to a data processing scheme based on a blockchain in various forms, and the following description will take resource data for processing electronic red packet airdrop as an example, please refer to fig. 2 together, which is a schematic view of a scenario of a blockchain-based data processing method according to an embodiment of the present application. As shown in fig. 2, the flow for implementing the data processing scenario may include modules such as under-chain resource data query, on-chain resource data query, and total resource data determination, where the terminal device 20a shown in fig. 2 may send a resource query request to a blockchain node, where the blockchain node may be any blockchain node corresponding to the blockchain network shown in fig. 1, 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 terminal device 20a sends a resource query request to the blockchain node, where the resource query request may include a user address, and the blockchain node may invoke the downlink resource query interface 20b according to the resource query request. The resource issuing variable associated with the user address is acquired through the above-described link-down resource inquiry interface 20b, and is used to indicate the issuing status of the resource data provided for the user address. If the resource issuing variable indicates that the resource has been issued, directly querying the on-link resource data 20c on the blockchain network for the user address, and sending the resource value corresponding to the on-link resource data 20c to the terminal device 20a, where the terminal device 20a may display the resource value corresponding to the on-link resource data 20c corresponding to the user address on a screen. If the resource issuing variable indicates that the resource is not issued, the blockchain node returns query error information 20d to the terminal device 20a, where the query error information 20d may include a gateway address storing the unpublished resource data, and the terminal device 20a may obtain signed resource information according to the gateway address to its corresponding gateway 20f, where the signed resource information may be stored in the gateway 20f by the service party 20e, and the signed resource information may include air-dropped resource data, a user address, and signature information, where the signature information refers to signature information obtained by encrypting, by the service party 20e, a hash digest of the resource data and the user address according to a private key of the service party 20 e. The terminal device then writes the signed resource information and the user address to the inquiry authentication interface 20g, said inquiry authentication interface 20g being invoked on the basis of the resource inquiry request sent by the terminal device 20a, and invoking said inquiry authentication interface 20g enables to check said signed resource information. If the verification fails, returning error information to the terminal equipment 20a and the service party 20 e; if the verification is successful, inquiring the resource data 20h in the on-chain resource data 20c and the signed resource information aiming at the user address on the block chain network, and determining the sum of the resource data 20c and the resource data 20h in the signed resource information as the total resource data 20i. The block link transmits the above-mentioned total resource data 20i to the terminal device 20a, and the terminal device can display the total resource data 20i on a screen.
Therefore, the embodiment of the application can store the resource data under the chain without performing the on-chain issuing operation, but still can provide the display function of the total resource data (namely the sum of the under-chain resource data and the on-chain resource data) for the user with the query requirement, and the resource data of the business side is not issued to the blockchain in the query process, so that the whole query process can not consume resources. In addition, when the terminal equipment initiates the transaction service, the resource data of the service party can be issued to the user address on the blockchain network, in other words, before the user initiates the transaction, whether the resource data is queried or not can be avoided, the resource consumption and the resource loss on the chain are avoided because the resource data is not used after being issued on the chain, so that the service cost of the service party can be reduced, and the unused resource data under the chain can not be executed for issuing operation on the chain, thereby saving the network resource of the blockchain.
Further, referring to fig. 3, fig. 3 is a flow chart of a data processing method based on a blockchain according to an embodiment of the present application. The data processing method may be performed by a blockchain node, for example, any blockchain node in the blockchain network in the embodiment corresponding to fig. 1, and the blockchain node will be described below as an example of an execution body.
Step S101, a user address in a resource query request sent by a terminal device is obtained.
Specifically, the terminal device sends a resource query request to the block link, where the resource query request may include a user address for querying resource data and a function identifier for calling an under-link resource query interface. After receiving the resource query request, the blockchain node obtains the user address, invokes an under-chain resource query interface (the under-chain resource query interface may be called as balanceOf (addr) interface) in the intelligent contract through a function identifier carried in the resource query request, and queries the issue condition of under-chain resource data corresponding to the user address through the invoked under-chain resource query interface, where the under-chain resource data is non-issued resource data stored in an under-chain gateway in an air drop of a service party scheduled to send to the user address.
Step S102, if the variable issued by the resource associated with the user address indicates that the resource is not issued, acquiring query error information; the variable issued by the resource associated with the user address is used to indicate the issue status of the resource associated with the user address.
Specifically, the block link point invokes an under-chain resource query interface according to the resource query request, writes a user address to be queried into the under-chain resource query interface, obtains a resource issuing variable associated with the user address through the under-chain resource query interface (the resource issuing variable may also be referred to as a classified [ addr ], addr represents the user address), the resource issuing variable is used for indicating the issuing state of the service policy on the resource data provided by the user address, for example, the resource issuing variable may be divided into two types of identifiers of issued resource and non-issued resource, an identifier representing that the issued resource is used for indicating that the issued resource address does not have the under-chain resource data associated with the issued resource, and after identifying the identifier representing that the issued resource, the block link point skips the step of querying the under-chain resource data, directly queries the on-chain resource data corresponding to the user address, where the on-chain resource data refers to the resource data issued to the block link network and can be dominated by the user. In addition, the identifier representing the non-issue of the resource is used for indicating that the user address has the under-chain resource data associated with the user address, and after the block link point identifies the identifier representing the non-issue of the resource, the under-chain resource data corresponding to the user address is queried first, and then the on-chain resource data corresponding to the user address is queried.
Specifically, after the blockchain node identifies the identifier that represents the unpublished resource, a query error message is returned to the terminal device, where the query error message may include a gateway address of a gateway for storing the resource data under the chain corresponding to the user address.
Step S103, 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 that is not published in the blockchain network.
Specifically, after receiving the query error information returned by the block link point, the terminal device obtains signed resource information from the corresponding gateway according to the gateway address carried in the query error information. It can be understood that the above signed resource information may include a user address, resource data (also may be referred to as downlink resource data), and signature information, where the signed resource information may be an air drop stored in a gateway corresponding to the user address by a service party, or an air drop obtained in other manners, which is not limited in this application. The air drop can be a game prop in a cloud game scene, and can also be resource data such as an electronic red packet, and the application is not limited to the above.
The signature information is obtained by signing the resource data by using a private key of a service party, specifically, the service party obtains a user address and a hash abstract of the resource data through calculation of a hash function according to an air drop original text, and then encrypts and signs the hash abstract according to the private key of the service party to obtain signature information corresponding to the user address and the resource data.
Step S104, signature verification is carried out on the signature information in the signed resource information based on the public key of the service party.
Specifically, the terminal device may initiate a call request carrying signed resource information and a function identifier of a query verification interface (the query verification interface may also be referred to as a baranceofwithsig interface) to the blockchain node, where the blockchain node further invokes the query verification interface in the intelligent contract based on the function identifier of the query verification interface, the blockchain node may write an airdrop parameter and a context information parameter for the query verification interface based on the signed resource information in the call request, where the airdrop parameter may include the signed resource information obtained from the gateway, and the context information parameter may include a user address. Further, the signed resource information is checked and signed through a query verification interface.
It can be understood that the block link point decrypts the signature information in the signed resource information based on the public key of the service party to obtain the hash value to be verified; the block chain node acquires the user address and the resource data in the signed resource information, and carries out hash abstract calculation on the user address and the resource data through a hash function to obtain a target hash value; finally, the block chain node compares the hash value to be verified with the target hash value, and if the hash value to be verified is the same as the target hash value, the verification is determined to be successful; if the hash value to be verified is different from the target hash value, determining that the verification fails, and returning error information to the service party and the terminal equipment.
Step S105, 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.
Specifically, if the signed resource information is determined to be successfully checked by the query verification interface, adding the on-link resource data to the resource data in the signed resource information to obtain a total resource data value corresponding to the user address. Further, the total resource value is sent to the terminal device, and the terminal device can display the total resource value. It should be noted that, the resource data in the signed resource information at this time does not consume resources on the chain, is not issued to the blockchain network, but is stored under the chain, and the on-chain issue operation is performed when the subsequent terminal device uses the resource data, for example, when the terminal device initiates a transaction service.
It may be understood that the above operation is performed based on the condition that the resource issue variable associated with the user address indicates that the resource is not issued, and optionally, if the resource issue variable associated with the user address indicates that the resource is issued, the blockchain node directly obtains the resource value corresponding to the on-chain resource data of the user address on the blockchain network, without obtaining the on-chain data resource, and further sends the resource value corresponding to the on-chain resource data to the terminal device, so that the terminal device displays the resource value corresponding to the on-chain resource data.
In summary, the service side stores the resource data under the chain without performing on-chain issuing operation, but the service side still can provide the display function of the total resource data for the user with the query requirement, and the resource data of the service side is not issued to the blockchain in the query process, so that the whole query process does not consume resources. In addition, when the terminal equipment initiates the transaction service, the resource data of the service party can be issued to the user address on the blockchain network, in other words, before the user initiates the transaction, whether the resource data is queried or not can be avoided, the resource consumption and the resource loss on the chain are avoided because the resource data is not used after being issued on the chain, so that the service cost of the service party can be reduced, and the unused resource data under the chain can not be executed for issuing operation on the chain, thereby saving the network resource of the blockchain.
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 transaction service mentioned in the embodiment corresponding to fig. 3, and the data processing method may be performed by a 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 the steps of:
step S201, if a resource transaction request sent by a terminal device is received, a user address in the resource transaction request is obtained.
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. As shown in fig. 5, the terminal device 50a sends a resource transaction request to the blockchain link, which may include a user address, a transacted user address, and a value of the resource to be transacted, a function identification for invoking a transaction interface 50b in an intelligent contract in the blockchain network. After receiving the resource transaction request, the block link point acquires the user address in the resource transaction request.
In step S202, if the resource issue variable associated with the user address indicates that the resource is not issued, the query error information is obtained.
Specifically, referring to fig. 5 again, the blockchain node invokes the transaction interface 50b (the transaction interface may also be referred to as a Transfer interface) through the function identifier in the resource transaction request, and obtains, through the transaction interface 50b, a resource issue variable 50c (the resource issue variable may also be referred to as a client [ addr ], addr may represent the user address) associated with the user address, where the resource issue variable may be divided into a first identifier indicating that the resource variable is not issued, and a second identifier indicating that the resource variable is issued, which is used to indicate an issue state of the resource data provided by the service policy on the user address, and the specific form of the resource issue variable is not limited in the present application. If the resource issuing variable indicates that the resource is not issued, that is, the resource issuing variable is the first identifier, the blockchain node returns query error information 50e to the terminal device 50a, where the query error information 50e may include a gateway address storing the downlink resource data corresponding to the user address, and the terminal device 50a may obtain the corresponding downlink resource data according to the gateway address to the corresponding gateway, where the downlink resource data refers to the unpublished resource data stored in the downlink gateway in the airdrop that the service party plans to send to the user address.
It will be appreciated that the above description is made with respect to the case where the resource issue variable indicates that the resource is not issued, and optionally, if the resource issue variable indicates that the resource is issued, that is, the resource issue variable is the second identifier, the blockchain node directly invokes the transaction interface 50b, and completes the transaction service 50d through the transaction interface 50b and the resource data on the chain of the user address on the blockchain network.
Step S203, the signed resource information is obtained by querying the gateway address indicated by the error information.
Specifically, referring to fig. 5 again, the terminal device 50a obtains, from the gateway 50g corresponding to the gateway address, signed resource information sent by the service party 50f according to the gateway address obtained by the query error information 50e, and it can be understood that the signed resource information may include a user address, resource data, and signature information, where the signed resource information may be an airdrop sent by the service party 50f and stored in the gateway 50g corresponding to the user address, or may be an airdrop obtained in other manners, which is not limited in this application, and the airdrop may be a game prop in a cloud game scene, or may be resource data such as an electronic red packet.
The resource data is for being issued to the corresponding user address on the blockchain network when the terminal device 50a initiates a transaction service. The signature information is obtained by signing the resource data by using a private key of the service party 50f, specifically, the service party 50f calculates a hash digest of the user address and the resource data through a hash function, and then encrypts and signs the hash digest according to the private key of the service party 50f to obtain signature information corresponding to the user address and the resource data.
Step S204, signature verification is carried out on the signature information in the signed resource information based on the public key of the service party.
Specifically, referring to fig. 5 again, the terminal device 50a may initiate a call request carrying the signed resource information and the function identifier of the transaction verification interface 50h (the transaction verification interface may also be referred to as a transfer wissig interface) to the blockchain node, and the blockchain node may write the signed resource information obtained by the terminal device 50a from the gateway 50g into the transaction verification interface 50h based on the signed resource information in the call request, where the transaction verification interface 50h is used to verify the signature information in the signed resource information.
It can be understood that the block link point decrypts the signature information in the signed resource information based on the public key of the service party 50f to obtain the hash value to be verified; the block chain node performs hash abstract calculation through a hash function based on the user address and the resource data in the signed resource information to obtain a target hash value; and finally, the block chain node compares the hash value to be verified with the target hash value, if the hash value to be verified is the same as the target hash value, the verification is successful, and if the hash value to be verified is different from the target hash value, the verification is failed, and error information is returned to the service party 50f and the terminal equipment 50 a.
Step S205, if the signature verification is successful, the resource data in the signed resource information is issued to the user address in the blockchain network, and the resource data on the update chain associated with the user address is obtained; the resource data on the update chain contains the resource data in the signed resource information.
Specifically, referring to fig. 5 again, if it is determined that the signed resource information is successfully signed, the blockchain node issues the resource data in the signed resource information to the user address. It will be appreciated that the specific flow of distribution may be: taking the address of the service party 50f, the user address, the resource data in the signed resource information and the transfer relation between the address of the service party 50f and the user address as a transaction to be uplink, and sending the transaction to be uplink to a blockchain network to generate a block containing the transaction to be uplink; in a block chain consensus network, performing consensus verification on the blocks; after the common identification passes, the block is stored in a block chain account book in a block chain network to finish the uplink operation, namely, the resource data in the signed resource information is successfully issued to the user address, and the user corresponding to the user address has the authority to control the resource data.
Further, after the resource data is successfully issued, the blockchain node updates the user address and the on-chain resource data value corresponding to the service 50 f. Specifically, the difference between the on-chain resource data corresponding to the service party 50f and the resource data in the signed resource information is determined as the updated on-chain resource data of the service party 50 f; and determining the sum of the on-chain resource data corresponding to the user address and the resource data in the signed resource information as update on-chain resource data 50i corresponding to the user address.
It should be noted that, after the resource data is successfully uplink, the blockchain node also updates the resource issue variable 50c corresponding to the user address, updates the resource issue variable 50c indicating that the resource is not issued to the resource issue variable 50c indicating that the resource is issued, i.e. updates the first identifier to the second identifier. Optionally, the blockchain node may update the resource issuing variable 50c corresponding to the user address after the transaction is completed.
It can be appreciated that after the resource data is used, the update of the resource issuing variable 50c by the blockchain node can ensure that the same resource data cannot be reused, thereby ensuring the integrity of the data and maintaining the security of the blockchain network.
Step S206, executing the transaction business indicated by the resource transaction request in the blockchain network by updating the resource data on the chain.
Specifically, referring to fig. 5 again, the blockchain node executes the transaction service 50d indicated by the resource transaction request in the blockchain network by calling the transaction verification interface 50h and updating the resource data 50i on the chain, and the specific flow may be: the block link point determines the user address participating in the transaction, the address of the user to be transacted and the value of the resource to be transacted in the resource transaction request as the value of the resource to be transacted; the block chain link point calculates the hash abstract of the transaction to be uplink, and then carries out encryption signature operation on the hash abstract of the transaction to be uplink through a private key of a user address to obtain a transaction signature; the block chain link point packages the transaction signature and the transaction to be uplink to generate a block to be uplink; and the block chain link point executes the transaction to be uplink in the block to be uplink to obtain a transaction execution result after the transaction. For example, the to-be-uplink transaction may be exchange or transfer of resource data, which is not limited in this application, and the transaction execution result may include a resource state corresponding to the user address and the user address to be transacted after resource transfer is performed based on the to-be-transacted resource value, for example, may be a resource data value of both parties participating in the transaction after the transaction is completed; the block chain node can send the transaction execution result and the block to be uplinked to other block chain nodes in the consensus network together, and the consensus network performs consensus verification on the transaction execution result and the block to be uplinked; if the transaction execution result and the block to be uplinked are successfully identified, determining the block to be uplinked as an uplinked block, wherein the user to be transacted has the authority to govern the resource data in the uplinked block; finally, the numerical value of the resource states corresponding to the user address and the user address to be transacted is updated according to the transaction execution result, for example, if the transaction to be uplink is the transfer of the resource data, the difference between the on-chain resource data before the user address transaction and the resource data to be transacted is used as the resource data after the user address update; and taking the sum of the on-chain resource data before the address of the transacted user is transacted and the resource data to be transacted as the resource data updated by the address of the transacted user.
It should be understood that, the above description of the transaction for the update on-link resource data 50i is based on the fact that the resource issue variable 50c indicates that the resource is not issued, where the update on-link resource data 50i represents the available on-link resource data corresponding to the user address, and optionally, the above description of the process for the transaction service 50d when the resource issue variable 50c indicates that the resource is issued, and the above method flow may also be applied, and it should be noted that, in the case that the resource issue variable 50c indicates that the resource data involved in the transaction is the on-link resource data corresponding to the user address in the case that the resource is issued.
In summary, the service side stores the resource data under the chain without performing on-chain issuing operation, and still can provide the display function of the total resource data for the user with the query requirement. In addition, when the terminal equipment initiates the transaction service, the resource data of the service party can be issued to the user address on the blockchain network, in other words, before the user initiates the transaction, whether the resource data is queried or not can be avoided, the resource consumption and the resource loss on the chain are avoided because the resource data is not used after being issued on the chain, so that the service cost of the service party can be reduced, and the unused resource data under the chain can not be executed for issuing operation on the chain, thereby saving the network resource of the blockchain.
Fig. 6 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. 6, the data processing apparatus 1 may include: a first acquisition module 101, a second acquisition module 102, a third acquisition module 103, a first signature verification module 104 and a first data processing module 105.
A first obtaining module 101, configured to obtain a user address in a resource query request sent by a terminal device;
a second obtaining module 102, configured to obtain query error information when a resource issuing variable associated with a user address indicates that a resource is not issued; 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;
the method is particularly used for acquiring query error information returned by the intelligent contract when the resource issuing variable is the first identifier; the query error information includes a gateway address associated with the user address;
A third obtaining module 103, configured to obtain signed resource information by querying 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;
the first signature verification module 104 is configured to verify signature information in the signed resource information based on a public key of the service party;
the first data processing module 105 is configured to determine 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 when the signature verification is successful, and send the total resource value to the terminal device, so that the terminal device 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.
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 functional implementation manner of the second obtaining module 102 may refer to step S102 in the embodiment corresponding to fig. 3; the specific implementation manner of the function of the third obtaining module 103 may refer to step S103 in the embodiment corresponding to fig. 3; the specific functional implementation manner of the first signature verification module 104 may refer to step S104 in the embodiment corresponding to fig. 3; the specific functional implementation manner of the first data processing module 105 may refer to step S105 in the embodiment corresponding to fig. 3, and will not be described herein.
Referring to fig. 6 again, the data processing apparatus 1 may further include: a fourth acquisition module 106, a first determination module 107, a second determination module 108.
A fourth obtaining module 106, configured to obtain, through an under-link resource query interface, a resource issuing variable associated with a user address;
a first determining module 107, configured to determine that the resource issue variable indicates that the resource is not issued when the resource issue variable is the first identifier;
a second determining module 108, configured to determine that the resource issue variable indicates that the resource has been issued when the resource issue variable is the second identifier;
the specific functional implementation manner of the fourth obtaining module 106, the first determining module 107, and the second determining module 108 may refer to the description of step S102 in the embodiment corresponding to fig. 3, and will not be described herein.
Referring to fig. 6 again, the data processing apparatus 1 may further include: a second data processing module 109.
And the second data processing module 109 is configured to obtain a resource value corresponding to the resource data on the first chain of the blockchain network when the resource issuing variable associated with the user address indicates that the resource has been issued, and send the resource value corresponding to the resource data on the first chain to the terminal device, so that the terminal device displays the resource value corresponding to the resource data on the first chain.
The specific functional implementation manner of the second data processing module 109 may refer to the description of the case of indicating that the resource has been issued for the resource issuing variable in step S102 in the embodiment corresponding to fig. 3, or may refer to the description of indicating that the resource has been issued for the resource issuing variable in step S105 in the embodiment corresponding to fig. 3, which is not repeated here.
Referring to fig. 6 again, the data processing apparatus 1 may further include: a fifth acquisition module 110, a sixth acquisition module 111, a seventh acquisition module 112, a second signature verification module 113, a first uplink module 114, a first transaction module 115.
A fifth obtaining module 110, configured to obtain, when receiving a resource transaction request sent by a terminal device, a user address in the resource transaction request;
a sixth obtaining module 111, configured to obtain query error information when the resource issuing variable associated with the user address indicates that the resource is not issued;
a seventh obtaining module 112, configured to obtain signed resource information by querying the gateway address indicated by the error information;
the second signature verification module 113 is configured to verify signature information in the signed resource information based on a public key of the service party;
The first uplink module 114 is configured to issue, when the signature verification is successful, resource data in the signed resource information to a user address in the blockchain network, so as to obtain update on-chain resource data associated with the user address; the resource data on the update chain contains the resource data in the signed resource information;
a first transaction module 115 for executing a transaction service indicated by a resource transaction request in the blockchain network by updating the on-chain resource data;
the first transaction module 115 is specifically configured to execute a transaction service indicated by a resource transaction request in the blockchain network through the transaction verification interface and updating the on-chain resource data.
The specific implementation manner of the function of the fifth obtaining module 110 may refer to step S201 in the embodiment corresponding to fig. 4; the specific function implementation manner of the sixth obtaining module 111 may refer to step S202 in the embodiment corresponding to fig. 4; the specific implementation of the seventh obtaining module 112 may refer to step S203 in the embodiment corresponding to fig. 4; the specific functional implementation manner of the second signature verification module 113 may refer to step S204 in the embodiment corresponding to fig. 4; the specific function implementation manner of the first uplink module 114 may refer to step S205 in the embodiment corresponding to fig. 4; the specific functional implementation manner of the first transaction module 115 may refer to step S206 in the embodiment corresponding to fig. 4, and will not be described herein.
Referring to fig. 6 again, the data processing apparatus 1 may further include: an eighth acquisition module 116, a second transaction module 117.
An eighth obtaining module 116, configured to obtain a resource issuing variable associated with the user address;
the second transaction module 117 is configured to execute, in the blockchain network, the transaction service indicated by the resource transaction request through the transaction interface and the user address on the first link on the blockchain network if the resource issuing variable associated with the user address indicates that the resource has been issued.
The specific implementation of the function of the eight acquiring module 116 may refer to step S202 in the embodiment corresponding to fig. 4; the specific function implementation manner of the second transaction module 117 may be described with respect to the case that the resource issue variable indicates that the resource has been issued in step S202 in the embodiment corresponding to fig. 4, or may be described with respect to the case that the resource issue variable indicates that the resource has been issued in step S206 in the embodiment corresponding to fig. 4, which will not be described in detail here.
Referring to fig. 6 again, the third obtaining module 103 may include: a first transmission unit 1031, and a first interface calling unit 1032.
A first transmission unit 1031, configured to send query error information to a terminal device, so that the terminal device obtains signed resource information from the gateway device according to a gateway address indicated by the query error information;
a first interface calling unit 1032, configured to write, based on a call request from the terminal device to the query verification interface of the intelligent contract, signed resource information and a user address sent by the terminal device into the query verification interface; the inquiry verification interface is used for verifying signature information in the signed resource information.
The specific function implementation manner of the first transmission unit 1031 and the first interface calling unit 1032 may refer to step S103 in the embodiment corresponding to fig. 3.
Referring again to fig. 6, the first signature verification module 104 may include: a hash acquisition unit 1041, a hash generation unit 1042, and a hash verification unit 1043.
A hash obtaining unit 1041, configured to decrypt the signature information in the signed resource information based on the public key of the service party, to obtain a hash value to be verified;
a hash generation unit 1042 for generating a target hash value of the resource data in the signed resource information;
the hash verification unit 1043 is configured to determine that the signature verification is successful when the hash value to be verified is the same as the target hash value;
The hash verification unit 1043 is further configured to determine that the signature verification fails if the hash value to be verified is different from the target hash value, and return error reporting information to the terminal device and the service party.
The specific functional implementation manner of the hash obtaining unit 1041, the hash generating unit 1042, and the hash verifying unit 1043 may refer to step S104 in the embodiment corresponding to fig. 3, or may refer to step S204 in the embodiment corresponding to fig. 4, which is not described herein.
Referring again to fig. 6, the first data processing module 105 may include: a first acquisition unit 1051, a first determination unit 1052, a second transmission unit 1053.
A first obtaining unit 1051, configured to obtain, when the verification is successful, resource data of the user address on a first chain on the blockchain network by querying the user address in the verification interface;
a first determining unit 1052, configured to determine a sum of resource values corresponding to the resource data in the signed resource information and the resource data on the first chain as a total resource value corresponding to the user address;
the second transmission unit 1053 is configured to send the total resource value to the terminal device through the query verification interface, so that the terminal device displays the total resource value.
The specific function implementation manner of the first acquiring unit 1051, the first determining unit 1052, and the second transmitting unit 1053 may refer to step S105 in the embodiment corresponding to fig. 3, and will not be described herein.
Referring again to fig. 6, the seventh obtaining module 112 may include: a second acquisition unit 1121, and a second interface call unit 1122.
A second obtaining unit 1121, configured to send query error information to the terminal device, so that the terminal device obtains signed resource information from the gateway device according to the gateway address indicated by the query error information;
a second interface invoking unit 1122, configured to write the signed resource information and the user address sent by the terminal device into the transaction verification interface based on the invoking request of the terminal device to the transaction verification interface of the intelligent contract; the transaction verification interface is used for verifying signature information in the signed resource information.
The specific function implementation manner of the second obtaining unit 1121 and the second interface invoking unit 1122 may refer to step S202 in the embodiment corresponding to fig. 4, and will not be described herein.
Referring again to fig. 6, the first uplink module 114 may include: a first uplink unit 1141, a second determination unit 1142, and a first update unit 1143.
The first uplink unit 1141 is configured to issue, when the signature verification is successful, resource data in the signed resource information to the user address through the transaction verification interface;
a second determining unit 1142 configured to determine a sum of resource data in the issued signed resource information and on-chain resource data in the user address before issue as update on-chain resource data associated with the user address;
a first updating unit 1143, configured to update the resource issuing variable from the first identifier to the second identifier when the resource data in the signed resource information is successfully issued; the first identifier is used for indicating that the resource is not released by the resource release variable, and the second identifier is used for indicating that the resource is released by the resource release variable.
The specific functional implementation manner of the first uplink unit 1141 and the second determining unit 1142 may refer to step S205 in the embodiment corresponding to fig. 4; the specific function implementation manner of the first updating unit 1143 may refer to the description of the resource issuing variable updating operation in step S205 in the embodiment corresponding to fig. 4, and will not be described herein.
Referring again to fig. 6, the first transaction module 115 may include: a third determination unit 1151, a first signature unit 1152, a block generation unit 1153, a third transmission unit 1154, and a second update unit 1155.
A third determining unit 1151, configured to determine, as a to-be-uplink transaction, a user address participating in the transaction in the resource transaction request, a user address to be transacted, and a value of a resource to be transacted;
a first signing unit 1152, configured to sign a transaction to be uplink based on a private key of the user address, to obtain a transaction signature;
a block generating unit 1153, configured to package the transaction signature and the transaction to be uplink, and generate a block to be uplink;
a third transmission unit 1154, configured to perform a to-be-uplink transaction in the to-be-uplink block, obtain a transaction execution result, and send the transaction execution result and the to-be-uplink block to a consensus network in the blockchain network; the transaction execution result comprises resource states respectively corresponding to the user address and the transacted user address after resource transfer based on the value of the resources to be transacted;
and a second updating unit 1155, configured to determine the block to be uplink as the already uplink block when the consensus network successfully consensus the transaction execution result and the block to be uplink, and update the values of the resource states corresponding to the user address and the user address to be transacted respectively according to the transaction execution result.
The specific functional implementation manners of the third determining unit 1151, the first signing unit 1152, the block generating unit 1153, the third transmitting unit 1154 and the second updating unit 1155 may refer to step S206 in the embodiment corresponding to fig. 4, and will not be described herein.
By the method provided by the embodiment of the application, different processing strategies can be adopted for the resource query request and the resource transaction request, when the resource query request is received, the service party stores the resource data under the chain instead of on-chain issuing operation, the display function of the total resource data can still be provided for the user with the query requirement, and in the query process, the resource data of the service party are not issued to the block chain, so that the whole query process can not consume resources. In addition, when the terminal equipment initiates the transaction service, the resource data of the service party can be issued to the user address on the blockchain network, in other words, before the user initiates the transaction, whether the resource data is queried or not can be avoided, the resource consumption and the resource loss on the chain are avoided because the resource data is not used after being issued on the chain, so that the service cost of the service party can be reduced, and the unused resource data under the chain is not executed for issuing operation on the chain, thereby saving the network resource of the blockchain.
Fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 7, 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. 7, 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. 7, 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 service party for the resource data provided by the user address;
acquiring signed resource information through a gateway address indicated by the query 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 a blockchain network;
signing verification is carried out on signature information in the signed resource information based on the 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 the 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, and 5, 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, in which the computer program executed by the aforementioned data processing apparatus 1 is stored, and the computer program includes program instructions, when executed by the aforementioned processor, can execute the description of the data processing method in any of the foregoing embodiments corresponding to fig. 2, 3, 4, and 5, and therefore, the description will not be repeated 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 in any of the corresponding embodiments of fig. 2, 3, 4, 5, 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 (15)

1. A blockchain-based data processing method, comprising:
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 service party for the resource data provided by the user address;
acquiring signed resource information through a gateway address indicated by the query 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 a blockchain network;
signing verification is carried out on signature information in the signed resource information based on the 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 used for being issued to the user address on the blockchain network when the terminal equipment initiates transaction service; the first identifier of the resource issuing variable is updated to be a second identifier when the resource data is issued to the user address; the first identifier is used for indicating that the resource issuing variable indicates that the resource is not issued, and the second identifier is used for indicating that the resource issuing variable indicates that the resource is issued.
2. The method of claim 1, wherein the resource query request is for invoking an under-chain resource query interface in a smart contract in the blockchain network, the user address being written to the under-chain resource query interface; the method further comprises the steps of:
acquiring a resource issuing variable associated with the user address through the link resource inquiry interface;
If the resource issuing variable is the first identifier, determining that the resource issuing variable indicates that the resource is not issued;
if the resource issuing variable is the second identifier, determining that the resource issuing variable indicates that the resource has been issued;
and if the resource issuing variable associated with the user address indicates that the resource is not issued, acquiring query error information, including:
if the resource issuing variable is the first identifier, acquiring query error information returned by the intelligent contract; the query error information includes a gateway address associated with the user address.
3. The method of claim 2, wherein the obtaining signed resource information by the gateway address indicated by the query error information comprises:
the inquiry error information is sent to the terminal equipment, so that the terminal equipment obtains signed resource information from the gateway equipment according to the gateway address indicated by the inquiry error information;
writing the signed resource information and the user address sent by the terminal equipment into a query verification interface based on a call request of the terminal equipment to the query verification interface of the intelligent contract; the inquiry verification interface is used for verifying signature information in the signed resource information.
4. The method according to claim 3, wherein 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 transmitting the total resource value to the terminal device, so that the terminal device displays the total resource value, including:
if the signature verification is successful, acquiring resource data of the user address on a first chain of the blockchain network through the user address in the query verification interface;
determining the sum of the resource data in the signed resource information and the resource value corresponding to the resource data on the first chain as the total resource value corresponding to the user address;
and sending the total resource value to the terminal equipment through the inquiry verification interface so that the terminal equipment displays the total resource value.
5. The method of claim 1, wherein signing the signature information in the signed resource information based on the public key of the business party comprises:
decrypting signature information in the signed resource information based on the public key of the service party to obtain a hash value to be verified;
Generating a target hash value of the resource data in the signed resource information;
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, and returning error reporting information to the terminal equipment and the service party.
6. The method as recited in claim 1, further comprising:
if the resource issuing variable associated with the user address indicates that the resource is issued, acquiring a resource value corresponding to the resource data of the user address on a first chain on the block chain network, and sending the resource value corresponding to the resource data on the first chain to the terminal equipment so that the terminal equipment displays the resource value corresponding to the resource data on the first chain.
7. The method as recited in claim 1, further comprising:
if a resource transaction request sent by the terminal equipment is received, acquiring the user address in the resource transaction request;
if the resource issuing variable associated with the user address indicates that the resource is not issued, acquiring the query error information;
Acquiring the signed resource information through the gateway address indicated by the query error information;
signing verification is carried out on signature information in the signed resource information based on the public key of the service party;
if the signature verification is successful, the resource data in the signed resource information is sent to the user address in the blockchain network, and the resource data on an update chain associated with the user address is obtained; the resource data on the update chain comprises the resource data in the signed resource information;
and executing the transaction business indicated by the resource transaction request in the blockchain network through the resource data on the update chain.
8. The method of claim 7, wherein the resource transaction request is for invoking a transaction interface in a smart contract in the blockchain network, the method further comprising:
acquiring the resource issuing variable associated with the user address;
and if the resource issuing variable associated with the user address indicates that the resource is issued, executing the transaction service indicated by the resource transaction request in the blockchain network through the transaction interface and the resource data of the user address on a first chain on the blockchain network.
9. The method of claim 8, wherein the obtaining the signed resource information by the gateway address indicated by the query error information comprises:
the inquiry error information is sent to the terminal equipment, so that the terminal equipment obtains the signed resource information from gateway equipment according to the gateway address indicated by the inquiry error information;
writing the signed resource information and the user address sent by the terminal equipment into the transaction verification interface based on a call request of the terminal equipment to the transaction verification interface of the intelligent contract; the transaction verification interface is used for verifying signature information in the signed resource information.
10. The method of claim 9, wherein if the signing is successful, transmitting the resource data in the signed resource information to the user address in the blockchain network to obtain the update on-chain resource data associated with the user address, comprising:
if the signature verification is successful, the resource data in the signed resource information is sent to the user address through the transaction verification interface;
Determining the sum of the resource data in the issued signed resource information and the on-chain resource data in the user address before issuing as the updated on-chain resource data associated with the user address;
the executing the transaction service indicated by the resource transaction request in the blockchain network through the resource data on the update chain comprises the following steps:
and executing the transaction business indicated by the resource transaction request in the blockchain network through the transaction verification interface and the resource data on the update chain.
11. The method as recited in claim 10, further comprising:
if the resource data in the signed resource information is successfully issued, updating the resource issuing variable from the first identifier to the second identifier; the first identifier is used for indicating that the resource issuing variable indicates that the resource is not issued, and the second identifier is used for indicating that the resource issuing variable indicates that the resource is issued.
12. The method of claim 7, wherein the executing the transaction traffic indicated by the resource transaction request in the blockchain network with the update-chain resource data comprises:
Determining the user address, the transacted user address and the value of the resources to be transacted which participate in the transaction in the resource transaction request as the resources to be transacted;
signing the transaction to be uplink based on the private key of the user address to obtain a transaction signature;
packaging the transaction signature and the transaction to be uplink to generate a block to be uplink;
executing the to-be-uplinked transaction in the to-be-uplinked block to obtain a transaction execution result, and sending the transaction execution result and the to-be-uplinked block to a consensus network in the blockchain network; the transaction execution result comprises resource states corresponding to the user address and the transacted user address respectively after resource transfer is carried out based on the value of the resources to be transacted;
and if the consensus network successfully consensus the transaction execution result and the block to be uplinked, determining the block to be uplinked as the uplinked block, and carrying out numerical value update on the resource states respectively corresponding to the user address and the user address to be transacted through the transaction execution result.
13. A blockchain-based data processing device, comprising:
The first acquisition module is used for acquiring a user address in a resource query request sent by the terminal equipment;
the second acquisition module is used for acquiring query error information when the resource issuing variable associated with the user address indicates that the resource is not issued; the resource issuing variable associated with the user address is used for indicating the issuing state of the service party for the resource data provided by the user address;
the third acquisition module is used for acquiring signed resource information through the gateway address indicated by the query 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 a blockchain network;
the first signature verification module is used for verifying signature information in the signed resource information based on the public key of the service party;
the data processing module is used for 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 when the signature verification is successful, 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 used for being issued to the user address on the blockchain network when the terminal equipment initiates transaction service; the first identifier of the resource issuing variable is updated to be a second identifier when the resource data is issued to the user address; the first identifier is used for indicating that the resource issuing variable indicates that the resource is not issued, and the second identifier is used for indicating that the resource issuing variable indicates that the resource is issued.
14. 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-12.
15. 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-12.
CN202311298090.2A 2023-10-09 2023-10-09 Block chain-based data processing method and device and readable storage medium Active CN117032998B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311298090.2A CN117032998B (en) 2023-10-09 2023-10-09 Block chain-based data processing method and device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311298090.2A CN117032998B (en) 2023-10-09 2023-10-09 Block chain-based data processing method and device and readable storage medium

Publications (2)

Publication Number Publication Date
CN117032998A CN117032998A (en) 2023-11-10
CN117032998B true CN117032998B (en) 2024-01-19

Family

ID=88641645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311298090.2A Active CN117032998B (en) 2023-10-09 2023-10-09 Block chain-based data processing method and device and readable storage medium

Country Status (1)

Country Link
CN (1) CN117032998B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107066893A (en) * 2017-02-28 2017-08-18 腾讯科技(深圳)有限公司 The treating method and apparatus of accounts information in block chain
CN111507839A (en) * 2020-04-15 2020-08-07 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and equipment
CN112200571A (en) * 2020-10-09 2021-01-08 支付宝(杭州)信息技术有限公司 Resource distribution method and device based on block chain and electronic equipment
CN112950181A (en) * 2021-02-26 2021-06-11 成都质数斯达克科技有限公司 Asset management method, electronic device and readable storage medium
CN113420087A (en) * 2021-06-22 2021-09-21 中国工商银行股份有限公司 Asset query method and device based on block chain

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190102163A1 (en) * 2017-10-04 2019-04-04 Dispatch Labs, LLC System and Method for a Blockchain-Supported Programmable Information Management and Data Distribution System
US20200143466A1 (en) * 2018-11-06 2020-05-07 Jianxin Wu Blockchain-based lending systems and methods
US11573952B2 (en) * 2020-05-04 2023-02-07 International Business Machines Corporation Private shared resource confirmations on blockchain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107066893A (en) * 2017-02-28 2017-08-18 腾讯科技(深圳)有限公司 The treating method and apparatus of accounts information in block chain
CN111507839A (en) * 2020-04-15 2020-08-07 腾讯科技(深圳)有限公司 Data processing method and device based on block chain, storage medium and equipment
CN112200571A (en) * 2020-10-09 2021-01-08 支付宝(杭州)信息技术有限公司 Resource distribution method and device based on block chain and electronic equipment
CN112950181A (en) * 2021-02-26 2021-06-11 成都质数斯达克科技有限公司 Asset management method, electronic device and readable storage medium
CN113420087A (en) * 2021-06-22 2021-09-21 中国工商银行股份有限公司 Asset query method and device based on block chain

Also Published As

Publication number Publication date
CN117032998A (en) 2023-11-10

Similar Documents

Publication Publication Date Title
US20220231869A1 (en) Cross-blockchain mutual data storage
TWI710979B (en) Cross-block chain interaction method, device, system, and electronic equipment
CN111461723B (en) Data processing system, method and device based on block chain
CN112685505B (en) Transaction data processing method and device, computer equipment and storage medium
WO2023020242A1 (en) Blockchain-based data processing method and apparatus, computer device, computer-readable storage medium, and computer program product
CN112804354B (en) Method and device for data transmission across chains, computer equipment and storage medium
CN111984735A (en) Data archiving method and device, electronic equipment and storage medium
CN112699136B (en) Cross-link certificate storage method and related device
CN117311985A (en) Block chain-based data processing method and device and readable storage medium
US20230259930A1 (en) Cross-chain transaction processing method and apparatus, electronic device, and storage medium
CN110458541B (en) Object replacement method and device based on block chain
CN117032998B (en) Block chain-based data processing method and device and readable storage medium
CN115409511B (en) Personal information protection system based on block chain
CN113014556B (en) Bank-enterprise communication system, communication method and electronic terminal
WO2023159827A1 (en) Information processing system based on cross-chain communication and multi-chain fusion
CN117010889A (en) Data processing method, device, equipment, medium and product
CN116804949B (en) Block chain-based data processing method, device, equipment and readable storage medium
CN110597466B (en) Control method and device of block chain node, storage medium and computer equipment
CN117056084B (en) Data processing method, device, equipment and medium based on hierarchical blockchain network
WO2024007855A1 (en) Data processing method and device based on blockchain, and readable storage medium
US20230325833A1 (en) Blockchain-based data processing method and apparatus, device, storage medium, and program product
CN117544631A (en) Block chain-based data processing method and device and readable storage medium
CN117557261A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN117176737A (en) Block chain-based data processing method, device, equipment and readable storage medium
CN117172782A (en) Data processing method and device based on block chain and related equipment

Legal Events

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