CN110097363A - It is a kind of based on block chain event publication, event subscription method and device - Google Patents

It is a kind of based on block chain event publication, event subscription method and device Download PDF

Info

Publication number
CN110097363A
CN110097363A CN201910292876.0A CN201910292876A CN110097363A CN 110097363 A CN110097363 A CN 110097363A CN 201910292876 A CN201910292876 A CN 201910292876A CN 110097363 A CN110097363 A CN 110097363A
Authority
CN
China
Prior art keywords
event
theme
contract
catenary system
block
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.)
Pending
Application number
CN201910292876.0A
Other languages
Chinese (zh)
Inventor
刘丽平
苏小康
张开翔
范瑞彬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WeBank Co Ltd
Original Assignee
WeBank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN201910292876.0A priority Critical patent/CN110097363A/en
Publication of CN110097363A publication Critical patent/CN110097363A/en
Pending legal-status Critical Current

Links

Classifications

    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y04INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
    • Y04SSYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
    • Y04S10/00Systems supporting electrical power generation, transmission or distribution
    • Y04S10/50Systems or methods supporting the power network operation or management, involving a certain degree of interaction with the load-side end user applications
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y04INFORMATION OR COMMUNICATION TECHNOLOGIES HAVING AN IMPACT ON OTHER TECHNOLOGY AREAS
    • Y04SSYSTEMS INTEGRATING TECHNOLOGIES RELATED TO POWER NETWORK OPERATION, COMMUNICATION OR INFORMATION TECHNOLOGIES FOR IMPROVING THE ELECTRICAL POWER GENERATION, TRANSMISSION, DISTRIBUTION, MANAGEMENT OR USAGE, i.e. SMART GRIDS
    • Y04S50/00Market activities related to the operation of systems integrating technologies related to power network operation or related to communication or information technologies
    • Y04S50/12Billing, invoicing, buying or selling transactions or other related activities, e.g. cost or usage evaluation

Abstract

The event publication based on block chain that the invention discloses a kind of, the method and device of event subscription, wherein, event dissemination method includes: that publisher server receives posting request, according to the theme of the event to be released in posting request, the contract address of the theme contract of event to be released is determined from block chain (Blockchain) system, generate the first transaction request, first transaction request is sent to block catenary system, block catenary system calls the theme contract of event to be released to issue event to be released and sends the first transaction results to publisher server after generating transaction log.The technical program uses block chain technology, solves the problems, such as that publication event is tampered with or deletes, and then realizes effective post-audit.

Description

It is a kind of based on block chain event publication, event subscription method and device
Technical field
The present embodiments relate to the fields financial technology (Fintech), more particularly to one kind to be based on block chain (Block Chain the method and device of event publication, event subscription).
Background technique
Event publication refers to that the event of generation is sent to event and corresponded in the message queue of theme by the producer;Event Subscription refers to that consumer obtains event from the message queue of specific subject.Existing event distribution subscription pays close attention to the producer Whether the event of publication is accurately and rapidly subscribed to by consumer, can be by event in message queue after the completion of consumer subscribes to It deletes.
But in existing event distribution subscription, the event in message queue can be accessed personnel and distort easily, Bu Nengbao Hinder the accuracy of event subscription, and allow to delete event in message queue after the completion of subscribing to, cannot accomplish effectively subsequent examine Meter.
Summary of the invention
The embodiment of the present invention provide it is a kind of based on block chain event publication, event subscription method and device, to solve The problem of certainly publication event is tampered with or deletes, and then realize effective post-audit.
A kind of method of event publication based on block chain provided in an embodiment of the present invention, comprising:
Publisher server receives posting request, and the posting request includes event to be released;
The publisher server determines the thing to be released according to the theme of the event to be released from block catenary system The contract address of the corresponding theme contract of part;The corresponding theme contract of each theme is stored in the block catenary system;
The publisher server generates the first transaction request;First transaction request includes that the event to be released is corresponding Theme contract contract address and the event to be released;
First transaction request is sent to the block catenary system by the publisher server;
The publisher server receives the first transaction results that the block catenary system returns;First transaction results are The block catenary system calls the corresponding theme contract of the event to be released to issue the event to be released and generate the day of trade It is sent after will;Record has the event of publication in the transaction log.
In above-mentioned technical proposal, using block catenary system, it is stored with each theme in block catenary system and each theme is corresponding Theme contract.Publisher server receives posting request, and what which can be producer's transmission includes event to be released Request, publisher server determine the address of the theme contract of event to be released, so that area according to the theme of event to be released Block catenary system calls the theme contract of event to be released to execute publication movement to event to be released, and block catenary system, which generates record, to be had The transaction log of event has been issued, and transaction log has been stored in block catenary system, has been stored by the chain type of block catenary system, It prevents from having issued event and is tampered with and deletes, ensured the accuracy of the event of publication, effectively audited afterwards with realizing.
Optionally, the publisher server is according to the theme of the event to be released, determined from block catenary system described in The contract address of the corresponding theme contract of event to be released, comprising:
The publisher server obtains system contract from the block catenary system;The system contract includes theme and master Inscribe the corresponding relationship of the contract address of contract;
The publisher server is determined described pending according to the theme of the event to be released from the system contract The contract address of the corresponding theme contract of cloth event.
In above-mentioned technical proposal, when publisher server determines that the theme of event to be released closes according to the theme of event to be released When contract address about, need to obtain system contract from block catenary system, and determine contract address from system contract.It will lead The corresponding relationship of the contract address of topic and theme contract is stored into the system contract of block catenary system, has ensured the safety of data Property, and block catenary system realizes the theme contract for accurately calling event to be released, and issues to event to be released And storage.
Optionally, before the posting request that the publisher server receives that the producer sends, further includes:
The publisher server receives theme to be created;
The publisher server generates the second transaction request according to the theme to be created;Second transaction request is used for Indicate that the block catenary system disposes the theme contract of the theme to be created;
Second transaction request is sent to the block catenary system by the publisher server;
The publisher server receives the second transaction results that the block catenary system returns;Second transaction results are It is sent after the corresponding theme contract of block catenary system theme to be created according to the theme deployment to be created;It is described Second transaction results include the contract address of the corresponding theme contract of the theme to be created.
In above-mentioned technical proposal, publisher server can generate the second transaction request according to the theme to be created of the producer, And it is sent to block catenary system, block catenary system disposes corresponding theme contract, and by the conjunction for the theme contract disposed About address is back to publisher server, and new theme contract is disposed in realization in block catenary system.The producer can create new master Topic, and the corresponding event of new theme is issued, and the corresponding event of new theme of producer's publication can store to block catenary system In, ensure the corresponding event of new theme is not easy tamper.
Optionally, before the publisher server receives the theme to be created, further includes:
The publisher server sends third transaction request to the block catenary system;The third transaction request is for referring to Show the block catenary system deployment system contract;
The publisher server receives the third transaction results that the block catenary system returns;The third transaction results are What the block catenary system was completed to send after the deployment of the system contract;
After the second transaction results that the publisher server receives that the block catenary system returns, further includes:
The publisher server is by the contract of the theme to be created and the corresponding theme contract of the theme to be created The corresponding relationship of location is updated to the system contract.
In above-mentioned technical proposal, publisher server, can also be to block chain before the theme to be created for receiving the producer System sends the transaction request for being used to indicate block catenary system deployment system contract, that is to say, that block catenary system is led in deployment It, can also elder generation's deployment system contract before inscribing contract.After block catenary system has disposed theme contract, the contract of theme contract Address feeds back to publisher server, and the corresponding relationship of the contract address of theme and theme contract can be updated to by publisher server System contract is being sent out so that system contract stores the corresponding relationship of newest theme and contract address in current block catenary system When cloth server obtains system contract, the information of the corresponding relationship of newest theme and contract address is got, further such that Block catenary system calls the corresponding theme contract of event to be released, and the transaction log that record has the event of publication is stored to area In block catenary system.
Correspondingly, the embodiment of the invention also provides a kind of methods of event subscription based on block chain, comprising:
Subscriber receives acquisition request, and the acquisition request is used to indicate the Subscriber from block catenary system It is middle to obtain event to be obtained;The transaction log on the books for having issued event is stored in the block catenary system;The transaction log It is that the block catenary system calls the corresponding theme contract of event to be released to generate in the event of publication;The block catenary system In be stored with the corresponding theme contract of each theme;
The subscription service judges in the block catenary system according to the theme of the event to be obtained with the presence or absence of described The corresponding theme contract of event to be obtained;If so, obtaining the event to be obtained from the block catenary system.
In above-mentioned technical proposal, Subscriber can receive acquisition request, which can be consumer Xiang Ding The request including event to be obtained of server transmission is read, Subscriber is first according to the theme of event to be obtained in acquisition request Determine the theme that whether there is event to be obtained in system contract, and if it exists, can then determine to deposit in current block catenary system In the theme contract of event to be obtained, that is, determine that the event to be obtained can be obtained from block catenary system.Subscriber Whether by the judgement of the theme to the event to be obtained in consumer's acquisition request, directly judging can be from block catenary system In get the event of customer requests, improve judging efficiency.
Optionally, the transaction log, which also records, the event mark for having issued event;Event mark is for unique Mark each event;
The Subscriber obtains the event to be obtained from the block catenary system, comprising:
The Subscriber is indicated according to the event of the event to be obtained, from the block catenary system described in determination Block where event to be obtained, and the thing to be obtained is obtained from the transaction log of the block where the event to be obtained Part.
In above-mentioned technical proposal, when block catenary system, which generates record, the transaction log of the event of publication, that is, indicate The event to be released has been published.It wherein, further include the event mark for having issued event in transaction log, that is to say, that Event mark is for marking issued event.The event of publication corresponds to event mark, and event to be obtained is equally corresponding Event mark, when Subscriber, which is determined, can obtain the event to be obtained of consumer from block catenary system, Ke Yigen It is indicated according to the event of event to be obtained, first determines the block where event to be obtained, then from the block where event to be obtained In determine event to be obtained, without traversing entire block catenary system, improve the efficiency of acquisition event.Further, it consumes The event that person obtains is certain moment storage of block catenary system in history, i.e. consumer can subscribe to going through for producer's publication Historical event part improves user experience.
Optionally, the event mark includes the sequence number of event and the block height of event;The sequence number of the event For the event in affiliated theme corresponding sequence number;The block height of the event is to record the area of the block of the event Block height.
In above-mentioned technical proposal, Subscriber can determine the thing to be obtained according to the block height of event to be obtained Event to be obtained is quickly navigated to the block in block catenary system by the block where part.It include multiple transaction in the block Log records the event mark of the event of publication in the transaction log, that is, has issued the sequence number of event and issued event Block height, Subscriber further can quickly navigate to the day of trade in block according to the sequence number of event to be obtained Will, and determine event to be obtained, this programme is improved by block height and sequence number, quick obtaining to the event to be obtained The efficiency of the event of subscription.
Optionally, the event to be obtained is to set the newly-increased event of theme;
The Subscriber obtains the event to be obtained from the block catenary system, comprising:
After the Subscriber has newly-increased block in determining the block catenary system, obtain in the newly-increased block Transaction log;
The Subscriber determines in the newly-increased block according to the setting theme with the presence or absence of the setting theme Corresponding transaction log;If so, obtaining the event to be obtained from the transaction log of the newly-increased block.
In above-mentioned technical proposal, consumer is also based on to request to send to Subscriber to the monitoring of setting theme and obtain Taking the event to be obtained in request, that is, consumer's acquisition request is to set the newly-increased event of theme, and Subscriber is directed to Whether such acquisition request has newly-increased block in real-time judge block chain, if there is newly-increased block, obtained from newly-increased block to Acquisition event, so that consumer can get the thing of newest publication corresponding with setting theme from block catenary system Part improves user experience.
Correspondingly, the device for the event publication that the embodiment of the invention also provides a kind of based on block chain, comprising:
Transmit-Receive Unit, for receiving posting request, the posting request includes event to be released;
Processing unit determines the thing to be released for the theme according to the event to be released from block catenary system The contract address of the corresponding theme contract of part;The corresponding theme contract of each theme is stored in the block catenary system;Generate the One transaction request;First transaction request include the corresponding theme contract of the event to be released contract address and it is described to Publication event;
The Transmit-Receive Unit is also used to first transaction request being sent to the block catenary system;
The Transmit-Receive Unit is also used to receive the first transaction results that the block catenary system returns;First transaction The result is that the block catenary system calls the corresponding theme contract of the event to be released to issue the event to be released and generate It is sent after transaction log;Record has the event of publication in the transaction log.
Optionally, the processing unit is specifically used for:
System contract is obtained from the block catenary system;The system contract includes the contract of theme and theme contract The corresponding relationship of location;
According to the theme of the event to be released, the corresponding master of the event to be released is determined from the system contract Inscribe the contract address of contract.
Optionally, the processing unit is also used to:
Before the Transmit-Receive Unit receives posting request, controls the Transmit-Receive Unit and receive theme to be created;
The second transaction request is generated according to the theme to be created;Second transaction request is used to indicate the block chain The theme contract of theme to be created described in system deployment;
It controls the Transmit-Receive Unit and second transaction request is sent to the block catenary system;
It controls the Transmit-Receive Unit and receives the second transaction results that the block catenary system returns;Second transaction results It is sent after the corresponding theme contract of block catenary system theme to be created according to the theme deployment to be created;Institute State the contract address that the second transaction results include the corresponding theme contract of the theme to be created.
Optionally, the processing unit is also used to:
Before the Transmit-Receive Unit receives the theme to be created, the Transmit-Receive Unit is controlled to the block catenary system Send third transaction request;The third transaction request is used to indicate the block catenary system deployment system contract;
Receive the third transaction results that the block catenary system returns;The third transaction results are the block catenary systems It completes to send after the deployment of the system contract;
The processing unit is also used to:
After the second transaction results that the Transmit-Receive Unit receives that the block catenary system returns, it is single to control the transmitting-receiving The corresponding relationship of the contract address of the theme to be created and the corresponding theme contract of the theme to be created is updated to institute by member State system contract.
Correspondingly, the embodiment of the invention also provides a kind of devices of event subscription based on block chain, comprising:
Transmit-Receive Unit, for receiving acquisition request, the acquisition request is used to indicate the Subscriber from block chain Event to be obtained is obtained in system;The transaction log on the books for having issued event is stored in the block catenary system;The transaction Log is that the block catenary system calls the corresponding theme contract of event to be released to generate in the event of publication;The block chain The corresponding theme contract of each theme is stored in system;
Processing unit, for being judged in the block catenary system according to the theme of the event to be obtained with the presence or absence of described The corresponding theme contract of event to be obtained;If so, obtaining the event to be obtained from the block catenary system.
Optionally, the transaction log, which also records, the event mark for having issued event;Event mark is for unique Mark each event;
The processing unit is specifically used for:
It is indicated according to the event of the event to be obtained, the event place to be obtained is determined from the block catenary system Block, and the event to be obtained is obtained from the transaction log of the block where the event to be obtained.
Optionally, the event mark includes the sequence number of event and the block height of event;The sequence number of the event For the event in affiliated theme corresponding sequence number;The block height of the event is to record the area of the block of the event Block height.
Optionally, the event to be obtained is to set the newly-increased event of theme;
The processing unit is specifically used for:
After there is newly-increased block in determining the block catenary system, the transaction log in the newly-increased block is obtained;
It is determined in the newly-increased block according to the setting theme with the presence or absence of the corresponding transaction log of the setting theme; If so, obtaining the event to be obtained from the transaction log of the newly-increased block.
Correspondingly, the embodiment of the invention also provides a kind of systems of event distribution subscription based on block chain, comprising:
The device and block catenary system of device, event subscription that above-mentioned event is issued.
Correspondingly, the embodiment of the invention also provides a kind of calculating equipment, comprising:
Memory, for storing program instruction;
Processor executes above-mentioned event according to the program of acquisition for calling the program instruction stored in the memory The method of publication.
Correspondingly, the embodiment of the invention also provides a kind of computer-readable non-volatile memory medium, including computer Readable instruction, when computer is read and executes the computer-readable instruction, so that computer executes above-mentioned event publication Method.
Correspondingly, the embodiment of the invention also provides a kind of calculating equipment, comprising:
Memory, for storing program instruction;
Processor executes above-mentioned event according to the program of acquisition for calling the program instruction stored in the memory The method of subscription.
Correspondingly, the embodiment of the invention also provides a kind of computer-readable non-volatile memory medium, including computer Readable instruction, when computer is read and executes the computer-readable instruction, so that computer executes above-mentioned event subscription Method.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this For the those of ordinary skill in field, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is a kind of schematic diagram of system architecture provided in an embodiment of the present invention;
Fig. 2 is a kind of flow diagram of the method for event publication provided in an embodiment of the present invention;
Fig. 3 is the flow diagram of the method for a kind of deployment provided in an embodiment of the present invention and more new system contract;
A kind of Fig. 4 flow diagram of the method for event subscription provided in an embodiment of the present invention;
Fig. 5 (a) is the flow diagram of the method for another event subscription provided in an embodiment of the present invention;
Fig. 5 (b) is the flow diagram of the method for another event subscription provided in an embodiment of the present invention;
Fig. 5 (c) is the flow diagram of the method for another event subscription provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram of the device of event publication provided in an embodiment of the present invention;
Fig. 7 is a kind of structural schematic diagram of the device of event subscription provided in an embodiment of the present invention;
Fig. 8 is a kind of structural schematic diagram of publisher server provided in an embodiment of the present invention;
Fig. 9 is a kind of structural schematic diagram of Subscriber provided in an embodiment of the present invention.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into It is described in detail to one step, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole implementation Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts All other embodiment, shall fall within the protection scope of the present invention.
Fig. 1 illustratively shows the system that the embodiment of the present invention provides event publication, the method for event subscription is applicable in Framework, the system architecture may include the producer 100, publisher server 200, block catenary system 300, Subscriber 400, disappear The person of expense 500.Wherein, the producer 100 is used for for generating event to be released, publisher server 200 by event write area to be released In block catenary system 300, consumer 500 is used to subscribe to event from block catenary system 300 by Subscriber 400.
When the producer 100 needs to issue event, event to be released is sent to publisher server 200, publisher server 200 Transaction request is generated according to event to be released, transaction request is sent to block catenary system 300, block chain by publisher server 200 System 300 executes contract according to transaction request and records the event to be released, i.e. the event publication of the completion producer 100.
When consumer 500 needs to obtain event, acquisition request, 400 basis of Subscriber are sent to Subscriber 400 The acquisition request received determines the corresponding event of acquisition request from block catenary system 300, feeds back to consumer 500, i.e., Complete the event subscription of consumer 500.
Publisher server 200 and Subscriber 400 in this system framework can be a service on physical entity Device, the server complete publication and subscribe to function, or two sseparated servers are respectively completed issuing function and subscription Function, herein with no restrictions.
Block catenary system 300 executes contract according to transaction request and records the event to be released, and event to be released is issued Afterwards, it is stored in block catenary system 300, since block catenary system 300 is chain structure, there is the spy for being not easy to be tampered and delete Property, ensure the safety that publication event is stored in block catenary system 300.
Based on foregoing description, Fig. 2 illustratively shows a kind of method of event publication provided in an embodiment of the present invention Process, the process can do following explanation in conjunction with the producer, publisher server and block catenary system.
As shown in Fig. 2, the process specifically includes:
Step 201, the producer sends posting request to publisher server.
The producer generates event to be released, generates posting request according to event to be released, wherein wrap in posting request Event to be released is included, then event to be released can be interpreted as producer's event to be released.Wherein, each event pair to be released Event topic is answered, for example, event to be released is " triumph of certain basketball team ", then it can be basket that the event to be released, which corresponds to event topic, Ball theme, event content are " triumph of certain basketball team ".
Step 202, publisher server determines event pair to be released according to the theme of event to be released from block catenary system The contract address for the theme contract answered.
In the embodiment of the present invention, the corresponding theme contract of each theme is stored in block catenary system, when publisher server connects When receiving event to be released, it can according to the theme of event to be released, determine the corresponding master of the theme in block catenary system Inscribe the contract address of contract, i.e. the contract address of block catenary system theme contract to be called, specifically, publisher server can be with The corresponding relationship of the contract address of each theme and theme contract in block catenary system is got, which is referred to table 1 The example shown deploys the contract of the contract of theme A, the contract of theme B and theme C in block catenary system, respectively corresponds conjunction About address a, contract address b, contract address c, when the theme for the event to be released that publisher server is got is " theme B ", The contract address that according to table 1, can then determine the theme contract of the event to be released is " contract address b ", that is, block The contract address of catenary system theme contract to be called is " contract address b ".
Table 1
Theme The contract address of theme contract
Theme A Contract address a
Theme B Contract address b
Theme C Contract address c
Publisher server can be obtained when obtaining above-mentioned corresponding relationship from the local of publisher server, can also be from area It is obtained in block catenary system, that is to say, that above-mentioned corresponding relationship can store in publisher server local, also can store in block In catenary system, further, when above-mentioned corresponding relationship stores in block catenary system, it can be deposited in a manner of system contract Storage includes the correspondence of the contract address of theme and theme contract there are system contract that is, in block catenary system, in the system contract Relationship.
In the embodiment of the present invention, when the corresponding relationship of the contract address of theme and theme contract is stored in block catenary system System contract in when, publisher server can obtain the system contract from block catenary system, for example, publisher server is to area Block catenary system sends the acquisition request of system contract, and receives the system contract of block catenary system feedback.When publisher server obtains After getting system contract, it according to the theme of event to be released, can determine that the theme of event to be released is closed from system contract Contract address about.It is closed using the corresponding of contract address of system contract storage theme and theme contract in block catenary system System ensures the corresponding relationship of the two, is not easy to be tampered, and ensures that event to be released is accurately called in the realization of block catenary system Theme contract, and event to be released is issued and stored.
Step 203, publisher server generates the first transaction request.
Publisher server generates first according to the contract address of the theme contract of event to be released and event to be released and hands over Easily request, then first transaction request include the corresponding theme contract of event to be released contract address and event to be released.
Step 204, the first transaction request is sent to block catenary system by publisher server.
Step 205, block catenary system calls the theme contract of event to be released to issue event to be released and generates the day of trade Will.
Block catenary system is according to the contract address of the corresponding theme contract of event to be released in the first transaction request, with pending The theme and event content of cloth event are parameter, call the theme contract of event to be released, are equivalent to and execute to event to be released Publication movement, event to be released is issued by block catenary system, and generates transaction log, wherein can recorde in transaction log Event is issued, such as record has theme, the event content of the event of publication, can also record the correlation of the event of publication certainly Parameter, such as issued the event mark of event, producer's mark.Block catenary system generates the transaction that record has the event of publication Log, it can be understood as the event to be released issued completion.
In the embodiment of the present invention, the event mark in transaction log can be understood as the mark for each event of uniquely tagged Show.Optionally, which is denoted as sequence of events number, by block catenary system store it is all issued event by write sequence into First time, is such as written the publication event of block chain by row number, and record event is denoted as " 1 ";It will second of write-in block chain Publication event, record event is denoted as " 2 ";Third time is written to the publication event of block chain, record event is denoted as "3".Certainly, event mark can also be the sequence number write according to theme, that is, be directed to any one theme, by the theme Corresponding event of having issued is numbered in order, has such as issued event for theme A is corresponding, then block is written in first time The publication event of chain, record event are denoted as " A1 ", second are written the publication event of block chain, record event mark For " A2 ", third time is written to the publication event of block chain, record event is denoted as " A3 ";It is such as corresponding for theme B The publication event of block chain is written in first time by publication event, and record event is denoted as " B1 ", will second of write-in block chain Publication event, record event is denoted as " B2 ", the publication event of block chain is written in third time, record event is denoted as “B3”。
Further, in the event mark of transaction log, it not only can recorde the sequence number write according to theme, may be used also To record block height of the event place block in entire block catenary system, that is to say, that the event identifier of transaction log The block height of sequence number and event including event, wherein corresponding sequence in the affiliated theme of sequence number, that is, event of event Number, the block height of event is to record the block height of the block of the event.For example, it has been issued for theme A is corresponding The publication event of block chain will be written for the first time, record the Serial No. " A1 " of event for event, and determine current record this The block height of the block of publication event, it is assumed that block height is 6 at this time, then event, which indicates, to be " A1,6 ", it will be second The publication event that block chain is written, records the Serial No. " A2 " of event, and determines current record this has issued the area of event The block height of block, it is assumed that block height is 7 at this time, then event, which indicates, to be " A2,7 ".
After block catenary system generates transaction log, block catenary system is written into transaction log, then in the transaction log Publication event will not be tampered with.
Step 206, the first transaction results are sent to publisher server by block catenary system.
First transaction results of transaction log write-in block catenary system are fed back to publisher server by block catenary system.
Step 207, publisher server sends publication to the producer and completes message.
After publisher server receives the first transaction results of block catenary system feedback, then event to be released can be determined It is successfully written block catenary system, i.e., the message that publication is completed can be then sent to by event to be released issued completion The producer.
In above-described embodiment, the corresponding theme contract of each theme is stored in block catenary system, such as table 1, in block catenary system It is stored with the corresponding theme contract of 3 themes, the event of any one theme in 3 themes can be generated in the producer, and passes through The event is distributed in block catenary system by publisher server.Certainly, the producer can also be by publisher server in block chain New theme is created in system, that is, is generated a theme to be created and be sent to publisher server, publisher server is according to master to be created Topic generates the second transaction request, which is the theme conjunction for being used to indicate block catenary system and disposing theme to be created About, the second transaction request is sent to block catenary system by publisher server, and block catenary system is disposed according to second transaction request The corresponding theme contract of the theme to be created generates the second transaction results, and second transaction results are anti-after the completion of deployment It is fed to publisher server, wherein second transaction results include the contract address of the corresponding theme contract of theme to be created.
Further, publisher server is by the correspondence of the contract address of theme to be created and the theme contract of theme to be created Relationship is updated in mapping table.The mapping table can be previously stored the system contract in block catenary system, then issue The corresponding relationship of the contract address of theme to be created and the theme contract of theme to be created can be updated to system conjunction by server In about.
In addition, the embodiment of the present invention also provide it is a kind of can in block catenary system deployment system contract mode.This is Integration can about be completed before disposing theme contract, that is to say, that the producer sends theme to be created or sends posting request Before, block catenary system completes the deployment of system contract.Publisher server sends third transaction request, block to block catenary system Catenary system receives the third transaction request, and deployment system contract.Block catenary system is sent after the deployment for completing system contract Third transaction results are to publisher server.It should be noted that block catenary system is in deployment system contract, the system contract Original state can be sky, and publisher server can be by the contract address of theme to be created and the theme contract of theme to be created In corresponding relationship writing system contract.
The deployment process of system contract and update are referred to the process shown in Fig. 3:
The deployment process of system contract first is referred to step 301~step 303, and deployment process is related to publisher server Interaction between block catenary system.
Step 301, publisher server sends third transaction request to block catenary system;
Step 302, block catenary system deployment system contract;
Block catenary system is after receiving third transaction request, according to third transaction request deployment system contract, wherein should System contract can be sky when just starting deployment.
Step 303, block catenary system sends third transaction results to publisher server;
Block catenary system is after the deployment for completing system contract, it can sends third transaction knot to publisher server Fruit informs the deployed completion of publisher server system contract, and further, the producer can generate theme to be created, area Deployment theme contract corresponding with the theme to be created in block catenary system, creates theme process and is related to the producer, publisher server Interaction between block catenary system, is referred to step 304~step 307.
Step 304, the producer sends theme to be created to publisher server;
The producer can first generate theme to be created, and this is to be created when needing to issue the corresponding event of new theme Theme is sent to publisher server.
Step 305, publisher server generates the second transaction request according to theme to be created;
Step 306, publisher server sends the second transaction request to block catenary system;
Second transaction request is used to indicate the theme contract that block catenary system disposes theme to be created, second transaction request In may include theme to be created.
Step 307, block catenary system disposes theme contract;
Step 308, block catenary system sends the second transaction results to publisher server;
It include the contract address of the theme contract of the theme to be created of block catenary system deployment in second transaction results, by this Contract address is sent to publisher server.
Step 309, publisher server is by the correspondence of the contract address of theme to be created and the theme contract of theme to be created Relationship is updated to system contract.
Publisher server can be by the corresponding relationship of the contract address of theme to be created and the theme contract of theme to be created It is sent to block catenary system, block catenary system will be in the corresponding relationship writing system contract.
In above-mentioned technical proposal, using block catenary system, it is stored with each theme in block catenary system and each theme is corresponding Theme contract.The producer to publisher server send include event to be released posting request, publisher server is according to pending The theme of cloth event determines the address of the theme contract of event to be released, so that block catenary system calls event to be released Theme contract, block catenary system, which generates record, the transaction log of event to be released, and transaction log is stored in block chain In system, is stored by the chain type of block catenary system, prevent event to be released to be tampered with and delete, ensured thing to be released The accuracy of part is effectively audited afterwards with realizing.By recording transaction in block catenary system, and deposited using chain type Storage, has accomplished real name record, persistence, can not distort, supported complete post audit.
Foregoing invention embodiment has been described in detail the producer and how to pass through publisher server to be completed in block catenary system Event publication and theme contract deployment and publisher server how in block catenary system deployment system contract, below will It is specifically described the implementation how consumer completes event subscription by Subscriber.
Consumer sends acquisition request to Subscriber, which is used to indicate Subscriber from block linkwork Event to be obtained is obtained in system.The block catenary system of publisher server publication event in the block catenary system, that is, above-described embodiment, The transaction log on the books for having issued event is stored in the block catenary system, and the transaction log, that is, above-mentioned block catenary system is being sent out The corresponding theme contract of event to be released is called to generate when cloth event.
After Subscriber receives the acquisition request, the master that whether there is the event to be obtained in block catenary system is determined Contract is inscribed, specifically, the system contract in available block catenary system, judges in the system contract with the presence or absence of thing to be obtained The theme of part, if so, Subscriber determination obtains event to be obtained from block catenary system, otherwise, it determines block linkwork There is no the events that the consumer is to be obtained in system, return to consumer and subscribe to failure news.
The mode that consumer completes event subscription can be two kinds, and one is the event for obtaining history publication, another kind is The event newly issued is obtained in real time.For different subscribing manners, it is as described below that the embodiment of the present invention divides situation to carry out.
One, consumer obtains the event of history publication
When consumer obtains the event of history publication, need the event mark of event to be obtained being sent to subscription service Device is obtained from the existing block in block catenary system so that Subscriber is indicated according to the event of event to be obtained.
It is construed to, when event is issued, block catenary system generates the transaction log that record has the event of publication, the transaction log In be also recorded the event for having issued event mark, will issue event write-in block catenary system in, then represent thing to be released Part is issued, and further, event mark has respectively issued event for uniquely tagged.When block catenary system completes transaction log Storage after, the first transaction results can be sent to publisher server, issuing service sends publication to the producer and completes to disappear Breath all includes the event mark for event of having issued, that is to say, that production herein, in the first transaction results, publication completion message After person issues completion event, the event mark of the event can be also received.
In practical application, the event mark for all events that the available producer of consumer issued so far, for example, raw So far (in March, 2019) from January, 2018 publication event, consumer is then available to arrive the producer from January, 2018 to production person Publication event so far (in March, 2019) all events mark, certainly, consumer also it is available into the above-mentioned period appoint The event of all events of one sub- period indicates or the event of partial event mark.Further, consumer can basis The event of event to be obtained indicates, and the event to be obtained is obtained from block catenary system by Subscriber, specifically, event Mark is used for each event of uniquely tagged, and Subscriber is indicated according to the event of event to be obtained, determines from block catenary system Block where event to be obtained, then the event to be obtained is obtained from the transaction log of the block where event to be obtained.
For example, the event of event to be obtained is denoted as " A3 ", then Subscriber is in the acquisition for receiving consumer's transmission After request (the event mark " A3 " that the acquisition request includes event to be obtained), it is entire that " A3 " traversal can be indicated according to the event The transaction log stored in block chain first determines that outgoing event is denoted as the block where the event of " A3 ", then from the block really The event of making is denoted as the event of " A3 ", that is, the event to be obtained.In the embodiment of the present invention, in order to efficiently obtain wait obtain Event is taken, block catenary system will can be used to store the area of the block for event of having issued when executing contract generation transaction log Block altitude record is in event mark, i.e. event mark includes the sequence number of event and the block height of event, and herein, event can Think the event of publication, or event to be obtained.Then consumer includes wait obtain in acquisition request when sending acquisition request The event of event is taken to indicate, Subscriber is indicated according to the event of event to be obtained, and determination is to be obtained from block catenary system When event, specifically specific block can be navigated to, then further according to event to be obtained first according to the block height of event to be obtained Sequence number, the event to be obtained is determined from specific block.For example, if current consumer wants to obtain from block catenary system Event is denoted as that " A4,19 " publication event then can be according to " A4,19 " first determine block height from block catenary system For 19 block, the All Activity log in the block that the block height is 19 is then obtained, for example, having in All Activity log The corresponding event 1 (event is denoted as " A1,19 ") of theme A, event 2 (event is denoted as " A2,19 "), (event is denoted as event 3 "A3,19");The corresponding event 3 (event is denoted as " B3,19 ") of theme B, event 4 (event is denoted as " B4,19 "), then can be with Event to be obtained is directly determined according to the sequence number " A4 " of event to be obtained, that is, determines the corresponding event 4 of theme A.
In the embodiment of the present invention, sets event mark to include the sequence number of event and the block height of event, subscribe to Server can determine the block where the event to be obtained according to the block height of event to be obtained, i.e., by event to be obtained Quickly navigate to the block in block catenary system.Include multiple transaction logs in the block, records and issued in the transaction log The event of event indicates, that is, has issued the sequence number of event and issued the block height of event, Subscriber can be into one Step quickly navigates to the transaction log in block according to the sequence number of event to be obtained, and determines event to be obtained, this programme By block height and sequence number, quick obtaining improves the efficiency of subscription event to the event to be obtained.And consumer can be with The event of historical certain moment storage is obtained, i.e. consumer can subscribe to the historical events of producer's publication, improve user's body It tests.
Two, consumer obtains the event newly issued in real time
Consumer is requested based on the monitoring to setting theme, acquisition request is sent to Subscriber, at this point, acquisition request In event to be obtained can be understood as the newly-increased event of setting theme, consumer sends to Subscriber to setting theme The acquisition request of newly-increased event.Whether there is newly-increased block in Subscriber real-time detection block catenary system, once it is determined that having new After increasing block, then the transaction log in newly-increased block is obtained.Determine in newly-increased block whether deposit according to the theme of event to be obtained In the corresponding transaction log of the theme of event to be obtained, and if it exists, then obtain thing to be obtained from the transaction log of newly-increased block Part.And event to be obtained is fed back into consumer.It if it does not exist, then can be to consumer feedback without the corresponding new publication of theme Event, it is of course also possible to not to consumer feedback's message, until determining event to be obtained from the transaction log of newly-increased block And feed back to consumer.By the way that the monitoring request for meeting consumer to setting theme is arranged, it is corresponding new that theme can will be set Increasing event is sent to consumer, improves user experience.
In the embodiment of the present invention, a kind of consumer is also provided when obtaining the event newly issued in real time, due to certain failures Reason causes leakage to obtain or interrupt the disposal method for obtaining new publication event.
For example, from January, 2018 publication event, (in March, 2019), consumer are the producer from January, 2018 so far The producer is obtained in real time, the event in block catenary system is distributed to by publisher server, but due to consumer itself is certain It is the event that can not be got the producer and be issued after in January, 2019 from January, 2019, then consumer can be taken by subscribing to Business device is from obtaining the event issued after in January, 2019 in block catenary system.Specifically, if the producer in January, 2019 so far Publication event has a corresponding event of A theme, Serial No. A45~A100, event identifier be respectively " A45,78 ", " A46,79 ", " A47,79 " ..., " A100,96 ", consumer only gets the event of Serial No. A44, then consumer can be to subscription service Device sends acquisition request, which is used to indicate the event that Subscriber obtains Serial No. A45, wraps in acquisition request Include event mark " A45,78 ", then Subscriber can according to " A45,78 " by state event location to be obtained to block height be 78 Block in, and obtain the event to be obtained of Serial No. A45, further, consumer also can indicate that Subscriber obtains The event of sequence number A46~A100 is taken, until getting newest publication event.Consumer get newest publication event it Afterwards, it can turn in the logic for obtaining publication event in real time, the newly-increased event for obtaining setting theme is sent to Subscriber Request.
In conjunction with foregoing description, Fig. 4 illustratively shows a kind of method of event subscription provided in an embodiment of the present invention Process, the process can do following explanation by executing subject of Subscriber.
As shown in figure 4, the process specifically includes:
Step 401, the acquisition request that consumer sends is received.
Step 402, the theme contract of event to be obtained is judged whether there is.If so, turning to step 403, otherwise, turn to Step 404.
Step 403, judge in acquisition request whether to include that event indicates, if so, turning to step 405, otherwise, turn to step Rapid 407.
Step 404, it is sent to consumer and subscribes to failed message.
Step 405, the block according to the block height of event mark where determining event to be obtained in block catenary system.
Step 406, according to event indicate sequence number obtained from the transaction log of the block where event to be obtained to Acquisition event.
Step 407, after there is newly-increased block in determining block catenary system, the transaction log in newly-increased block is obtained.
Step 408, judge the corresponding transaction log of theme that whether there is event to be obtained in newly-increased block, if so, Step 409 is turned to, otherwise, turns to step 407.
It, can be with there is no after the corresponding transaction log of theme of event to be obtained in the transaction log for determining newly-increased block After there is newly-increased block in listening to block catenary system next time, the theme for judging whether there is event to be obtained again is corresponding Transaction log, until determine event to be obtained, and event to be obtained is sent to consumer.
As shown in figure 5, the embodiment of the present invention also provides the process of a kind of method of event subscription, which, which can combine, disappears Fei Zhe, Subscriber and block catenary system are illustrated.
Specifically, Fig. 5 (a) shows a kind of flow diagram of event subscription.
Step 501, consumer sends acquisition request to Subscriber;
It wherein, include event to be obtained in the acquisition request.
Step 502, Subscriber judges the theme contract that whether there is event to be obtained in block catenary system;
Step 503, if there are the theme contract of event to be obtained in block catenary system, Subscriber is determined from block Event to be obtained is obtained in catenary system;
Step 504, event to be obtained is sent to consumer by Subscriber.
In step 503, system contract in the available block catenary system of Subscriber, judge in system contract whether There are the themes of event to be obtained, and if it exists, is also assured that out in block catenary system that there are the conjunctions of the theme of event to be obtained About.Subscriber can specifically be divided into two kinds of situations, in conjunction with Fig. 5 when obtaining event to be obtained from block catenary system (b) it is illustrated with 5 (c).
Fig. 5 (b) show Subscriber obtained from block catenary system according to the event of event to be obtained mark it is to be obtained Event, detailed process is referring to step 505~step 508.
Step 505, Subscriber determines thing to be obtained according to the block height of event to be obtained from block catenary system Block where part;
Step 506, the acquisition request of transaction log is sent to block catenary system by Subscriber;
After Subscriber determines the block where event to be obtained, the acquisition request of transaction log is sent to block chain System, for obtaining the All Activity log in the block.
Step 507, transaction log is sent to Subscriber by block catenary system;
Step 508, Subscriber is according to the sequence number of event to be obtained, from the transaction of the block where event to be obtained Event to be obtained is obtained in log.
Fig. 5 (c) shows Subscriber and monitors the newly-increased event for whether having consumer to set theme in block catenary system, and The newly-increased event is obtained from block catenary system, detailed process is referring to step 509~step 512.
Step 509, Subscriber sends newly-increased transaction log acquisition request to block catenary system;
With the presence or absence of newly-increased block in Subscriber real-time monitoring block catenary system, if there is newly-increased block, then to Block catenary system sends the acquisition request for increasing transaction log in newly-increased block newly.
Step 510, block catenary system sends newly-increased transaction log to Subscriber;
Step 511, Subscriber determines corresponding with the presence or absence of setting theme in newly-increased transaction log according to setting theme Transaction log;
Step 512, the corresponding transaction log of theme is set if it exists, then Subscriber obtains event to be obtained.
In above-mentioned technical proposal, Subscriber can receive acquisition request, which can be consumer Xiang Ding The request including event to be obtained of server transmission is read, Subscriber is first according to the theme of event to be obtained in acquisition request Determine the theme that whether there is event to be obtained in system contract, and if it exists, can then determine to deposit in current block catenary system In the theme contract of event to be obtained, that is, determine that the event to be obtained can be obtained from block catenary system.Subscriber Whether by the judgement of the theme to the event to be obtained in consumer's acquisition request, directly judging can be from block catenary system In get the event of customer requests, improve judging efficiency.
Based on the same inventive concept, Fig. 6 illustratively shows provided in an embodiment of the present invention a kind of based on block chain The device of event publication, the device of event publication can execute the process of the method for above-mentioned event publication.
Transmit-Receive Unit 601, for receiving posting request, the posting request includes event to be released;
Processing unit 602, for the theme according to the event to be released, determination is described to be released from block catenary system The contract address of the corresponding theme contract of event;The corresponding theme contract of each theme is stored in the block catenary system;It generates First transaction request;First transaction request includes the contract address of the corresponding theme contract of the event to be released and described Event to be released;
The Transmit-Receive Unit 601 is also used to first transaction request being sent to the block catenary system;
The Transmit-Receive Unit 601 is also used to receive the first transaction results that the block catenary system returns;Described first hands over Easily the result is that the block catenary system calls the corresponding theme contract of the event to be released to issue the event to be released and life At what is sent after transaction log;Record has the event of publication in the transaction log.
Optionally, the processing unit 602 is specifically used for:
System contract is obtained from the block catenary system;The system contract includes the contract of theme and theme contract The corresponding relationship of location;
According to the theme of the event to be released, the corresponding master of the event to be released is determined from the system contract Inscribe the contract address of contract.
Optionally, the processing unit 602 is also used to:
Before the Transmit-Receive Unit 601 receives posting request, controls the Transmit-Receive Unit 601 and receive theme to be created;
The second transaction request is generated according to the theme to be created;Second transaction request is used to indicate the block chain The theme contract of theme to be created described in system deployment;
It controls the Transmit-Receive Unit 601 and second transaction request is sent to the block catenary system;
It controls the Transmit-Receive Unit 601 and receives the second transaction results that the block catenary system returns;Second transaction The result is that being sent after the corresponding theme contract of block catenary system theme to be created according to the theme deployment to be created 's;Second transaction results include the contract address of the corresponding theme contract of the theme to be created.
Optionally, the processing unit 602 is also used to:
Before the Transmit-Receive Unit 601 receives the theme to be created, the Transmit-Receive Unit 601 is controlled to the block Catenary system sends third transaction request;The third transaction request is used to indicate the block catenary system deployment system contract;
Receive the third transaction results that the block catenary system returns;The third transaction results are the block catenary systems It completes to send after the deployment of the system contract;
The processing unit 602 is also used to:
After the second transaction results that the Transmit-Receive Unit 601 receives that the block catenary system returns, the receipts are controlled Bill member 601 by the corresponding relationship of the contract address of the theme to be created and the corresponding theme contract of the theme to be created more The new extremely system contract.
Based on the same inventive concept, Fig. 7 illustratively shows provided in an embodiment of the present invention a kind of based on block chain The device of event subscription, the device of the event subscription can execute the process of the method for above-mentioned event subscription.
Transmit-Receive Unit 701, for receiving acquisition request, the acquisition request is used to indicate the Subscriber from block Event to be obtained is obtained in catenary system;The transaction log on the books for having issued event is stored in the block catenary system;The friendship Easy log is that the block catenary system calls the corresponding theme contract of event to be released to generate in the event of publication;The block The corresponding theme contract of each theme is stored in catenary system;
Processing unit 702, for judging to whether there is in the block catenary system according to the theme of the event to be obtained The corresponding theme contract of the event to be obtained;If so, obtaining the event to be obtained from the block catenary system.
Optionally, the transaction log, which also records, the event mark for having issued event;Event mark is for unique Mark each event;
The processing unit 702 is specifically used for:
It is indicated according to the event of the event to be obtained, the event place to be obtained is determined from the block catenary system Block, and the event to be obtained is obtained from the transaction log of the block where the event to be obtained.
Optionally, the event mark includes the sequence number of event and the block height of event;The sequence number of the event For the event in affiliated theme corresponding sequence number;The block height of the event is to record the area of the block of the event Block height.
Optionally, the event to be obtained is to set the newly-increased event of theme;
The processing unit 702 is specifically used for:
After there is newly-increased block in determining the block catenary system, the transaction log in the newly-increased block is obtained;
It is determined in the newly-increased block according to the setting theme with the presence or absence of the corresponding transaction log of the setting theme; If so, obtaining the event to be obtained from the transaction log of the newly-increased block.
Based on the same inventive concept, it is the embodiment of the invention also provides a kind of event distribution subscription based on block chain System, comprising:
The device and block catenary system of device, event subscription that above-mentioned event is issued.
Based on the same inventive concept, the embodiment of the invention also provides a kind of calculating equipment, comprising:
Memory, for storing program instruction;
Processor executes above-mentioned event according to the program of acquisition for calling the program instruction stored in the memory The method of publication.
Based on the same inventive concept, the embodiment of the invention also provides a kind of computer-readable non-volatile memory medium, Including computer-readable instruction, when computer is read and executes the computer-readable instruction, so that computer execution is above-mentioned The method of event publication.
Based on the same inventive concept, the embodiment of the invention also provides a kind of calculating equipment, comprising:
Memory, for storing program instruction;
Processor executes above-mentioned event according to the program of acquisition for calling the program instruction stored in the memory The method of subscription.
Based on the same inventive concept, the embodiment of the invention also provides a kind of computer-readable non-volatile memory medium, Including computer-readable instruction, when computer is read and executes the computer-readable instruction, so that computer execution is above-mentioned The method of event subscription.
Based on the same technical idea, the embodiment of the invention provides a kind of publisher servers, as shown in figure 8, including extremely Lack a processor 801, and the memory 802 connecting at least one processor, does not limit processing in the embodiment of the present invention Specific connection medium between device 801 and memory 802 passes through bus between processor 801 and memory 802 in Fig. 8 and connects For.Bus can be divided into address bus, data/address bus, control bus etc..
In embodiments of the present invention, memory 802 is stored with the instruction that can be executed by least one processor 801, at least The instruction that one processor 801 is stored by executing memory 802 can execute included in the method for event publication above-mentioned The step of.
Wherein, processor 801 is the control centre of publisher server, can use various interfaces and connection publication clothes The various pieces of business device, are stored in memory 802 by running or executing the instruction being stored in memory 802 and calling Data, to realize data processing.Optionally, processor 801 may include one or more processing units, and processor 801 can Integrated application processor and modem processor, wherein the main processing operation system of application processor, user interface and application Program etc., the instruction that the main process for producing person of modem processor issues.It is understood that above-mentioned modem processor It can not also be integrated into processor 801.In some embodiments, processor 801 and memory 802 can be on the same chip It realizes, in some embodiments, they can also be realized respectively on independent chip.
Processor 801 can be general processor, such as central processing unit (CPU), digital signal processor, dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array or other can Perhaps transistor logic, discrete hardware components may be implemented or execute present invention implementation for programmed logic device, discrete gate Each method, step and logic diagram disclosed in example.General processor can be microprocessor or any conventional processor Deng.The step of method disclosed in the embodiment of binding events publication, can be embodied directly in hardware processor and execute completion, or Hardware and software module combination in person's processor execute completion.
Memory 802 is used as a kind of non-volatile computer readable storage medium storing program for executing, can be used for storing non-volatile software journey Sequence, non-volatile computer executable program and module.Memory 802 may include the storage medium of at least one type, It such as may include flash memory, hard disk, multimedia card, card-type memory, random access storage device (Random Access Memory, RAM), static random-access memory (Static Random Access Memory, SRAM), may be programmed read-only deposit Reservoir (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), band Electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic storage, disk, CD etc..Memory 802 can be used for carrying or storing have instruction or data The desired program code of structure type and can by any other medium of computer access, but not limited to this.The present invention is real Applying the memory 802 in example can also be circuit or other devices that arbitrarily can be realized store function, for storing program Instruction and/or data.
Based on the same technical idea, the embodiment of the invention provides a kind of Subscribers, as shown in figure 9, including extremely Lack a processor 901, and the memory 902 connecting at least one processor, does not limit processing in the embodiment of the present invention Specific connection medium between device 901 and memory 902 passes through bus between processor 901 and memory 902 in Fig. 9 and connects For.Bus can be divided into address bus, data/address bus, control bus etc..
In embodiments of the present invention, memory 902 is stored with the instruction that can be executed by least one processor 901, at least The instruction that one processor 901 is stored by executing memory 902 can execute included in the method for event subscription above-mentioned The step of.
Wherein, processor 901 is the control centre of Subscriber, can use various interfaces and connection subscribes to clothes The various pieces of business device, are stored in memory 902 by running or executing the instruction being stored in memory 902 and calling Data, to realize data processing.Optionally, processor 901 may include one or more processing units, and processor 901 can Integrated application processor and modem processor, wherein the main processing operation system of application processor, application program etc. are adjusted Demodulation processor processed mainly handles the instruction of consumer's transmission.It is understood that above-mentioned modem processor can not also It is integrated into processor 901.In some embodiments, processor 901 and memory 902 can be realized on the same chip, In some embodiments, they can also be realized respectively on independent chip.
Processor 901 can be general processor, such as central processing unit (CPU), digital signal processor, dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array or other can Perhaps transistor logic, discrete hardware components may be implemented or execute present invention implementation for programmed logic device, discrete gate Each method, step and logic diagram disclosed in example.General processor can be microprocessor or any conventional processor Deng.The step of method disclosed in the embodiment that binding events are subscribed to, can be embodied directly in hardware processor and execute completion, or Hardware and software module combination in person's processor execute completion.
Memory 902 is used as a kind of non-volatile computer readable storage medium storing program for executing, can be used for storing non-volatile software journey Sequence, non-volatile computer executable program and module.Memory 902 may include the storage medium of at least one type, It such as may include flash memory, hard disk, multimedia card, card-type memory, random access storage device (Random Access Memory, RAM), static random-access memory (Static Random Access Memory, SRAM), may be programmed read-only deposit Reservoir (Programmable Read Only Memory, PROM), read-only memory (Read Only Memory, ROM), band Electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), magnetic storage, disk, CD etc..Memory 902 can be used for carrying or storing have instruction or data The desired program code of structure type and can by any other medium of computer access, but not limited to this.The present invention is real Applying the memory 902 in example can also be circuit or other devices that arbitrarily can be realized store function, for storing program Instruction and/or data.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (18)

1. a kind of method of the event publication based on block chain characterized by comprising
Publisher server receives posting request, and the posting request includes event to be released;
The publisher server determines the event pair to be released according to the theme of the event to be released from block catenary system The contract address for the theme contract answered;The corresponding theme contract of each theme is stored in the block catenary system;
The publisher server generates the first transaction request;First transaction request includes the corresponding master of the event to be released The contract address of topic contract and the event to be released;
First transaction request is sent to the block catenary system by the publisher server;
The publisher server receives the first transaction results that the block catenary system returns;First transaction results are described After block catenary system calls the corresponding theme contract of the event to be released to issue the event to be released and generate transaction log It sends;Record has the event of publication in the transaction log.
2. the method as described in claim 1, which is characterized in that the publisher server is according to the master of the event to be released Topic determines the contract address of the corresponding theme contract of the event to be released from block catenary system, comprising:
The publisher server obtains system contract from the block catenary system;The system contract includes that theme and theme close The corresponding relationship of contract address about;
The publisher server determines the thing to be released according to the theme of the event to be released from the system contract The contract address of the corresponding theme contract of part.
3. method according to claim 1 or 2, which is characterized in that before the publisher server receives posting request, also Include:
The publisher server receives theme to be created;
The publisher server generates the second transaction request according to the theme to be created;Second transaction request is used to indicate The block catenary system disposes the theme contract of the theme to be created;
Second transaction request is sent to the block catenary system by the publisher server;
The publisher server receives the second transaction results that the block catenary system returns;Second transaction results are described It is sent after the corresponding theme contract of block catenary system theme to be created according to the theme deployment to be created;Described second Transaction results include the contract address of the corresponding theme contract of the theme to be created.
4. method as claimed in claim 3, which is characterized in that the publisher server receive the theme to be created it Before, further includes:
The publisher server sends third transaction request to the block catenary system;The third transaction request is used to indicate institute State block catenary system deployment system contract;
The publisher server receives the third transaction results that the block catenary system returns;The third transaction results are described What block catenary system was completed to send after the deployment of the system contract;
After the second transaction results that the publisher server receives that the block catenary system returns, further includes:
The publisher server is by the contract address of the theme to be created and the corresponding theme contract of the theme to be created Corresponding relationship is updated to the system contract.
5. a kind of method of the event subscription based on block chain characterized by comprising
Subscriber receives acquisition request, and the acquisition request is used to indicate the Subscriber and obtains from block catenary system Take event to be obtained;The transaction log on the books for having issued event is stored in the block catenary system;The transaction log is institute State block catenary system calls the corresponding theme contract of event to be released to generate in the event of publication;It is deposited in the block catenary system Contain the corresponding theme contract of each theme;
The subscription service judges in the block catenary system with the presence or absence of described according to the theme of the event to be obtained wait obtain Take the corresponding theme contract of event;If so, obtaining the event to be obtained from the block catenary system.
6. method as claimed in claim 5, which is characterized in that the transaction log, which also records, the thing for having issued event Part mark;Event mark is used for each event of uniquely tagged;
The Subscriber obtains the event to be obtained from the block catenary system, comprising:
The Subscriber is indicated according to the event of the event to be obtained, is determined from the block catenary system described wait obtain The block where event is taken, and obtains the event to be obtained from the transaction log of the block where the event to be obtained.
7. method as claimed in claim 6, which is characterized in that the event mark includes the sequence number of event and the area of event Block height;The corresponding sequence number in affiliated theme of event described in the Serial No. of the event;The block height of the event For record the event block block height.
8. method as claimed in claim 5, which is characterized in that the event to be obtained is to set the newly-increased event of theme;
The Subscriber obtains the event to be obtained from the block catenary system, comprising:
After the Subscriber has newly-increased block in determining the block catenary system, the friendship in the newly-increased block is obtained Easy log;
The Subscriber determines corresponding with the presence or absence of the setting theme in the newly-increased block according to the setting theme Transaction log;If so, obtaining the event to be obtained from the transaction log of the newly-increased block.
9. a kind of device of the event publication based on block chain characterized by comprising
Transmit-Receive Unit, for receiving posting request, the posting request includes event to be released;
Processing unit determines the event pair to be released for the theme according to the event to be released from block catenary system The contract address for the theme contract answered;The corresponding theme contract of each theme is stored in the block catenary system;First is generated to hand over Easily request;First transaction request includes the contract address of the corresponding theme contract of the event to be released and described to be released Event;
The Transmit-Receive Unit is also used to first transaction request being sent to the block catenary system;
The Transmit-Receive Unit is also used to receive the first transaction results that the block catenary system returns;First transaction results It is that the block catenary system calls the corresponding theme contract of the event to be released to issue the event to be released and generate transaction It is sent after log;Record has the event of publication in the transaction log.
10. device as claimed in claim 9, which is characterized in that the processing unit is specifically used for:
System contract is obtained from the block catenary system;The system contract includes the contract address of theme and theme contract Corresponding relationship;
According to the theme of the event to be released, determine that the corresponding theme of the event to be released is closed from the system contract Contract address about.
11. the device as described in claim 9 or 10, which is characterized in that the processing unit is also used to:
Before the Transmit-Receive Unit receives posting request, controls the Transmit-Receive Unit and receive theme to be created;
The second transaction request is generated according to the theme to be created;Second transaction request is used to indicate the block catenary system Dispose the theme contract of the theme to be created;
It controls the Transmit-Receive Unit and second transaction request is sent to the block catenary system;
It controls the Transmit-Receive Unit and receives the second transaction results that the block catenary system returns;Second transaction results are institutes It states and sends after the corresponding theme contract of block catenary system theme to be created according to the theme deployment to be created;Described Two transaction results include the contract address of the corresponding theme contract of the theme to be created.
12. device as claimed in claim 11, which is characterized in that the processing unit is also used to:
Before the Transmit-Receive Unit receives the theme to be created, controls the Transmit-Receive Unit and sent to the block catenary system Third transaction request;The third transaction request is used to indicate the block catenary system deployment system contract;
Receive the third transaction results that the block catenary system returns;The third transaction results are that the block catenary system is completed It is sent after the deployment of the system contract;
The processing unit is also used to:
After the second transaction results that the Transmit-Receive Unit receives that the block catenary system returns, controlling the Transmit-Receive Unit will The corresponding relationship of the contract address of the theme to be created and the corresponding theme contract of the theme to be created is updated to the system Integration is about.
13. a kind of device of the event subscription based on block chain characterized by comprising
Transmit-Receive Unit, for receiving acquisition request, the acquisition request is used to indicate the Subscriber from block catenary system It is middle to obtain event to be obtained;The transaction log on the books for having issued event is stored in the block catenary system;The transaction log It is that the block catenary system calls the corresponding theme contract of event to be released to generate in the event of publication;The block catenary system In be stored with the corresponding theme contract of each theme;
Processing unit, for being judged in the block catenary system with the presence or absence of described according to the theme of the event to be obtained wait obtain Take the corresponding theme contract of event;If so, obtaining the event to be obtained from the block catenary system.
14. device as claimed in claim 13, which is characterized in that the transaction log, which also records to have, described has issued event Event mark;Event mark is used for each event of uniquely tagged;
The processing unit is specifically used for:
It is indicated according to the event of the event to be obtained, the area where determining the event to be obtained in the block catenary system Block, and the event to be obtained is obtained from the transaction log of the block where the event to be obtained.
15. device as claimed in claim 13, which is characterized in that the event to be obtained is to set the newly-increased event of theme;
The processing unit is specifically used for:
After there is newly-increased block in determining the block catenary system, the transaction log in the newly-increased block is obtained;
It is determined in the newly-increased block according to the setting theme with the presence or absence of the corresponding transaction log of the setting theme;If It is that the event to be obtained is then obtained from the transaction log of the newly-increased block.
16. a kind of system of the event distribution subscription based on block chain characterized by comprising
Device, the described in any item things of such as claim 13 to 15 such as the described in any item events publications of claim 9 to 12 The device and block catenary system that part is subscribed to.
17. a kind of calculating equipment characterized by comprising
Memory, for storing program instruction;
Processor requires 1 to 8 according to the program execution benefit of acquisition for calling the program instruction stored in the memory Described in any item methods.
18. a kind of computer-readable non-volatile memory medium, which is characterized in that including computer-readable instruction, work as computer When reading and executing the computer-readable instruction, so that computer executes method as claimed in any one of claims 1 to 8.
CN201910292876.0A 2019-04-12 2019-04-12 It is a kind of based on block chain event publication, event subscription method and device Pending CN110097363A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910292876.0A CN110097363A (en) 2019-04-12 2019-04-12 It is a kind of based on block chain event publication, event subscription method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910292876.0A CN110097363A (en) 2019-04-12 2019-04-12 It is a kind of based on block chain event publication, event subscription method and device

Publications (1)

Publication Number Publication Date
CN110097363A true CN110097363A (en) 2019-08-06

Family

ID=67444740

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910292876.0A Pending CN110097363A (en) 2019-04-12 2019-04-12 It is a kind of based on block chain event publication, event subscription method and device

Country Status (1)

Country Link
CN (1) CN110097363A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110633309A (en) * 2019-08-30 2019-12-31 阿里巴巴集团控股有限公司 Block chain transaction processing method and device
CN110704438A (en) * 2019-09-26 2020-01-17 深圳前海微众银行股份有限公司 Method and device for generating bloom filter in block chain
WO2020215925A1 (en) * 2019-04-22 2020-10-29 深圳前海微众银行股份有限公司 Event subscription method and apparatus based on blockchain
US10936581B2 (en) 2019-08-30 2021-03-02 Advanced New Technologies Co., Ltd. Blockchain transaction processing method and apparatus
CN112671878A (en) * 2020-12-17 2021-04-16 杭州趣链科技有限公司 Block chain information subscription method, device, server and storage medium
CN115987697A (en) * 2023-03-21 2023-04-18 安徽省大数据中心 Multi-level information data sharing method and system based on event subscription mechanism

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160260095A1 (en) * 2015-03-02 2016-09-08 Dell Products, Lp Containerized Computational Task Execution Management Using a Secure Distributed Transaction Ledger
CN107943951A (en) * 2017-11-24 2018-04-20 中钞信用卡产业发展有限公司杭州区块链技术研究院 A kind of search method and system of block chain business information
CN108282529A (en) * 2018-01-23 2018-07-13 百度在线网络技术(北京)有限公司 Publication and system, the method and apparatus for subscribing to data
CN108932189A (en) * 2018-06-30 2018-12-04 平安科技(深圳)有限公司 The method and apparatus for saving server log
CN108985757A (en) * 2017-11-27 2018-12-11 北京京东金融科技控股有限公司 Information processing method, apparatus and system, storage medium, electronic equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160260095A1 (en) * 2015-03-02 2016-09-08 Dell Products, Lp Containerized Computational Task Execution Management Using a Secure Distributed Transaction Ledger
CN107943951A (en) * 2017-11-24 2018-04-20 中钞信用卡产业发展有限公司杭州区块链技术研究院 A kind of search method and system of block chain business information
CN108985757A (en) * 2017-11-27 2018-12-11 北京京东金融科技控股有限公司 Information processing method, apparatus and system, storage medium, electronic equipment
CN108282529A (en) * 2018-01-23 2018-07-13 百度在线网络技术(北京)有限公司 Publication and system, the method and apparatus for subscribing to data
CN108932189A (en) * 2018-06-30 2018-12-04 平安科技(深圳)有限公司 The method and apparatus for saving server log

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李莉、周斯琴等: "基于区块链的数字版权交易系统", 《网络与信息安全学报》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020215925A1 (en) * 2019-04-22 2020-10-29 深圳前海微众银行股份有限公司 Event subscription method and apparatus based on blockchain
CN110633309A (en) * 2019-08-30 2019-12-31 阿里巴巴集团控股有限公司 Block chain transaction processing method and device
US10936581B2 (en) 2019-08-30 2021-03-02 Advanced New Technologies Co., Ltd. Blockchain transaction processing method and apparatus
CN110704438A (en) * 2019-09-26 2020-01-17 深圳前海微众银行股份有限公司 Method and device for generating bloom filter in block chain
CN110704438B (en) * 2019-09-26 2023-10-03 深圳前海微众银行股份有限公司 Method and device for generating bloom filter in blockchain
CN112671878A (en) * 2020-12-17 2021-04-16 杭州趣链科技有限公司 Block chain information subscription method, device, server and storage medium
CN115987697A (en) * 2023-03-21 2023-04-18 安徽省大数据中心 Multi-level information data sharing method and system based on event subscription mechanism

Similar Documents

Publication Publication Date Title
CN110097363A (en) It is a kind of based on block chain event publication, event subscription method and device
US7647258B2 (en) Determining taxes by applying tax rules specified using configurable templates
JP2023184749A (en) Method of distributing block chain-registered digital asset, and autonomous computation agent
US7693760B1 (en) Method and apparatus for providing a tax service that is configurable for local jurisdictions
CN110020542B (en) Data reading and writing method and device and electronic equipment
TW202008196A (en) Transaction method and system based on centralized settlement and block chain deposit certification
CN111476667B (en) Block chain-based original work transaction method and device and electronic equipment
CN110032598B (en) Method and device for updating field and electronic equipment
TW202008235A (en) Transaction method and system based on centralized settlement and block chain storage
CN110083629B (en) Event subscription method and device based on blockchain
CN108683562A (en) Abnormality detection localization method, device, computer equipment and storage medium
WO2014063127A1 (en) Method and system for creating tax configuration templates
AU2003249184A1 (en) Apparatus and method configurable for local jurisdictions that facilitates determining taxes
US20090013085A1 (en) Interaction-management methods and platform for client-agent interaction-related environments
CN110278264B (en) Block chain-based cross-link communication method and device and transaction system
CN110442341A (en) Interface configuration method, device and the terminal device of application program
CN110458556A (en) A kind of fund checking method, device, computer equipment and system architecture
CN109086433A (en) A kind of file management method and server based on big data analysis
CN111694681A (en) Batch service processing method and device, electronic equipment and computer storage medium
CN107798459A (en) Parameter values computational methods, device, storage medium and computer equipment
CN106570005A (en) Database cleaning method and device
CN107980147B (en) Tracking data flows in a distributed computing system
CN110473031A (en) Processing method, system, electronic equipment and the storage medium of invoice data
CN114548963B (en) Payment interaction processing method and device
CN115439253A (en) Data management method and device for transaction account, electronic equipment and storage medium

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190806