CN111866166B - Chat method, apparatus and storage medium - Google Patents

Chat method, apparatus and storage medium Download PDF

Info

Publication number
CN111866166B
CN111866166B CN202010748218.0A CN202010748218A CN111866166B CN 111866166 B CN111866166 B CN 111866166B CN 202010748218 A CN202010748218 A CN 202010748218A CN 111866166 B CN111866166 B CN 111866166B
Authority
CN
China
Prior art keywords
user
transaction
chat
information
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010748218.0A
Other languages
Chinese (zh)
Other versions
CN111866166A (en
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.)
Nanjing Benchain Information Technology Co ltd
Hangzhou Fuzamei Technology Co Ltd
Original Assignee
Nanjing Benchain Information Technology Co ltd
Hangzhou Fuzamei Technology 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 Nanjing Benchain Information Technology Co ltd, Hangzhou Fuzamei Technology Co Ltd filed Critical Nanjing Benchain Information Technology Co ltd
Priority to CN202010748218.0A priority Critical patent/CN111866166B/en
Publication of CN111866166A publication Critical patent/CN111866166A/en
Application granted granted Critical
Publication of CN111866166B publication Critical patent/CN111866166B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/55Push-based network services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Finance (AREA)
  • Computing Systems (AREA)
  • Computational Linguistics (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a chatting method, a device and a storage medium, wherein the method comprises the following steps: receiving a first chat transaction generated by a second user terminal of a second user; and inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction: if yes, when a third user registers chat transaction push service at the current node, updating second prepaid information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and pushing the first chat transaction to a user side of the third user; and when the third user does not register chat transaction push service in the current node, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points. The method and the device ensure the safety of the block chain chat.

Description

Chat method, apparatus and storage medium
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a chat method, device, and storage medium.
Background
In the existing block chain chat scheme, data is very abundant, the chat content can be acquired only after the data is blocked, and the chat content can be stored on a block chain, so that a hacker can acquire the chat content through replay transaction; and the chat transaction quantity is large, thus easily causing network storm.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it is desirable to provide a chat method, apparatus and storage medium with improved security.
In a first aspect, the present invention provides a chat method applicable to a block chain node, where a user side of a user registers a chat transaction push service to the block chain node, and the method includes:
receiving a first service fee pre-storage transaction generated by a first user side of a first user, deducting a first number of first assets pre-stored in the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first number of first assets, recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain, and updating the first prepaid information of the first user in a local under-chain database;
receiving a first chat transaction generated by a second user terminal of a second user; the first transaction is generated by the second user end responding to the second user and sending chat information to the third user;
and inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, judging whether a third user registers chat transaction push service at the current node:
if yes, updating second prepayment information of the second user in a local down-link database according to a pre-configured service fee deduction rule, and pushing the first chat transaction to a user side of a third user;
if not, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
otherwise, the first chat transaction is discarded.
In a second aspect, the present invention provides a chat method applicable to a user side, where the user side registers chat transaction push service to a block link point, and the method includes:
responding to the service fee prestored by the current user, generating a first service fee prestored transaction and sending the first service fee prestored transaction to a first block chain node so that the first service fee prestored transaction can be deducted by the block chain node from a first quantity of first assets prestored by the first service fee prestored transaction, determining corresponding first prepaid information according to the first quantity of first assets, recording the corresponding relation between the first address of the current user and the first prepaid information on the block chain, and updating the first prepaid information of the current user in a local under-chain database;
responding to the chat information sent by the current user to the second user, generating a first chat transaction and sending the first chat transaction to the first block chain node, so that the block chain node:
querying a local down-link database for first prepaid information based on the first chat transaction for sufficient service fees for the first chat transaction:
if yes, judging whether the second user has the registered information of the chat transaction push service registered by the second user:
if yes, updating the first prepayment information in a local down-link database according to the preconfigured service fee deduction rule, and pushing the first chat transaction to the user side of the second user;
if not, updating the first prepayment information in the local under-link database according to the pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
otherwise, the first chat transaction is discarded.
In a third aspect, the present invention provides a chat method applicable to a block chain node, where a user side of a user registers a chat transaction push service to the block chain node, and the method includes:
receiving a first service fee pre-storage transaction generated by a first user side of a first user, deducting a first number of first assets pre-stored by the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first number of first assets, and recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain;
judging whether the first user registers the chat transaction push service at the current node:
if yes, updating the first prepayment information of the first user in a local down-link database according to the corresponding relation;
receiving a first chat transaction generated by a second user terminal of a second user; the first transaction is generated by the second user end in response to the second user sending chat information to the third user;
determining whether the first chat transaction is received by the rpc port:
if yes, inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, judging whether a third user registers chat transaction push service at the current node:
if yes, updating second prepaid information of the second user in a local down-link database according to a pre-configured service fee deduction rule, and pushing the first chat transaction to a user side of a third user;
if not, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
if not, discarding the first chat transaction;
if not, judging whether a third user registers the chat transaction push service at the current node:
if yes, pushing the first chat transaction to the user side of the third user;
otherwise, the first chat transaction is broadcast to the connected block link points.
In a fourth aspect, the present invention provides a chat method applicable to a blockchain node, where the method includes:
receiving a first service fee pre-storage transaction generated by a first user side of a first user, deducting a first quantity of first assets pre-stored by the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first quantity of first assets, recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain, and updating the first prepaid information of the first user in a local under-chain database;
receiving a first chat transaction sent by a second user terminal of a second user; the first transaction is generated by the second user end in response to the second user sending chat information to the third user;
and inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, determining a first block chain node for pushing the first chat transaction to a user side of a third user according to the first chat transaction and a pre-configured transaction pushing node determination rule; and the number of the first and second groups,
updating second prepaid information of the second user in a local down-link database according to a preconfigured service fee deduction rule, and sending the first chat transaction to the first block link node, so that the second prepaid information of the second user is updated in the local down-link database according to the preconfigured service fee deduction rule, and the first chat transaction is pushed to a user side of a third user;
otherwise, the first chat transaction is discarded.
In a fifth aspect, the present invention also provides an apparatus comprising one or more processors and memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform a chat method provided in accordance with embodiments of the present invention.
In a sixth aspect, the present invention further provides a storage medium storing a computer program, the computer program causing a computer to execute the chat method provided in accordance with the embodiments of the present invention.
The chatting method, the device and the storage medium provided by the embodiments of the invention receive a first chatting transaction generated by a second user terminal of a second user; and inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction: if so, when the third user registers chat transaction push service at the current node, updating second prepaid information of the second user in a local under-link database according to a preconfigured service fee deduction rule, and pushing the first chat transaction to a user side of the third user; and when the third user does not register chat transaction push service at the current node, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block chain link points, thereby ensuring the security of block chain chat.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
fig. 1 is a flowchart of a chat method according to an embodiment of the present invention.
Fig. 2 is a flowchart of another chat method according to an embodiment of the present invention.
Fig. 3 is a flowchart of another chat method according to an embodiment of the present invention.
Fig. 4 is a flowchart of another chat method according to an embodiment of the present invention.
Fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not to be construed as limiting the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a chat method according to an embodiment of the present invention. As shown in fig. 1, in this embodiment, the present invention provides a chat method applicable to a blockchain node, where a user terminal of a user registers a chat transaction push service to the blockchain node, where the method includes:
s12: receiving a first service fee pre-storage transaction generated by a first user side of a first user, deducting a first quantity of first assets pre-stored by the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first quantity of first assets, recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain, and updating the first prepaid information of the first user in a local under-chain database;
s14: receiving a first chat transaction generated by a second user terminal of a second user; the first transaction is generated by the second user end in response to the second user sending chat information to the third user;
s161: and inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, go to step S1621: judging whether a third user registers chat transaction push service at the current node:
if yes, go to step S1622: updating second prepaid information of the second user in a local down-link database according to a preconfigured service fee deduction rule, and pushing the first chat transaction to a user side of a third user;
otherwise, step S1623 is executed: updating second prepaid information of a second user in a local downlink database according to a preconfigured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
otherwise, step S163 is executed: the first chat transaction is discarded.
Specifically, for example, when prepaid information is used as the number of times of service, 1mmm =10 times of service, and a preconfigured service fee deduction rule is used for deducting 1 time of service each time, it is assumed that a user side of a user a registers a chat transaction push service on a node a, a user side of a user B registers a chat transaction push service on a node B, the user side of the user a establishes a long connection with the node a, and the user side of the user B establishes a long connection with the node B; user A sends chat transaction tx1 (msg 1) to user B;
the user A wants to use the chat service on the block chain, the user A wants to pre-store 10MMM service fee, and the user side of the user A generates a service fee pre-storage transaction and sends the transaction to the block chain node;
the block chain node performs step S12: deducting 10MMM prestored in the service fee prestoring exchange of the user A, determining corresponding prepaid information (namely 100 times of service) according to the 10MMM, recording the corresponding relation between the address addr (A) of the user A and the prepaid information on the block chain, and updating the prepaid information (A, 100) of the user A in a local under-chain database;
step S14 is executed, and tx1 (msg 1) generated by the user side of the user A is received;
step S161 is executed, and according to tx1 (msg 1), whether the corresponding prepaid information is sufficient to pay the service fee of tx1 (msg 1) is queried in the local chain database:
since the prepaid information of the user a is (a, 100) at this time and sufficient payment is made, step S1621 is executed:
judging whether the user B registers chat transaction push service in the user A:
otherwise, a executes step S1623: updating the prepaid information (A, 99) of the user A in a local downlink database, and broadcasting tx1 (msg 1) to the connected block link points;
assuming the connected block link point to be node B;
step S161 is executed, and according to tx1 (msg 1), whether the corresponding prepaid information is sufficient to pay the service fee of tx1 (msg 1) is queried in the local chain database:
since the prepaid information of the user a is (a, 100) at this time and sufficient payment is made, step S1621 is executed:
judging whether the user B registers the chat transaction push service in the user B:
if yes, step S1622 is executed by B: the prepaid information (a, 99) of subscriber a is updated in the local down-link database and tx1 (msg 1) is pushed to the subscriber side of subscriber b.
Because the user end of the user A establishes long connection with the node A, but the path information of the nodes in the block chain is uncertain, the prepayment information of the user A in the node A is 0 at first;
when the prepaid information (a, 0) of the user a is received, if a receives the chat transaction sent by the user side of the user a again, the step S163 is executed: the received chat transaction is discarded.
In the above embodiment, the prepaid information is used as the service times, 1mmm =10 services, and the preconfigured service fee deduction rule is to deduct 1 service each time, assuming that the user side of the user a registers the chat transaction push service on the node a, the user side of the user B registers the chat transaction push service on the node B, the user side of the user a establishes a long connection with the node a, and the user side of the user B establishes a long connection with the node B; the chat principle of the application is exemplarily explained by taking the example that the user A sends the chat transaction to the user B;
in further embodiments, the prepaid information may also be configured according to actual requirements, for example, configured to 2mmm =10 services, and the same technical effect may be achieved. Correspondingly, the preconfigured service fee deduction rule may also be configured according to actual requirements, for example, configured to deduct 2 times of service each time, and the same technical effect may be achieved.
The embodiment ensures the security of chatting.
Preferably, after step S1622, the method further includes:
updating the times of service provision of the current node;
after step S1623, the method further includes:
and updating the number of times that the current node provides the service.
Preferably, the method according to a preferred embodiment of the method shown in fig. 1 further comprises:
when the current node is a main node of a block chain, monitoring the times of providing service for each block chain link point;
and when the current time is a pre-configured time, awards are issued to the block chain links providing services according to the number of times of providing services of the block chain links.
In more embodiments, the mode of issuing the rewards may also be configured according to actual requirements, for example, the master node does not need to count the number of times that each block link point provides services, and directly issues the same number of rewards to each block link point providing services, so as to achieve the same technical effect.
Fig. 2 is a flowchart of another chat method according to an embodiment of the present invention. As shown in fig. 2, in this embodiment, the present invention provides a chat method applicable to a user side, where the user side registers chat transaction push service to a block link point, and the method includes:
s22: responding to the service fee prestored by the current user, generating a first service fee prestored transaction and sending the first service fee prestored transaction to a first block chain node, so that the first service fee prestored transaction is deducted by the block chain node for a first quantity of first assets prestored, determining corresponding first prepaid information according to the first quantity of first assets, recording the corresponding relation between the first address of the current user and the first prepaid information on the block chain, and updating the first prepaid information of the current user in a local under-chain database;
s24: responding to the chat information sent by the current user to the second user, generating a first chat transaction and sending the first chat transaction to the first block chain node, so that the block chain node:
querying a local under-link database for first prepaid information based on the first chat transaction for sufficient service fees for the first chat transaction:
if yes, judging whether the second user has the registered information of the chat transaction push service registered by the second user:
if yes, updating the first prepayment information in a local down-link database according to the preconfigured service fee deduction rule, and pushing the first chat transaction to the user side of the second user;
if not, updating the first prepayment information in the local under-link database according to the pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
otherwise, the first chat transaction is discarded.
The chat principle of the above embodiment can refer to the method shown in fig. 1, and is not described herein again.
Fig. 3 is a flowchart of another chat method according to an embodiment of the present invention. As shown in fig. 3, in this embodiment, the present invention provides a chat method applicable to a blockchain node, where a user terminal of a user registers a chat transaction push service to the blockchain node, where the method includes:
s32: receiving a first service fee pre-storage transaction generated by a first user side of a first user, deducting a first number of first assets pre-stored in the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first number of first assets, and recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain;
s341: judging whether the first user registers the chat transaction push service at the current node:
if yes, go to step S342: updating the first prepayment information of the first user in a local downlink database according to the corresponding relation;
s36: receiving a first chat transaction generated by a second user terminal of a second user; the first transaction is generated by the second user end in response to the second user sending chat information to the third user;
s381: determining whether the first chat transaction was received by rpc service:
if yes, go to step S3821: and inquiring whether the corresponding second prepaid information is sufficient to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, go to step S38221: judging whether a third user registers chat transaction push service at the current node:
if yes, go to step S38222: updating second prepaid information of the second user in a local down-link database according to a preconfigured service fee deduction rule, and pushing the first chat transaction to a user side of a third user;
otherwise, go to step S38223: updating second prepaid information of a second user in a local downlink database according to a preconfigured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
otherwise, step S3823 is executed: discarding the first chat transaction;
otherwise, step S3831 is executed: judging whether a third user registers chat transaction push service at the current node:
if yes, go to step S3832: pushing the first chat transaction to a user side of a third user;
otherwise, step S3833 is executed: the first chat transaction is broadcast to the connected tile link points.
It should be noted that the block link point may receive a transaction through rpc service or p2p service, the transaction received through rpc service is directly sent by the client, and the rpc service is configured with an interface that sends the transaction of the client to the memport module; the transaction received through the p2p service is sent to a certain block chain node by the client, and then received after being broadcasted by the block chain node, and the p2p service is provided with a port for broadcasting the transaction in the memo to other nodes.
Fig. 3 differs from the embodiment shown in fig. 1 in that in the embodiment shown in fig. 3 only the local downlink database of node a records and updates the prepaid information of user a.
Fig. 4 is a flowchart of another chat method according to an embodiment of the present invention. As shown in fig. 4, in this embodiment, the present invention provides a chat method applicable to a blockchain node, where the method includes:
s42: receiving a first service fee pre-storage transaction generated by a first user side of a first user, deducting a first quantity of first assets pre-stored by the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first quantity of first assets, recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain, and updating the first prepaid information of the first user in a local under-chain database;
s44: receiving a first chat transaction sent by a second user terminal of a second user; the first transaction is generated by the second user end in response to the second user sending chat information to the third user;
s461: and inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, go to step S462: determining a first block chain node for pushing the first chat transaction to a user side of a third user according to the first chat transaction and a pre-configured transaction pushing node determination rule; and the number of the first and second groups,
s463: updating second prepaid information of the second user in a local down-link database according to a preconfigured service fee deduction rule, and sending the first chat transaction to the first block link node, so that the second prepaid information of the second user is updated in the local down-link database according to the preconfigured service fee deduction rule, and the first chat transaction is pushed to a user side of a third user;
otherwise, step S464 is executed: the first chat transaction is discarded.
Specifically, by taking prepaid information as the number of times of service, 1mmm =10 times of service, a preconfigured service fee deduction rule is to deduct 1 time of service for each time, a preconfigured transaction push node determination rule is to compare a transaction hash of a chat transaction with node ids of link points of each block, and a node with the smallest logical distance is found to be a block link node of a push chat transaction as an example, assuming that a user side of a user a establishes long connection with a node a, and a user side of a user B establishes long connection with a node B; user A sends chat transaction tx2 (msg 2) to user B;
the block chain node performs step S42: deducting 10MMM prestored in the service fee prestoring exchange of the user A, determining corresponding prepaid information (namely 100 times of service) according to the 10MMM, recording the corresponding relation between the address addr (A) of the user A and the prepaid information on the block chain, and updating the prepaid information (A, 100) of the user A in a local under-chain database;
step S44 is executed by A, tx2 (msg 2) sent by the user side of the user A is received;
step S461 is executed, and according to tx2 (msg 2), the corresponding prepaid information is queried in the local downlink database to determine whether it is sufficient to pay the service fee of tx2 (msg 2):
if yes, go to step S462: comparing a transaction hash (tx 2) of tx2 (msg 2) with the node ids of all the block chain nodes, and determining a first block chain node for pushing tx2 (msg 2) to the user end of the user B (assuming that the logical distance between the node id of the node C and the hash (tx 2) is minimum, the determined first block chain link point is the node C); and the number of the first and second groups,
step S463, updating the prepayment information (A, 99) of the user A in a local downlink database, and sending tx2 (msg 2) to the node C;
and the node C updates the prepayment information (A, 99) of the user A in a local downlink database, and pushes tx2 (msg 2) to the user side of the user B.
Because the user end of the user A establishes long connection with the node A, but the path information of the nodes in the block chain is uncertain, the prepayment information of the user A in the node A is 0 at first;
when the prepaid information (a, 0) of the user a is received, if a receives the chat transaction sent by the user side of the user a again, the step S464 is executed: the received chat transaction is discarded.
In the above embodiment, prepaid information is used as the number of times of service, 1mmm =10 times of service, a preconfigured service fee deduction rule is to deduct 1 time of service for each time, a preconfigured transaction push node determination rule is to find a node with the smallest logical distance as a block link point of a push chat transaction according to a comparison between a transaction hash of the chat transaction and a node id of each block link point, and it is assumed that a user side of a user a establishes a long connection with a node a and a user side of a user B establishes a long connection with a node B; the chat principle of the embodiment is exemplarily illustrated by the user a sending the chat transaction tx2 (msg 2) to the user b.
In further embodiments, the prepaid information may also be configured according to actual requirements, for example, configured to 2mmm =10 services, and the same technical effect may be achieved. Correspondingly, the preconfigured service fee deduction rule may also be configured according to actual requirements, for example, configured to deduct 2 times of service each time, and the same technical effect may be achieved.
In further embodiments, the preconfigured transaction push node determination rule may also be configured according to actual requirements, for example, configured to determine the node of the node id corresponding to the remainder as the block link point of the push chat transaction according to the transaction hash of the chat transaction and the total number of the block link points, so as to achieve the same technical effect.
The methods described in the preferred embodiments of the method shown in fig. 1 are equally applicable to the methods shown in fig. 2-4.
Fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention. As shown in fig. 5, as another aspect, the present application also provides an apparatus 500 including one or more Central Processing Units (CPUs) 501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the apparatus 500 are also stored. The CPU501, ROM502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output portion 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted on the storage section 508 as necessary.
In particular, according to an embodiment of the present disclosure, the method described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing any of the methods described above. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511.
As still another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present application.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (8)

1. A chat method is applicable to a blockchain node, and a user side of a user registers chat transaction push service to the blockchain node, and the method comprises the following steps:
receiving a first service fee pre-storage transaction generated by a first user end of a first user, deducting a first quantity of first assets pre-stored in the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first quantity of first assets, recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain, and updating the first prepaid information of the first user in a local under-chain database;
receiving a first chat transaction generated by a second user terminal of a second user; wherein the first chat transaction is generated by the second user in response to the second user sending chat information to a third user;
inquiring whether the corresponding second prepayment information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
and if the third user is enough to pay, judging whether the third user registers the chat transaction push service at the current node:
if the second user is registered, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and pushing the first chat transaction to a user side of the third user;
if the second user is not registered, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
and if not sufficient, discarding the first chat transaction.
2. The method of claim 1, wherein after pushing the first chat transaction to the user side of the third user, further comprising:
updating the number of times of service provided by the current node;
after broadcasting the first chat transaction to the connected tile link points, the method further includes:
and updating the number of times that the current node provides the service.
3. The method of claim 2, further comprising:
when the current node is a main node of a block chain, monitoring the times of providing services for each block chain node;
and when the current time is a pre-configured time, issuing rewards to each block chain node providing services according to the service providing times of each block chain node.
4. A chat method is applicable to a user side, and the user side of a user registers chat transaction push service to a block link point, and the method comprises the following steps:
responding to the service fee prestored by the current user, generating a first service fee prestored transaction and sending the transaction to a first block chain node, so that the first service fee prestored transaction is deducted by the block chain node for a first quantity of first assets prestored, determining corresponding first prepaid information according to the first quantity of first assets, recording the corresponding relation between the first address of the current user and the first prepaid information on a block chain, and updating the first prepaid information of the current user in a local under-chain database;
responding to the chat information sent by the current user to the second user, generating a first chat transaction and sending the first chat transaction to the first block chain node, so that the block chain node:
querying a local down-link database for the first prepaid information based on the first chat transaction if the first prepaid information is sufficient to pay a service fee for the first chat transaction:
if the payment is enough, judging whether the registered information of the chat transaction push service registered by the second user is possessed:
if the registration information exists, updating the first prepayment information in a local under-link database according to a pre-configured service fee deduction rule, and pushing the first chat transaction to the user side of the second user;
if the registration information does not exist, updating the first prepayment information in a local under-link database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
and if not sufficient, discarding the first chat transaction.
5. A chat method is applicable to a blockchain node, and a user side of a user registers chat transaction push service to the blockchain node, and the method comprises the following steps:
receiving a first service fee pre-storage transaction generated by a first user end of a first user, deducting a first quantity of first assets pre-stored in the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first quantity of first assets, and recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain;
judging whether the first user registers chat transaction push service at the current node:
if yes, updating the first prepayment information of the first user in a local downlink database according to the corresponding relation;
receiving a first chat transaction generated by a second user terminal of a second user; wherein the first chat transaction is generated by the second user in response to the second user sending chat information to a third user;
determining whether the first chat transaction is received by the rpc port:
and if the first chat transaction is received by the rpc port, inquiring whether the corresponding second prepaid information is enough to pay the service fee of the first chat transaction in the local offline database according to the first chat transaction:
and if the third user is enough to pay, judging whether the third user registers the chat transaction push service at the current node:
if the second user is registered, updating second prepayment information of the second user in a local under-link database according to a pre-configured service fee deduction rule, and pushing the first chat transaction to a user side of the third user;
if the first chat transaction is not registered, updating second prepayment information of the second user in a local downlink database according to a pre-configured service fee deduction rule, and broadcasting the first chat transaction to the connected block link points;
discarding the first chat transaction if payment is insufficient;
if the third user is not received by the rpc port, judging whether the third user registers the chat transaction push service at the current node:
if the third user is registered, pushing the first chat transaction to the user side of the third user;
if not, the first chat transaction is broadcast to the connected block chain nodes.
6. A chat method, the method being applicable to a blockchain node, the method comprising:
receiving a first service fee pre-storage transaction generated by a first user end of a first user, deducting a first quantity of first assets pre-stored in the first service fee pre-storage transaction, determining corresponding first prepaid information according to the first quantity of first assets, recording a corresponding relation between a first address of the first user and the first prepaid information on a block chain, and updating the first prepaid information of the first user in a local under-chain database;
receiving a first chat transaction sent by a second user terminal of a second user; wherein the first chat transaction is generated by the second user in response to the second user sending chat information to a third user;
inquiring whether the corresponding second prepaid information is enough to pay the service fee of the first chat transaction in a local down-link database according to the first chat transaction:
if yes, determining a first block chain node for pushing the first chat transaction to the user side of the third user according to the first chat transaction and a pre-configured transaction pushing node determination rule; and the number of the first and second groups,
updating second prepaid information of the second user in a local downlink database according to a preconfigured service fee deduction rule, and sending the first chat transaction to the first blockchain node, so that the first blockchain node updates the second prepaid information of the second user in the local downlink database according to the preconfigured service fee deduction rule, and pushes the first chat transaction to a user side of the third user;
otherwise, discarding the first chat transaction.
7. An apparatus for chatting, the apparatus comprising:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-6.
8. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-6.
CN202010748218.0A 2020-07-30 2020-07-30 Chat method, apparatus and storage medium Active CN111866166B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010748218.0A CN111866166B (en) 2020-07-30 2020-07-30 Chat method, apparatus and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010748218.0A CN111866166B (en) 2020-07-30 2020-07-30 Chat method, apparatus and storage medium

Publications (2)

Publication Number Publication Date
CN111866166A CN111866166A (en) 2020-10-30
CN111866166B true CN111866166B (en) 2023-04-18

Family

ID=72946160

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010748218.0A Active CN111866166B (en) 2020-07-30 2020-07-30 Chat method, apparatus and storage medium

Country Status (1)

Country Link
CN (1) CN111866166B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667717A (en) * 2018-04-20 2018-10-16 网易(杭州)网络有限公司 Block chain processing method, medium, device and computing device based on instant communication message record
CN109274586A (en) * 2018-11-14 2019-01-25 深圳市云歌人工智能技术有限公司 Storage method, device and the storage medium of chat message
CN110737668A (en) * 2019-12-17 2020-01-31 腾讯科技(深圳)有限公司 Data storage method, data reading method, related device and medium
CN110768897A (en) * 2019-10-25 2020-02-07 支付宝(杭州)信息技术有限公司 Block chain-based digital information authorization method and device
CN111401866A (en) * 2020-03-13 2020-07-10 杭州复杂美科技有限公司 Method, apparatus and storage medium for pre-storing and deducting commission fee
CN111464630A (en) * 2020-03-31 2020-07-28 杭州复杂美科技有限公司 Transaction broadcasting method, apparatus and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101795695B1 (en) * 2016-07-14 2017-12-01 주식회사 코인플러그 Method for providing archiving service and verification service of data transceived via messenger service and server using the same

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108667717A (en) * 2018-04-20 2018-10-16 网易(杭州)网络有限公司 Block chain processing method, medium, device and computing device based on instant communication message record
CN109274586A (en) * 2018-11-14 2019-01-25 深圳市云歌人工智能技术有限公司 Storage method, device and the storage medium of chat message
CN110768897A (en) * 2019-10-25 2020-02-07 支付宝(杭州)信息技术有限公司 Block chain-based digital information authorization method and device
CN110737668A (en) * 2019-12-17 2020-01-31 腾讯科技(深圳)有限公司 Data storage method, data reading method, related device and medium
CN111401866A (en) * 2020-03-13 2020-07-10 杭州复杂美科技有限公司 Method, apparatus and storage medium for pre-storing and deducting commission fee
CN111464630A (en) * 2020-03-31 2020-07-28 杭州复杂美科技有限公司 Transaction broadcasting method, apparatus and storage medium

Also Published As

Publication number Publication date
CN111866166A (en) 2020-10-30

Similar Documents

Publication Publication Date Title
CN112860451A (en) Multi-tenant data processing method and device based on SaaS
EP3087702B1 (en) Providing toll-free application data access
CN110505162A (en) Method for message transmission, device and electronic equipment
KR20030019180A (en) Content delivery system using a proxy content sever
CN112381543A (en) Multiple signature transaction method, device and storage medium
CN111209060A (en) Capability development platform processing method and device
CN112884405A (en) Inquiry system and scheduling method thereof
US11263569B2 (en) Blockchain-based information processing method and apparatus, and device
CN111401866A (en) Method, apparatus and storage medium for pre-storing and deducting commission fee
CN108629582B (en) Service processing method and device
CN111866166B (en) Chat method, apparatus and storage medium
CN112990991B (en) Method and device for combined invoicing
US20150193755A1 (en) Point-of-sale communication and payment system
US20180139336A1 (en) Methods and apparatus to determine a telecommunications account status
CN115587860A (en) Service processing method, device, storage medium and electronic equipment
CN111639944B (en) Transaction broadcasting method, apparatus and storage medium
CN111371675B (en) Intelligent addressing method, device, equipment and storage medium thereof
CN113450045A (en) Freight obtaining method and device, computer readable medium and electronic equipment
CN111784527B (en) Method and device for updating rights and interests through block chain
CN112995244B (en) Subscription withholding method, resource access method and equipment
CN111082947A (en) Method and device for charging consumption of resources
CN113612676B (en) Social group message synchronization method, device, equipment and storage medium
CN114202292B (en) Stock information sending method and device, electronic equipment and computer readable medium
CN112533035B (en) Advertisement pushing method and system
CN112927035A (en) Resource allocation method, device, equipment and 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
GR01 Patent grant
GR01 Patent grant