WO2021073202A1 - Intelligent contract processing method, computer device and storage medium - Google Patents

Intelligent contract processing method, computer device and storage medium Download PDF

Info

Publication number
WO2021073202A1
WO2021073202A1 PCT/CN2020/105942 CN2020105942W WO2021073202A1 WO 2021073202 A1 WO2021073202 A1 WO 2021073202A1 CN 2020105942 W CN2020105942 W CN 2020105942W WO 2021073202 A1 WO2021073202 A1 WO 2021073202A1
Authority
WO
WIPO (PCT)
Prior art keywords
smart contract
uri
data
http request
http
Prior art date
Application number
PCT/CN2020/105942
Other languages
French (fr)
Chinese (zh)
Inventor
薄辰龙
Original Assignee
深圳壹账通智能科技有限公司
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 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2021073202A1 publication Critical patent/WO2021073202A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Definitions

  • This application relates to the field of blockchain technology, in particular to a smart contract processing method, computer equipment and storage medium.
  • blockchain technology uses blockchain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses automated scripts.
  • the first aspect of the present application provides a smart contract processing method, which is applied to an http server of a blockchain node, and the smart contract processing method includes:
  • the second aspect of the present application provides a smart contract processing method, which is applied to an http server of a smart contract, and the smart contract processing method includes:
  • a third aspect of the present application provides a computer device that includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to Implement the following steps:
  • a fourth aspect of the present application provides a computer device that includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to Implement the following steps:
  • a fifth aspect of the present application provides a computer-readable storage medium that stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, the following steps are implemented:
  • a sixth aspect of the present application provides a computer-readable storage medium that stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, the following steps are implemented:
  • the smart contract processing method, computer equipment, and storage medium described in this application enable the smart contract to have web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can use a web browser to Intuitively browse the block chain data of the smart contract, without the need to obtain the data of the smart contract in the form of programming; this application displays its own API in the form of a page, which reduces the communication during the development process and improves the production efficiency; this application will web
  • the combination of application and blockchain technology makes web applications a part of the chain ecology, without the need to build web services by themselves.
  • Fig. 1 is a flowchart of a smart contract processing method provided by the first embodiment of the present application.
  • Fig. 2 is a flowchart of the smart contract processing method provided by the second embodiment of the present application.
  • Fig. 3 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • Fig. 4 is an exemplary functional block diagram of the computer device shown in Fig. 3.
  • Fig. 1 is a flowchart of a smart contract processing method according to the first embodiment of the present application.
  • the smart contract processing method can be applied to an application scenario of a Fabric-based blockchain business platform.
  • the application scenarios of the Fabric-based blockchain business platform include client, server and blockchain networks.
  • the client is used to obtain different operation requests of the user, and send the operation request to the server in the service platform for processing;
  • the server is in communication connection with the blockchain network;
  • the blockchain network It is used to respond to the user's operation request and return the response result of the user's request to the client.
  • an embodiment of the present application provides a smart contract processing method, which is applied to an http server of a blockchain node, and the smart contract processing method may include the following steps:
  • the http request refers to a request message from the client to the server, and the http request may include a data query request, an operation and maintenance request, and the like.
  • the http request includes a webpage identifier (URI, UniformResourceIdentifier, uniform resource identifier) in a preset format for indicating the address of the requested webpage in the blockchain smart contract.
  • the webpage identifier is an expression of the location and access method of resources available on the Internet, and is the address of a standard resource on the Internet.
  • Each resource file on the Internet has a unique URI.
  • the web page identifier in the preset format needs to indicate the information of the smart contract to be requested.
  • the webpage identifier in the preset format is preset by system personnel.
  • the webpage identifier in the preset format may be: http://nodeip/smartcontractname and http://nodeip/smartcontractname/xxx.
  • smartcontractname and smartcontractname/xxx are the indicated information of the smart contract to be requested.
  • the http request is sent to the http server of the blockchain node, and the blockchain node can provide the web by providing the http server service to the blockchain node Service, so that the blockchain node can proxy the http request.
  • the http server of the blockchain node is used to send the http request to the http server of the corresponding smart contract according to the URI information carried in the received http request; the http server of the blockchain node also uses To receive the http request response data sent by the http server of the smart contract, and output the http request response data to the client.
  • the method further includes: building an http server on a blockchain node; obtaining the server address and port number of the http server; configuring the server in the blockchain node Address and the port number, and use the http server as a proxy server for the blockchain node.
  • Node.js is a lightweight Javascript runtime environment. Because Node.js uses an event-driven, non-blocking I/O model, it is lightweight and efficient.
  • the block chain node and the http server are placed in a network, and the server address and port number are configured in the block chain node.
  • the http server serves as the proxy server of the blockchain node.
  • the blockchain node sends a network request to the outside world, it must pass through the http server, and the http server will proxy the blockchain node to the outside world. Request and act on behalf of the blockchain node to receive the result returned by the outside world according to the network request. Therefore, the http server essentially acts as an intermediary for the blockchain node to communicate with the outside world.
  • the step of parsing the URI identifier in the http request includes: obtaining a request message of the http request; parsing the request message to obtain the request of the http request Method, URI identification, domain name, file suffix name information.
  • the client can output requests from different users, and only requests from users with corresponding permissions can be responded to.
  • the method further includes: matching verification information corresponding to the URI identification, and the verification information includes a digital signature and user information.
  • the URI identification is verified according to the verification information; when the verification of the URI identification is passed, the URI identification is converted into a smart contract URI identification.
  • the digital signature is a digital signature performed by the client sending the http request on the URI identifier by using a preset digital signature algorithm, and the preset digital signature algorithm is an algorithm preset by a user.
  • the step of verifying the URI identifier according to the verification information includes: digitally signing the received URI identifier through a preset digital signature algorithm; The obtained digital signature is compared with the digital signature carried by the URI identification to determine whether the comparison result is consistent; if the judgment result is consistent, the URI identification passes the signature verification.
  • the step of verifying the URI identifier according to the verification information includes: traversing a pre-stored user information blacklist database according to the user information carried in the URI identifier; and determining the Whether the user information carried by the URI identifier is a blacklist user; if the judgment result is no, the URI identifier passes the blacklist verification.
  • a tag is added to the http request, and the tag is used to record the verification information verification process of the http request and the corresponding relationship between the http request and the http server-side interface of the smart contract.
  • the step of converting the URI identification into a smart contract URI identification includes: obtaining a keyword at a preset position in the URI identification; matching from a smart contract keyword library Generate the target smart contract corresponding to the keyword; obtain the target URI identifier of the target smart contract; use the target URI identifier as the URI identifier of the target smart contract.
  • the preset location is a location that indicates the smart contract information to be requested. For example, if the format of the URI identification is http://nodeip/smartcontractname, the keyword at the corresponding preset location is smartcontractname.
  • URI identifier obtained by parsing the http request through the http server of the blockchain node is: http://nodeip/oldlaicontract/
  • the keyword in the URI identifier: oldlaicontract is obtained, and the smart contract is traversed according to this keyword
  • the keyword library matches the smart contract corresponding to this keyword, which is called the target smart contract oldlaicontract, so as to determine the URI identification of the target smart contract.
  • the URI identification of the smart contract is: http://127.0.0.1: 398213/.
  • the smart contract runs in a sandbox environment and can only communicate with the blockchain node.
  • the http request is sent to the http server of the smart contract identified by the smart contract URI through the http server of the blockchain node.
  • the smart contract runs in the blockchain network, and the smart contract is redesigned to provide http server services for the smart contract, so that the smart contract can support web standard services, and the user can access the smart contract arbitrarily through the client The custom page of the contract.
  • the method for providing http server services to the smart contract includes: building an http server on the smart contract; obtaining the server address and port number of the http server that has been built; configuring the server address in the smart contract And the port number, and use the http server as a proxy server for the smart contract. Since the method of providing http server service to the smart contract has the same principle as the method of providing http server service to the blockchain node, it will not be repeated here.
  • S15 Receive smart contract data sent by the http server of the smart contract and obtained by parsing the http request.
  • the http server of the blockchain node receives smart contract data sent by the http server of the smart contract and obtained by parsing the http request.
  • the method further includes: receiving an http request sent by the http server of the blockchain node, where the http request carries Characteristic information; according to the characteristic information query ranking strategy, the ranking priority corresponding to the characteristic information is obtained; and the processing order of the http request is adjusted according to the ranking priority.
  • the sorting strategy is used to record the correspondence between characteristic information and sorting priority
  • the characteristic information includes one or any combination of the following: user identification, data type, device type information, device IP address, and page jump information .
  • the data response time optimizes the allocation of internal resources of the system and effectively improves the user experience.
  • the http server of the smart contract parses the http request to obtain smart contract data, it includes the following steps: parsing the http request through the http server of the smart contract, and according to the analysis result Determine the function interface of the smart contract to be called; call the smart contract on the blockchain to process the business according to the function interface of the smart contract to be called; obtain the smart contract data generated for the business process.
  • the smart contract includes a data contract and a behavior contract.
  • the data contract specifically stores data, which only performs simple data acquisition and modification; the behavior contract specifically describes the background business processing logic.
  • Each smart contract implies a contract address and a compiled ABI (Application Binary Interface), which is encapsulated and hidden by node.js, and only provides a unified function interface to the outside. Through the ABI, the encapsulated js package code is used to determine the function interface of the smart contract to be called according to the analysis result.
  • ABI Application Binary Interface
  • the smart contract data is sent to the blockchain node through the http server of the smart contract, and the smart contract data is sent through the http server of the blockchain node
  • the client parses the smart contract data encapsulated in an XML format to obtain smart contract data.
  • the http server of the blockchain node encapsulates the acquired smart contract data into XML format data, and sends the smart contract data encapsulated into the XML format to the client.
  • the step of encapsulating the smart contract data into XML format data includes: embedding program code to read smart contract data; defining a data structure in XML format; and loading the smart contract data into a data structure in XML format.
  • the embodiment of the application provides a smart contract processing method, which is applied to an http server of a blockchain node to receive an http request sent by a client; parse out the URI identifier in the http request; convert the URI identifier into a smart Contract URI identification; sending the http request to the http server of the smart contract corresponding to the smart contract URI identification; receiving the smart contract data sent by the http server of the smart contract parsing the http request; sending the smart contract The contract data is sent to the client.
  • the smart contract is provided with web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can intuitively browse the blockchain data of the smart contract through a web browser without programming adjustments.
  • the data of the smart contract is obtained in the form of taking; this application displays its own API in the form of a page, which reduces communication during the development process and improves production efficiency; this application combines web applications with blockchain technology to make web applications a chain ecosystem For one part, there is no need to build web services yourself.
  • an embodiment of the present application provides a smart contract processing method, which is applied to an http server of a smart contract, and the smart contract processing method includes:
  • the http request sent by the http server of the blockchain node is received through the http server of the smart contract.
  • the method before the step of parsing the http request to obtain smart contract data, the method further includes: acquiring the characteristic information carried in the http request; acquiring the characteristic information corresponding to the characteristic information The ordering priority; adjust the processing order of the http request according to the ordering priority.
  • the sorting strategy is used to record the correspondence between characteristic information and sorting priority
  • the characteristic information includes one or any combination of the following: user identification, data type, device type information, device IP address, and page jump information .
  • the data response time optimizes the allocation of internal resources of the system and effectively improves the user experience.
  • the step of parsing the http request to obtain smart contract data includes: parsing the http request; determining the function interface of the smart contract to be called according to the analysis result; calling the blockchain according to the function interface of the smart contract to be called The smart contract for business processing; obtain the smart contract data generated for business processing.
  • the smart contract includes a data contract and a behavior contract.
  • the data contract specifically stores data, which only performs simple data acquisition and modification; the behavior contract specifically describes the background business processing logic.
  • Each smart contract implies a contract address and a compiled ABI (Application Binary Interface), which is encapsulated and hidden by node.js, and only provides a unified function interface to the outside. Through the ABI, the encapsulated js package code is used to determine the function interface of the smart contract to be called according to the analysis result.
  • ABI Application Binary Interface
  • the smart contract data is sent to the http server of the blockchain node, and the smart contract data is sent to the client through the http server of the blockchain node .
  • the client parses the smart contract data encapsulated in the XML format to obtain smart contract data.
  • the embodiment of the application provides a smart contract processing method, which is applied to the http server of the smart contract, receives the http request sent by the http server of the blockchain node; parses the http request to obtain the smart contract data; sends the smart contract data To the http server of the blockchain node.
  • the smart contract is provided with web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can intuitively browse the blockchain data of the smart contract through a web browser without programming adjustments.
  • the data of the smart contract is obtained in the form of taking; this application displays its own API in the form of a page, which reduces communication during the development process and improves production efficiency; this application combines web applications with blockchain technology to make web applications a chain ecosystem For one part, there is no need to build web services yourself.
  • FIG. 3 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • the computer device 1 includes a memory 10 in which the smart contract processing apparatus 100 is stored.
  • the smart contract processing device 100 can receive an http request sent by a client; parse out the URI identifier in the http request; and convert the URI The identifier is converted into a smart contract URI identifier; sending the http request to the http server of the smart contract corresponding to the smart contract URI identifier; receiving the smart contract data sent by the http server of the smart contract by parsing the http request; Send the smart contract data to the client.
  • the smart contract processing device 100 can also be applied to an http server of a smart contract.
  • the smart contract processing device 100 can receive an http request sent by an http server of a blockchain node; parse the http request to obtain smart contract data; and send The smart contract data is sent to the http server of the blockchain node.
  • the smart contract is provided with web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can intuitively browse the blockchain data of the smart contract through a web browser without programming adjustments.
  • the data of the smart contract is obtained in the form of taking; this application displays its own API in the form of a page, which reduces communication during the development process and improves production efficiency; this application combines web applications with blockchain technology to make web applications a chain ecosystem For one part, there is no need to build web services yourself.
  • the computer device 1 may also include a display screen 20 and a processor 30.
  • the memory 10 and the display screen 20 may be electrically connected to the processor 30 respectively.
  • the memory 10 may be different types of storage devices for storing various types of data.
  • it can be the memory or internal memory of the computer device 1, or it can be a memory card that can be externally connected to the computer device 1, such as flash memory, SM card (Smart Media Card), SD card (Secure Digital Card, secure digital card). Card) etc.
  • the memory 10 may include a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card (Flash Card), at least one disk storage device, a flash memory Device, or its computer-readable storage device.
  • the memory 10 is used to store various types of data, for example, various types of applications (Applications) installed in the computer device 1, and data set and obtained by applying the smart contract processing method described above.
  • the display screen 20 is installed in the computer device 1 for displaying information.
  • the processor 30 is used to execute the smart contract processing method and various software installed in the computer device 1, such as an operating system and application display software.
  • the processor 30 includes, but is not limited to, a processor (Central Processing Unit, CPU), a Micro Controller Unit (MCU), and other devices for interpreting computer instructions and processing data in computer software.
  • a processor Central Processing Unit, CPU
  • MCU Micro Controller Unit
  • the smart contract processing apparatus 100 may include one or more modules, and the one or more modules are stored in the memory 10 of the computer device 1 and configured to be operated by one or more processors (this embodiment is A processor 30) executes to complete the embodiment of the present application.
  • the smart contract processing device 100 may include an http request receiving module 101, an http request parsing module 102, and a URI identifier.
  • the module referred to in the embodiment of the present application may be a program segment that completes a specific function, and is more suitable for describing the execution process of software in the processor 30 than a program.
  • the computer device 1 may include some or all of the functional modules shown in FIG. 4, and the functions of each module will be described in detail below. It should be noted that the same nouns, related nouns and specific explanations in the various implementations of the above smart contract processing method can also be applied to the following functional introduction of each module. In order to save space and avoid repetition, I won't repeat them here.
  • the http request receiving module 101 may be used to receive http requests sent by the client.
  • the http request parsing module 102 may be used to parse the URI identification in the http request.
  • the URI identification conversion module 103 may be used to convert the URI identification into a smart contract URI identification.
  • the http request sending module 104 may send the http request to the http server of the smart contract corresponding to the smart contract URI identification.
  • the contract data acquisition module 105 may be configured to receive smart contract data sent by the http server of the smart contract and obtained by parsing the http request.
  • the contract data sending module 106 may be used to send the smart contract data to the client.
  • the http request receiving module 101 may also be used to receive an http request sent by an http server of a blockchain node.
  • the http request parsing module 102 can also be used to parse the http request to obtain smart contract data.
  • the contract data sending module 106 can also be used to send the smart contract data to the http server of the blockchain node.
  • the embodiment of the present application also provides a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor 30, the steps of the smart contract processing method in any of the foregoing embodiments are implemented.
  • the smart contract processing device 100 can be stored in a computer readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned implementation methods, and can also be completed by instructing relevant hardware through a computer program.
  • the computer program can be stored in a computer-readable storage medium. When the program is executed by the processor 30, the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer-readable instruction code, and the computer-readable instruction code may be in the form of source code, object code, executable file, or some intermediate form.
  • the computer-readable storage medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read- Only Memory, Random Access Memory (RAM) and other volatile and non-volatile readable storage media.
  • the so-called processor 30 may be a central processing unit (Central Processing Unit, CPU), other general processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
  • the processor 30 is the control center of the smart contract processing apparatus 100/computer equipment 1, and is connected by various interfaces and lines. All parts of the entire smart contract processing device 100/computer equipment 1.
  • the memory 10 is used to store the computer program and/or module, and the processor 30 runs or executes the computer program and/or module stored in the memory 10 and calls the data stored in the memory 10, Various functions of the smart contract processing device 100/computer equipment 1 are realized.
  • the memory 10 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; the storage data area may Data (such as audio data) created in accordance with the use of the computer device 1 and the like are stored.
  • the computer-readable storage medium mainly includes a storage program area and a storage data area, where the storage program area can store an operating system, an application program required by at least one function, etc.; the storage data area can store a block chain node Use the created data, etc.
  • the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Abstract

An intelligent contract processing method, a computer device, and a storage medium, which are applied to an http server of a blockchain node. The method comprises: receiving an http request sent by a client (S11); parsing a URI identifier in the http request (S12); converting the URI identifier into an intelligent contract URI identifier (S13); sending the http request to an http server of an intelligent contract corresponding to the intelligent contract URI identifier (S14); receiving intelligent contract data sent by the http server of the intelligent contract and obtained by parsing the http request (S15); and sending the intelligent contract data to the client (S16). The method enables the intelligent contract to have a web access capability, and acquires data of the intelligent contract without using a programming form, so that communications in a development process are reduced, and the production efficiency is improved.

Description

智能合约处理方法、计算机设备及存储介质Smart contract processing method, computer equipment and storage medium
本申请要求于2019年10月15日提交中国专利局,申请号为201910977369.0发明名称为“智能合约处理方法、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on October 15, 2019. The application number is 201910977369.0. The invention title is "Smart contract processing method, computer equipment and storage medium". The entire content is incorporated into this by reference. Applying.
技术领域Technical field
本申请涉及区块链技术领域,尤其涉及一种智能合约处理方法、计算机设备及存储介质。This application relates to the field of blockchain technology, in particular to a smart contract processing method, computer equipment and storage medium.
背景技术Background technique
随着计算机技术的发展,区块链的应用也越来越广泛。广义来讲,区块链技术是利用区块链数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全、利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构和计算方式。With the development of computer technology, the application of blockchain has become more and more extensive. Broadly speaking, blockchain technology uses blockchain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses automated scripts. A new distributed infrastructure and calculation method for programming and manipulating data with smart contracts composed of codes.
发明人发现目前Fabric区块链架构中的智能合约数据只能使用Fabric的sdk,以编程的方式远程调用才能够访问,离普通用户的使用习惯很远;且实际在开发的场景内,由于智能合约不具备直观的表述能力,也为区块链开发增加了复杂度。因而,亟需提供一种智能合约访问方法,使得智能合约具备web访问能力,从而任意用户都可以使用浏览器简单、便捷地访问智能合约的数据,降低用户访问门槛和使用复杂度。The inventor found that the smart contract data in the current Fabric blockchain architecture can only be accessed using the Fabric SDK, which can be accessed by remote calls in a programmatic manner, which is far from the usage habits of ordinary users; and in the actual development scenario, due to smart The contract does not have the ability of intuitive expression, and it also adds complexity to the development of the blockchain. Therefore, there is an urgent need to provide a smart contract access method that enables the smart contract to have web access capabilities, so that any user can use a browser to simply and conveniently access the data of the smart contract, and reduce the user's access threshold and use complexity.
发明内容Summary of the invention
鉴于以上内容,有必要提出一种智能合约处理方法、计算机设备以及存储介质,其可以使得所述智能合约具备web访问能力,从而无需通过编程调取的形式获取智能合约的数据,降低开发过程中的沟通,提高生产效率。In view of the above, it is necessary to propose a smart contract processing method, computer equipment, and storage medium, which can enable the smart contract to have web access capabilities, so that there is no need to obtain the data of the smart contract in the form of programming call, and reduce the development process. Communication and improve production efficiency.
本申请的第一方面提供一种智能合约处理方法,应用于区块链节点的http服务器中,所述智能合约处理方法包括:The first aspect of the present application provides a smart contract processing method, which is applied to an http server of a blockchain node, and the smart contract processing method includes:
接收客户端发送的http请求;Receive the http request sent by the client;
解析出所述http请求中的URI标识;Parse out the URI identifier in the http request;
将所述URI标识转换成智能合约URI标识;Converting the URI identification into a smart contract URI identification;
发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;Sending the http request to the http server of the smart contract corresponding to the smart contract URI identification;
接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;Receiving the smart contract data sent by the http server of the smart contract and obtained by parsing the http request;
将所述智能合约数据发送至所述客户端。Send the smart contract data to the client.
本申请的第二方面提供一种智能合约处理方法,应用于智能合约的http服务器中,所述智能合约处理方法包括:The second aspect of the present application provides a smart contract processing method, which is applied to an http server of a smart contract, and the smart contract processing method includes:
接收区块链节点的http服务器发送的http请求;Receive the http request sent by the http server of the blockchain node;
解析所述http请求得到智能合约数据;Parsing the http request to obtain smart contract data;
发送所述智能合约数据至所述区块链节点的http服务器中。Send the smart contract data to the http server of the blockchain node.
本申请的第三方面提供一种计算机设备,所述计算机设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:A third aspect of the present application provides a computer device that includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to Implement the following steps:
接收客户端发送的http请求;Receive the http request sent by the client;
解析出所述http请求中的URI标识;Parse out the URI identifier in the http request;
将所述URI标识转换成智能合约URI标识;Converting the URI identification into a smart contract URI identification;
发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;Sending the http request to the http server of the smart contract corresponding to the smart contract URI identification;
接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;Receiving the smart contract data sent by the http server of the smart contract and obtained by parsing the http request;
将所述智能合约数据发送至所述客户端。Send the smart contract data to the client.
本申请的第四方面提供一种计算机设备,所述计算机设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:A fourth aspect of the present application provides a computer device that includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to Implement the following steps:
接收区块链节点的http服务器发送的http请求;Receive the http request sent by the http server of the blockchain node;
解析所述http请求得到智能合约数据;Parsing the http request to obtain smart contract data;
发送所述智能合约数据至所述区块链节点的http服务器中。Send the smart contract data to the http server of the blockchain node.
本申请的第五方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:A fifth aspect of the present application provides a computer-readable storage medium that stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, the following steps are implemented:
接收客户端发送的http请求;Receive the http request sent by the client;
解析出所述http请求中的URI标识;Parse out the URI identifier in the http request;
将所述URI标识转换成智能合约URI标识;Converting the URI identification into a smart contract URI identification;
发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;Sending the http request to the http server of the smart contract corresponding to the smart contract URI identification;
接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;Receiving the smart contract data sent by the http server of the smart contract and obtained by parsing the http request;
将所述智能合约数据发送至所述客户端。Send the smart contract data to the client.
本申请的第六方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:A sixth aspect of the present application provides a computer-readable storage medium that stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, the following steps are implemented:
接收区块链节点的http服务器发送的http请求;Receive the http request sent by the http server of the blockchain node;
解析所述http请求得到智能合约数据;Parsing the http request to obtain smart contract data;
发送所述智能合约数据至所述区块链节点的http服务器中。Send the smart contract data to the http server of the blockchain node.
综上所述,本申请所述的智能合约处理方法、计算机设备及存储介质,使得所述智能合约具备web访问能力,从而提供丰富的数据展示能力和交互体验;且用户通过web浏览器,能够直观的浏览智能合约的区块链数据,无需通过编程调取的形式获取智能合约的数据;本申请将自身的API通过页面形式展示,降低开发过程中的沟通,提高生产效率;本申请将web应用与区块链技术结合,使得web应用成为链生态的一部分,无需自己搭建web服务。In summary, the smart contract processing method, computer equipment, and storage medium described in this application enable the smart contract to have web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can use a web browser to Intuitively browse the block chain data of the smart contract, without the need to obtain the data of the smart contract in the form of programming; this application displays its own API in the form of a page, which reduces the communication during the development process and improves the production efficiency; this application will web The combination of application and blockchain technology makes web applications a part of the chain ecology, without the need to build web services by themselves.
附图说明Description of the drawings
图1是本申请第一实施方式提供的智能合约处理方法的流程图。Fig. 1 is a flowchart of a smart contract processing method provided by the first embodiment of the present application.
图2是本申请第二实施方式提供的智能合约处理方法的流程图。Fig. 2 is a flowchart of the smart contract processing method provided by the second embodiment of the present application.
图3是本申请实施例提供的计算机设备的结构示意图。Fig. 3 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
图4是图3所示的计算机设备的示例性的功能模块图。Fig. 4 is an exemplary functional block diagram of the computer device shown in Fig. 3.
具体实施方式Detailed ways
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施例对本申请进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。In order to be able to understand the above objectives, features and advantages of the application more clearly, the application will be described in detail below with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments of the application and the features in the embodiments can be combined with each other if there is no conflict.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field of this application. The terminology used in the specification of the application herein is only for the purpose of describing specific embodiments, and is not intended to limit the application.
图1是本申请第一实施方式的智能合约处理方法的流程图,所述智能合约处理方法可以应用于基于Fabric的区块链业务平台的应用场景下。其中,基于Fabric的区块链业务平台的应用场景包括客户端、服务器端及区块链网络。所述客户端用于获取用户的不 同操作请求,并将该操作请求发送至业务平台中的服务器端进行处理;所述服务器端与所述区块链网络进行通信连接;所述区块链网络用于对用户的操作请求进行响应,并将用户请求的响应结果返回给所述客户端。Fig. 1 is a flowchart of a smart contract processing method according to the first embodiment of the present application. The smart contract processing method can be applied to an application scenario of a Fabric-based blockchain business platform. Among them, the application scenarios of the Fabric-based blockchain business platform include client, server and blockchain networks. The client is used to obtain different operation requests of the user, and send the operation request to the server in the service platform for processing; the server is in communication connection with the blockchain network; the blockchain network It is used to respond to the user's operation request and return the response result of the user's request to the client.
如图1所示,本申请实施例提供一种智能合约处理方法,应用于区块链节点的http服务器中,所述智能合约处理方法可以包括如下步骤:As shown in FIG. 1, an embodiment of the present application provides a smart contract processing method, which is applied to an http server of a blockchain node, and the smart contract processing method may include the following steps:
S11、接收客户端发送的http请求。S11. Receive the http request sent by the client.
在本申请的至少一实施例中,所述http请求是指从客户端到服务器端的请求消息,所述http请求可以包括数据查询请求、运维请求等。In at least one embodiment of the present application, the http request refers to a request message from the client to the server, and the http request may include a data query request, an operation and maintenance request, and the like.
S12、解析出所述http请求中的URI标识。S12. Parse the URI identifier in the http request.
在本申请的至少一实施例中,所述http请求中包括用于指示所请求的网页在区块链智能合约中的地址的预设格式的网页标识(URI,UniformResourceIdentifier,统一资源标识符)。所述网页标识是对可以从互联网上得到的资源的位置和访问方法的一种表达,是互联网上标准资源的地址,互联网上每个资源文件都有唯一的URI。In at least one embodiment of the present application, the http request includes a webpage identifier (URI, UniformResourceIdentifier, uniform resource identifier) in a preset format for indicating the address of the requested webpage in the blockchain smart contract. The webpage identifier is an expression of the location and access method of resources available on the Internet, and is the address of a standard resource on the Internet. Each resource file on the Internet has a unique URI.
由于所有的http请求均需要通过所述区块链节点做http请求代理到智能合约处理,因此,所述预设格式的网页标识中需要标明要请求的智能合约的信息。所述预设格式的网页标识为系统人员预先设置的,例如,所述预设格式的网页标识可以为:http://nodeip/smartcontractname及http://nodeip/smartcontractname/xxx。其中,smartcontractname及smartcontractname/xxx即为标明的要请求的智能合约的信息。Since all http requests need to be processed by the blockchain node through the http request proxy to the smart contract, the web page identifier in the preset format needs to indicate the information of the smart contract to be requested. The webpage identifier in the preset format is preset by system personnel. For example, the webpage identifier in the preset format may be: http://nodeip/smartcontractname and http://nodeip/smartcontractname/xxx. Among them, smartcontractname and smartcontractname/xxx are the indicated information of the smart contract to be requested.
当接收到客户端发送的http请求时,将所述http请求发送至区块链节点的http服务器中,通过对所述区块链节点提供http服务器服务,使得所述区块链节点能够提供web服务,从而使得所述区块链节点能够代理所述http请求。可以理解的是,所述区块链节点的http服务器用于根据接收的http请求中携带的URI信息,并向相应智能合约的http服务器发送http请求;所述区块链节点的http服务器还用于接收智能合约的http服务器发送的http请求应答数据,并将http请求应答数据输出至客户端。When receiving the http request sent by the client, the http request is sent to the http server of the blockchain node, and the blockchain node can provide the web by providing the http server service to the blockchain node Service, so that the blockchain node can proxy the http request. It is understandable that the http server of the blockchain node is used to send the http request to the http server of the corresponding smart contract according to the URI information carried in the received http request; the http server of the blockchain node also uses To receive the http request response data sent by the http server of the smart contract, and output the http request response data to the client.
在本申请的至少一实施例中,所述方法还包括:在区块链节点上搭建http服务器;获取所述http服务器的服务器地址和端口号;在所述区块链节点中配置所述服务器地址和所述端口号,并将所述http服务器作为所述区块链节点的代理服务器。In at least one embodiment of the present application, the method further includes: building an http server on a blockchain node; obtaining the server address and port number of the http server; configuring the server in the blockchain node Address and the port number, and use the http server as a proxy server for the blockchain node.
可选地,基于Node.js搭建http服务器。Node.js为轻量的Javascript运行环境,由于Node.js使用事件驱动,非阻塞I/O模型,故而具备轻量和高效的特点。Optionally, build an http server based on Node.js. Node.js is a lightweight Javascript runtime environment. Because Node.js uses an event-driven, non-blocking I/O model, it is lightweight and efficient.
将所述区块链节点和http服务器置于一个网络,并在所述区块链节点中配置服务器地址和端口号。配置完成后,http服务器作为所述区块链节点的代理服务器,所述区块链节点在向外界发出网络请求时,必须经过http服务器,由http服务器代理所述区块链节点向外界发出网络请求,并代理所述区块链节点接收外界根据该网络请求返回的结果,因此,所述http服务器实质上是作为所述区块链节点与外界通信的中介。The block chain node and the http server are placed in a network, and the server address and port number are configured in the block chain node. After the configuration is completed, the http server serves as the proxy server of the blockchain node. When the blockchain node sends a network request to the outside world, it must pass through the http server, and the http server will proxy the blockchain node to the outside world. Request and act on behalf of the blockchain node to receive the result returned by the outside world according to the network request. Therefore, the http server essentially acts as an intermediary for the blockchain node to communicate with the outside world.
在本申请的至少一实施例中,所述解析出所述http请求中的URI标识的步骤包括:获取所述http请求的请求报文;解析所述请求报文,获取所述http请求的请求方法、URI标识、域名、文件后缀名信息。In at least one embodiment of the present application, the step of parsing the URI identifier in the http request includes: obtaining a request message of the http request; parsing the request message to obtain the request of the http request Method, URI identification, domain name, file suffix name information.
S13、将所述URI标识转换成智能合约URI标识。S13. Convert the URI identification into a smart contract URI identification.
在本申请的至少一实施例中,所述客户端可以输出不同用户的请求,相应具有权限的用户的请求才可以被响应。优选地,在所述将所述URI标识转换成智能合约URI标识的步骤之前,所述方法还包括:匹配出与所述URI标识对应的验证信息,所述验证信息包括数字签名及用户信息中的一种或多种;根据所述验证信息对所述URI标识进行验证;当验证所述URI标识通过,则将所述URI标识转换为智能合约URI标识。其中,所述数字签名为发送所述http请求的客户端通过预设数字签名算法对所述URI标识进行的数字签名,所述预设数字签名算法为用户预先设置的算法。In at least one embodiment of the present application, the client can output requests from different users, and only requests from users with corresponding permissions can be responded to. Preferably, before the step of converting the URI identification into a smart contract URI identification, the method further includes: matching verification information corresponding to the URI identification, and the verification information includes a digital signature and user information. One or more of; the URI identification is verified according to the verification information; when the verification of the URI identification is passed, the URI identification is converted into a smart contract URI identification. Wherein, the digital signature is a digital signature performed by the client sending the http request on the URI identifier by using a preset digital signature algorithm, and the preset digital signature algorithm is an algorithm preset by a user.
可以理解的是,当所述验证信息为数字签名时,所述根据验证信息对所述URI标识进行校验的步骤包括:通过预设数字签名算法对接收的所述URI标识进行数字签名;将获得的数字签名与所述URI标识携带的数字签名进行比较,判断比较结果是否一致;若判断结果为一致,则所述URI标识通过签名校验。It is understandable that when the verification information is a digital signature, the step of verifying the URI identifier according to the verification information includes: digitally signing the received URI identifier through a preset digital signature algorithm; The obtained digital signature is compared with the digital signature carried by the URI identification to determine whether the comparison result is consistent; if the judgment result is consistent, the URI identification passes the signature verification.
当所述验证信息为黑名单校验时,所述根据验证信息对所述URI标识进行校验的步骤包括:根据所述URI标识携带的用户信息遍历预存的用户信息黑名单数据库;判断所述URI标识携带的用户信息是否为黑名单用户;若判断结果为否,则所述URI标识通过黑名单校验。When the verification information is blacklist verification, the step of verifying the URI identifier according to the verification information includes: traversing a pre-stored user information blacklist database according to the user information carried in the URI identifier; and determining the Whether the user information carried by the URI identifier is a blacklist user; if the judgment result is no, the URI identifier passes the blacklist verification.
优选地,在所述http请求中添加标签,所述标签用于记录所述http请求的验证信息校验过程,以及所述http请求与智能合约的http服务器端接口的对应关系。Preferably, a tag is added to the http request, and the tag is used to record the verification information verification process of the http request and the corresponding relationship between the http request and the http server-side interface of the smart contract.
在本申请的至少一实施例中,所述将所述URI标识转换成智能合约URI标识的步骤包括:获取所述URI标识中的预设位置处的关键词;从智能合约关键词库中匹配出与所述关键词对应的目标智能合约;获取所述目标智能合约的目标URI标识;将所述目标URI标识作为所述目标智能合约的URI标识。In at least one embodiment of the present application, the step of converting the URI identification into a smart contract URI identification includes: obtaining a keyword at a preset position in the URI identification; matching from a smart contract keyword library Generate the target smart contract corresponding to the keyword; obtain the target URI identifier of the target smart contract; use the target URI identifier as the URI identifier of the target smart contract.
具体地,由于所述URI标识的格式为系统人员预先设置的,则所述预设位置处为标明要请求的智能合约信息的位置。例如,对于所述URI标识的格式为http://nodeip/smartcontractname,则其对应的预设位置处的关键词为smartcontractname。Specifically, since the format of the URI identification is preset by system personnel, the preset location is a location that indicates the smart contract information to be requested. For example, if the format of the URI identification is http://nodeip/smartcontractname, the keyword at the corresponding preset location is smartcontractname.
示例性的,假设智能合约关键词库中存在一个用于查询老赖名单的智能合约,其对应的关键词为oldlaicontract。通过所述区块链节点的http服务器解析所述http请求得到的URI标识为:http://nodeip/oldlaicontract/,获取所述URI标识中的关键词:oldlaicontract,根据这一关键词遍历智能合约关键词库,匹配出与这一关键词对应的智能合约,称为目标智能合约oldlaicontract,从而确定所述目标智能合约的URI标识,所述智能合约URI标识为:http://127.0.0.1:398213/。Exemplarily, suppose that there is a smart contract for querying the list of old laity in the smart contract keyword library, and the corresponding keyword is oldlaicontract. The URI identifier obtained by parsing the http request through the http server of the blockchain node is: http://nodeip/oldlaicontract/, the keyword in the URI identifier: oldlaicontract is obtained, and the smart contract is traversed according to this keyword The keyword library matches the smart contract corresponding to this keyword, which is called the target smart contract oldlaicontract, so as to determine the URI identification of the target smart contract. The URI identification of the smart contract is: http://127.0.0.1: 398213/.
S14、发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中。S14. Send the http request to the http server of the smart contract corresponding to the smart contract URI identification.
在本申请的至少一实施例中,所述智能合约(smartcontract)运行在沙箱环境里,只能与所述区块链节点进行通信。通过所述区块链节点的http服务器将所述http请求发送至对应所述智能合约URI标识的智能合约的http服务器中。所述智能合约运行于区块链网络中,通过重新设计所述智能合约,对所述智能合约提供http服务器服务,使得所述智能合约能够支持web标准服务,则用户可以通过客户端任意访问智能合约的自定义页面。In at least one embodiment of the present application, the smart contract (smartcontract) runs in a sandbox environment and can only communicate with the blockchain node. The http request is sent to the http server of the smart contract identified by the smart contract URI through the http server of the blockchain node. The smart contract runs in the blockchain network, and the smart contract is redesigned to provide http server services for the smart contract, so that the smart contract can support web standard services, and the user can access the smart contract arbitrarily through the client The custom page of the contract.
具体地,对所述智能合约提供http服务器服务的方法包括:在所述智能合约上搭建http服务器;获取搭建完成的http服务器的服务器地址和端口号;在所述智能合约中配置所述服务器地址和所述端口号,并将所述http服务器作为所述智能合约的代理服务器。由于对所述智能合约提供http服务器服务的方法与对所述区块链节点提供http服务器服务的方法原理相同,在此不再赘述。Specifically, the method for providing http server services to the smart contract includes: building an http server on the smart contract; obtaining the server address and port number of the http server that has been built; configuring the server address in the smart contract And the port number, and use the http server as a proxy server for the smart contract. Since the method of providing http server service to the smart contract has the same principle as the method of providing http server service to the blockchain node, it will not be repeated here.
S15、接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据。S15. Receive smart contract data sent by the http server of the smart contract and obtained by parsing the http request.
在本申请的至少一实施例中,所述区块链节点的http服务器接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据。优选地,所述智能合约的http服务器在解析所述http请求得到智能合约数据之前,所述方法还包括:接收所述区块链节点的http服务器发送的http请求,所述http请求中携带有特征信息;根据所述特征信息查询排序策略,得到与所述特征信息对应的排序优先级;根据所述排序优先级调整所述http请求的处理顺序。In at least one embodiment of the present application, the http server of the blockchain node receives smart contract data sent by the http server of the smart contract and obtained by parsing the http request. Preferably, before the http server of the smart contract parses the http request to obtain smart contract data, the method further includes: receiving an http request sent by the http server of the blockchain node, where the http request carries Characteristic information; according to the characteristic information query ranking strategy, the ranking priority corresponding to the characteristic information is obtained; and the processing order of the http request is adjusted according to the ranking priority.
具体地,所述排序策略用于记录特征信息与排序优先级的对应关系,所述特征信息包括以下之一或者任意组合:用户标识、数据类型、设备类型信息、设备IP地址、跳转 页面信息。根据数据获取请求携带的特征信息确定数据获取请求的排序优先级,并根据该排序优先级调整数据获取请求的处理顺序,这样,可以使数据获取请求的处理顺序更加合理,有效地缩短部分用户等待数据响应的时间,优化系统内部资源的配置,有效提升用户体验。Specifically, the sorting strategy is used to record the correspondence between characteristic information and sorting priority, and the characteristic information includes one or any combination of the following: user identification, data type, device type information, device IP address, and page jump information . Determine the sorting priority of the data acquisition request according to the characteristic information carried in the data acquisition request, and adjust the processing order of the data acquisition request according to the sorting priority. In this way, the processing sequence of the data acquisition request can be made more reasonable, and the waiting of some users can be effectively shortened. The data response time optimizes the allocation of internal resources of the system and effectively improves the user experience.
在本申请的至少一实施例中,所述智能合约的http服务器在解析所述http请求得到智能合约数据时,包括以下步骤:通过所述智能合约的http服务器解析所述http请求,根据解析结果确定待调用的智能合约的函数接口;根据所述待调用的智能合约的函数接口调用区块链上的智能合约对业务进行处理;获取对进行业务处理生成的智能合约数据。In at least one embodiment of the present application, when the http server of the smart contract parses the http request to obtain smart contract data, it includes the following steps: parsing the http request through the http server of the smart contract, and according to the analysis result Determine the function interface of the smart contract to be called; call the smart contract on the blockchain to process the business according to the function interface of the smart contract to be called; obtain the smart contract data generated for the business process.
具体地,所述智能合约的数据和逻辑是分离的,也即,所述智能合约包括数据合约和行为合约。其中,数据合约专门存储数据,其只进行简单的数据获取和修改;行为合约专门描述后台业务处理逻辑。每一个智能合约都隐射一个合约地址以及编译完成的ABI(Application Binary Interface,应用程序二进制接口),通过node.js进行封装隐藏,对外只提供统一的函数接口。通过所述ABI利用封装的js封装代码根据所述解析结果确定待调用的智能合约的函数接口。Specifically, the data and logic of the smart contract are separated, that is, the smart contract includes a data contract and a behavior contract. Among them, the data contract specifically stores data, which only performs simple data acquisition and modification; the behavior contract specifically describes the background business processing logic. Each smart contract implies a contract address and a compiled ABI (Application Binary Interface), which is encapsulated and hidden by node.js, and only provides a unified function interface to the outside. Through the ABI, the encapsulated js package code is used to determine the function interface of the smart contract to be called according to the analysis result.
S16、将所述智能合约数据发送至所述客户端。S16. Send the smart contract data to the client.
在本申请的至少一实施例中,通过所述智能合约的http服务器将所述智能合约数据发送至区块链节点中,并通过所述区块链节点的http服务器将所述智能合约数据发送至所述客户端,所述客户端解析所述封装成XML格式的智能合约数据,得到智能合约数据。所述区块链节点的http服务器将获取到的智能合约数据封装成XML格式数据,并将封装成XML格式的智能合约数据发送至所述客户端。其中,将所述智能合约数据封装成XML格式数据的步骤包括:嵌入程序代码读取智能合约数据;定义XML格式的数据结构;将所述智能合约数据加载至XML格式的数据结构中。In at least one embodiment of the present application, the smart contract data is sent to the blockchain node through the http server of the smart contract, and the smart contract data is sent through the http server of the blockchain node To the client, the client parses the smart contract data encapsulated in an XML format to obtain smart contract data. The http server of the blockchain node encapsulates the acquired smart contract data into XML format data, and sends the smart contract data encapsulated into the XML format to the client. Wherein, the step of encapsulating the smart contract data into XML format data includes: embedding program code to read smart contract data; defining a data structure in XML format; and loading the smart contract data into a data structure in XML format.
本申请实施例提供一种智能合约处理方法,应用于区块链节点的http服务器中,接收客户端发送的http请求;解析出所述http请求中的URI标识;将所述URI标识转换成智能合约URI标识;发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;将所述智能合约数据发送至所述客户端。通过本申请实施例,使得所述智能合约具备web访问能力,从而提供丰富的数据展示能力和交互体验;且用户通过web浏览器,能够直观的浏览智能合约的区块链数据,无需通过编程调取的形式获取智能合约的数据;本申请将自身的API通过页面形式展示,降低开发过程中的沟通,提高生产效率;本申请将web应用与区块链技术结合,使得web应用成为链生态的一部分,无需自己搭建web服务。The embodiment of the application provides a smart contract processing method, which is applied to an http server of a blockchain node to receive an http request sent by a client; parse out the URI identifier in the http request; convert the URI identifier into a smart Contract URI identification; sending the http request to the http server of the smart contract corresponding to the smart contract URI identification; receiving the smart contract data sent by the http server of the smart contract parsing the http request; sending the smart contract The contract data is sent to the client. Through the embodiments of this application, the smart contract is provided with web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can intuitively browse the blockchain data of the smart contract through a web browser without programming adjustments. The data of the smart contract is obtained in the form of taking; this application displays its own API in the form of a page, which reduces communication during the development process and improves production efficiency; this application combines web applications with blockchain technology to make web applications a chain ecosystem For one part, there is no need to build web services yourself.
如图2所示,本申请实施例提供一种智能合约处理方法,应用于智能合约的http服务器中,所述智能合约处理方法包括:As shown in FIG. 2, an embodiment of the present application provides a smart contract processing method, which is applied to an http server of a smart contract, and the smart contract processing method includes:
S21、接收区块链节点的http服务器发送的http请求。S21. Receive the http request sent by the http server of the blockchain node.
在本申请的至少一实施例中,通过所述智能合约的http服务器接收所述区块链节点的http服务器发送的http请求。In at least one embodiment of the present application, the http request sent by the http server of the blockchain node is received through the http server of the smart contract.
S22、解析所述http请求得到智能合约数据。S22. Parse the http request to obtain smart contract data.
在本申请的至少一实施例中,在所述解析所述http请求得到智能合约数据的步骤之前,所述方法还包括:获取所述http请求中携带的特征信息;获取与所述特征信息对应的排序优先级;根据所述排序优先级调整所述http请求的处理顺序。In at least one embodiment of the present application, before the step of parsing the http request to obtain smart contract data, the method further includes: acquiring the characteristic information carried in the http request; acquiring the characteristic information corresponding to the characteristic information The ordering priority; adjust the processing order of the http request according to the ordering priority.
具体地,所述排序策略用于记录特征信息与排序优先级的对应关系,所述特征信息包括以下之一或者任意组合:用户标识、数据类型、设备类型信息、设备IP地址、跳转页面信息。根据数据获取请求携带的特征信息确定数据获取请求的排序优先级,并根据该排序优先级调整数据获取请求的处理顺序,这样,可以使数据获取请求的处理顺序更 加合理,有效地缩短部分用户等待数据响应的时间,优化系统内部资源的配置,有效提升用户体验。Specifically, the sorting strategy is used to record the correspondence between characteristic information and sorting priority, and the characteristic information includes one or any combination of the following: user identification, data type, device type information, device IP address, and page jump information . Determine the sorting priority of the data acquisition request according to the characteristic information carried in the data acquisition request, and adjust the processing order of the data acquisition request according to the sorting priority. In this way, the processing sequence of the data acquisition request can be made more reasonable, and the waiting of some users can be effectively shortened. The data response time optimizes the allocation of internal resources of the system and effectively improves the user experience.
所述解析所述http请求得到智能合约数据的步骤包括:解析所述http请求;根据解析结果确定待调用的智能合约的函数接口;根据所述待调用的智能合约的函数接口调用区块链上的智能合约对业务进行处理;获取对进行业务处理生成的智能合约数据。The step of parsing the http request to obtain smart contract data includes: parsing the http request; determining the function interface of the smart contract to be called according to the analysis result; calling the blockchain according to the function interface of the smart contract to be called The smart contract for business processing; obtain the smart contract data generated for business processing.
具体地,所述智能合约的数据和逻辑是分离的,也即,所述智能合约包括数据合约和行为合约。其中,数据合约专门存储数据,其只进行简单的数据获取和修改;行为合约专门描述后台业务处理逻辑。每一个智能合约都隐射一个合约地址以及编译完成的ABI(Application Binary Interface,应用程序二进制接口),通过node.js进行封装隐藏,对外只提供统一的函数接口。通过所述ABI利用封装的js封装代码根据所述解析结果确定待调用的智能合约的函数接口。Specifically, the data and logic of the smart contract are separated, that is, the smart contract includes a data contract and a behavior contract. Among them, the data contract specifically stores data, which only performs simple data acquisition and modification; the behavior contract specifically describes the background business processing logic. Each smart contract implies a contract address and a compiled ABI (Application Binary Interface), which is encapsulated and hidden by node.js, and only provides a unified function interface to the outside. Through the ABI, the encapsulated js package code is used to determine the function interface of the smart contract to be called according to the analysis result.
S23、发送所述智能合约数据至所述区块链节点的http服务器中。S23. Send the smart contract data to the http server of the blockchain node.
在本申请的至少一实施例中,发送所述智能合约数据至所述区块链节点的http服务器中,通过所述区块链节点的http服务器将所述智能合约数据发送至所述客户端。所述客户端解析所述封装成XML格式的智能合约数据,得到智能合约数据。In at least one embodiment of the present application, the smart contract data is sent to the http server of the blockchain node, and the smart contract data is sent to the client through the http server of the blockchain node . The client parses the smart contract data encapsulated in the XML format to obtain smart contract data.
本申请实施例提供一种智能合约处理方法,应用于智能合约的http服务器中,接收区块链节点的http服务器发送的http请求;解析所述http请求得到智能合约数据;发送所述智能合约数据至所述区块链节点的http服务器中。通过本申请实施例,使得所述智能合约具备web访问能力,从而提供丰富的数据展示能力和交互体验;且用户通过web浏览器,能够直观的浏览智能合约的区块链数据,无需通过编程调取的形式获取智能合约的数据;本申请将自身的API通过页面形式展示,降低开发过程中的沟通,提高生产效率;本申请将web应用与区块链技术结合,使得web应用成为链生态的一部分,无需自己搭建web服务。The embodiment of the application provides a smart contract processing method, which is applied to the http server of the smart contract, receives the http request sent by the http server of the blockchain node; parses the http request to obtain the smart contract data; sends the smart contract data To the http server of the blockchain node. Through the embodiments of this application, the smart contract is provided with web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can intuitively browse the blockchain data of the smart contract through a web browser without programming adjustments. The data of the smart contract is obtained in the form of taking; this application displays its own API in the form of a page, which reduces communication during the development process and improves production efficiency; this application combines web applications with blockchain technology to make web applications a chain ecosystem For one part, there is no need to build web services yourself.
以上是对本申请实施例所提供的方法进行的详细描述。根据不同的需求,所示流程图中方块的执行顺序可以改变,某些方块可以省略。The foregoing is a detailed description of the method provided by the embodiment of the present application. According to different requirements, the execution order of the blocks in the flowchart shown can be changed, and some blocks can be omitted.
图3是本申请实施例提供的计算机设备的结构示意图,如图3所示,计算机设备1包括存储器10,存储器10中存储有所述智能合约处理装置100。当所述智能合约处理装置100应用于区块链节点的http服务器中,所述智能合约处理装置100可以接收客户端发送的http请求;解析出所述http请求中的URI标识;将所述URI标识转换成智能合约URI标识;发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;将所述智能合约数据发送至所述客户端。所述智能合约处理装置100还可以应用于智能合约的http服务器中,所述智能合约处理装置100可以接收区块链节点的http服务器发送的http请求;解析所述http请求得到智能合约数据;发送所述智能合约数据至所述区块链节点的http服务器中。通过本申请实施例,使得所述智能合约具备web访问能力,从而提供丰富的数据展示能力和交互体验;且用户通过web浏览器,能够直观的浏览智能合约的区块链数据,无需通过编程调取的形式获取智能合约的数据;本申请将自身的API通过页面形式展示,降低开发过程中的沟通,提高生产效率;本申请将web应用与区块链技术结合,使得web应用成为链生态的一部分,无需自己搭建web服务。FIG. 3 is a schematic structural diagram of a computer device provided by an embodiment of the present application. As shown in FIG. 3, the computer device 1 includes a memory 10 in which the smart contract processing apparatus 100 is stored. When the smart contract processing device 100 is applied to an http server of a blockchain node, the smart contract processing device 100 can receive an http request sent by a client; parse out the URI identifier in the http request; and convert the URI The identifier is converted into a smart contract URI identifier; sending the http request to the http server of the smart contract corresponding to the smart contract URI identifier; receiving the smart contract data sent by the http server of the smart contract by parsing the http request; Send the smart contract data to the client. The smart contract processing device 100 can also be applied to an http server of a smart contract. The smart contract processing device 100 can receive an http request sent by an http server of a blockchain node; parse the http request to obtain smart contract data; and send The smart contract data is sent to the http server of the blockchain node. Through the embodiments of this application, the smart contract is provided with web access capabilities, thereby providing rich data display capabilities and interactive experience; and the user can intuitively browse the blockchain data of the smart contract through a web browser without programming adjustments. The data of the smart contract is obtained in the form of taking; this application displays its own API in the form of a page, which reduces communication during the development process and improves production efficiency; this application combines web applications with blockchain technology to make web applications a chain ecosystem For one part, there is no need to build web services yourself.
本实施方式中,计算机设备1还可以包括显示屏20及处理器30。存储器10、显示屏20可以分别与处理器30电连接。In this embodiment, the computer device 1 may also include a display screen 20 and a processor 30. The memory 10 and the display screen 20 may be electrically connected to the processor 30 respectively.
所述的存储器10可以是不同类型存储设备,用于存储各类数据。例如,可以是计算机设备1的存储器、内存,还可以是可外接于该计算机设备1的存储卡,如闪存、SM卡(Smart Media Card,智能媒体卡)、SD卡(Secure Digital Card,安全数字卡)等。此外,存储器10可以包括硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card,SMC), 安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其计算机可读的存储器件。存储器10用于存储各类数据,例如,所述计算机设备1中安装的各类应用程序(Applications)、应用上述智能合约处理方法而设置、获取的数据等信息。The memory 10 may be different types of storage devices for storing various types of data. For example, it can be the memory or internal memory of the computer device 1, or it can be a memory card that can be externally connected to the computer device 1, such as flash memory, SM card (Smart Media Card), SD card (Secure Digital Card, secure digital card). Card) etc. In addition, the memory 10 may include a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash memory card (Flash Card), at least one disk storage device, a flash memory Device, or its computer-readable storage device. The memory 10 is used to store various types of data, for example, various types of applications (Applications) installed in the computer device 1, and data set and obtained by applying the smart contract processing method described above.
显示屏20安装于计算机设备1,用于显示信息。The display screen 20 is installed in the computer device 1 for displaying information.
处理器30用于执行所述智能合约处理方法以及所述计算机设备1内安装的各类软件,例如操作系统及应用显示软件等。处理器30包含但不限于处理器(Central Processing Unit,CPU)、微控制单元(Micro Controller Unit,MCU)等用于解释计算机指令以及处理计算机软件中的数据的装置。The processor 30 is used to execute the smart contract processing method and various software installed in the computer device 1, such as an operating system and application display software. The processor 30 includes, but is not limited to, a processor (Central Processing Unit, CPU), a Micro Controller Unit (MCU), and other devices for interpreting computer instructions and processing data in computer software.
所述的智能合约处理装置100可以包括一个或多个的模块,所述一个或多个模块被存储在计算机设备1的存储器10中并被配置成由一个或多个处理器(本实施方式为一个处理器30)执行,以完成本申请实施例。当所述智能合约处理装置100应用于区块链节点的http服务器时,例如,参阅图4所示,所述智能合约处理装置100可以包括http请求接收模块101、http请求解析模块102、URI标识转换模块103、http请求发送模块104、合约数据获取模块105及合约数据发送模块106。本申请实施例所称的模块可以是完成一特定功能的程序段,比程序更适合于描述软件在处理器30中的执行过程。The smart contract processing apparatus 100 may include one or more modules, and the one or more modules are stored in the memory 10 of the computer device 1 and configured to be operated by one or more processors (this embodiment is A processor 30) executes to complete the embodiment of the present application. When the smart contract processing device 100 is applied to an http server of a blockchain node, for example, as shown in FIG. 4, the smart contract processing device 100 may include an http request receiving module 101, an http request parsing module 102, and a URI identifier. The conversion module 103, the http request sending module 104, the contract data obtaining module 105, and the contract data sending module 106. The module referred to in the embodiment of the present application may be a program segment that completes a specific function, and is more suitable for describing the execution process of software in the processor 30 than a program.
可以理解的是,对应上述智能合约处理方法中的各实施方式,计算机设备1可以包括图4中所示的各功能模块中的一部分或全部,各模块的功能将在以下具体介绍。需要说明的是,以上智能合约处理方法的各实施方式中相同的名词、相关名词及其具体的解释说明也可以适用于以下对各模块的功能介绍。为节省篇幅及避免重复起见,在此就不再赘述。It can be understood that, corresponding to the various implementations of the smart contract processing method described above, the computer device 1 may include some or all of the functional modules shown in FIG. 4, and the functions of each module will be described in detail below. It should be noted that the same nouns, related nouns and specific explanations in the various implementations of the above smart contract processing method can also be applied to the following functional introduction of each module. In order to save space and avoid repetition, I won't repeat them here.
http请求接收模块101可以用于接收客户端发送的http请求。The http request receiving module 101 may be used to receive http requests sent by the client.
http请求解析模块102可以用于解析出所述http请求中的URI标识。The http request parsing module 102 may be used to parse the URI identification in the http request.
URI标识转换模块103可以用于将所述URI标识转换成智能合约URI标识。The URI identification conversion module 103 may be used to convert the URI identification into a smart contract URI identification.
http请求发送模块104可以发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中。The http request sending module 104 may send the http request to the http server of the smart contract corresponding to the smart contract URI identification.
合约数据获取模块105可以用于接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据。The contract data acquisition module 105 may be configured to receive smart contract data sent by the http server of the smart contract and obtained by parsing the http request.
合约数据发送模块106可以用于将所述智能合约数据发送至所述客户端。The contract data sending module 106 may be used to send the smart contract data to the client.
当所述智能合约处理装置100应用于智能合约的http服务器时,所述http请求接收模块101还可以用于接收区块链节点的http服务器发送的http请求。When the smart contract processing device 100 is applied to an http server of a smart contract, the http request receiving module 101 may also be used to receive an http request sent by an http server of a blockchain node.
所述http请求解析模块102还可以用于解析所述http请求得到智能合约数据。The http request parsing module 102 can also be used to parse the http request to obtain smart contract data.
所述合约数据发送模块106还可以用于发送所述智能合约数据至所述区块链节点的http服务器中。The contract data sending module 106 can also be used to send the smart contract data to the http server of the blockchain node.
本申请实施例还提供一种计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器30执行时实现上述任一实施方式中的智能合约处理方法的步骤。The embodiment of the present application also provides a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor 30, the steps of the smart contract processing method in any of the foregoing embodiments are implemented.
所述智能合约处理装置100如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施方式方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器30执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机可读指令代码,所述计算机可读指令代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读存储介质可以包括:能够携带所述计算机可读指令代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器 (ROM,Read-Only Memory)、随机存取存储器(Random Access Memory,RAM)等易失性和非易失性的可读存储介质。If the smart contract processing device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, this application implements all or part of the processes in the above-mentioned implementation methods, and can also be completed by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the program is executed by the processor 30, the steps of the foregoing method embodiments can be implemented. Wherein, the computer program includes computer-readable instruction code, and the computer-readable instruction code may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying the computer-readable instruction code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read- Only Memory, Random Access Memory (RAM) and other volatile and non-volatile readable storage media.
所称处理器30可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器30是所述智能合约处理装置100/计算机设备1的控制中心,利用各种接口和线路连接整个智能合约处理装置100/计算机设备1的各个部分。The so-called processor 30 may be a central processing unit (Central Processing Unit, CPU), other general processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The processor 30 is the control center of the smart contract processing apparatus 100/computer equipment 1, and is connected by various interfaces and lines. All parts of the entire smart contract processing device 100/computer equipment 1.
所述存储器10用于存储所述计算机程序和/或模块,所述处理器30通过运行或执行存储在所述存储器10内的计算机程序和/或模块,以及调用存储在存储器10内的数据,实现所述智能合约处理装置100/计算机设备1的各种功能。所述存储器10可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据计算机设备1的使用所创建的数据(比如音频数据)等。The memory 10 is used to store the computer program and/or module, and the processor 30 runs or executes the computer program and/or module stored in the memory 10 and calls the data stored in the memory 10, Various functions of the smart contract processing device 100/computer equipment 1 are realized. The memory 10 may mainly include a program storage area and a data storage area, where the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.), etc.; the storage data area may Data (such as audio data) created in accordance with the use of the computer device 1 and the like are stored.
进一步地,所述计算机可读存储介质主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序等;存储数据区可存储根据区块链节点的使用所创建的数据等。Further, the computer-readable storage medium mainly includes a storage program area and a storage data area, where the storage program area can store an operating system, an application program required by at least one function, etc.; the storage data area can store a block chain node Use the created data, etc.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
在本申请所提供的几个具体实施方式中,应该理解到,所揭露的计算机设备和方法,可以通过其它的方式实现。例如,以上所描述的系统实施方式仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several specific implementation manners provided in this application, it should be understood that the disclosed computer device and method may be implemented in other ways. For example, the system implementation described above is only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
对于本领域技术人员而言,显然本申请实施例不限于上述示范性实施例的细节,而且在不背离本申请实施例的精神或基本特征的情况下,能够以其他的具体形式实现本申请实施例。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请实施例的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请实施例内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。系统、装置或计算机设备权利要求中陈述的多个单元、模块或装置也可以由同一个单元、模块或装置通过软件或者硬件来实现。For those skilled in the art, it is obvious that the embodiments of the present application are not limited to the details of the above exemplary embodiments, and can be implemented in other specific forms without departing from the spirit or basic characteristics of the embodiments of the present application. example. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive. The scope of the embodiments of the present application is defined by the appended claims rather than the above description, and therefore it is intended to fall on All changes within the meaning and scope of equivalent elements of the claims are included in the embodiments of the present application. Any reference signs in the claims should not be regarded as limiting the claims involved. Multiple units, modules or devices stated in the claims of a system, device or computer equipment can also be implemented by the same unit, module or device through software or hardware.
以上实施方式仅用以说明本申请实施例的技术方案而非限制,尽管参照以上较佳实施方式对本申请实施例进行了详细说明,本领域的普通技术人员应当理解,可以对本申请实施例的技术方案进行修改或等同替换都不应脱离本申请实施例的技术方案的精神和范围。The above implementation manners are only used to illustrate the technical solutions of the embodiments of the present application and not to limit them. Although the embodiments of the present application are described in detail with reference to the above preferred implementation manners, those of ordinary skill in the art should understand that the technical solutions of the embodiments of the present application can be compared. Modifications or equivalent replacements of the solutions should not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (20)

  1. 一种智能合约处理方法,应用于区块链节点的http服务器中,其中,所述智能合约处理方法包括:A smart contract processing method applied to an http server of a blockchain node, wherein the smart contract processing method includes:
    接收客户端发送的http请求;Receive the http request sent by the client;
    解析出所述http请求中的URI标识;Parse out the URI identifier in the http request;
    将所述URI标识转换成智能合约URI标识;Converting the URI identification into a smart contract URI identification;
    发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;Sending the http request to the http server of the smart contract corresponding to the smart contract URI identification;
    接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;Receiving the smart contract data sent by the http server of the smart contract and obtained by parsing the http request;
    将所述智能合约数据发送至所述客户端。Send the smart contract data to the client.
  2. 根据权利要求1所述的智能合约处理方法,其中,所述方法还包括:The smart contract processing method according to claim 1, wherein the method further comprises:
    在区块链节点上搭建http服务器;Build http server on blockchain nodes;
    获取所述http服务器的服务器地址和端口号;Obtaining the server address and port number of the http server;
    在所述区块链节点中配置所述服务器地址和所述端口号,并将所述http服务器作为所述区块链节点的代理服务器。The server address and the port number are configured in the blockchain node, and the http server is used as a proxy server of the blockchain node.
  3. 根据权利要求1所述的智能合约处理方法,其中,在所述将所述URI标识转换成智能合约URI标识的步骤之前,所述方法还包括:The smart contract processing method according to claim 1, wherein, before the step of converting the URI identification into a smart contract URI identification, the method further comprises:
    匹配出与所述URI标识对应的验证信息,所述验证信息包括数字签名及用户信息中的一种或多种;Matching verification information corresponding to the URI identification, the verification information including one or more of a digital signature and user information;
    根据所述验证信息对所述URI标识进行验证;Verify the URI identifier according to the verification information;
    当验证所述URI标识通过,则将所述URI标识转换为智能合约URI标识。When the verification of the URI identification is passed, the URI identification is converted into a smart contract URI identification.
  4. 根据权利要求1所述的智能合约处理方法,其中,所述将所述URI标识转换成智能合约URI标识的步骤包括:The smart contract processing method according to claim 1, wherein the step of converting the URI identification into a smart contract URI identification comprises:
    获取所述URI标识中的预设位置处的关键词;Acquiring a keyword at a preset position in the URI identifier;
    从智能合约关键词库中匹配出与所述关键词对应的目标智能合约;Match the target smart contract corresponding to the keyword from the smart contract keyword library;
    获取所述目标智能合约的目标URI标识;Acquiring the target URI identifier of the target smart contract;
    将所述目标URI标识作为所述目标智能合约的URI标识。The target URI identifier is used as the URI identifier of the target smart contract.
  5. 根据权利要求1所述的智能合约处理方法,其中,在所述将所述智能合约数据发送至所述客户端之前,所述方法还包括:The smart contract processing method according to claim 1, wherein, before the sending the smart contract data to the client, the method further comprises:
    嵌入程序代码读取所述智能合约数据;Embedded program code to read the smart contract data;
    定义XML格式的数据结构;Define the data structure in XML format;
    将所述智能合约数据加载至XML格式的数据结构中。Load the smart contract data into a data structure in XML format.
  6. 一种智能合约处理方法,应用于智能合约的http服务器中,其中,所述方法包括:A smart contract processing method applied to an http server of a smart contract, wherein the method includes:
    接收区块链节点的http服务器发送的http请求;Receive the http request sent by the http server of the blockchain node;
    解析所述http请求得到智能合约数据;Parsing the http request to obtain smart contract data;
    发送所述智能合约数据至所述区块链节点的http服务器中。Send the smart contract data to the http server of the blockchain node.
  7. 根据权利要求6所述的智能合约处理方法,其中,在所述解析所述http请求得到智能合约数据的步骤之前,所述方法还包括:The smart contract processing method according to claim 6, wherein, before the step of parsing the http request to obtain smart contract data, the method further comprises:
    获取所述http请求中携带的特征信息;Acquiring the characteristic information carried in the http request;
    获取与所述特征信息对应的排序优先级;Acquiring a ranking priority corresponding to the characteristic information;
    根据所述排序优先级调整所述http请求的处理顺序。Adjust the processing order of the http request according to the sorting priority.
  8. 根据权利要求6所述的智能合约处理方法,其中,所述解析所述http请求得到智能合约数据的步骤包括:The smart contract processing method according to claim 6, wherein the step of parsing the http request to obtain smart contract data comprises:
    解析所述http请求;Parsing the http request;
    根据解析结果确定待调用的智能合约的函数接口;Determine the function interface of the smart contract to be called according to the analysis result;
    根据所述待调用的智能合约的函数接口调用区块链上的智能合约对业务进行处理;Call the smart contract on the blockchain to process the business according to the function interface of the smart contract to be called;
    获取对进行业务处理生成的智能合约数据。Obtain smart contract data generated for business processing.
  9. 一种计算机设备,其中,所述计算机设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:A computer device, wherein the computer device includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to implement the following steps:
    接收客户端发送的http请求;Receive the http request sent by the client;
    解析出所述http请求中的URI标识;Parse out the URI identifier in the http request;
    将所述URI标识转换成智能合约URI标识;Converting the URI identification into a smart contract URI identification;
    发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;Sending the http request to the http server of the smart contract corresponding to the smart contract URI identification;
    接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;Receiving the smart contract data sent by the http server of the smart contract and obtained by parsing the http request;
    将所述智能合约数据发送至所述客户端。Send the smart contract data to the client.
  10. 根据权利要求9所述的计算机设备,其中,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:The computer device according to claim 9, wherein the processor is configured to execute the at least one computer readable instruction to implement the following steps:
    在区块链节点上搭建http服务器;Build http server on blockchain nodes;
    获取所述http服务器的服务器地址和端口号;Obtaining the server address and port number of the http server;
    在所述区块链节点中配置所述服务器地址和所述端口号,并将所述http服务器作为所述区块链节点的代理服务器。The server address and the port number are configured in the blockchain node, and the http server is used as a proxy server of the blockchain node.
  11. 根据权利要求9所述的计算机设备,其中,在所述将所述URI标识转换成智能合约URI标识的步骤之前,所述处理器执行所述至少一个计算机可读指令还用以实现以下步骤:The computer device according to claim 9, wherein, before the step of converting the URI identification into a smart contract URI identification, the processor executing the at least one computer-readable instruction is further used to implement the following steps:
    匹配出与所述URI标识对应的验证信息,所述验证信息包括数字签名及用户信息中的一种或多种;Matching verification information corresponding to the URI identification, the verification information including one or more of a digital signature and user information;
    根据所述验证信息对所述URI标识进行验证;Verify the URI identifier according to the verification information;
    当验证所述URI标识通过,则将所述URI标识转换为智能合约URI标识。When the verification of the URI identification is passed, the URI identification is converted into a smart contract URI identification.
  12. 根据权利要求9所述的计算机设备,其中,所述处理器执行所述至少一个计算机可读指令以实现所述将所述URI标识转换成智能合约URI标识的步骤时,具体包括:The computer device according to claim 9, wherein when the processor executes the at least one computer-readable instruction to implement the step of converting the URI identification into a smart contract URI identification, it specifically comprises:
    获取所述URI标识中的预设位置处的关键词;Acquiring a keyword at a preset position in the URI identifier;
    从智能合约关键词库中匹配出与所述关键词对应的目标智能合约;Match the target smart contract corresponding to the keyword from the smart contract keyword library;
    获取所述目标智能合约的目标URI标识;Acquiring the target URI identifier of the target smart contract;
    将所述目标URI标识作为所述目标智能合约的URI标识。The target URI identifier is used as the URI identifier of the target smart contract.
  13. 根据权利要求9所述的计算机设备,其中,在所述将所述智能合约数据发送至所述客户端之前,所述处理器执行所述至少一个计算机可读指令还用以实现以下步骤:The computer device according to claim 9, wherein, before the sending the smart contract data to the client, the processor executing the at least one computer-readable instruction is further used to implement the following steps:
    嵌入程序代码读取所述智能合约数据;Embedded program code to read the smart contract data;
    定义XML格式的数据结构;Define the data structure in XML format;
    将所述智能合约数据加载至XML格式的数据结构中。Load the smart contract data into a data structure in XML format.
  14. 一种计算机设备,其中,所述计算机设备包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:A computer device, wherein the computer device includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to implement the following steps:
    接收区块链节点的http服务器发送的http请求;Receive the http request sent by the http server of the blockchain node;
    解析所述http请求得到智能合约数据;Parsing the http request to obtain smart contract data;
    发送所述智能合约数据至所述区块链节点的http服务器中。Send the smart contract data to the http server of the blockchain node.
  15. 一种计算机可读存储介质,其上存储有至少一个计算机可读指令,其中,所述至少一个计算机可读指令被处理器执行时实现以下步骤:A computer-readable storage medium having at least one computer-readable instruction stored thereon, wherein the at least one computer-readable instruction implements the following steps when executed by a processor:
    接收客户端发送的http请求;Receive the http request sent by the client;
    解析出所述http请求中的URI标识;Parse out the URI identifier in the http request;
    将所述URI标识转换成智能合约URI标识;Converting the URI identification into a smart contract URI identification;
    发送所述http请求至所述智能合约URI标识对应的智能合约的http服务器中;Sending the http request to the http server of the smart contract corresponding to the smart contract URI identification;
    接收所述智能合约的http服务器发送的解析所述http请求得到的智能合约数据;Receiving the smart contract data sent by the http server of the smart contract and obtained by parsing the http request;
    将所述智能合约数据发送至所述客户端。Send the smart contract data to the client.
  16. 根据权利要求15所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行还用以实现以下步骤:The storage medium according to claim 15, wherein the execution of the at least one computer readable instruction by the processor further implements the following steps:
    在区块链节点上搭建http服务器;Build http server on blockchain nodes;
    获取所述http服务器的服务器地址和端口号;Obtaining the server address and port number of the http server;
    在所述区块链节点中配置所述服务器地址和所述端口号,并将所述http服务器作为所述区块链节点的代理服务器。The server address and the port number are configured in the blockchain node, and the http server is used as a proxy server of the blockchain node.
  17. 根据权利要求15所述的存储介质,其中,在所述将所述URI标识转换成智能合约URI标识的步骤之前,所述至少一个计算机可读指令被所述处理器执行还用以实现以下步骤:The storage medium according to claim 15, wherein, before the step of converting the URI identification into a smart contract URI identification, the execution of the at least one computer-readable instruction by the processor is further used to implement the following steps :
    匹配出与所述URI标识对应的验证信息,所述验证信息包括数字签名及用户信息中的一种或多种;Matching verification information corresponding to the URI identification, the verification information including one or more of a digital signature and user information;
    根据所述验证信息对所述URI标识进行验证;Verify the URI identifier according to the verification information;
    当验证所述URI标识通过,则将所述URI标识转换为智能合约URI标识。When the verification of the URI identification is passed, the URI identification is converted into a smart contract URI identification.
  18. 根据权利要求15所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述将所述URI标识转换成智能合约URI标识的步骤时,具体包括:The storage medium according to claim 15, wherein when the at least one computer-readable instruction is executed by the processor to implement the step of converting the URI identification into a smart contract URI identification, it specifically comprises:
    获取所述URI标识中的预设位置处的关键词;Acquiring a keyword at a preset position in the URI identifier;
    从智能合约关键词库中匹配出与所述关键词对应的目标智能合约;Match the target smart contract corresponding to the keyword from the smart contract keyword library;
    获取所述目标智能合约的目标URI标识;Acquiring the target URI identifier of the target smart contract;
    将所述目标URI标识作为所述目标智能合约的URI标识。The target URI identifier is used as the URI identifier of the target smart contract.
  19. 根据权利要求15所述的存储介质,其中,在所述将所述智能合约数据发送至所述客户端之前,所述至少一个计算机可读指令被所述处理器执行还用以实现以下步骤:The storage medium according to claim 15, wherein, before the sending the smart contract data to the client, the at least one computer readable instruction is executed by the processor to further implement the following steps:
    嵌入程序代码读取所述智能合约数据;Embedded program code to read the smart contract data;
    定义XML格式的数据结构;Define the data structure in XML format;
    将所述智能合约数据加载至XML格式的数据结构中。Load the smart contract data into a data structure in XML format.
  20. 一种计算机可读存储介质,其上存储有至少一个计算机可读指令,其中,所述至少一个计算机可读指令被处理器执行时实现以下步骤:A computer-readable storage medium having at least one computer-readable instruction stored thereon, wherein the at least one computer-readable instruction implements the following steps when executed by a processor:
    接收区块链节点的http服务器发送的http请求;Receive the http request sent by the http server of the blockchain node;
    解析所述http请求得到智能合约数据;Parsing the http request to obtain smart contract data;
    发送所述智能合约数据至所述区块链节点的http服务器中。Send the smart contract data to the http server of the blockchain node.
PCT/CN2020/105942 2019-10-15 2020-07-30 Intelligent contract processing method, computer device and storage medium WO2021073202A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910977369.0 2019-10-15
CN201910977369.0A CN111026982A (en) 2019-10-15 2019-10-15 Intelligent contract processing method, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2021073202A1 true WO2021073202A1 (en) 2021-04-22

Family

ID=70204818

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/105942 WO2021073202A1 (en) 2019-10-15 2020-07-30 Intelligent contract processing method, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN111026982A (en)
WO (1) WO2021073202A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542405A (en) * 2021-07-14 2021-10-22 广东卓启云链科技有限公司 Block chain-based network communication system, method, device and storage medium
CN113792103A (en) * 2021-09-17 2021-12-14 北京安天网络安全技术有限公司 Management method and device of mobile storage equipment and electronic equipment
CN113822595A (en) * 2021-10-11 2021-12-21 中国平安人寿保险股份有限公司 Method and device for configuring incentive data of financial products, computer equipment and medium
CN115277147A (en) * 2022-07-21 2022-11-01 深圳壹账通智能科技有限公司 File tracing verification method, electronic device and readable storage medium

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111026982A (en) * 2019-10-15 2020-04-17 深圳壹账通智能科技有限公司 Intelligent contract processing method, computer equipment and storage medium
CN111984245A (en) * 2020-08-31 2020-11-24 上海玳鸽信息技术有限公司 Block chain intelligent contract online integrated development environment system and implementation method
CN112819468A (en) * 2021-02-24 2021-05-18 浙江蓝景科技有限公司 Intelligent contract processing method and device and electronic equipment
CN113014666B (en) * 2021-03-17 2023-02-28 深圳壹账通智能科技有限公司 Block chain protocol stack architecture method, system, equipment and storage medium
CN114338036A (en) * 2021-12-23 2022-04-12 杭州趣链科技有限公司 Data communication method and device for block chain client

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282339A (en) * 2018-01-25 2018-07-13 中国科学院合肥物质科学研究院 A kind of digital identity method for retrieving based on intelligent contract and from social media
CN108717431A (en) * 2018-05-11 2018-10-30 中国科学院软件研究所 A kind of electronic evidence based on block chain deposits card, verification method and system
CN109033406A (en) * 2018-08-03 2018-12-18 上海点融信息科技有限责任公司 For searching for the method, apparatus and storage medium of block chain data
CN109150904A (en) * 2018-09-25 2019-01-04 深圳市佰仟金融服务有限公司 Interface service call method and terminal device
CN111026982A (en) * 2019-10-15 2020-04-17 深圳壹账通智能科技有限公司 Intelligent contract processing method, computer equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107370730B (en) * 2017-07-14 2020-06-02 创新先进技术有限公司 Login information processing method and equipment
CN108777698A (en) * 2018-04-13 2018-11-09 深圳市元征科技股份有限公司 Webpage storage method, system and block chain node device
CN108665372B (en) * 2018-04-28 2024-01-16 腾讯科技(深圳)有限公司 Information processing, inquiring and storing method and device based on block chain
CN109376541A (en) * 2018-09-21 2019-02-22 上海点融信息科技有限责任公司 For running the method, apparatus and computer storage medium of intelligent contract
CN109683869A (en) * 2018-12-29 2019-04-26 北京阿斯特时代科技有限公司 The development approach and device of DAPP
CN109922077B (en) * 2019-03-27 2021-06-04 北京思源理想控股集团有限公司 Identity authentication method and system based on block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282339A (en) * 2018-01-25 2018-07-13 中国科学院合肥物质科学研究院 A kind of digital identity method for retrieving based on intelligent contract and from social media
CN108717431A (en) * 2018-05-11 2018-10-30 中国科学院软件研究所 A kind of electronic evidence based on block chain deposits card, verification method and system
CN109033406A (en) * 2018-08-03 2018-12-18 上海点融信息科技有限责任公司 For searching for the method, apparatus and storage medium of block chain data
CN109150904A (en) * 2018-09-25 2019-01-04 深圳市佰仟金融服务有限公司 Interface service call method and terminal device
CN111026982A (en) * 2019-10-15 2020-04-17 深圳壹账通智能科技有限公司 Intelligent contract processing method, computer equipment and storage medium

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113542405A (en) * 2021-07-14 2021-10-22 广东卓启云链科技有限公司 Block chain-based network communication system, method, device and storage medium
CN113542405B (en) * 2021-07-14 2023-10-17 广东卓启云链科技有限公司 Block chain-based network communication system, method, equipment and storage medium
CN113792103A (en) * 2021-09-17 2021-12-14 北京安天网络安全技术有限公司 Management method and device of mobile storage equipment and electronic equipment
CN113822595A (en) * 2021-10-11 2021-12-21 中国平安人寿保险股份有限公司 Method and device for configuring incentive data of financial products, computer equipment and medium
CN113822595B (en) * 2021-10-11 2024-03-19 中国平安人寿保险股份有限公司 Method, device, computer equipment and medium for configuring financial product incentive data
CN115277147A (en) * 2022-07-21 2022-11-01 深圳壹账通智能科技有限公司 File tracing verification method, electronic device and readable storage medium

Also Published As

Publication number Publication date
CN111026982A (en) 2020-04-17

Similar Documents

Publication Publication Date Title
WO2021073202A1 (en) Intelligent contract processing method, computer device and storage medium
US10623476B2 (en) Endpoint management system providing an application programming interface proxy service
JP6754011B2 (en) Methods, devices and servers for providing voice services
CN110311983B (en) Service request processing method, device and system, electronic equipment and storage medium
US11175796B2 (en) Menu management method, server, and system
US20140289366A1 (en) Service providing method and system for instance hosting
CN111290865A (en) Service calling method and device, electronic equipment and storage medium
CN112527528A (en) Data transmission method, device and storage medium based on message queue
US11716264B2 (en) In situ triggered function as a service within a service mesh
US11360737B2 (en) Method and apparatus for providing speech service
US20150222616A1 (en) Private cloud connected device cluster architecture
CN105765533B (en) Method and apparatus for firmware virtualization
CN106713469B (en) Dynamic loading method, device and system for distributed container
US10747600B2 (en) Extensibility for third party application programming interfaces
CN110380919A (en) Processing method, device, electronic equipment and the readable storage medium storing program for executing of block chain request
CN111953648A (en) Data processing method and device based on block chain prediction machine and electronic equipment
WO2023011274A1 (en) Communication protocol conversion method, and device, system, and gateway device
CN111475309A (en) Data processing method, device, block chain service system and storage medium
CN114513552B (en) Data processing method, device, equipment and storage medium
CN110995521A (en) Service providing method, device, equipment and system
CN108365976B (en) Network service optimization method and device
CN116668520A (en) Gateway-based service arrangement method, system, equipment and storage medium
CN110780915B (en) Data processing method, device and storage medium
CN113268272B (en) Application delivery method, device and system based on private cloud
CN113296987B (en) Interface calling method and device for calling module, computer equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20876599

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18.08.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20876599

Country of ref document: EP

Kind code of ref document: A1