WO2021057070A1 - 一种基于区块链的提议处理方法、装置及电子设备 - Google Patents

一种基于区块链的提议处理方法、装置及电子设备 Download PDF

Info

Publication number
WO2021057070A1
WO2021057070A1 PCT/CN2020/093896 CN2020093896W WO2021057070A1 WO 2021057070 A1 WO2021057070 A1 WO 2021057070A1 CN 2020093896 W CN2020093896 W CN 2020093896W WO 2021057070 A1 WO2021057070 A1 WO 2021057070A1
Authority
WO
WIPO (PCT)
Prior art keywords
question
blockchain
answer
user
proposal
Prior art date
Application number
PCT/CN2020/093896
Other languages
English (en)
French (fr)
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 WO2021057070A1 publication Critical patent/WO2021057070A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the embodiments of the present application relate to the field of blockchain technology, and in particular to a method, device, and electronic equipment for processing proposals based on blockchain.
  • a distributed system is a system composed of multiple independent nodes (such as servers, processing units, etc.) that are geographically and physically dispersed. These nodes are connected together to realize the use of different resources. For distributed systems, multiple nodes in the system run in parallel. At the same time, there may be multiple nodes or multiple processes of the same node initiating concurrent occupation of the same resource. If orderly control is not carried out, it will lead to various An abnormal situation occurs.
  • a distributed system that provides air ticket ordering services if user A and user B buy air tickets for the same flight and the same seat, there will be a problem of mutual exclusion of resources, causing air tickets to be unavailable, or The process of user A and user B's purchase of air tickets is damaged.
  • the current solution is to use distributed locks to orderly control concurrent access to the same resource.
  • the distributed lock is a program developed separately for a distributed system in a certain application scenario.
  • the logic is more complicated and not universal, and it is not easy to build and maintain.
  • how to implement lock services in a distributed system in a simpler way is a technical problem that needs to be solved urgently.
  • the purpose of the embodiments of the present application is to provide a block chain-based proposal processing method, device, and electronic equipment, which can implement lock services in a distributed system in a simple manner.
  • a proposal processing method based on blockchain including:
  • analyzing the target proposal to obtain a question proposed by the first user and a candidate answer to the question;
  • the query is missed, initiate a multi-party consensus for the target proposal to multiple blockchain nodes of the blockchain, and after the multi-party consensus is passed, accept the target proposal, and send the candidate answer As the predetermined answer to the question, it is recorded in the blockchain.
  • a proposal processing device based on blockchain including:
  • An analysis module in response to a target proposal initiated by a first user, analyzes the target proposal to obtain a question proposed by the first user and a candidate answer to the question;
  • Query module to query whether the blockchain has recorded a predetermined answer to the question
  • the first proposal processing module if the query hits, reject the target proposal and/or feed back the predetermined answer to the question recorded by the blockchain to the first user;
  • the second proposal processing module if the query is missed, initiates a multi-party consensus for the target proposal to multiple blockchain nodes of the blockchain, and accepts the target proposal after the multi-party consensus is passed, And recording the candidate answer as the predetermined answer of the question in the blockchain.
  • an electronic device including: a memory, a processor, and a computer program stored on the memory and capable of running on the processor, the computer program being executed by the processor:
  • analyzing the target proposal to obtain a question proposed by the first user and a candidate answer to the question;
  • the query is missed, initiate a multi-party consensus for the target proposal to multiple blockchain nodes of the blockchain, and after the multi-party consensus is passed, accept the target proposal, and send the candidate answer As the predetermined answer to the question, it is recorded in the blockchain.
  • a computer-readable storage medium is provided, and a computer program is stored on the computer-readable storage medium.
  • the computer program is executed by a processor, the following steps are implemented:
  • analyzing the target proposal to obtain a question proposed by the first user and a candidate answer to the question;
  • the query is missed, initiate a multi-party consensus for the target proposal to multiple blockchain nodes of the blockchain, and after the multi-party consensus is passed, accept the target proposal, and send the candidate answer As the predetermined answer to the question, it is recorded in the blockchain.
  • the solution of the embodiment of the present application uses the blockchain to record the question and the corresponding established answer. If the user proposes an existing question and the corresponding candidate answer, the corresponding established answer can be queried from the blockchain to decide whether to accept the user's proposal. If the user proposes a new question and corresponding candidate answer, the multi-party consensus technology of the blockchain can be used to decide whether to accept the user's proposal, and after acceptance, the candidate answer proposed by the user is recorded as the established answer of the proposed question to the district Block chain.
  • the resource occupation of a distributed system can be abstracted into the question of "whether the resource can be occupied" and the answer of "whose resource is occupied or the resource is already occupied”.
  • the blockchain records a unique and effective established answer to a question. Therefore, the function of a distributed lock can be realized by using the blockchain to decide whether to accept the user's proposed occupation of resources.
  • the blockchain is an existing database structure, and there is no need to separately develop and maintain a distributed lock program for a distributed system, which can reduce implementation costs and improve versatility.
  • multi-party consensus to determine the established answer to the question can decentralize the distributed system and ensure the fairness of the proposal.
  • FIG. 1 is a schematic diagram of the first flow of a proposal processing method provided by an embodiment of this application.
  • FIG. 2 is a schematic diagram of the second flow of the proposal processing method provided by an embodiment of the application.
  • FIG. 3 is a schematic structural diagram of a proposal processing apparatus provided by an embodiment of the application.
  • FIG. 4 is a schematic structural diagram of an electronic device provided by an embodiment of the application.
  • the existing distributed system uses distributed locks to prevent conflicts or interference caused by different processes accessing the same resource at the same time.
  • the distributed lock logic is complex, difficult to build and maintain, and has low practicability.
  • this application aims to provide a technical solution for implementing lock services in a distributed system in a simpler manner.
  • FIG. 1 is a flowchart of a block chain-based proposal processing method according to an embodiment of the present application. The method shown in Figure 1 can be executed by the following corresponding devices, including:
  • Step S102 Based on the target proposal initiated by the first user, the target proposal is analyzed to obtain the question proposed by the first user and the candidate answer to the question.
  • the target proposal carries the above-mentioned question and the above-mentioned candidate answer.
  • the target proposal may include, but is not limited to: a proposal that the first user occupies the target resource.
  • the questions obtained by the correspondence analysis can include: “Is the target resource occupied?".
  • the candidate answer for "Is the target resource occupied?” may include: "The first user occupies the target resource”.
  • a proposal of "whether I (the first user) can occupy the target resource” can be initiated.
  • the semantic analysis of "I (the first user) can occupy the target resource” is performed, and the question proposed by the first user is "whether the target resource is occupied” and the candidate answer proposed by the first user "(if the target resource is not occupied? Occupy) I occupy the target resource”.
  • Step S104 query whether there is a predetermined answer to the question recorded in the blockchain.
  • the distributed system records the established answers to the previously determined questions through the blockchain. Specifically, in this step, the determined predetermined answer and the corresponding question may be associated and stored in a block of the blockchain.
  • step S102 Still take the example cited in step S102 as an introduction:
  • the blockchain will record the occupation status of the target resource. This occupancy state is the established answer to "whether the target resource is occupied".
  • Step S106 if the query hits, reject the target proposal.
  • a question only corresponds to a unique valid answer, that is, a predetermined answer. Obviously, if there is a predetermined answer to the question proposed by the first user, the target proposal initiated by the first user can no longer be adopted.
  • step S102 Still take the example cited in step S102 as an introduction:
  • the blockchain has an established answer of "Is the target resource occupied?", it can mean that other users have preemptively occupied the target resource. Considering the mutual exclusion of target resource occupation, the target proposal initiated by the first user should be rejected. Or, on the premise that the first user does not accept the occupation of the target resource, the information "the target resource has been occupied" is notified to the first user.
  • the predetermined answer to the question recorded in the blockchain can be fed back to the first user.
  • step S108 if the query is missed, a multi-party consensus for the target proposal is initiated to multiple blockchain nodes of the blockchain.
  • multi-party consensus is that multiple blockchain nodes reach a consensus on the target proposal proposed by the first user. If the consensus is not reached, it means that the candidate answer proposed by the first user is not recognized, and the first user’s candidate answer can be rejected.
  • a target proposal initiated by a user If a consensus is reached, it means that the candidate answer proposed by the first user is recognized, and therefore the candidate answer is recorded in the blockchain as the established answer to the question in the target proposal.
  • step S102 Still take the example cited in step S102 as an introduction:
  • the established answer is not queried through the blockchain, it means "the target resource is not occupied”.
  • multiple blockchain nodes make a multi-party consensus on whether the first user can occupy the target resource.
  • multi-party consensus is passed, which means that the first user is accepted to occupy the target resource. If the multi-party consensus fails, it means that the first user is refused to occupy the target resource.
  • step S110 if the multi-party consensus is passed, the target proposal is accepted, and the candidate answer is recorded in the blockchain as the predetermined answer to the above question.
  • step S102 Still take the example cited in step S102 as an introduction:
  • the target resource has been occupied by (the first user) is taken as the predetermined answer to "whether the target resource can be occupied” and stored in the blockchain.
  • the "target resource has been occupied by the (first user)” can be queried from the blockchain, thereby rejecting the proposal of occupying the target resource initiated by other users.
  • the solution in the embodiment of the present application uses a blockchain to record the question and the corresponding established answer. If the user proposes an existing question and the corresponding candidate answer, the corresponding established answer can be queried from the blockchain to decide whether to accept the user's proposal. If the user proposes a brand-new question and corresponding candidate answer, the multi-party consensus technology of the blockchain can be used to decide whether to accept the user proposal, and after acceptance, the candidate answer proposed by the user is recorded as the established answer of the proposed question to the district Block chain.
  • the resource occupation of a distributed system can be abstracted into the question of "whether the resource can be occupied" and the answer of "whose resource is occupied or the resource is already occupied”.
  • the blockchain records a unique and effective established answer to a question. Therefore, the function of a distributed lock can be realized by using the blockchain to decide whether to accept the user's proposed occupation of resources.
  • the blockchain is an existing database structure, and there is no need to separately develop and maintain a distributed lock program for a distributed system, which can reduce implementation costs and improve versatility.
  • multi-party consensus to determine the established answer to the question can decentralize the distributed system and ensure the fairness of the proposal.
  • the user who is selected as the predetermined answer after the proposal can edit or delete the predetermined answer recorded in the blockchain. That is, the method of the embodiment of the present application further includes:
  • Step S112 based on the edit request or delete request for the question initiated by the second user, it is determined whether the blockchain has recorded a predetermined answer to the above question and whether the predetermined answer was proposed by the third user.
  • step S114 if the blockchain records a predetermined answer to the above question, and the predetermined answer is proposed by a third user, a function for editing or deleting the predetermined answer recorded in the blockchain is turned on for the third user.
  • the user who is selected as the predetermined answer after the proposal is the user who occupies the target resource. If the user does not want to continue occupying the target resource, he can take the initiative to delete the predetermined answer recorded in the blockchain through operation, so that the target The resource returns to the idle state and can be used by other users.
  • users' occupation of resources in a distributed system can also be time-sensitive.
  • the candidate answer is recorded in the blockchain as the predetermined answer to the question, it periodically judges the validity of the predetermined answer to the question, and after judging that the predetermined answer is invalid for the question, deletes the record of the blockchain. The established answer to the question.
  • the effective time for a certain user to occupy the target resource is one week.
  • the method of the embodiment of this application can actively delete the predetermined answer in the blockchain that the target resource has been occupied.
  • the target resource is idle.
  • the method of the embodiment of the present application uses the blockchain to realize the function of the distributed lock.
  • the resource occupation or resource access
  • the resource occupation is abstracted into questions and answers, and the only effective established answer to the question is determined and recorded through the multi-party consensus of the blockchain.
  • a user initiates a proposal to occupy a certain resource, abstractly extract the question proposed by the user, and try to query the established answer to the question from the blockchain. If the query is hit, it is decided whether to accept the proposal initiated by the user based on the predetermined answer. If the query is missed, the multi-party consensus method of the block chain is used to determine whether to accept the user's proposal, and after acceptance, the candidate answer proposed by the user is recorded as the established answer to the proposed question in the block chain.
  • the execution subject of the method can be, but is not limited to, any node in the distributed system.
  • the nodes in the distributed system also serve as the blockchain nodes in the blockchain to participate in multi-party consensus.
  • Step S201 Receive a target proposal for occupying target resources initiated by a first user.
  • Step S202 Analyze the target proposal, and determine the question proposed by the first user and the candidate answer corresponding to the question.
  • the intention of the first user in the target proposal can be determined to determine the question proposed by the first user and the corresponding candidate answer.
  • the intention of the first user to initiate the target proposal is to occupy the target resource, so the question proposed by the first user can be, but not limited to, "Are target resources occupied?", and the corresponding candidate answer (the first user's needs) is OK but It is not limited to "occupying the target resource by the first user".
  • Step S203 It is judged whether there is a predetermined answer of "whether the target resource is occupied" is recorded in the blockchain. If yes, go to step S204; if no, go to step S205.
  • step S204 the target proposal initiated by the first user is rejected, and/or the predetermined answer of "whether the target resource is occupied" recorded in the blockchain is fed back to the first user.
  • a query hit means that the proposal of other users to occupy the target resource has been previously accepted, so the first user can directly reject the proposal initiated by the first user.
  • the predetermined answer may feed back more information, such as which user occupies the target resource and/or the effective time of occupancy of the target resource.
  • the first user After the first user receives the predetermined answer, he can understand the occupation of the target resource, so that when there is a subsequent demand, he can re-initiate the proposal to occupy the target resource.
  • Step S205 Connect the target blockchain nodes in the blockchain, and initiate a multi-party consensus for the target proposal to multiple blockchain nodes in the blockchain.
  • the nodes of the distributed system can be regarded as the blockchain nodes in the blockchain. Therefore, in this step, the nodes of the distributed system can be responsible for reaching the multi-party consensus for the target proposal.
  • Step S206 It is judged whether the multi-party consensus is passed. If yes, go to step S207; if not, go to step S210.
  • Step S207 Determine whether the target blockchain node is selected as the accounting node in the blockchain. If yes, execute step S208; if no, execute step S209.
  • Step S208 Add a block recording the candidate answer as the predetermined answer to the question in the sub-blockchain corresponding to the target blockchain node, and broadcast the block to other blockchain nodes in the blockchain.
  • the block header of the block can be configured with an index field for retrieving a predetermined answer.
  • the method of the embodiment of the present application can compile the question into a string, and use the string as the index field of the block header.
  • the predetermined answer can have a composition structure of character string + answer content.
  • Step S209 Receive a block that is broadcasted by other nodes in the blockchain and records a predetermined answer with a candidate answer as the question, and add the block to the sub-blockchain corresponding to the target blockchain node.
  • Step S210 Reject the target proposal initiated by the first user, and notify the first user that the target proposal has not been approved.
  • the problems can be spatialized in the blockchain. That is, after determining the predetermined answer to the question, the method of the embodiment of the present application records the question, the predetermined answer of the question, and the type of the question in the blockchain.
  • the category of the question serves as an index for retrieving the established answer to the question recorded in the blockchain.
  • the question can be "What do you do on the weekend?”, the question category is "Team building”, and the candidate answer of the proposed question is "Weekend mountain climbing”. If the target proposal is passed through multi-party consensus, then the question "What do you do on the weekend?", the question type "team building”, and the established answer "climbing on the weekend” can be associated and recorded on the blockchain to form a spatial data structure. .
  • the question can be "What do you do on weekends?”, the type of question is “work overtime”, and the candidate answer of the proposed question is "work overtime on weekends”. If the target proposal is passed through multi-party consensus, the question "What do you do on the weekend?", the question type "work overtime”, and the established answer "Training on weekends” can be associated and recorded on the blockchain to form a spatialized data result.
  • the distributed system opens different types of user interfaces to users, such as: hypertext transfer protocol interface, remote procedure call protocol interface, and software development kit interface, etc., to provide users with air ticket ordering services.
  • the node of the web browser can abstract the proposal of "who can occupy the L01 seat of CA01 on 2019-2-4" initiated by user A as a question of "whether the L01 seat of CA01 on 2019-2-4 is occupied?" , And the candidate answer of "User A occupies the L01 seat of CA01 2019-2-4".
  • the node of the web browser queries the established answer of "Who can occupy the L01 seat of CA01 on the 2019-2-4" from the blockchain.
  • This query process is used to inform user A whether it is possible to purchase a flight ticket for the L01 seat of CA01 on the 2019-2-4 number.
  • the query If the query is hit, it indicates that the L01 seat of CA01 on No. 2019-2-4 has been occupied, and the result that user A cannot purchase the flight ticket for the L01 seat of CA01 on No. 2019-2-4 is notified.
  • the blockchain node responsible for accounting generates a block that records the established answer, and all ticket purchasing platforms add this block to their respective sub-blockchains.
  • user A as the occupant of the L01 seat of CA01 on 2019-2-4, has the right to re-edit the "Who can occupy the L01 seat of CA01 on 2019-2-4?" recorded in the blockchain. For example, user A can initiate a refund operation to delete the established answer of "User A has the seat L01 of CA01 No. 2019-2-4" from the blockchain, thereby releasing the resources of the seat L01 of CA01 No. 2019-2-4.
  • the distributed system can delete the record in the blockchain that "User A owns 2019 -2-4 CA01 seat L01" the established answer.
  • the method of the embodiment of the present application realizes the lock service of the distributed system through the blockchain technology.
  • the multi-party consensus algorithm of the blockchain can ensure that user proposals can be processed fairly, and the normal execution of multi-party consensus can also be ensured when less than half of the blockchain nodes are unavailable.
  • user suggestions can be abstracted into questions and answers in most application scenarios. Therefore, the solutions of the embodiments of the present application have high versatility and are convenient for distributed systems to expand new business capabilities.
  • users can initiate proposals through any platform interface provided by the distributed system, and the blockchain nodes built in the blockchain for each platform interface are extremely flexible, making the implementation of the solution more practical.
  • an embodiment of the present application further provides a blockchain-based information feedback device 300, including:
  • the proposal analysis module 310 analyzes the target proposal based on the target proposal initiated by the first user, and obtains the question proposed by the first user and the candidate answer to the question; wherein, the target proposal carries the question And the candidate answer.
  • the answer query module 320 if the query hits, reject the target proposal.
  • the first proposal processing module 330 if the query hits, rejects the target proposal and/or feeds back the predetermined answer to the question recorded by the blockchain to the first user.
  • the second proposal processing module 340 if the query is missed, initiates a multi-party consensus for the target proposal to multiple blockchain nodes of the blockchain.
  • the data uploading module 350 accepts the target proposal after the multi-party consensus is passed, and records the candidate answer as the predetermined answer to the question in the blockchain.
  • the solution in the embodiment of the present application uses a blockchain to record the question and the corresponding predetermined answer. If the user proposes an existing question and the corresponding candidate answer, the corresponding established answer can be queried from the blockchain to decide whether to accept the user's proposal. If the user proposes a new question and corresponding candidate answer, the multi-party consensus technology of the blockchain can be used to decide whether to accept the user's proposal, and after acceptance, the candidate answer proposed by the user is recorded as the established answer of the proposed question to the district Block chain.
  • the resource occupation of a distributed system can be abstracted into the question of "whether the resource can be occupied" and the answer of "whose resource is occupied or the resource is already occupied”.
  • the blockchain records a unique and effective established answer to a question. Therefore, the function of a distributed lock can be realized by using the blockchain to decide whether to accept the user's proposed occupation of resources.
  • the blockchain is an existing database structure, and there is no need to separately develop and maintain a distributed lock program for a distributed system, which can reduce implementation costs and improve versatility.
  • multi-party consensus to determine the established answer to the question can decentralize the distributed system and ensure the fairness of the proposal.
  • the first proposal processing module 330 may also feed back the predetermined answer to the question recorded by the blockchain to the first user.
  • the device of the embodiment of the present application further includes:
  • the first processing module determines whether the blockchain records a predetermined answer to the question and whether the predetermined answer was proposed by the third user. And, if the blockchain records a predetermined answer to the question, and the predetermined answer is proposed by the third user, then the third user is opened for editing or deleting the blockchain The recorded function of the given answer.
  • the device of the embodiment of the present application further includes:
  • the second processing module after recording the candidate answer as the predetermined answer of the question in the blockchain, periodically judge the validity of the predetermined answer to the question, and determine the predetermined answer After the answer is invalid for the question, the established answer to the question recorded by the blockchain is deleted.
  • the target proposal includes: a proposal for the first user to occupy target resources.
  • the problem includes: whether the target resource is occupied.
  • the candidate answer includes: an answer in which the target resource is occupied by the first user.
  • the data uploading module specifically associates the question, the predetermined answer to the question, and the category of the question to the blockchain; wherein the category of the question is used as the retrieval of the blockchain The index of the established answer to the question recorded in.
  • the target proposal is initiated by the first user through any one of the following interfaces:
  • the device of the embodiment of the present application can be used as the execution body of the method shown in FIG. 1, so the device can realize the functions implemented by the method in FIG. 1 and FIG. 2. Since the principle is the same, this article will not repeat them.
  • Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory.
  • the memory may include memory, such as high-speed random access memory (Random-Access Memory, RAM), or may also include non-volatile memory (non-volatile memory), such as at least one disk storage.
  • RAM Random-Access Memory
  • non-volatile memory such as at least one disk storage.
  • the electronic device may also include hardware required by other services.
  • the processor, network interface, and memory can be connected to each other through an internal bus.
  • the internal bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect, peripheral component interconnection standard) bus, or an EISA (Extended) bus. Industry Standard Architecture, extended industry standard structure) bus, etc.
  • the bus can be divided into an address bus, a data bus, a control bus, and so on. For ease of presentation, only one bidirectional arrow is used to indicate in FIG. 4, but it does not mean that there is only one bus or one type of bus.
  • the program may include program code, and the program code includes computer operation instructions.
  • the memory may include memory and non-volatile memory, and provide instructions and data to the processor.
  • the processor reads the corresponding computer program from the non-volatile memory to the memory and then runs it to form a question-and-answer pair data mining device at the logical level.
  • the processor executes the program stored in the memory, and is specifically used to perform the following operations:
  • the target proposal is analyzed to obtain the question proposed by the first user and the candidate answer to the question; wherein the target proposal carries the question and the candidate answer ;
  • the target proposal is accepted, and the candidate answer is recorded in the blockchain as the predetermined answer to the question.
  • the solution of the embodiment of the present application uses a blockchain to record the question and the corresponding predetermined answer. If the user proposes an existing question and the corresponding candidate answer, the corresponding established answer can be queried from the blockchain to decide whether to accept the user's proposal. If the user proposes a new question and corresponding candidate answer, the multi-party consensus technology of the blockchain can be used to decide whether to accept the user's proposal, and after acceptance, the candidate answer proposed by the user is recorded as the established answer of the proposed question to the district Block chain.
  • the resource occupation of a distributed system can be abstracted into the question of "whether the resource can be occupied" and the answer of "whose resource is occupied or the resource is already occupied”.
  • the blockchain records a unique and effective established answer to a question. Therefore, the function of a distributed lock can be realized by using the blockchain to decide whether to accept the user's proposed occupation of resources.
  • the blockchain is an existing database structure, and there is no need to separately develop and maintain a distributed lock program for a distributed system, which can reduce implementation costs and improve versatility.
  • multi-party consensus to determine the established answer to the question can decentralize the distributed system and ensure the fairness of the proposal.
  • the above proposal processing method disclosed in the embodiment shown in FIG. 1 of the present application may be applied to a processor or implemented by a processor.
  • the processor may be an integrated circuit chip with signal processing capabilities.
  • each step of the above method can be completed by an integrated logic circuit of hardware in the processor or instructions in the form of software.
  • the above-mentioned processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (Network Processor, NP), etc.; it may also be a digital signal processor (DSP), a dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • CPU central processing unit
  • NP Network Processor
  • DSP digital signal processor
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • the methods, steps, and logical block diagrams disclosed in the embodiments of the present application can be implemented or executed.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field, such as random memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
  • the electronic equipment of this application does not exclude other implementations, such as logic devices or a combination of software and hardware, etc. That is to say, the execution body of the following processing flow is not limited to each logic unit. It can also be a hardware or logic device.
  • the embodiment of the present application also proposes a computer-readable storage medium, the computer-readable storage medium stores one or more programs, the one or more programs include instructions, when the instructions are included in a portable computer that includes multiple application programs.
  • the portable electronic device can be made to execute the method of the embodiment shown in FIG. 1, and is specifically used to execute the following methods:
  • the target proposal is analyzed to obtain the question proposed by the first user and the candidate answer to the question; wherein the target proposal carries the question and the candidate answer ;
  • the target proposal is accepted, and the candidate answer is recorded in the blockchain as the predetermined answer to the question.
  • this specification can be provided as a method, a system or a computer program product. Therefore, this specification may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, this specification can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.

Abstract

一种基于区块链的提议处理方法、装置及电子设备。其中,方法包括:响应于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案(S102);查询区块链是否记录有所述问题的既定答案(S104);若查询命中,则拒绝所述目标提议(S106)和/或将所述区块链记录的所述问题的既定答案反馈至所述第一用户;若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识(S108),并在所述多方共识通过后,接受所述目标提议,以及将所述候选答案作为所述问题的既定答案记录至所述区块链中(S110)。

Description

一种基于区块链的提议处理方法、装置及电子设备 技术领域
本申请实施例涉及区块链技术领域,尤其涉及一种基于区块链的提议处理方法、装置及电子设备。
背景技术
分布式系统是由地理上和物理上分散的各自独立的多个节点(如服务器、处理单元等)组成的系统。这些节点连接在一起实现对不同资源的使用。对于分布式系统来说,系统内的多个节点并行运行,在同一时刻可能存在多个节点或同一节点的多个进程对同一资源发起并发占用,若不进行有序控制,将会导致各种反常状况发生。举个简单的例子:在提供飞机票订购服务的分布式系统中,如果用户A和用户B购买了同一航班同一座位的飞机票,则会产生资源互斥的问题,引发飞机票不可订购,或者用户A和用户B购买飞机票的进程损坏等现象。
针对上述问题,目前的解决方法是引用分布式锁来有序控制同一资源的并发访问。具体来说,当同一资源被多个进程访问时,只有获得该资源的分布式锁的进程能够进行访问。而分布式锁是单独为分布式系统在某一应用场景中所开发的程序,逻辑比较复杂且不具有泛用性,不易于搭建和维护。有鉴于此,如何以更简单的方式在分布式系统中实现锁服务,是当前急需解决的技术问题。
发明内容
本申请实施例目的是提供一种基于区块链的提议处理方法、装置及电子设备,能够以简单的方式在分布式系统中实现锁服务。
为了实现上述目的,本申请实施例是这样实现的:
第一方面,提供一种基于区块链的提议处理方法,包括:
响应于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;
查询区块链是否记录有所述问题的既定答案;
若查询命中,则拒绝所述目标提议和/或将所述区块链记录的所述问题的既定答案反 馈至所述第一用户;
若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识,并在所述多方共识通过后,接受所述目标提议,以及将所述候选答案作为所述问题的既定答案记录至所述区块链中。
第二方面,提供一种基于区块链的提议处理装置,包括:
分析模块,响应于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;
查询模块,查询区块链是否记录有所述问题的既定答案;
第一提议处理模块,若查询命中,则拒绝所述目标提议和/或将所述区块链记录的所述问题的既定答案反馈至所述第一用户;
第二提议处理模块,若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识,并在所述多方共识通过后,接受所述目标提议,以及将所述候选答案作为所述问题的既定答案记录至所述区块链中。
第三方面,提供一种电子设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行:
响应于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;
查询区块链是否记录有所述问题的既定答案;
若查询命中,则拒绝所述目标提议和/或将所述区块链记录的所述问题的既定答案反馈至所述第一用户;
若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识,并在所述多方共识通过后,接受所述目标提议,以及将所述候选答案作为所述问题的既定答案记录至所述区块链中。
第四方面,提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:
响应于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;
查询区块链是否记录有所述问题的既定答案;
若查询命中,则拒绝所述目标提议和/或将所述区块链记录的所述问题的既定答案反馈至所述第一用户;
若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识,并在所述多方共识通过后,接受所述目标提议,以及将所述候选答案作为所述问题的既定答案记录至所述区块链中。
本申请实施例的方案采用区块链记录问题和对应的既定答案。若用户提议已有的问题和对应的候选答案,则可以从区块链查询相应的既定答案以决策是否接受用户提议。若用户提议的是全新的问题和对应的候选答案,则可以利用区块链的多方共识技术决定是否接受用户提议,并在接受后将用户提议的候选答案作为提议的问题的既定答案记录至区块链中。在实际应用中,可以将分布式系统的资源占用抽象成“资源是否可以被占用”的问题和“资源被谁占用或者资源已被占用”的答案。显然,这种方式下,区块链针对一个问题记录有唯一有效的既定答案,因此通过区块链决策是否接受用户对资源发起的占用提议,可实现分布式锁的功能。一方面,区块链是已有的数据库结构,不需要为分布式系统单独开发和维护分布锁程序,可降低实施成本并提高泛用性。另一方面,多方共识决定问题的既定答案可以使分布式系统去中心化,保证提议采用的公平性。
附图说明
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请实施例中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本申请实施例提供的提议处理方法的第一种流程示意图。
图2为本申请实施例提供的提议处理方法的第二种流程示意图。
图3为本申请实施例提供的提议处理装置的结构示意图。
图4为本申请实施例提供的电子设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施 例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。
如前所述,现有的分布式系统引用分布式锁,来防止不同的进程同时访问相同资源所产生的冲突或干扰。而分布式锁逻辑复杂,不易搭建和维护,具有较低的实用性。为此,本申请旨在提供一种以更为简单的方式在分布式系统中实现锁服务的技术方案。
图1是本申请实施例基于区块链的提议处理方法的流程图。图1所示的方法可以由下文相对应的装置执行,包括:
步骤S102,基于第一用户发起的目标提议,对目标提议进行分析,得到第一用户提议的问题和问题的候选答案。
其中,目标提议携带有上述问题和上述候选答案。目标提议可以但不限于包括:第一用户占用目标资源的提议。对应分析获得的问题可以包括:“目标资源是否被占用?”。针对“目标资源是否被占用?”的候选答案可以包括:“第一用户占用目标资源”。
为便于理解,下面对本步骤进行示例性介绍:
当第一用户需要占用目标资源时,可以发起“我(第一用户)是否可以占用目标资源”的提议。本步骤对“我(第一用户)是否可以占用目标资源”进行语义分析,确定第一用户提议的问题是“目标资源是否被占用”以及第一用户提议的候选答案“(若目标资源没有被占用)我占用目标资源”。
应理解,分析问题和答案的方式可以由分布式系统实际提供的服务确定,由于并不唯一,本申请实施例不作具体限定。
步骤S104,查询区块链是否记录有问题的既定答案。
其中,分布式系统通过区块链记录先前已经确定的问题的既定答案。具体地,本步骤可以将确定的既定答案与对应的问题关联存储在区块链的区块中。
还是以步骤S102中所举示例作为介绍:
若目标资源在第一用户发起目标提议前已被占用,则区块链来会记录目标资源的占用状态。该占用状态即为“目标资源是否被占用”的既定答案。
步骤S106,若查询命中,则拒绝目标提议。
在本申请实施例中,一个问题仅对应有唯一有效的答案,即既定答案。显然,若第一用户提议的问题存在既定答案,则不能再采纳第一用户发起的目标提议。
还是以步骤S102中所举示例作为介绍:
若区块链已有“目标资源是否被占用?”的既定答案,则可以表示其他用户已经抢先占用了目标资源,考虑到目标资源占用的互斥性,应拒绝第一用户发起的目标提议,或者在不接受第一用户占用目标资源的前提下,将“目标资源已被占用”的信息告知给第一用户。
此外,本步骤在查询命中后还可以将区块链记录的问题的既定答案反馈至第一用户。
步骤S108,若查询未命中,则向区块链的多个区块链节点发起针对目标提议的多方共识。
应理解,多方共识的目的是多个区块链节点就第一用户所提出的目标提议达成共识,如果未达共识,则表示不认可第一用户所提出的候选答案,则是可以拒绝由第一用户发起的目标提议。如果达成共识,则表示认可第一用户所提出的候选答案,因此将候选答案作为目标提议中问题的既定答案记录至区块链中。
还是以步骤S102中所举示例作为介绍:
假设通过区块链未查询到既定答案,则表示“目标资源未被占用”,此时多个区块链节点就第一用户是否可以占用目标资源进行多方共识。其中,多方共识通过,则表示接受第一用户占用目标资源。多方共识未通过,则表示拒绝第一用户占用目标资源。
步骤S110,若多方共识通过后,则接受目标提议,将候选答案作为上述问题的既定答案记录至区块链中。
还是以步骤S102中所举示例作为介绍:
若多个区块链节点认可第一用户占用目标资源,则本步骤将“目标资源已被(第一用户)占用”作为“目标资源是否可以占用”的既定答案,存储至区块链中。后续其他用户发起占用目标资源的提议时,可以从区块链中查询到“目标资源已被(第一用户)占用”,从而拒绝其他用户发起的占用目标资源的提议。
基于图1所示的提议处理方法可以知道:本申请实施例的方案采用区块链记录问题和对应的既定答案。若用户提议已有的问题和对应的候选答案,则可以从区块链查询相应的既定答案以决策是否接受用户提议。若用户提议的是全新的问题和对应的候选答案, 则可以利用区块链的多方共识技术决定是否接受用户提议,并在接受后将用户提议的候选答案作为提议的问题的既定答案记录至区块链中。在实际应用中,可以将分布式系统的资源占用抽象成“资源是否可以被占用”的问题和“资源被谁占用或者资源已被占用”的答案。显然,这种方式下,区块链针对一个问题记录有唯一有效的既定答案,因此通过区块链决策是否接受用户对资源发起的占用提议,可实现分布式锁的功能。一方面,区块链是已有的数据库结构,不需要为分布式系统单独开发和维护分布锁程序,可降低实施成本并提高泛用性。另一方面,多方共识决定问题的既定答案可以使分布式系统去中心化,保证提议采用的公平性。
可选地,在上述基础之上,提议后被选为既定答案的用户可以对区块链中记录的该既定答案进行编辑或删除。即,本申请实施例的方法还包括:
步骤S112,基于第二用户发起的针对所述问题的编辑请求或删除请求,判断区块链是否记录有上述问题的既定答案以及该既定答案是否由第三用户提议获得的。
步骤S114,若区块链记录有上述问题的既定答案,且该既定答案是由第三用户提议获得的,则向第三用户开启用于编辑或删除区块链记录的该既定答案的功能。
以目标资源占用为例,提议后被选为既定答案的用户即占用目标资源的用户,该用户如果不想继续占用目标资源时,可以主动通过操作删掉区块链记录的既定答案,从而使目标资源重新回到空闲状态,能够被其他用户所使用。
此外,用户占用分布式系统中的资源也可以具有时效。本实施例的方法在将候选答案作为问题的既定答案记录至区块链中后,周期性判断既定答案针对问题的有效性,并在判断出既定答案针对问题失效后,删除区块链记录的问题的既定答案。
以目标资源占用为例,某一用户占用目标资源的有效时长为一周,当占用时间达到一周后,则本申请实施例的方法可以主动删除区块链中针对该目标资源已被占用的既定答案,以目标资源处于空闲状态。
下面对本申请实施例的方法进行详细介绍。
本申请实施例的方法利用区块链来实现分布式锁的功能。具体地,将资源占用(也可以是资源访问)抽象成问题和答案,通过区块链的多方共识来决定问题唯一有效的既定答案并进行记录。当用户针对某一资源发起占用的提议时,抽象提取用户提议的问题,并尝试从区块链中查询该问题的既定答案。若查询命中,则基于既定答案决策是否接受用户发起的提议。若查询未命中,则通过区块链的多方共识方式,决定是否接受用户的 提议,并在接受后将用户提议的候选答案作为提议的问题的既定答案记录至区块链中。
其中,方法的执行主体可以但不限于是分布式系统中的任意节点。作为可行的一种方案,分布式系统中的节点也作为区块链中的区块链节点,以参与多方共识。
对应的执行流程如图2所示,包括:
步骤S201,接收第一用户发起的占用目标资源的目标提议。
步骤S202,对目标提议进行分析,确定第一用户提议的问题和该问题对应的候选答案。
在本步骤中,可以确定第一用户在目标提议中的意图,以确定第一用户提议的问题和对应候选答案。显然,第一用户发起目标提议的意图是为了占用目标资源,因此第一用户提议的问题可以但不限是“目标资源是否被占用?”,对应的候选答案(第一用户的需求)可以但不限是“由第一用户占用目标资源”。
步骤S203,判断区块链中是否记录有“目标资源是否被占用”的既定答案。是,则执行步骤S204;否,则执行步骤S205。
步骤S204,拒绝第一用户发起的目标提议,和/或,将区块链记录的“目标资源是否被占用”的既定答案反馈至第一用户。
如前所述,查询命中则表示先前已经接受了其他用户占用目标资源的提议,因此可以直接拒绝第一用户发起提议。
可选地,既定答案可以反馈更多的信息,比如是哪一个用户占用了目标资源和/或占用目标资源的有效时间。第一用户接受到了既定答案后,可以了解目标资源的占用情况,以便后续有需求时,重新再发起占用目标资源的提议。
步骤S205,连接区块链中的目标区块链节点,向区块链的多个区块链节点发起针对目标提议的多方共识。
其中,分布式系统的节点可以视为区块链中的区块链节点。因此本步骤中,可以由分布式系统的节点负责达到针对目标提议的多方共识。
步骤S206,判断多方共识是否通过。是,则执行步骤S207;否,则执行步骤S210。
步骤S207,判断目标区块链节点是否被选为区块链中的记账节点。是,则执行步骤S208;否,则执行步骤S209。
步骤S208,在目标区块链节点对应的子区块链中添加记录有以候选答案作为问题的既定答案的区块,并将区块广播至区块链中的其他区块链节点。
具体地,区块的区块头可以配置有用于检索既定答案的索引字段。作为其中一个可行方案:本申请实施例的方法可以将问题编译成字符串,由字符串作为区块头的索引字段。对应地,既定答案可以有是字符串+答案内容的组成结构。
步骤S209,接收区块链中的其他节点所广播的记录有以候选答案作为问题的既定答案的区块,并将该区块添加至目标区块链节点对应的子区块链中。
步骤S210,拒绝第一用户发起的目标提议,并告知第一用户目标提议未被审核通过。
当然,实际应用中,复杂系统可能有多种不同领域和需求的共识问题,为了方便扩展及管理,防止不同领域的问题与答案相互混淆,可以在区块链中对问题进行空间化。即,本申请实施例的方法在确定问题的既定答案后,将问题、问题的既定答案和问题的类别关联记录至区块链中。问题的类别作为检索区块链中记录的问题的既定答案的索引。
举例介绍:
假设第一用户发起的目标提议为“周末团建去爬山”,则问题可以为“周末干什么?”,问题的类别为“团建”,提议的问题的候选答案是“周末去爬山”。如果通过多方共识,通过了目标提议,则可以将问题“周末干什么?”、问题类型“团建”、既定答案“周末去爬山”三个维度关联记录至区块链,形成空间化的数据结构。
后续在搜索“周末干什么”的既定答案时,可以具体引入问题类型“团建”作为检索字段,从而精确查找到“周末去爬山”。
同理,假设第一用户发起的目标提议为“周末加班去培训”,则问题可以为“周末干什么?”,问题的类别为“加班”,提议的问题的候选答案是“周末去培训”。如果通过多方共识,通过了目标提议,则可以将问题“周末干什么?”、问题类型“加班”、既定答案“周末去培训”三个维度关联记录至区块链,形成空间化数据结果。
后续在搜索“周末干什么”的既定答案时,可以具体引入问题类型“加班”作为检索字段,从而精确查找到“周末去培训”的加班答案,而不是上述“周末去爬山”的团建答案。
以上是对本申请实施例的方法的原理介绍。应理解,在不脱离本文上述原理基础之上,还可以进行适当的变化,这些变化也应视为本申请实施例的保护范围。比如,任何 由问题和答案构成的提议都适用于本申请实施例的方法,其中,上文所述的解决分布式系统的资源占用问题仅是方案所实现的其中一种技术效果。
下面结合实际的应用场景,对本申请实施例的方法进行详细介绍。
在本应用场景中,分布式系统向用户开放不同种类的用户接口,比如:超文本传输协议接口、远程过程调用协议接口和软件开发工具包接口等,以为用户提供飞机票订购服务。
假设用户A希望购买2019-2-4号CA01的L01座位的飞机票,则可以通过上述任意一种接口发起“我是否可以占有2019-2-4号CA01的L01座位”的提议。
对于分布系统,不同接口对应有不同的购票平台,其他用户也可以通过任意的购票平台购买2019-2-4号CA01的L01座位的飞机票。假设用户A通过网页浏览器(即超文本传输协议接口)发起“我是否可以占有2019-2-4号CA01的L01座位”的提议,则网页浏览器的节点需要确定2019-2-4号CA01的L01座位的占用状态。
具体地,网页浏览器的节点可以将用户A发起的“谁可以占有2019-2-4号CA01的L01座位”的提议抽象为“2019-2-4号CA01的L01座位是否被占有”的问题,以及“用户A占有2019-2-4号CA01的L01座位”的候选答案。
应理解,“用户A占有2019-2-4号CA01的L01座位”是用户A为了购买飞机票提议的,并不是“谁可以占有2019-2-4号CA01的L01座位”的唯一答案。对于购买相同飞机票的其他用户来讲,提议的候选答案可以是“其他用户占有2019-2-4号CA01的L01座位”。对于本应用场景来讲,需要从这些候选答案中确定一个作为“谁可以占有2019-2-4号CA01的L01座位”的唯一有效的既定答案。
网页浏览器的节点在抽象获取问题和候选答案后,从区块链中查询“谁可以占有2019-2-4号CA01的L01座位”的既定答案。
这个查询过程用于告知用户A是否可以购买2019-2-4号CA01的L01座位的飞机票。
如果查询命中,则表明2019-2-4号CA01的L01座位的已被占用,则告知用户A无法购买2019-2-4号CA01的L01座位的飞机票的结果。
如果未查询命中,则需要向其他购票平台发起“用户A是否可以购买2019-2-4号CA01的L01座位的飞机票”的多方共识。这个多方共识过程可以公平性地验证用户A是否有资质购买2019-2-4号CA01的L01座位的飞机票。
一旦多方共识通过,则表示其他购票平台认可用户A购买2019-2-4号CA01的L01座位的飞机票的提议,并将用户A提议的“用户A占有2019-2-4号CA01的L01座位”的候选答案作为“谁可以占有2019-2-4号CA01的L01座位”的既定答案。基于区块链的数据上链机制,负责记账的区块链节点生成记录既定答案的区块,所有购票平台在各自的子区块链中添加该区块。
一旦“用户A占有2019-2-4号CA01的L01座位”的既定答案成功上链,其他用户不管是通过哪个购票平台发起购买2019-2-4号CA01的L01座位的飞机票的提议不会被通过。
此外,用户A作为2019-2-4号CA01的L01座位的占有者,具有对区块链中记录的“谁可以占有2019-2-4号CA01的L01座位?”重新编辑的权利。比如,用户A可以发起退票操作,将“用户A占有2019-2-4号CA01的L01座位”的既定答案从区块链中删除,从而释放2019-2-4号CA01的L01座位的资源。
此外,若用户A未发起退票,则在2019-2-4号CA01航班结束后,用户A购买的飞机票不再具有时效,分布式系统可以删掉区块链中记录有“用户A占有2019-2-4号CA01的L01座位”的既定答案。
此外,其他用户也可以通过任何购票平台的接口,向区块链查询2019-2-4号CA01的L01座位是否被占用。
综上所述,本申请实施例的方法通过区块链技术实现了分布式系统的锁服务。其中,通过区块链的多方共识算法可以保证用户提议能够被公平地处理,且少于一半的区块链节点不可用时,也能够保证多方共识正常执行。此外,用户提议在绝大部分的应用场景中都可以被抽象成问题和答案,因此本申请实施例的方案具有较高的通用性,且便于分布式系统拓展新的业务能力。此外,用户可以通过分布式系统提供的任何平台接口发起提议,各平台接口在区块链中搭建的区块链节点极为灵活,使得方案实施更具有实用性。
与上述方法相对应地,如图3所示,本申请实施例还提供一种基于区块链的信息反馈装置300,包括:
提议分析模块310,基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答案。
答案查询模块320,若查询命中,则拒绝所述目标提议。
第一提议处理模块330,若查询命中,则拒绝所述目标提议和/或将所述区块链记录的所述问题的既定答案反馈至所述第一用户。
第二提议处理模块340,若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识。
数据上链模块350,若所述多方共识通过后,接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
基于图3所示的提议处理装置可以知道:本申请实施例的方案采用区块链记录问题和对应的既定答案。若用户提议已有的问题和对应的候选答案,则可以从区块链查询相应的既定答案以决策是否接受用户提议。若用户提议的是全新的问题和对应的候选答案,则可以利用区块链的多方共识技术决定是否接受用户提议,并在接受后将用户提议的候选答案作为提议的问题的既定答案记录至区块链中。在实际应用中,可以将分布式系统的资源占用抽象成“资源是否可以被占用”的问题和“资源被谁占用或者资源已被占用”的答案。显然,这种方式下,区块链针对一个问题记录有唯一有效的既定答案,因此通过区块链决策是否接受用户对资源发起的占用提议,可实现分布式锁的功能。一方面,区块链是已有的数据库结构,不需要为分布式系统单独开发和维护分布锁程序,可降低实施成本并提高泛用性。另一方面,多方共识决定问题的既定答案可以使分布式系统去中心化,保证提议采用的公平性。
可选地,若答案查询模块320查询命中,则第一提议处理模块330还可以将所述区块链记录的所述问题的既定答案反馈至所述第一用户。
可选地,本申请实施例的装置还包括:
第一处理模块,基于第二用户发起的针对所述问题的编辑请求或删除请求,判断区块链是否记录有所述问题的既定答案以及该既定答案是否由所述第三用户提议获得的。以及,若所述区块链记录有所述问题的既定答案,且该既定答案是由所述第三用户提议获得的,则向所述第三用户开启用于编辑或删除所述区块链记录的该既定答案的功能。
可选地,本申请实施例的装置还包括:
第二处理模块,在将所述候选答案作为所述问题的既定答案记录至所述区块链中后,周期性判断所述既定答案针对所述问题的有效性,并在判断出所述既定答案针对 所述问题失效后,删除所述区块链记录的所述问题的既定答案。
可选地,所述目标提议包括:第一用户占用目标资源的提议。所述问题包括:所述目标资源是否被占用的问题。所述候选答案包括:所述目标资源被所述第一用户占用的答案。
可选地,数据上链模块具体将所述问题、所述问题的既定答案和所述问题的类别关联记录至所述区块链中;其中,所述问题的类别作为检索所述区块链中记录的所述问题的既定答案的索引。
可选地,所述目标提议是所述第一用户通过以下任意一种接口所发起:
长文本传输协议接口、远程过程调用协议接口和软件开发工具包接口。
显然,本申请实施例的装置可以作为上述图1所示的方法的执行主体,因此该装置能够实现方法在图1和图2所实现的功能。由于原理相同,本文不再赘述。
图4是本申请的一个实施例电子设备的结构示意图。请参考图4,在硬件层面,该电子设备包括处理器,可选地还包括内部总线、网络接口、存储器。其中,存储器可能包含内存,例如高速随机存取存储器(Random-Access Memory,RAM),也可能还包括非易失性存储器(non-volatile memory),例如至少1个磁盘存储器等。当然,该电子设备还可能包括其他业务所需要的硬件。
处理器、网络接口和存储器可以通过内部总线相互连接,该内部总线可以是ISA(Industry Standard Architecture,工业标准体系结构)总线、PCI(Peripheral Component Interconnect,外设部件互连标准)总线或EISA(Extended Industry Standard Architecture,扩展工业标准结构)总线等。所述总线可以分为地址总线、数据总线、控制总线等。为便于表示,图4中仅用一个双向箭头表示,但并不表示仅有一根总线或一种类型的总线。
存储器,用于存放程序。具体地,程序可以包括程序代码,所述程序代码包括计算机操作指令。存储器可以包括内存和非易失性存储器,并向处理器提供指令和数据。
处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,在逻辑层面上形成问答对数据挖掘装置。处理器,执行存储器所存放的程序,并具体用于执行以下操作:
基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答 案;
查询区块链是否记录有所述问题的既定答案;
若查询命中,则拒绝所述目标提议;
若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识;以及,
若所述多方共识通过后,则接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
基于图4所示的电子设备额可以知道:本申请实施例的方案采用区块链记录问题和对应的既定答案。若用户提议已有的问题和对应的候选答案,则可以从区块链查询相应的既定答案以决策是否接受用户提议。若用户提议的是全新的问题和对应的候选答案,则可以利用区块链的多方共识技术决定是否接受用户提议,并在接受后将用户提议的候选答案作为提议的问题的既定答案记录至区块链中。在实际应用中,可以将分布式系统的资源占用抽象成“资源是否可以被占用”的问题和“资源被谁占用或者资源已被占用”的答案。显然,这种方式下,区块链针对一个问题记录有唯一有效的既定答案,因此通过区块链决策是否接受用户对资源发起的占用提议,可实现分布式锁的功能。一方面,区块链是已有的数据库结构,不需要为分布式系统单独开发和维护分布锁程序,可降低实施成本并提高泛用性。另一方面,多方共识决定问题的既定答案可以使分布式系统去中心化,保证提议采用的公平性。
上述如本申请图1所示实施例揭示的提议处理方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随 机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。
应理解,本申请实施例的电子设备可以实现上述装置在图1和图2所示的实施例的功能,本文不再赘述。
当然,除了软件实现方式之外,本申请的电子设备并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
此外,本申请实施例还提出了一种计算机可读存储介质,该计算机可读存储介质存储一个或多个程序,该一个或多个程序包括指令,该指令当被包括多个应用程序的便携式电子设备执行时,能够使该便携式电子设备执行图1所示实施例的方法,并具体用于执行以下方法:
基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答案;
查询区块链是否记录有所述问题的既定答案;
若查询命中,则拒绝所述目标提议;
若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识;以及,
若所述多方共识通过后,则接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
应理解,上述指令当被包括多个应用程序的便携式电子设备执行时,能够使上文所述的提议处理装置实现图1和图2所示实施例的功能,本文不再赘述。
本领域技术人员应明白,本说明书的实施例可提供为方法、系统或计算机程序产品。因此,本说明书可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
以上仅为本说明书的实施例而已,并不用于限制本说明书。对于本领域技术人员来说,本说明书可以有各种更改和变化。凡在本说明书的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本说明书的权利要求范围之内。

Claims (10)

  1. 一种基于区块链的提议处理方法,包括:
    基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答案;
    查询区块链是否记录有所述问题的既定答案;
    若查询命中,则拒绝所述目标提议;
    若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识;以及,
    若所述多方共识通过后,则接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
  2. 根据权利要求1所述的方法,还包括:
    若查询命中,将所述区块链记录的所述问题的既定答案反馈至所述第一用户。
  3. 根据权利要求1所述的方法,还包括:
    基于第二用户发起的针对所述问题的编辑请求或删除请求,判断区块链是否记录有所述问题的既定答案以及该既定答案是否由所述第三用户提议获得的;
    若所述区块链记录有所述问题的既定答案,且该既定答案是由所述第三用户提议获得的,则向所述第三用户开启用于编辑或删除所述区块链记录的该既定答案的功能。
  4. 根据权利要求1所述的方法,还包括:
    在将所述候选答案作为所述问题的既定答案记录至所述区块链中后,周期性判断所述既定答案针对所述问题的有效性,并在判断出所述既定答案针对所述问题失效后,删除所述区块链记录的所述问题的既定答案。
  5. 根据权利要求1-4任一项所述的方法,
    所述目标提议包括:第一用户占用目标资源的提议;
    所述问题包括:所述目标资源是否被占用的问题;
    所述候选答案包括:所述目标资源被所述第一用户占用的答案。
  6. 根据权利要求1-4任一项所述的方法,
    将所述候选答案作为所述问题的既定答案记录至所述区块链中,包括:
    将所述问题、所述问题的既定答案和所述问题的类别关联记录至所述区块链中;其中,所述问题的类别作为检索所述区块链中记录的所述问题的既定答案的索引。
  7. 根据权利要求1-4任一项所述的方法,
    所述目标提议是所述第一用户通过以下任意一种接口所发起:
    长文本传输协议接口、远程过程调用协议接口和软件开发工具包接口。
  8. 一种基于区块链的信息反馈装置,包括:
    提议分析模块,基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答案;
    答案查询模块,查询区块链是否记录有所述问题的既定答案;
    第一提议处理模块,若查询命中,则拒绝所述目标提议;
    第二提议处理模块,若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识;
    数据上链模块,若所述多方共识通过,接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
  9. 一种电子设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行:
    基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答案;
    查询区块链是否记录有所述问题的既定答案;
    若查询命中,则拒绝所述目标提议;
    若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识;以及,
    若所述多方共识通过后,则接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:
    基于第一用户发起的目标提议,对所述目标提议进行分析,得到所述第一用户提议的问题和所述问题的候选答案;其中,所述目标提议携带有所述问题和所述候选答案;
    查询区块链是否记录有所述问题的既定答案;
    若查询命中,则拒绝所述目标提议;
    若查询未命中,则向所述区块链的多个区块链节点发起针对所述目标提议的多方共识;以及,
    若所述多方共识通过后,则接受所述目标提议,将所述候选答案作为所述问题的既定答案记录至所述区块链中。
PCT/CN2020/093896 2019-09-23 2020-06-02 一种基于区块链的提议处理方法、装置及电子设备 WO2021057070A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910898488.7 2019-09-23
CN201910898488.7A CN110688410B (zh) 2019-09-23 2019-09-23 一种基于区块链的提议处理方法、装置及电子设备

Publications (1)

Publication Number Publication Date
WO2021057070A1 true WO2021057070A1 (zh) 2021-04-01

Family

ID=69109850

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/093896 WO2021057070A1 (zh) 2019-09-23 2020-06-02 一种基于区块链的提议处理方法、装置及电子设备

Country Status (3)

Country Link
CN (1) CN110688410B (zh)
TW (1) TW202113738A (zh)
WO (1) WO2021057070A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110688410B (zh) * 2019-09-23 2021-03-19 创新先进技术有限公司 一种基于区块链的提议处理方法、装置及电子设备
CN113516463A (zh) * 2020-04-09 2021-10-19 北京意锐新创科技有限公司 基于支付设备的共享信息处理方法和装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170701A (zh) * 2017-11-14 2018-06-15 北京欧链科技有限公司 区块链的信息处理方法及装置
CN109063169A (zh) * 2018-08-17 2018-12-21 福建省农村信用社联合社 一种基于区块链的客户数据管理系统
CN109272317A (zh) * 2018-09-27 2019-01-25 北京金山安全软件有限公司 一种区块链私钥的获取方法、装置及电子设备
CN109345392A (zh) * 2018-10-26 2019-02-15 阿里巴巴集团控股有限公司 编程题目发布、解答代码发布、解答代码检验方法及系统
WO2019097322A1 (en) * 2017-11-17 2019-05-23 International Business Machines Corporation Optimization of high volume transaction performance on a blockchain
CN110688410A (zh) * 2019-09-23 2020-01-14 阿里巴巴集团控股有限公司 一种基于区块链的提议处理方法、装置及电子设备

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9792101B2 (en) * 2015-11-10 2017-10-17 Wesley John Boudville Capacity and automated de-install of linket mobile apps with deep links
CN106878000B (zh) * 2017-03-06 2020-02-21 中钞信用卡产业发展有限公司杭州区块链技术研究院 一种联盟链共识方法及系统
CN108717443B (zh) * 2018-05-17 2020-06-05 京东数字科技控股有限公司 数据共享方法、区块链系统和计算机可读存储介质
CN109165134A (zh) * 2018-07-16 2019-01-08 付坤元 基于区块链技术的机试数据处理方法及系统
CN109218408B (zh) * 2018-08-16 2020-12-15 泰链(厦门)科技有限公司 区块链系统的共识机制实现方法、介质、计算机设备及区块链系统
CN109785200A (zh) * 2019-01-03 2019-05-21 中国联合网络通信集团有限公司 答疑方法、设备及存储介质
CN109936457B (zh) * 2019-02-20 2022-04-26 深圳前海微众银行股份有限公司 区块链多方见证方法、装置、设备及计算机可读存储介质

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170701A (zh) * 2017-11-14 2018-06-15 北京欧链科技有限公司 区块链的信息处理方法及装置
WO2019097322A1 (en) * 2017-11-17 2019-05-23 International Business Machines Corporation Optimization of high volume transaction performance on a blockchain
CN109063169A (zh) * 2018-08-17 2018-12-21 福建省农村信用社联合社 一种基于区块链的客户数据管理系统
CN109272317A (zh) * 2018-09-27 2019-01-25 北京金山安全软件有限公司 一种区块链私钥的获取方法、装置及电子设备
CN109345392A (zh) * 2018-10-26 2019-02-15 阿里巴巴集团控股有限公司 编程题目发布、解答代码发布、解答代码检验方法及系统
CN110688410A (zh) * 2019-09-23 2020-01-14 阿里巴巴集团控股有限公司 一种基于区块链的提议处理方法、装置及电子设备

Also Published As

Publication number Publication date
TW202113738A (zh) 2021-04-01
CN110688410A (zh) 2020-01-14
CN110688410B (zh) 2021-03-19

Similar Documents

Publication Publication Date Title
US10476911B2 (en) Data access policies
WO2021057070A1 (zh) 一种基于区块链的提议处理方法、装置及电子设备
WO2020119506A1 (zh) 一种基于联盟链的身份认证方法及终端设备
WO2020087774A1 (zh) 基于概念树的意图识别方法、装置及计算机设备
CN109145201B (zh) 一种基于区块链的信息管理方法、装置、设备及存储介质
JP2002099454A (ja) ファイル管理システムおよび方法
US11010389B1 (en) Contextual search using database indexes
CN110362727A (zh) 用于搜索系统的第三方搜索应用
WO2021057084A1 (zh) 一种基于区块链的数据处理方法、装置、系统及电子设备
CN110022259B (zh) 消息到达率确定方法、装置、数据统计服务器及存储介质
WO2021051775A1 (zh) 基于多人点单的订单管理方法及系统
KR102631875B1 (ko) 블록체인 시스템의 지갑 주소를 관리하는 방법 및 도메인에 기반한 트랜잭션을 처리하는 방법
CN106254528A (zh) 一种资源下载方法和缓存设备
CN108154024B (zh) 一种数据检索方法、装置及电子设备
CN106126634A (zh) 一种基于直播行业的主数据去重处理方法及系统
JPH09245053A (ja) 情報検索サービス方法及びシステム
CN111932076B (zh) 一种规则配置和发布方法、装置及计算设备
US7571153B2 (en) Systems and methods for performing streaming checks on data format for UDTs
WO2023236257A1 (zh) 文档搜索平台、搜索方法、装置、电子设备及存储介质
CN111988195B (zh) 用于分组测试的应答方案确定方法、装置、设备及介质
WO2015078124A1 (zh) 一种网络数据处理方法及装置
CN112947844A (zh) 一种数据存储方法、装置、电子设备及介质
CN111966919A (zh) 一种事件消息的处理方法、装置及设备
CN111427870B (zh) 一种资源管理方法、装置及设备
US11822459B2 (en) Automated function category detection

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: 20867940

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20867940

Country of ref document: EP

Kind code of ref document: A1