NFT contract identification method and apparatus, and related device

By obtaining and analyzing the signature field and source field in the log information of transaction information, the problem of incomplete NFT contract identification in the existing technology is solved, the accurate identification of NFT contract transactions is achieved, and the identification accuracy and credibility are improved. .

CN118540342AActive Publication Date: 2024-08-23BEIJING UNIV OF POSTS & TELECOMM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410385933.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-01
Publication Date
2024-08-23
Estimated Expiration
2044-04-01

AI Technical Summary

Technical Problem

Existing NFT contract identification methods cannot fully identify NFT contracts, especially when the contract does not implement the ERC-721 or ERC-1155 standard interface or the metadata storage method is inconsistent, leading to incomplete identification problems.

Method used

By obtaining the log information of the transaction information, using the signature field and source field to determine whether the transaction is an NFT contract transaction, including obtaining transaction information, determining the contract address, determining whether the signature field and source field match a specific type, and then identifying the NFT contract transaction. .

Benefits of technology

It improves the recognition accuracy and credibility of NFT contracts, enables more comprehensive identification of various forms of NFT contract transactions, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118540342A
    Figure CN118540342A
Patent Text Reader

Abstract

The invention provides an NFT contract identification method and apparatus, and related equipment. The method comprises the steps of obtaining transaction information; determining a contract address of the transaction information, and judging whether the transaction information belongs to a contract transaction according to the contract address; in response to the transaction information belonging to the contract transaction, obtaining log information of the transaction information, and determining whether a signature field of the log information accords with a specific type; in response to the condition that the signature field accords with the specific type, determining whether a first source field of the log information accords with a set condition; and determining that the transaction corresponding to the transaction information is the NFT contract transaction in response to the condition that the first source field meets the set condition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data identification technology, and in particular to an NFT contract identification method, device and related equipment. Background Art

[0002] There are currently two mainstream methods for NFT contract identification. One is to judge the interface of the smart contract, and the other is to perform metadata storage judgment based on the judgment of the smart contract interface.

[0003] However, the first method can only identify typical contracts; the second method is optimized on the basis of the first method, but this method has the problem of not storing in a third-party storage center, similar to the situation on ipfs. Therefore, both methods have the defect of not being able to fully identify NFT contracts. Summary of the invention

[0004] In view of this, the present application proposes an NFT contract identification method, device and related equipment to solve or partially solve the above problems.

[0005] Based on the above purpose, this application provides an NFT contract identification method, including:

[0006] Get transaction information;

[0007] Determine the contract address of the transaction information, and determine whether the transaction information belongs to a contract transaction according to the contract address;

[0008] In response to the transaction information belonging to the contract transaction, obtaining log information of the transaction information, and determining whether a signature field of the log information conforms to a specific type;

[0009] In response to the signature field being in accordance with the specific type, determining whether the first source field of the log information meets a set condition;

[0010] In response to the first source field meeting the set conditions, it is determined that the transaction corresponding to the transaction information is an NFT contract transaction.

[0011] In some implementations, obtaining transaction information includes:

[0012] Use remote call protocol to connect to the blockchain network;

[0013] Determine the block information of the blockchain network by returning a specified block instruction;

[0014] By returning the specified transaction object instruction, the transaction information in the block corresponding to the block information is determined.

[0015] In some implementations, determining the contract address of the transaction information includes:

[0016] Determining a second source field and an identification code field of the transaction information;

[0017] Performing recursive length prefix encoding on the second source field and the identification code field to determine a serialized format result of the second source field;

[0018] The serialized format result is decoded by the Keccak algorithm to obtain the contract address.

[0019] In some implementations, determining whether the transaction information belongs to a contract transaction according to the contract address includes:

[0020] Determine whether the recipient field of the transaction field of the contract address is empty;

[0021] In response to the recipient field being empty, determining the return value of the contract address by returning a specified address code instruction, and determining whether the length of the return value reaches a set length;

[0022] In response to the length of the returned value reaching the set length, it is determined that the transaction information belongs to the contract transaction.

[0023] In some implementations, the signature field includes at least a topic0 field; the specific type includes at least a Transfer type and a SafeTransferFrom type;

[0024] The determining whether the signature field of the log information conforms to a specific type includes:

[0025] Determine whether the type of the topic0 field belongs to one of the Transfer type and the SafeTransferFrom type.

[0026] In some implementations, before obtaining the transaction information, the method further includes:

[0027] Build and merge the Geth client and Prysm client to form a network node;

[0028] Determine whether the network node can synchronize data normally by checking the block synchronization status instruction;

[0029] In response to the network node being able to synchronize data normally, a monitoring process is acquired and run to monitor the data synchronization status of the network node.

[0030] In some embodiments, after determining that the transaction corresponding to the transaction information is an NFT contract transaction, the method further includes:

[0031] Performing interface identification on the transaction corresponding to the transaction information;

[0032] In response to the identification that the interface of the transaction corresponding to the transaction information belongs to the setting interface, the transaction corresponding to the transaction information is classified according to the identified interface type;

[0033] In response to the identified interface of the transaction corresponding to the transaction information not belonging to the set interface, the transaction corresponding to the transaction information is classified as other types.

[0034] Based on the same concept, the present application also provides an NFT contract identification device, including:

[0035] Acquisition module, used to obtain transaction information;

[0036] A first determination module, used to determine the contract address of the transaction information, and determine whether the transaction information belongs to a contract transaction according to the contract address;

[0037] A second determination module is configured to obtain log information of the transaction information in response to the transaction information belonging to the contract transaction, and determine whether a signature field of the log information conforms to a specific type;

[0038] A third determination module, configured to determine whether the first source field of the log information meets a set condition in response to the signature field meeting the specific type;

[0039] The fourth determination module is used to determine that the transaction corresponding to the transaction information is an NFT contract transaction in response to the first source field meeting the set conditions.

[0040] Based on the same concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the methods described above when executing the program.

[0041] Based on the same concept, the present application also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to implement any of the methods described above.

[0042] From the above, it can be seen that the present application provides an NFT contract identification method, device and related equipment, including: obtaining transaction information; determining the contract address of the transaction information, and judging whether the transaction information belongs to a contract transaction according to the contract address; in response to the transaction information belonging to a contract transaction, obtaining the log information of the transaction information, and determining whether the signature field of the log information meets a specific type; in response to the signature field meeting a specific type, determining whether the first source field of the log information meets the set conditions; in response to the first source field meeting the set conditions, determining that the transaction corresponding to the transaction information is an NFT contract transaction. The present application obtains the log information of the transaction information belonging to the contract transaction, and determines the signature field and source field of the log information to determine whether it is an NFT contract transaction. Regardless of the form of NFT contract transaction, the original appearance of the log information meets the specific form, and then the signature field and source field of the log information can be identified to more comprehensively realize the accurate identification of NFT contract transactions, improve the identification accuracy and credibility, and improve the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0044] Figure 1 A schematic diagram of the structure of an exemplary system provided in an embodiment of the present application.

[0045] Figure 2 A flowchart of an exemplary method provided in an embodiment of the present application.

[0046] Figure 3 A flowchart of establishing a data synchronization node according to an exemplary method provided in an embodiment of the present application.

[0047] Figure 4 A flowchart of contract classification according to the exemplary method provided in an embodiment of the present application.

[0048] Figure 5 A schematic diagram of the workflow of a casting transaction identification unit of an exemplary system provided in an embodiment of the present application.

[0049] Figure 6 A schematic diagram of the workflow of the contract classification unit of the exemplary system provided in an embodiment of the present application.

[0050] Figure 7 A schematic diagram of the structure of an exemplary device provided in an embodiment of the present application.

[0051] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of this specification more clear, this specification is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.

[0053] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements, objects or method steps appearing before the word cover the elements, objects or method steps listed after the word and their equivalents, without excluding other elements, objects or method steps. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0054] As mentioned in the background technology section, non-fungible tokens (NFTs) are a type of cryptocurrency on the blockchain that represents the ownership of a unique item. NFTs can represent both real assets (such as a piece of land) and digital assets (such as rare virtual cards). NFTs were originally proposed in the Ethereum Improvement Plan EIP-721 and improved in EIP-1155. Blockchain is a standard medium for displaying and trading NFT assets, providing a secure and distributed environment that makes these assets open, transparent, and tradable worldwide. Today, there are two mainstream standards for NFTs, ERC-721 and ERC-1155, which complete the vast majority of transactions in the NFT ecosystem market. In the process of NFT casting, since the chain is an incidental metadata storage link, buyers may find that the NFT's metadata is inconsistent with that before the purchase after the transaction is completed, increasing the risk of fraud. This phenomenon not only poses a potential threat to individual buyers, but also poses new challenges to regulators. However, it is difficult to effectively and promptly discover and solve these problems using traditional regulatory means. In response to this phenomenon, it is necessary to explore new regulatory methods to adapt to the rapidly developing digital field. Transaction behavior on Ethereum can uniquely identify the blockchain. By tracking transaction records, we can gain in-depth understanding of various behaviors of NFTs, including creation, transfer, destruction and other operations. Similar to the Bitcoin network adding new blocks with transaction information to the blockchain through "mining" (or "coining"), the NFT network writes NFT's Token ID, metadata or metadata URL, digital asset file URL and other data into new blocks of the blockchain through "minting", realizing the so-called "data on the chain". The life cycle of NFT is divided into several stages: creation of works, casting of NFTs, ownership and sale, change of ownership, display and exhibition, custody and management, and final destruction. The casting transaction is a crucial link in the NFT dissemination market, and it plays a key role in the life cycle of NFTs. The casting transaction is not only the initial creation process of digital assets, but also a key step to ensure the unique identity of each NFT. Through the casting transaction, each NFT obtains a unique identifier, making it irreplaceable and unique on the blockchain.

[0055] There are two mainstream identification methods. The first method is to identify NFTs by comparing whether the interface of the smart contract is ERC-721 or ERC-1155 standard. The other method is to obtain the source code of the smart contract, and convert the function abstraction stored in the metadata into a syntax tree, and then into a feature vector, and use machine learning for classification for more in-depth comparison and identification.

[0056] The first method, identifying NFTs through interface standards, is not comprehensive, because some NFT contracts do not implement this interface, although their transaction behavior belongs to casting transactions and there are NFT trading and circulation behaviors. Therefore, NFT contracts that rely solely on this method for identification are incomplete. For example, the current mainstream NFT platforms, such as Opensea and NFTscan, determine whether the contract is an NFT contract by checking whether the contract implements the ERC-721 or ERC-1155 standard interface. Through the ERC-165 standard, smart contracts can declare the interfaces they support for other contracts to check. Therefore, ERC-165 can be used to check whether a smart contract supports the ERC-721 or ERC-1155 interface. The ERC-165 interface contract only declares a supportsInterface function, inputs the interfaceId interface id to be queried (type is bytes4), and returns true if the contract implements the interface id; otherwise, it returns false. The supportsInterface function of the ERC-165 interface contract will be implemented in the ERC-721 contract, and true will be returned when querying 0x80ac58cd (ERC-721 interface id). When the ERC-1155 contract uses 0xd9b67a26 for contract interaction, if true is returned, it proves that it is an ERC-1155 contract, otherwise it is not. This allows the identification of NFT contracts. However, there is another contract that returns false for both interface ids, but its behavior does contain the step of casting transactions. This contract does not conform to the fully standard ERC-721 or ERC-1155, but there is a step of casting transactions in the NFT life cycle, which can be judged as an NFT contract. At the same time, there is another situation where the ERC-721 or ERC-1155 contract does not use the ERC-165 contract interface, so using this interface for judgment will result in errors and there is no way to identify it as an NFT contract.

[0057] The second method obtains the source code of the smart contract, abstracts it into a syntax tree, and further determines whether the NFT interface is ERC-721 or ERC-1155, and whether the metadata is implemented using tokenURI or uri function. There are certain limitations because during the training process. This type of method not only determines the storage method of metadata after determining the interface, but also makes progress over the first type of method. However, even if it complies with these two syntax trees, it cannot ensure the existence of tokenURI or uri function. The storage function of metadata can be customized or even stored directly on the chain, resulting in the contract complying with the ERC-721 or ERC-1155 standards, but using other methods to store metadata. The method of identifying NFT contracts by this method is essentially based on the existing standards of NFT, and there are also incomplete defects in quantity.

[0058] It can be seen that the first method is NFT identification implemented according to the interface, but it can only identify typical contracts. The second method is optimized on the basis of the first method, adding the judgment of metadata storage method, but this method has the problem of not storing in a third-party storage center, similar to the situation on ipfs, so both methods have the defect of not being able to fully identify NFT contracts.

[0059] In view of the above actual situation, the embodiment of the present application provides an NFT contract identification scheme. The present application obtains the log information of the transaction information belonging to the contract transaction, and uses the signature field and source field of the log information to determine whether it is an NFT contract transaction. Since no matter what form of NFT contract transaction, the most original appearance in its log information meets the specific form, and then through the identification of the signature field and source field of the log information, it can more comprehensively realize the accurate identification of NFT contract transactions, improve the identification accuracy and credibility, and improve the user experience.

[0060] in, Figure 1 A schematic diagram of the structure of an exemplary system 100 according to an embodiment of the present application is shown.

[0061] like Figure 1As shown, the NFT contract identification system 100 can be mainly composed of a data synchronization unit 110, a casting transaction identification unit 120 and a contract classification unit 130. Among them, the casting transaction identification unit 120 is a core unit, which is used to identify the corresponding transaction information. The data synchronization unit 110 is a pre-unit of the casting transaction identification unit 120, which is used to establish a data synchronization node and monitor its data synchronization status in real time. It is a unit used for data acquisition. The contract classification unit 130 is used to reclassify the transaction information identified as NFT contract transactions to facilitate downstream or subsequent operations. It should be noted that here, the NFT contract identification system 100 is divided into corresponding units only for the convenience of understanding. In specific application scenarios, it is completely possible not to make corresponding divisions, and the corresponding method steps can be completed independently by the terminal and the server, or the entire process can be completed by a unified electronic device or only an independent program product can be formed.

[0062] Furthermore, the operating basis and method of the core unit, the casting transaction identification unit 120, are first introduced.

[0063] Figure 2 The flowchart of the exemplary method provided in the embodiment of the present application is shown. The exemplary method can be completed by the casting transaction identification unit 120, that is, an NFT contract identification method.

[0064] like Figure 2 As shown, the NFT contract identification method exemplarily proposed in the embodiment of the present application specifically includes the following steps.

[0065] Step 202, obtaining transaction information.

[0066] In this step, the transaction information is the information corresponding to the interaction detected as a transaction type in the blockchain network. This information can be the corresponding information of the NFT contract transaction or the corresponding information of other transactions. In this step, as long as it involves a transaction, the corresponding transaction information will be obtained. In specific applications, there is generally a large amount of information in a blockchain network, and there is generally a large amount of transaction information in this information. This embodiment is only described for one transaction information. For scenarios with a large amount of information, the solution of this embodiment can be reused for each information.

[0067] In some embodiments, the method of obtaining transaction information can be to obtain it in real time from the blockchain network using the data synchronization unit 110, or to obtain it directly, or through direct input by an operator, etc. Among them, by establishing a local synchronization node, the efficiency and speed of Ethereum data synchronization can be improved, the security and integrity of the data synchronization process can be ensured, the efficiency and speed of identifying Ethereum NFT contracts can be guaranteed, the risks and costs in the Ethereum NFT contract identification process can be reduced, and the integrity, security and availability of transaction data obtained by identifying Ethereum NFT contracts can be guaranteed. Furthermore, in some embodiments, it is possible to choose to set up a data synchronization unit 110 first, and through it, before obtaining transaction information, first establish a network node that can obtain data in real time, so as to synchronize the blockchain information in Ethereum in real time, and when necessary, obtain transaction information through the network node.

[0068] For the process of acquiring data using the data synchronization unit 110, or the process of directly acquiring data from the blockchain network. In some embodiments, the network connection can be first performed through the remote call protocol, that is, the connection to the Ethereum blockchain network can be performed through the eth-rpc technology. Afterwards, the corresponding instructions are used to acquire the corresponding information. Through step-by-step data feedback, it can be finally determined whether the corresponding information is transaction information, and then the transaction information is finally acquired. Specifically, the block information of the blockchain network can be first acquired by returning the specified block instruction, wherein the specific form of the return specified block instruction can be the web3.eth.getblock('blockNumber') instruction. Afterwards, all the interaction information in the block is traversed by returning the specified transaction object instruction, and the interaction belonging to the transaction is identified therefrom, and the transaction information of the transaction is acquired, wherein the specific form of the return specified transaction object instruction can be web3.eth.getTransaction('txhash'). That is, in some embodiments, the acquisition of transaction information includes: connecting the blockchain network using the remote call protocol; determining the block information of the blockchain network by returning the specified block instruction; and determining the transaction information in the block corresponding to the block information by returning the specified transaction object instruction.

[0069] Step 204, determine the contract address of the transaction information, and determine whether the transaction information belongs to a contract transaction based on the contract address.

[0070] In this step, the contract address is converted from the contract hash value, which is the location information of the smart contract on the blockchain. Each smart contract will obtain a unique contract address after deployment, which is used to identify the smart contract. Since there are many types of smart contracts, after obtaining a transaction information, it is necessary to first determine whether the corresponding transaction is a transaction for interacting with the contract, that is, to determine whether the transaction information belongs to a contract transaction.

[0071] Afterwards, since the contract address itself is determined when the smart contract or the corresponding transaction information is determined, the method for determining the contract address of the transaction information can be derived by calculation through the information carried by the transaction information itself, or can be directly retrieved through a previously imported comparison table, etc. As for the calculation and derivation method, in some embodiments, the RLP encoding (Recursive Length Prefix) of the Ethereum blockchain and the keccak algorithm can be used to determine whether the transaction belongs to a contract transaction.

[0072] Specifically, in some embodiments, for the process of determining the contract address of the transaction information, the from field (source field) and the nonce field (identification code field) in the transaction information can be recursively length-prefix encoded to obtain the result of serialization format processing of the from field in the transaction information, and the contract address thereof can be obtained by operating the keccak algorithm. That is, in some embodiments, the determination of the contract address of the transaction information includes: determining the second source field and the identification code field of the transaction information; recursively length-prefix encoding the second source field and the identification code field to determine the serialization format result of the second source field; decoding the serialization format result through the keccak algorithm to obtain the contract address. Among them, the second source field is the from field in the transaction information.

[0073] Afterwards, in some embodiments, for the specific process of determining whether the transaction information belongs to a contract transaction according to the contract address, after obtaining the contract address, it can be determined whether the to field (recipient field) of the transaction field is empty. If it is not empty, it means that it does not belong to a contract transaction, and the identification process is exited; if it is empty, the return value of the contract address can be determined by the return code instruction of the specified address. If the return value length is greater than 2, it means that this is a smart contract that meets the requirements and belongs to a contract transaction. On the contrary, if it is less than or equal to 2, the identification process is exited. Among them, the specific form of the return code instruction of the specified address can be the web3.eth.getCode instruction, that is, if the final return value of getCode is greater than 2, it is recognized that this transaction is a transaction that interacts with the contract. That is, in some embodiments, determining whether the transaction information belongs to a contract transaction based on the contract address includes: determining whether the receiver field of the transaction field of the contract address is empty; in response to the receiver field being empty, determining the return value of the contract address by returning a specified address code instruction, and determining whether the length of the return value reaches a set length; in response to the length of the return value reaching the set length, determining that the transaction information belongs to the contract transaction.

[0074] Step 206: In response to the transaction information belonging to the contract transaction, obtaining log information of the transaction information, and determining whether the signature field of the log information conforms to a specific type.

[0075] First of all, it should be introduced that, according to the above introduction, the casting transaction is not only the initial creation process of digital assets, but also a key step to ensure the unique identity of each NFT. Through the casting transaction, each NFT obtains a unique identifier, making it irreplaceable and unique on the blockchain. In the process of studying NFT contract transactions, the applicant found that once the casting transaction is written into the blockchain, it is the unique identifier of the blockchain on the NFT. It is the first and most important operation in the entire life cycle of the NFT. From a technical perspective, no matter how the casting transaction function is customized, the most primitive form in the log log (log information) is the operation where the from of transfer or safetransfer is empty. In view of this feature, in this step and the subsequent steps, the data in the log log can be identified to determine whether the action of its function is transfer or safetransfer, and then determine whether the from field of the log log is empty, so as to realize the identification of the NFT contract.

[0076] Specifically, in this step, after determining that the transaction information is a contract transaction, the corresponding log information can be obtained, that is, the aforementioned log information can be obtained. In some embodiments, the corresponding instructions can be used to obtain the log information, such as using the receipt object instruction that returns the specified transaction, that is, the web3.eth.getTransactionReceipt('txhash') instruction. After obtaining the log information, the log information is parsed to obtain a variety of fields, such as the signature field (topic field), the source field (from field), etc. In this embodiment, the topic0 field in the signature field is mainly identified. In the process of studying the current NFT contract, it is found that no matter what the final form of the NFT contract is, its most original form in the current environment generally uses the ERC-721 standard or the ERC-1155 standard. Furthermore, if it is an NFT contract, the topic0 field of its log is either of the Transfer type, which belongs to the ERC-721 standard; or of the SafeTransferFrom type, which belongs to the ERC-1155 standard. The Transfer type and the SafeTransferFrom type are the specific types mentioned in this step. When the signature field conforms to one of the types, it can be considered that the signature field conforms to the specific type. That is, in some embodiments, the signature field includes at least the topic0 field; the specific type includes at least the Transfer type and the SafeTransferFrom type; the determination of whether the signature field of the log information conforms to the specific type includes: determining whether the type of the topic0 field belongs to one of the Transfer type and the SafeTransferFrom type.

[0077] Of course, with the development of blockchain technology, information technology and other fields, other standards may emerge that can be used to define NFT contracts. According to the above analysis, in this scenario, the topic0 field of its log will inevitably correspond to a fixed type. When other standards emerge, their corresponding types can also be classified into the specific types mentioned in this step.

[0078] Step 208: In response to the signature field meeting the specific type, determining whether the first source field of the log information meets a set condition.

[0079] In this step, for transaction information that meets a specific type, the log information needs to be further judged. According to the introduction in step 206, after determining that it meets a specific type, it is also necessary to judge the source field of the log information to determine whether it meets the set conditions. It should be noted here that the source field in this step is the source field of the log information in the transaction information, and the source field mentioned in some embodiments of step 204 is the source field of the transaction information. In this scheme, the source field of the log information in the transaction information is determined as the first source field, and the source field of the transaction information is determined as the second source field.

[0080] Specifically, for the log information that meets the specific type of transaction information, the parameters of the two functions Transfer and Safetransfer can be obtained when they are running, and it can be determined whether the from field obtained in the log information is empty (null). If it is empty (null), it proves that it is a minting transaction. Among them, the setting condition of this step can be to determine whether the from field (the first source field) is empty.

[0081] Step 210, in response to the first source field meeting the set conditions, determining that the transaction corresponding to the transaction information is an NFT contract transaction.

[0082] In this step, when the first source field meets the set conditions, it can be proved that the transaction information belongs to the corresponding information of the casting transaction, and the transaction corresponding to the transaction information is the NFT contract transaction. Of course, in some embodiments, during the judgment or confirmation process of any of the above steps, when it is determined that the corresponding transaction information does not belong to the information of the NFT contract transaction, although the current identification process will be terminated directly and the corresponding result will be output, it can continue to identify the information at set intervals in the subsequent process, and continue to determine whether there is a casting transaction in its subsequent transactions. Once the identification is passed, the corresponding transaction information can be identified as an NFT contract transaction.

[0083] At this point, the casting transaction identification unit 120 has completed its main work and identified whether the transaction corresponding to the current transaction information is an NFT contract transaction. It can then continue to classify it accordingly (using the contract classification unit 130, etc.) or can be input into other downstream programs to perform other related work. In this solution, for the key point of NFT casting transactions, the most important step for an NFT contract is completed through the identification of casting transactions, and the identification of NFT contracts on Ethereum is realized, including ERC-721, ERC-1155, and other NFT contracts that meet the casting conditions but do not belong to these two standards. In this way, the accurate identification of NFT contract transactions is more comprehensively realized, the recognition accuracy and credibility are improved, and the user experience is improved.

[0084] After that, the data synchronization unit 110 will be described. Since a local synchronization node is established, the efficiency and speed of Ethereum data synchronization can be improved, the security and integrity of the data synchronization process can be ensured, the efficiency and speed of identifying Ethereum NFT contracts can be guaranteed, the risks and costs in the Ethereum NFT contract identification process can be reduced, and the integrity, security and availability of transaction data obtained by identifying Ethereum NFT contracts can be guaranteed. Furthermore, the data synchronization unit 110 can be used to obtain transaction information, that is, before obtaining transaction information, the data synchronization unit 110 can be established first.

[0085] In some embodiments, since the consensus mechanism of Ethereum is transformed from the expensive and power-consuming PoW (Proof of Work) to the environmentally friendly PoS (Proof of Stake) mechanism, referred to as the Ethereum merger (that is, some PoW chains are merged with the parallel PoS chains into one PoS chain), building an ETH full node requires that both the execution client and the beacon node client be kept synchronized. At the same time, in order to ensure the uninterrupted operation of the Ethereum node, it is also necessary to write a monitoring daemon to ensure the normal operation of the node.

[0086] like Figure 3 As shown, a flow chart of establishing a data synchronization node according to an exemplary method of an embodiment of the present application is shown, which specifically includes the following steps.

[0087] Step 302: Establish and merge the Geth client and the Prysm client to form a network node.

[0088] In this step, since both PoW mechanism and PoS mechanism data need to be monitored or acquired, the established network node needs to keep both the execution client and the beacon node client synchronized.

[0089] Specifically, run the Ethereum execution client through the Geth client. Use the geth--rpc command to start Geth and open the RPC interface so that other applications can communicate with the node. After that, run the Ethereum beacon client through the Prysm client. Use the jwt-secret command to sign the JWT token. Once the key issuance service is running, you can generate a JWT token by sending an HTTP request to it and interact with the Prysm client. In this way, build an ETH full node, that is, establish a corresponding network node.

[0090] Step 304: Determine whether the network node can synchronize data normally by checking the block synchronization status instruction.

[0091] In this step, the command to check the block synchronization is the eth.syncing command. This step is to use eth.syncing to determine whether the network node is running normally. Specifically, you can use the geth attach command to enter the Geth console, and then use the eth.syncing command to observe whether the Ethereum node is synchronizing data normally. If it is not synchronized normally, check the network reason, or re-execute the above steps to ensure that the running node and the beacon node are running normally.

[0092] Step 306: In response to the network node being able to synchronize data normally, obtaining and running a monitoring process to monitor the data synchronization status of the network node.

[0093] In this step, after determining that the network node can synchronize data normally, it is necessary to monitor the corresponding synchronization data in real time, and if it is found that the data synchronization process is abnormal, immediate feedback is required. That is, in a specific scenario, if the data can be synchronized normally, it is necessary to further write a monitoring daemon process to ensure the normal operation of the node. The operator can write a bash script to use the ps-ef|grep command to monitor the program in the server to check whether there is a Geth process, and if not, restart the running node and the beacon node. Afterwards, add the corresponding scheduled task in crontab (scheduled task) at the same time, for example, run the monitoring script every half an hour to ensure the normal synchronous operation of the Ethereum node. In this step, the monitoring process is the corresponding program script written and input by the operator, and the corresponding monitoring task is completed by running the script.

[0094] Next, the contract classification unit 130 is explained. After the NFT contract identification is completed, for transactions belonging to NFT contract transactions, since the current mainstream is still based on the ERC-721 standard and the ERC-1155 standard, the NFT contract transactions of these two standards can be classified accordingly to facilitate downstream work. Then, after the identification is completed, a contract classification unit 130 can be added. As for the specific implementation process of the contract classification unit 130, as shown in Figure 4 FIG. 1 is a flow chart of contract classification according to an exemplary method of an embodiment of the present application, which specifically includes the following steps.

[0095] Step 402: performing interface identification on the transaction corresponding to the transaction information.

[0096] Step 404: in response to the identification that the interface of the transaction corresponding to the transaction information belongs to the setting interface, the transaction corresponding to the transaction information is classified according to the identified interface type.

[0097] Step 406: In response to the identified interface of the transaction corresponding to the transaction information not belonging to the set interface, classify the transaction corresponding to the transaction information as other types.

[0098] In this embodiment, the process of interface identification can be to check whether the corresponding transaction information supports the ERC-721 or ERC-1155 interface through ERC-165. For example, the abi interface parsing function is used to perform a read operation. Since the ERC-165 interface contract only declares a supportsInterface function, the function can be used to input the interfaceId interface id (type is bytes4) to be queried. If the contract implements the interface id, true is returned; otherwise, false is returned. Then, the bytes string of the interface id of ERC-721 and ERC-1155 can be sent for identification, where the bytes string of the erc-721 standard is 0x80ac58cd, and the bytes string of the erc-1155 standard is 0xd9b67a26. After sending the two bytes strings, if either returns true, it means that the transaction information belongs to the corresponding ERC-721 standard or ERC-1155 standard, and can be classified accordingly. If both return false or an error occurs, the transaction information can be classified as other types (others).

[0099] It should be noted that the "other types" here represent a type rather than a general term for multiple uncertain types. In this embodiment, transaction information will only be classified into three sets, one corresponding to the ERC-721 standard, one corresponding to the ERC-1155 standard, and the other is other types (others).

[0100] Afterwards, another thing that needs to be explained is that in the current environment, the setting interface of this embodiment is the interface corresponding to the ERC-721 standard or the ERC-1155 standard. As described in the aforementioned embodiments, if with the development of blockchain technology, information technology and other fields, when other standards that can be used to define NFT contracts emerge, the setting interface here may also include the interface corresponding to the new standard.

[0101] Finally, an overall example description of the exemplary system 100 is given as follows.

[0102] (1) Data synchronization unit 110, builds an Ethereum node to facilitate the acquisition of data on the Ethereum blockchain network. Building an Ethereum full node requires executing a client and a beacon node client.

[0103] (2) a casting transaction identification unit 120, such as Figure 5 As shown, eth-rpc technology is used to interact with geth.ipc through the web3 package. The data on the entire blockchain is traversed to obtain transaction information. By decoding the from field in each transaction and performing keccak operations, the contract address is obtained to identify whether the transaction is a transaction that interacts with the contract, that is, whether it is a contract transaction. If it is determined to be a transaction that interacts with the contract, the log information is obtained through the getTransactionReceipt instruction, and the log information is decoded to obtain the hexadecimal log information to determine whether there is a transfer transaction or a safetransfer transaction. If any of these transactions exist, then determine whether the from field of the log information is empty. If both are met, it proves that it is an NFT casting transaction, that is, an NFT contract transaction.

[0104] (3) Contract classification unit 130, such as Figure 6 As shown in the figure, if the NFT casting transaction identification is realized, the ERC-721 and ERC-1155 standards are tested by generating the corresponding bytes string for the supportsInterface function of the transaction information contract. If the query 0x80ac58cd returns true, the classification result is ERC-721; if the query 0xd9b67a26 returns true, the classification result is ERC-1155; and if neither is true, the classification result is determined to be others, and it is judged as another NFT contract type. After the classification is completed, it is finally stored in the warehouse.

[0105] It can be seen from the above embodiments that an NFT contract identification method and system provided by the embodiments of the present application include: obtaining transaction information; determining the contract address of the transaction information, and judging whether the transaction information belongs to a contract transaction according to the contract address; in response to the transaction information belonging to a contract transaction, obtaining the log information of the transaction information, and determining whether the signature field of the log information meets a specific type; in response to the signature field meeting a specific type, determining whether the first source field of the log information meets the set conditions; in response to the first source field meeting the set conditions, determining that the transaction corresponding to the transaction information is an NFT contract transaction. The present application obtains the log information of the transaction information belonging to the contract transaction, and determines the signature field and source field of the log information to determine whether it is an NFT contract transaction. Since no matter what form of NFT contract transaction, the most original appearance in its log information meets a specific form, and then the signature field and source field of the log information can be identified to more comprehensively realize the accurate identification of NFT contract transactions, improve the identification accuracy and credibility, and improve the user experience.

[0106] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of the embodiment of the present application can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.

[0107] It should be noted that the above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0108] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides an NFT contract identification device.

[0109] refer to Figure 7 , the NFT contract identification device comprises:

[0110] The acquisition module 710 is used to acquire transaction information.

[0111] The first determination module 720 is used to determine the contract address of the transaction information, and determine whether the transaction information belongs to a contract transaction based on the contract address.

[0112] The second determination module 730 is used to obtain log information of the transaction information in response to the transaction information belonging to the contract transaction, and determine whether the signature field of the log information conforms to a specific type.

[0113] The third determination module 740 is configured to determine whether the first source field of the log information meets a set condition in response to the signature field meeting the specific type.

[0114] The fourth determination module 750 is used to determine that the transaction corresponding to the transaction information is an NFT contract transaction in response to the first source field meeting the set conditions.

[0115] In some exemplary embodiments, the acquisition module 710 is further configured to:

[0116] Use remote call protocol to connect to the blockchain network;

[0117] Determine the block information of the blockchain network by returning a specified block instruction;

[0118] By returning the specified transaction object instruction, the transaction information in the block corresponding to the block information is determined.

[0119] In some exemplary embodiments, the first determining module 720 is further configured to:

[0120] Determining a second source field and an identification code field of the transaction information;

[0121] Performing recursive length prefix encoding on the second source field and the identification code field to determine a serialized format result of the second source field;

[0122] The serialized format result is decoded by the Keccak algorithm to obtain the contract address.

[0123] In some exemplary embodiments, the first determining module 720 is further configured to:

[0124] Determine whether the recipient field of the transaction field of the contract address is empty;

[0125] In response to the recipient field being empty, determining the return value of the contract address by returning a specified address code instruction, and determining whether the length of the return value reaches a set length;

[0126] In response to the length of the returned value reaching the set length, it is determined that the transaction information belongs to the contract transaction.

[0127] In some exemplary embodiments, the signature field includes at least a topic0 field; the specific type includes at least a Transfer type and a SafeTransferFrom type;

[0128] The second determining module 730 is further configured to:

[0129] Determine whether the type of the topic0 field belongs to one of the Transfer type and the SafeTransferFrom type.

[0130] In some exemplary embodiments, the acquisition module 710 is further configured to:

[0131] Build and merge the Geth client and Prysm client to form a network node;

[0132] Determine whether the network node can synchronize data normally by checking the block synchronization status instruction;

[0133] In response to the network node being able to synchronize data normally, a monitoring process is acquired and run to monitor the data synchronization status of the network node.

[0134] In some exemplary embodiments, the fourth determining module 750 is further configured to:

[0135] Performing interface identification on the transaction corresponding to the transaction information;

[0136] In response to the identification that the interface of the transaction corresponding to the transaction information belongs to the setting interface, the transaction corresponding to the transaction information is classified according to the identified interface type;

[0137] In response to the identified interface of the transaction corresponding to the transaction information not belonging to the set interface, the transaction corresponding to the transaction information is classified as other types.

[0138] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.

[0139] The device of the above-mentioned embodiment is used to implement the corresponding NFT contract identification method in the above-mentioned embodiment, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0140] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the NFT contract identification method as described in any of the above embodiments is implemented.

[0141] Figure 8 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.

[0142] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.

[0143] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.

[0144] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.

[0145] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0146] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).

[0147] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.

[0148] The electronic device of the above-mentioned embodiment is used to implement the corresponding NFT contract identification method in any of the aforementioned embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.

[0149] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the NFT contract identification method described in any of the above embodiments.

[0150] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.

[0151] The computer instructions stored in the storage medium of the above embodiments are used to enable the computer to execute the NFT contract identification method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0152] Based on the same concept, corresponding to any of the above-mentioned embodiments, the present application also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer so that the computer and / or the processor execute the NFT contract identification method. Corresponding to the execution subject corresponding to each step in each embodiment of the NFT contract identification method, the processor that executes the corresponding step may belong to the corresponding execution subject.

[0153] The computer program product of the above-mentioned embodiments is used to enable the computer and / or the processor to execute the NFT contract identification method described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.

[0154] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application (including the claims) is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.

[0155] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.

[0156] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.

[0157] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the scope of protection of the present application.

Claims

1. A method for identifying an NFT contract, characterized in that: include: Get transaction information; Determine the contract address of the transaction information, and determine whether the transaction information belongs to a contract transaction according to the contract address; In response to the transaction information belonging to the contract transaction, obtaining log information of the transaction information, and determining whether a signature field of the log information conforms to a specific type; In response to the signature field being in accordance with the specific type, determining whether the first source field of the log information meets a set condition; In response to the first source field meeting the set conditions, it is determined that the transaction corresponding to the transaction information is an NFT contract transaction.

2. The method according to claim 1, characterized in that The obtaining of transaction information includes: Use remote call protocol to connect to the blockchain network; Determine the block information of the blockchain network by returning a specified block instruction; By returning the specified transaction object instruction, the transaction information in the block corresponding to the block information is determined.

3. The method according to claim 1, characterized in that The determining of the contract address of the transaction information includes: Determining a second source field and an identification code field of the transaction information; Performing recursive length prefix encoding on the second source field and the identification code field to determine a serialized format result of the second source field; The serialized format result is decoded by the Keccak algorithm to obtain the contract address.

4. The method according to claim 1, characterized in that The determining whether the transaction information belongs to a contract transaction according to the contract address includes: Determine whether the recipient field of the transaction field of the contract address is empty; In response to the recipient field being empty, determining the return value of the contract address by returning a specified address code instruction, and determining whether the length of the return value reaches a set length; In response to the length of the returned value reaching the set length, it is determined that the transaction information belongs to the contract transaction.

5. The method according to claim 1, characterized in that The signature field includes at least the topic0 field; the specific type includes at least the Transfer type and the SafeTransferFrom type; The determining whether the signature field of the log information conforms to a specific type includes: Determine whether the type of the topic0 field belongs to one of the Transfer type and the SafeTransferFrom type.

6. The method according to claim 1, characterized in that Before obtaining the transaction information, the method further includes: Build and merge the Geth client and Prysm client to form a network node; Determine whether the network node can synchronize data normally by checking the block synchronization status instruction; In response to the network node being able to synchronize data normally, a monitoring process is acquired and run to monitor the data synchronization status of the network node.

7. The method according to claim 1, characterized in that After determining that the transaction corresponding to the transaction information is an NFT contract transaction, the method further includes: Performing interface identification on the transaction corresponding to the transaction information; In response to the identification that the interface of the transaction corresponding to the transaction information belongs to the setting interface, the transaction corresponding to the transaction information is classified according to the identified interface type; In response to the identified interface of the transaction corresponding to the transaction information not belonging to the set interface, the transaction corresponding to the transaction information is classified as other types.

8. An NFT contract identification device, characterized in that: include: Acquisition module, used to obtain transaction information; A first determination module, used to determine the contract address of the transaction information, and determine whether the transaction information belongs to a contract transaction according to the contract address; A second determination module is configured to obtain log information of the transaction information in response to the transaction information belonging to the contract transaction, and determine whether a signature field of the log information conforms to a specific type; A third determination module, configured to determine whether the first source field of the log information meets a set condition in response to the signature field meeting the specific type; The fourth determination module is used to determine that the transaction corresponding to the transaction information is an NFT contract transaction in response to the first source field meeting the set conditions.

9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method according to any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium, characterized in that: The non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to implement the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Data processing method, device and equipment and computer readable storage medium

    CN115599209A

  • Dynamic NFT identification method and device based on solid smart contract

    CN117009891A