CN112016115B - Event subscription system based on block chain - Google Patents
Event subscription system based on block chain Download PDFInfo
- Publication number
- CN112016115B CN112016115B CN202011200043.6A CN202011200043A CN112016115B CN 112016115 B CN112016115 B CN 112016115B CN 202011200043 A CN202011200043 A CN 202011200043A CN 112016115 B CN112016115 B CN 112016115B
- Authority
- CN
- China
- Prior art keywords
- event
- subscription
- node
- channel
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The invention relates to an event subscription system based on a block chain, which comprises the block chain, a processor and a memory which stores a computer program, wherein the block chain comprises a first channel, at least one second channel and an event distribution module, when the computer program is executed by the processor, the step S1 is realized, the first channel acquires event registration information and event subscription information, and an event subscription configuration table is generated; step S2, each second channel generates at least one event data and sends the event data to the first channel, wherein the event data comprises event structure information and corresponding event original data; step S3, the first channel generates event data to be sent based on the event subscription configuration table and the event data, and sends the event data to a corresponding second channel; step S4, each second channel sends the received event data to be sent to the event distribution module, and the event distribution module distributes the event data to be sent. The system has universality, convenience and expandability, and improves the efficiency of event subscription.
Description
Technical Field
The invention relates to the technical field of computers, in particular to an event subscription system based on a block chain.
Background
An event mechanism is preset in the existing block chain network, and event subscription can be carried out only by monitoring the structure in a block chain and the event sent by which node and contract by which subscription node is required, and the subscription node is difficult to quickly access the block chain network for event subscription, so that the cost is high, the convenience is poor, and the efficiency is low; and because different subscription nodes may be heterogeneous application systems, the heterogeneous application systems refer to different application systems implemented by adopting different development languages such as java, python, go and the like, and the different application systems need to adopt different modes to subscribe the event, the existing block chain event mechanism also has no universality and is poor in expansibility. Therefore, how to provide a universal, convenient and extensible event subscription system based on a block chain becomes a technical problem to be solved urgently, and the efficiency of event subscription is improved.
Disclosure of Invention
The invention aims to provide an event subscription system based on a block chain, which has universality, convenience and expandability and improves the efficiency of event subscription.
The invention provides an event subscription system based on a block chain, which comprises: a blockchain comprising a first channel, at least one second channel and an event distribution module,
when executed by a processor, the computer program implementing the steps of:
step S1, the first channel acquires event registration information and event subscription information, and generates an event subscription configuration table according to the event registration information and the event subscription information;
step S2, each of the second channels generates at least one event data and sends the event data to the first channel, where the event data includes event structure information and corresponding event raw data;
step S3, the first channel generates event data to be sent based on the event subscription configuration table and the event data, and sends the event data to a corresponding second channel;
step S4, each of the second channels sends the received event data to be sent to an event distribution module, and the event distribution module distributes the event data to be sent.
Compared with the prior art, the invention has obvious advantages and beneficial effects. By the technical scheme, the event subscription system based on the block chain can achieve considerable technical progress and practicability, has industrial wide utilization value and at least has the following advantages:
the system isolates an event channel from other channels by arranging a first channel for processing event data and a plurality of second channels capable of accessing the first channel in a block chain. The subscription event data is generated through interaction of the first channel and the second channel, so that the subscription node can acquire the subscription event data only by sending subscription requirements without considering the internal structure of the block chain, and the method has universality, convenience and expandability and improves the efficiency of event subscription. In addition, the event data is registered, generated and subscribed based on the block chain, so that the data can be traced back at each step, and the safety and reliability of the subscribed data are ensured.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical means of the present invention more clearly understood, the present invention may be implemented in accordance with the content of the description, and in order to make the above and other objects, features, and advantages of the present invention more clearly understood, the following preferred embodiments are described in detail with reference to the accompanying drawings.
Drawings
Fig. 1 is a schematic diagram of an event subscription system based on a block chain according to an embodiment of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention for achieving the predetermined object, the following detailed description will be given to an embodiment of a block chain based event subscription system and its effects according to the present invention with reference to the accompanying drawings and preferred embodiments.
An embodiment of the present invention provides an event subscription system based on a block chain, as shown in fig. 1, including: a blockchain comprising a first channel, at least one second channel and an event distribution module, a processor and a memory storing a computer program which, when executed by the processor, performs the steps of:
step S1, the first channel acquires event registration information and event subscription information, and generates an event subscription configuration table according to the event registration information and the event subscription information;
the first channel is an event channel, and an event intelligent contract can be deployed, the intelligent contract comprises transaction information such as event transaction registration, event transaction subscription and event transaction encryption, and the related operations such as event registration, event subscription and encryption are all performed on a block chain, so that the traceability and the non-tampering of the operations are ensured. And the independent event channel and the event contract ensure the safety and reliability of the event-related operation.
As an embodiment, the step S1 includes:
step S101, the first channel receives an event registration request sent by a first node, analyzes a first node id and event structure information from the event registration request, and generates a corresponding event type id according to the event registration request, wherein the first node id, the event structure information and the event type id form the event registration information, and the first node is an event generating node;
the event registration request can also be used for analyzing information such as an event name and the like, and the registration information can also comprise information such as the event name and the event registration time. The step S101 may be implemented by invoking a registered event transaction in an event contract, and all events are registered on the first channel through the step S101, and all event definitions are aggregated, so that uniform management of events and event subscription of subsequent subscribers are facilitated. The first node can join the first channel in a mode of a member of the alliance chain, and can return information such as event type id and registration event generated by the event registration uplink and the first channel to the corresponding first node by utilizing the registration event transaction of the corresponding event intelligent contract.
Step S102, the first channel receives an event subscription request sent by a second node, and public key information and a corresponding event type id of the second node are analyzed from the event subscription request, the public key information and the corresponding event type id of the second node form the event subscription information, and the second node is an event subscriber node;
wherein, the step S102 can be implemented by invoking a subscription event transaction in the event contract. The second node may join the first channel and a second channel where the first node corresponding to the subscription event id is located in advance. The system of the embodiment of the invention utilizes the channel isolation mechanism of the block chain to separate a first channel, namely the event channel, thereby facilitating the subsequent management, ensuring the safety of the channel data and ensuring that the event data is only acquired by the member nodes in the alliance. And the second node sends the pre-subscribed event type id and the corresponding public key information to the subscription transaction of the event contract of the first channel to perform block chain accounting.
Step S103, generating the event subscription configuration table based on the event registration information and the event subscription information, wherein fields of the event subscription configuration table include a first node id, an event type id, event structure information and public key information of at least one corresponding second node, and the public key information of all the second nodes corresponding to each event type id forms a subscription public key list corresponding to the event type id.
It should be noted that, both the first node and the second node may be physically implemented as one server, or may be implemented as a server group including a plurality of servers. Those skilled in the art will appreciate that parameters such as the model and specification of the server do not affect the scope of the present invention
Step S2, each of the second channels generates at least one event data and sends the event data to the first channel, where the event data includes event structure information and corresponding event raw data, the event structure is a preset event data storage structure, and the event raw data is data stored in the event structure;
the second channels may be divided according to specific service scenarios, each second channel is deployed with a corresponding service intelligent contract, one first node may correspond to multiple second channels according to specific service requirements, and each first node generates corresponding event data on the corresponding second channel by invoking the corresponding service intelligent contract.
Step S3, the first channel generates event data to be sent based on the event subscription configuration table and the event data, and sends the event data to a corresponding second channel;
as an example, the step S3 includes:
step S301, the first channel acquires a subscription public key list corresponding to each event type id from the event subscription configuration table, and acquires event data corresponding to each event type id from event data sent by the second channel;
step S302, traversing the subscription public key list, encrypting the corresponding event data one by using each public key information in the subscription public key list, generating subscription event encrypted data corresponding to each public key information, merging all subscription event encrypted data corresponding to each subscription public key list into event data to be sent, and sending the event data to the second channel.
Wherein, the step S302 can be implemented by invoking the encrypted event transaction in the event contract. As an embodiment, the public key is an x509 public key, and data encrypted by the x509 public key is difficult to break and has higher security.
In order to further improve the security of the subscription data and avoid the subscriber acquiring the false data, in an embodiment, between the step S301 and the step S302, the method further includes a step S311 of acquiring, from the registration information, a node id corresponding to an event type id of the event data sent by the second channel, checking a node id of a generated event corresponding to the event data sent by the second channel, and if the check is passed, executing the step S302. Therefore, the second node can be ensured to acquire correct data. If the check fails, an instruction that the event cannot be sent can be sent to the corresponding second node.
Step S4, each of the second channels sends the received event data to be sent to an event distribution module, and the event distribution module distributes the event data to be sent.
The event distribution module can timely access each second channel according to the requirements of each alliance chain so as to monitor and receive the event data to be sent from the second channel.
As an embodiment, in step S4, the distributing module distributes the event data to be sent, including:
step S401, the event distribution module analyzes the received event data to be sent, acquires each subscription event encrypted data and a corresponding second node id, creates an event queue for each second node, and sends the subscription event encrypted data corresponding to the same second node id to the corresponding event queue;
step S402, each event queue sends the subscription event encrypted data in the queue to the corresponding second node.
As an example, the event queue is a kafka (kaffa) queue, and the step S4 further includes a step 403 of setting, by using a kafka ACL control mechanism, a corresponding right for the event queue corresponding to each second node to ensure the security of the data, for example, the right includes a read-only right. The kafka ACL control mechanism is an existing safety mechanism of kafka and is not described herein. The Kafak queue can be used for connecting the applications of the second nodes realized by different development languages, so that the system has universality.
As an embodiment, the step S1 further includes step S100, where the first channel sends event structure information corresponding to the subscribed event id to the second node.
The step S4 is followed by the step S5,
Step S51, the second node analyzes the subscription event data from the received subscription event encrypted data according to the private key of the second node;
step S52, analyzing the original subscription event data from the subscription event data according to the subscription event data and the event structure information corresponding to the subscription event id.
As an embodiment, the same event id of the first node may correspond to multiple second service channels, that is, the same event type id corresponds to multiple event data, at this time, the event registration request further includes a channel id, a field of the event subscription configuration table further includes a channel id, and the event data also includes a channel id, so that the second node can clearly know from which channel the multiple event data corresponding to the same event type id respectively come, and user experience is further improved.
The system of the embodiment of the invention isolates the event channel from other service channels by arranging the first channel for processing the event data and the plurality of second channels capable of accessing the first channel in the block chain, and the event generating nodes can register the event through the first channel and generate the event data through the second channels. All event subscription nodes can subscribe events through the first channel, generate encrypted subscription event data through interaction of the first channel and the second channel, and distribute the encrypted subscription event data through the event distribution module. The nodes corresponding to the heterogeneous application systems can be quickly accessed into the system, so that the cost of accessing the heterogeneous application system into a block chain is reduced, and convenience and expandability are realized; the event subscription node can acquire subscription event data only by sending a subscription requirement without considering the internal structure of the block chain, and has universality; the system improves the efficiency of event subscription. In addition, the registration, generation and subscription of the event data are carried out based on the block chain, so that the data can be traced back at each step, and the safety and reliability of the subscription data are improved.
It should be noted that some exemplary embodiments of the present invention are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. Moreover, the order of steps is merely set forth for convenience of reference and does not imply a required order of execution or steps to be rearranged. A process may be terminated when its operations are completed, but may have additional steps not included in the figure. A process may correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (9)
1. A blockchain-based event subscription system, comprising: a blockchain comprising a first channel, at least one second channel and an event distribution module,
when executed by a processor, the computer program implementing the steps of:
step S1, the first channel acquires event registration information and event subscription information, and generates an event subscription configuration table according to the event registration information and the event subscription information, wherein fields of the event subscription configuration table include a first node id, an event type id, event structure information and public key information of at least one corresponding second node, and public key information of all second nodes corresponding to each event type id forms a subscription public key list corresponding to the event type id;
step S2, each of the second channels generates at least one event data and sends the event data to the first channel, where the event data includes event structure information and corresponding event raw data;
step S3, the first channel generates event data to be sent based on the event subscription configuration table and the event data, and sends the event data to a corresponding second channel;
the step S3 includes:
step S301, the first channel acquires a subscription public key list corresponding to each event type id from the event subscription configuration table, and acquires event data corresponding to each event type id from event data sent by the second channel;
step S302, traversing the subscription public key list, encrypting corresponding event data one by adopting each public key information in the subscription public key list, generating subscription event encrypted data corresponding to each public key information, combining all subscription event encrypted data corresponding to each subscription public key list into event data to be sent, and sending the event data to the second channel;
step S4, each of the second channels sends the received event data to be sent to an event distribution module, and the event distribution module distributes the event data to be sent.
2. The system of claim 1,
the step S1 includes:
step S101, the first channel receives an event registration request sent by a first node, analyzes a first node id and event structure information from the event registration request, and generates a corresponding event type id according to the event registration request, wherein the first node id, the event structure information and the event type id form the event registration information, and the first node is an event generating node;
step S102, the first channel receives an event subscription request sent by a second node, and public key information and a corresponding event type id of the second node are analyzed from the event subscription request, the public key information and the corresponding event type id of the second node form the event subscription information, and the second node is an event subscriber node;
step S103, generating the event subscription configuration table based on the event registration information and the event subscription information.
3. The system of claim 2,
between the step S301 and the step S302, a step S311 is further included, where a node id corresponding to an event type id of the event data sent by the second channel is obtained from the registration information, a node id of a generated event corresponding to the event data sent by the second channel is verified, and if the verification is passed, the step S302 is executed.
4. The system of claim 2,
in step S4, the event distributing module distributes the event data to be sent, including:
step S401, the event distribution module analyzes the received event data to be sent, acquires each subscription event encrypted data and a corresponding second node id, creates an event queue for each second node, and sends the subscription event encrypted data corresponding to the same second node id to the corresponding event queue;
step S402, each event queue sends the subscription event encrypted data in the queue to the corresponding second node.
5. The system of claim 4,
the event queue is a kafka queue, and the step S4 further includes step 403, setting a corresponding right for the event queue corresponding to each second node by using a kafka ACL control mechanism, where the right includes a read-only right.
6. The system of claim 2,
the step S1 further comprises a step S100,
And the first channel sends event structure information corresponding to the subscribed event id to the second node.
7. The system of claim 6,
the step S4 is followed by the step S5,
Step S51, the second node analyzes the subscription event data from the received subscription event encrypted data according to the private key of the second node;
step S52, analyzing the original subscription event data from the subscription event data according to the subscription event data and the event structure information corresponding to the subscription event id.
8. The system of claim 2,
and if the same event id of the first node corresponds to a plurality of second service channels, the event registration request further includes a channel id, the field of the event subscription configuration table further includes a channel id, and the event data also includes a channel id.
9. The system of claim 8,
the public key is an x509 public key.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011200043.6A CN112016115B (en) | 2020-11-02 | 2020-11-02 | Event subscription system based on block chain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011200043.6A CN112016115B (en) | 2020-11-02 | 2020-11-02 | Event subscription system based on block chain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112016115A CN112016115A (en) | 2020-12-01 |
CN112016115B true CN112016115B (en) | 2021-02-05 |
Family
ID=73527456
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011200043.6A Active CN112016115B (en) | 2020-11-02 | 2020-11-02 | Event subscription system based on block chain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112016115B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110110269A (en) * | 2019-04-09 | 2019-08-09 | 深圳前海微众银行股份有限公司 | A kind of event subscription method and device based on block chain |
CN110688634A (en) * | 2019-09-19 | 2020-01-14 | 杭州云象网络技术有限公司 | Intelligent execution method for alliance chain affairs |
CN111526047A (en) * | 2020-04-15 | 2020-08-11 | 杭州溪塔科技有限公司 | Block chain-based message queue design method and device |
CN111737356A (en) * | 2020-07-17 | 2020-10-02 | 支付宝(杭州)信息技术有限公司 | Processing method and device for block chain event |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11121881B2 (en) * | 2018-01-19 | 2021-09-14 | Visa International Service Association | Event communication and verification through a blockchain network |
US11777712B2 (en) * | 2019-03-22 | 2023-10-03 | International Business Machines Corporation | Information management in a database |
-
2020
- 2020-11-02 CN CN202011200043.6A patent/CN112016115B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110110269A (en) * | 2019-04-09 | 2019-08-09 | 深圳前海微众银行股份有限公司 | A kind of event subscription method and device based on block chain |
CN110688634A (en) * | 2019-09-19 | 2020-01-14 | 杭州云象网络技术有限公司 | Intelligent execution method for alliance chain affairs |
CN111526047A (en) * | 2020-04-15 | 2020-08-11 | 杭州溪塔科技有限公司 | Block chain-based message queue design method and device |
CN111737356A (en) * | 2020-07-17 | 2020-10-02 | 支付宝(杭州)信息技术有限公司 | Processing method and device for block chain event |
Non-Patent Citations (2)
Title |
---|
hyperledger.hyperledger-fabricdocs Documentation.《https://hyperledger-fabric.readthedocs.io/_/downloads/en/release-2.0/pdf/》.2020,510-511. * |
布萌区块链.Hyperledger Fabric的多通道设计详解.《http://blog.sina.com.cn/s/blog_16b6c12010102wjjs.html》.2017,全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN112016115A (en) | 2020-12-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108923908B (en) | Authorization processing method, device, equipment and storage medium | |
US9864868B2 (en) | Method and apparatus for process enforced configuration management | |
CN110765484B (en) | Credit data processing method and electronic equipment | |
CN111625301A (en) | Idempotent processing method, apparatus, device and storage medium | |
CN110289965B (en) | Application program service management method and device | |
CN109657492B (en) | Database management method, medium, and electronic device | |
CN111597543A (en) | Wide-area process access authority authentication method and system based on block chain intelligent contract | |
CN114615073A (en) | Access flow control method, device, equipment and medium | |
CN113014545B (en) | Data processing method and device, computer equipment and storage medium | |
CN116208666B (en) | Processing method and device supporting multi-source data center joint security calculation data | |
CN112016115B (en) | Event subscription system based on block chain | |
CN114095272B (en) | Intranet data linking method and device based on internal and external network security architecture | |
CN111399749A (en) | Data processing system and method | |
US7912922B2 (en) | Globally unique instance identification | |
CN111552551A (en) | User management method and device based on master-slave system, computer equipment and medium | |
CN113987035A (en) | Block chain external data access method, device, system, equipment and medium | |
JP2009521030A (en) | Using component targets when defining roles in distributed and centralized systems | |
WO2023116276A1 (en) | Fault handling method and apparatus, electronic device and storage medium | |
CN116032494B (en) | Data interaction method, blockchain predictor, device and medium | |
CN117648362B (en) | Method and system for linking third party databases | |
CN117811833B (en) | Unified network crypto-engine management system and method based on publishing and subscribing mode | |
CN113268517B (en) | Data analysis method and device, electronic equipment and readable medium | |
CN115604358B (en) | Service processing method, system, device, management server and storage medium | |
CN115883269A (en) | Flow control management method, device, equipment and medium | |
CN116432198A (en) | Information processing method and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |