CN111242603B - Riding settlement method and device based on blockchain - Google Patents

Riding settlement method and device based on blockchain Download PDF

Info

Publication number
CN111242603B
CN111242603B CN202010008356.5A CN202010008356A CN111242603B CN 111242603 B CN111242603 B CN 111242603B CN 202010008356 A CN202010008356 A CN 202010008356A CN 111242603 B CN111242603 B CN 111242603B
Authority
CN
China
Prior art keywords
blockchain
record
outbound
account
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
CN202010008356.5A
Other languages
Chinese (zh)
Other versions
CN111242603A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010008356.5A priority Critical patent/CN111242603B/en
Publication of CN111242603A publication Critical patent/CN111242603A/en
Application granted granted Critical
Publication of CN111242603B publication Critical patent/CN111242603B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/22Payment schemes or models
    • G06Q20/28Pre-payment schemes, e.g. "pay before"
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • 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/30Payment architectures, schemes or protocols characterised by the use of specific devices or networks
    • G06Q20/34Payment architectures, schemes or protocols characterised by the use of specific devices or networks using cards, e.g. integrated circuit [IC] cards or magnetic cards
    • G06Q20/349Rechargeable cards
    • 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/382Payment protocols; Details thereof insuring higher security of transaction

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Microelectronics & Electronic Packaging (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Computer Security & Cryptography (AREA)
  • Finance (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)

Abstract

The embodiment of the application provides a riding settlement method based on a blockchain, which is applied to nodes in a blockchain system, and comprises the following steps: receiving an outbound request sent by an outbound gate, wherein the outbound request comprises a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located; acquiring a transaction record corresponding to the user identifier from a blockchain; determining whether an outbound condition is met according to the transaction record corresponding to the user identifier; and if the outbound condition is met, controlling to transfer accounts to the blockchain accounts of the operators to which the outbound site belongs. Thus, riding settlement can be realized across operators.

Description

Riding settlement method and device based on blockchain
Technical Field
The application relates to the technical field of computers and communication, in particular to a riding settlement method and device based on blockchain.
Background
In the prior art, passengers typically make bus payments by means of a traffic card. That is, the passenger first charges the traffic card provided by the operator, and then deducts the traffic card from the account according to the riding fee of each time.
Since the operators are independent of each other, the traffic card provided by one operator is different for riding the traffic of another operator, that is, the same traffic card cannot realize riding settlement across operators.
Therefore, how to implement riding settlement across operators is a technical problem to be solved in the prior art.
Disclosure of Invention
The embodiment of the application provides a riding settlement method and device based on a blockchain, which can realize riding settlement across operators.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to an aspect of the embodiment of the present application, there is provided a blockchain-based riding settlement method applied to a node in a blockchain system, where the node is a passenger node where a passenger is located or an operator node where an operator is located, where a public blockchain account, a blockchain account corresponding to a user identifier, and blockchain accounts of a plurality of operators are provided in the blockchain system, where the public blockchain account is a transfer account of a passenger purchase cycle card, the method includes:
The node receives an outbound request sent by an outbound gate, wherein the outbound request comprises a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located;
The node obtains transaction records corresponding to the user identifications from a blockchain of the blockchain system, wherein the transaction records corresponding to the user identifications comprise transaction records representing the fund flow condition in a blockchain account corresponding to the user identifications and transaction records generated by purchasing a periodic card by a passenger indicated by the user identifications;
If the transaction records corresponding to the user identifications do not comprise periodic card purchase records, or the transaction records corresponding to the user identifications comprise periodic card purchase records and the current time is not in the effective bus taking period of the corresponding periodic card, the node calculates a balance in a blockchain account corresponding to the user identifications according to balance charge records and bus taking consumption records in the transaction records corresponding to the user identifications, obtains an inbound record corresponding to the user identifications according to the user identifications in the outbound request, obtains a second station identification in the inbound record, obtains a bus taking rule according to the corresponding operator of the first station identification or the second station identification, calculates bus taking expense according to the bus taking rule, the first station identification and the second station identification, and if the balance is not lower than the bus taking expense, the node transfers a account from the blockchain account corresponding to the user identifications to the blockchain account of the outbound operator according to the bus taking expense;
And if the transaction record corresponding to the user identifier comprises a periodic card purchase record and the current time is within the effective riding period of the periodic card indicated by the periodic card purchase record, the node transfers the money from the public blockchain account to the blockchain account of the operator to which the outbound site belongs according to the preset amount.
According to an aspect of an embodiment of the present application, there is provided a blockchain-based riding accounting device, which is characterized in that the blockchain-based riding accounting device is applied to a node in a blockchain system, wherein the node is a passenger node where a passenger is located or an operator node where an operator is located, a public blockchain account, a blockchain account corresponding to a user identifier, and blockchain accounts of a plurality of operators are provided in the blockchain system, and the public blockchain account is a transfer account of a passenger purchase cycle card, the device includes:
The system comprises an outbound request receiving module, a gateway module and an outbound request receiving module, wherein the outbound request receiving module is used for receiving an outbound request sent by an outbound gateway, and the outbound request comprises a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located;
A transaction record acquisition module, configured to acquire a transaction record corresponding to the user identifier from a blockchain of the blockchain system, where the transaction record corresponding to the user identifier includes a transaction record that characterizes a fund flow condition in a blockchain account corresponding to the user identifier, and a transaction record generated by purchasing a periodic card by a passenger indicated by the user identifier;
The control transfer module is used for obtaining the balance in the blockchain account corresponding to the user identifier according to the balance recharging record and the riding consumption record in the transaction record corresponding to the user identifier if the transaction record corresponding to the user identifier does not comprise the periodic card purchasing record or the transaction record corresponding to the user identifier comprises the periodic card purchasing record and the current time is not in the effective riding period of the corresponding periodic card, obtaining the inbound record corresponding to the user identifier according to the user identifier in the outbound request, obtaining the riding charging rule according to the operator corresponding to the first site identifier or the second site identifier, calculating the riding cost according to the riding charging rule, the first site identifier and the second site identifier, and carrying out transfer from the blockchain account corresponding to the user identifier to the blockchain account according to the riding cost if the balance is not lower than the riding cost; and if the transaction record corresponding to the user identifier comprises a periodic card purchase record and the current time is within the effective riding period of the periodic card indicated by the periodic card purchase record, transferring accounts from the public blockchain account to the blockchain account of the operator to which the outbound site belongs according to a preset amount.
In the technical scheme of the disclosure, when the outbound condition is met, the account is transferred to the withdrawal chain account of the operator to which the outbound site belongs. That is, regardless of whether the passenger is charged or buying the periodic card, the account is not directly transferred to the operator's blockchain account, but is transferred to the operator's blockchain account at each ride consumption to pay the current ride cost.
Through the scheme of the disclosure, the blockchain system can access a plurality of operators. Based on the method, passengers can take vehicles of different operators based on one-time recharging or the purchased cards of the same period, and the passengers do not need to purchase bus cards and the like provided by each operator respectively, so that riding across operators is realized. In addition, the transaction records of the passengers are written into the blockchain, and whether the outbound condition is met or not is judged according to the transaction records acquired from the blockchain based on the non-tamper property of the blockchain, so that the loss caused by the loss of the traffic card in the prior art is avoided, and the assets of the passengers in the blockchain system can be effectively ensured.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art. In the drawings:
FIG. 1 illustrates a schematic diagram of a blockchain system to which embodiments of the present application may be applied;
FIG. 2 illustrates a schematic diagram of a blockchain in accordance with an embodiment;
FIG. 3 is a flow diagram illustrating a blockchain-based ride settlement method according to an embodiment;
FIG. 4 is a flow chart of step 350 of the corresponding embodiment of FIG. 3 in one embodiment;
FIG. 5 is a flow chart of step 370 of the corresponding embodiment of FIG. 3 in one embodiment;
FIG. 6 is a flow chart illustrating a blockchain-based ride settlement method according to another embodiment;
FIG. 7 is a flow chart illustrating a blockchain-based ride settlement method according to yet another embodiment;
FIG. 8 is a flow chart illustrating a blockchain-based ride settlement method according to yet another embodiment;
FIG. 9 is a flow chart illustrating a blockchain-based ride settlement method according to yet another embodiment;
FIG. 10 is a flow chart illustrating a blockchain-based ride settlement method according to yet another embodiment;
FIG. 11 is a flow chart illustrating a blockchain-based ride settlement method according to yet another embodiment;
FIG. 12 is a block diagram illustrating a blockchain-based ride settlement device according to one embodiment;
fig. 13 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
Referring to fig. 1, fig. 1 is an optional structural schematic diagram of a blockchain system 100 according to an embodiment of the present invention, where the blockchain system 100 includes a distributed system formed by connecting a plurality of nodes 110 through a network communication, where the nodes 110 may be any form of computing device (such as a server, a user terminal, etc.) in an access network.
The nodes 110 in the blockchain system 100 may communicate with the outbound gate and the inbound gate, such that the nodes may receive outbound requests sent by the outbound gate and may receive inbound records sent by the inbound gate, based on which ride settlement is achieved according to the methods of the present disclosure.
The node 110 includes at least a terminal at which the passenger is located, so that the passenger interacts with an inbound gate or an outbound gate based on the terminal at which the passenger is located, and the inbound gate or the outbound gate can obtain the user identification of the passenger in the blockchain system. The node 110 further includes a computer device where the operator is located, so that the operator can implement processes such as raising a balance in the own blockchain account based on the client where the operator is located. Node 110 may also include other nodes that implement particular services, such as computing nodes that are deployed specifically to execute the present disclosure.
The nodes 110 form a component point-To-point (P2P) network, and the P2P protocol is an application layer protocol that runs on top of a transmission control protocol (TCP, transmission Control Protocol) protocol. In this system, any machine, such as a server, a terminal, may be added to become a node, which includes a hardware layer, a middle layer, an operating system layer, and an application layer.
Referring to the functionality of each node in the blockchain system 100 shown in fig. 1, the functions involved include:
1) The routing, the node has basic functions for supporting communication between nodes.
Besides the routing function, the node can also have the following functions:
2) The application is used for being deployed in a blockchain to realize specific service according to actual service requirements, recording data related to the realization function to form record data, carrying a digital signature in the record data to represent the source of task data, and sending the record data to other nodes in the blockchain system, wherein the record data such as balance recharging records, periodic card purchasing records, bus taking consumption records and the like are used for the other nodes to add the record data into a block when the record data source and the integrity are verified to be successful.
The services implemented by the application may include:
2.1 Wallet for providing electronic money transactions, including initiating a transaction (i.e., sending a transaction record of the current transaction to other nodes in the blockchain system, the other nodes, after verification, storing record data of the transaction in a temporary block of the blockchain in response to acknowledging that the transaction is valid;
2.2 Intelligent contracts, computerized agreements, which can execute the terms of a certain contract, implemented by code deployed on a shared ledger for execution when certain conditions are met, for completing automated transactions according to actual business demand codes; of course, the smart contract may also be a contract that performs processing of received information, such as a smart contract that determines whether outbound conditions are satisfied, a smart contract that transfers to blockchain accounts of operators to which outbound sites belong, and the like.
3) The blockchain comprises a series of blocks (blocks) which are connected with each other according to the generated sequence time, the new blocks are not removed once being added into the blockchain, and record data submitted by nodes in the blockchain system are recorded in the blocks. The record data may be a transaction record such as a balance recharge record, a periodic card purchase record, a ride consumption record, a present transaction record, etc.
Referring to fig. 2, fig. 2 is an optional schematic diagram of a blockchain according to an embodiment of the present invention, where each block includes a hash value of a transaction record stored in the block (hash value of the block) and a hash value of a previous block, and the blocks are connected by the hash values to form the blockchain. In addition, the block may include information such as a time stamp at the time of block generation. The blockchain (Blockchain), essentially a de-centralized database, is a string of data blocks that are generated in association using cryptographic methods, each of which contains associated information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
The implementation details of the technical scheme of the embodiment of the application are described in detail below:
FIG. 3 illustrates a flow chart of a blockchain-based ride settlement method that is applied to nodes in a blockchain system in accordance with an embodiment of the present application. Referring to fig. 3, the blockchain-based riding settlement method at least includes steps 310 to 370, and is described in detail as follows:
step 310, an outbound request sent by an outbound gate is received, where the outbound request includes a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located.
The first station identifier generally refers to a station identifier corresponding to an inbound station of a passenger to be outbound.
The user identification of the passenger to be outbound is used to uniquely identify the passenger in the blockchain system. In one embodiment, the user identification is generated by a node in the blockchain system for the outbound passenger, such as a public key generated by the node for the outbound passenger. In other embodiments, the user identifier may also be an identifier code generated by the node performing one or more hash operations according to the public key of the passenger to be outbound, which is not specifically limited herein.
When the passengers to be outbound need to be outbound, the passengers to be outbound send the user identification of the passengers in the blockchain system to the outbound gate through terminal equipment, an IC card and the like, and the outbound gate generates an outbound request according to the user identification of the passengers to be outbound and the first station identification of the outbound station where the outbound gate is located and sends the outbound request to nodes in the blockchain system.
The terminal device may be a terminal such as a smart phone or a tablet computer, or may be wearable device such as a smart bracelet, which is not particularly limited herein.
The passenger waiting for the outbound can scan the two-dimensional code or one-dimensional code carrying the user identification information of the passenger in the client of the terminal at the scanning position of the outbound gate so that the outbound gate can correspondingly acquire the user identification of the passenger by identifying the two-dimensional code or the one-dimensional code.
In another embodiment, the outbound gate may also collect biometric information, such as fingerprint information or facial image information, of the passenger to be outbound, then determine a user identification of the passenger to be outbound in the blockchain system based on the collected biometric information of the passenger to be outbound, and generate an outbound request based on the user identification and the first station identification.
Step 330, a transaction record corresponding to the user identifier is obtained from the blockchain.
In the scheme of the disclosure, a node is correspondingly provided with a blockchain account for a user in a blockchain system. For a blockchain system, its users include at least passengers and operators. The operator refers to a party to whom the riding fee of the passenger is transferred. In a blockchain system, users are correspondingly identified by user identification.
In one embodiment, the passenger may pay a ride fee based on the balance in the blockchain account on the basis of recharging the blockchain account itself.
In another embodiment, the passenger may purchase a periodic card upon which the passenger may make an outbound based on the periodic card without the need to additionally deduct fees from the passenger's blockchain account. After purchasing the periodic card, the information of the purchased periodic card is associated with the user identification, so that the passenger corresponding to the user identification can go out by means of the periodic card. It is worth mentioning that the periodic card may be a virtual card or a physical card.
The cycle cards may be week cards, month cards, quarter cards, year cards, etc. The period card corresponds to an effective riding period, and if riding time is within the effective riding period corresponding to the period card, passengers indicated by the associated user identifiers can be discharged according to the period card; if the riding time is not in the effective riding period corresponding to the period card, the corresponding passenger can not go out according to the period card.
The transaction record corresponding to the user identifier refers to a transaction record associated with the user identifier, which may include a transaction record characterizing the funds flow in the blockchain account to which the user identifier corresponds, and may also include a transaction record generated by the user identifier indicating the passenger purchasing period card.
The transaction records corresponding to the user identification may include transaction records generated by recharging the blockchain account corresponding to the user identification (i.e., balance recharge records hereinafter), transaction records generated for purchasing periodic cards (i.e., periodic card purchase records hereinafter), and transaction records generated for transferring money from the blockchain account corresponding to the user identification to the operator account for payment of the ride share (i.e., ride consumption records hereinafter).
After generating the transaction record, the nodes in the blockchain system write the transaction record into the blockchain and synchronize to other nodes in the blockchain system. Thus, any node in the blockchain system can correspondingly obtain transaction records from the blockchain according to the user identification.
After the transaction records corresponding to the user identifications are obtained from the blockchain, the node can know the transaction conditions related to the user identifications according to the obtained transaction records.
Step 350, determining whether the outbound condition is satisfied according to the transaction record corresponding to the user identifier.
The outbound condition can be set according to actual needs. The outbound condition may be that the balance in the blockchain account to which the user identification corresponds is not less than the ride cost for the ride. Correspondingly, according to the transaction record corresponding to the user identifier, the balance in the blockchain account corresponding to the user identifier can be correspondingly calculated, and whether the balance is lower than the riding expense of the riding at this time is further judged according to the calculated balance; if the bus riding cost is not lower than the bus riding cost, the outbound condition is met; conversely, if the ride cost is lower, the outbound condition is not satisfied.
In another embodiment, the outbound condition may also be that the current ride time is within a valid ride period of the periodic card associated with the user identification; correspondingly, if searching is carried out according to the transaction record corresponding to the user identifier, determining whether the transaction record corresponding to the user identifier comprises a periodic card purchase record or not; if so, further judging whether the current time is in the effective riding period of the periodic card corresponding to the periodic card purchase record, and if so, determining that the outbound condition is met; otherwise, if not, determining that the outbound condition is not met.
In yet another embodiment, the outbound condition is that the balance in the blockchain account to which the user identification corresponds is not less than the ride cost of the current ride or the current ride time is within the valid ride deadline of the cycle card with which the user identification is associated. Correspondingly, judging whether a periodic card purchase record exists or not according to the transaction record corresponding to the user identifier; if so, further judging whether the current time is in the effective riding period of the periodic card indicated by the periodic card purchase record, and if so, determining that riding conditions are met; if the balance is not lower than the riding expense corresponding to the riding at the time, the riding condition is determined to be met, and if the balance is lower than the riding expense, the riding condition is determined to be not met. If the periodic card purchase record does not exist according to the transaction record corresponding to the user identification, determining that the riding condition is met by determining the balance in the blockchain account corresponding to the user identification, if the balance is not lower than the riding cost corresponding to the riding at this time, and if the balance is lower than the riding cost, determining that the riding condition is not met.
And 370, if the outbound condition is met, controlling to transfer accounts to the blockchain accounts of the operators to which the outbound site belongs.
In the technical scheme of the disclosure, when the outbound condition is met, the account is transferred to the withdrawal chain account of the operator to which the outbound site belongs. That is, the transaction does not directly transfer an account to the operator's blockchain account regardless of whether the passenger is recharging or buying the cycle card, but rather, transfers a corresponding account to the operator's blockchain account to pay the current ride cost each time the ride is consumed.
Through the scheme of the disclosure, the blockchain system can access a plurality of operators. Based on the method, passengers can take vehicles of different operators based on one-time recharging or the purchased cards of the same period, and the passengers do not need to purchase bus cards and the like provided by each operator respectively, so that riding across operators is realized. Moreover, since the transaction records of the passengers are written into the blockchain, the accuracy and the effectiveness of the obtained transaction records are ensured based on the non-tamper property of the blockchain.
The scheme of the present disclosure can be used for riding settlement in vehicles provided with an outbound gate and an inbound gate, such as subways, light rails, ferries, trains, and the like.
In one embodiment, if it is determined that the transaction record corresponding to the user identifier meets the outbound condition, the node further sends a release instruction to the outbound gate, so that the outbound gate performs a release action for the passenger, and the passenger passes through the outbound gate. In another embodiment, after the transfer is successful in step 370, a release command may be sent to the outbound gate.
In one embodiment, as shown in FIG. 4, step 350 includes:
step 410, judging whether the transaction record corresponding to the user identifier comprises a periodic card purchase record;
If not, then step 420 is performed: calculating to obtain the balance in the blockchain account corresponding to the user identifier according to the balance recharging record and the riding consumption record in the transaction record corresponding to the user identifier;
Step 430, determining whether the balance is lower than the ride cost. The riding fee is determined according to the first station identification and the second station identification of the inbound station corresponding to the passenger to be outbound, and the second station identification is determined according to the inbound record of the passenger to be outbound.
If not, determining that the outbound condition is met; if the number is lower than the preset number, determining that the outbound condition is not met;
If the transaction record corresponding to the user identifier includes the periodic card purchase record, step 440 is performed: judging whether the current time is in the effective riding period of the periodic card indicated by the periodic card purchase record;
Determining that the outbound condition is satisfied if the current time is within a valid ride period of the periodic card indicated by the periodic card purchase record;
if the current time is not within the valid period of the corresponding periodic card, then step 420 is entered.
The periodic card purchase record is a transaction record generated by the outbound passenger purchasing the periodic card in the blockchain system.
In the blockchain system, if a passenger purchases a periodic card, the passenger can take a ride based on the purchased periodic card within a set period without paying out the balance in the passenger's blockchain account. The set period is the effective riding period of the period card.
In the blockchain system, a blockchain account is allocated for the user correspondingly in the blockchain system. The user corresponds as a passenger to have a blockchain account in the blockchain system. The money in the blockchain account of the passenger is used to pay the passenger's ride.
In order to pay the cost of the bus through the blockchain account of the passenger, it is necessary to ensure that there is money in the blockchain account of the passenger. In other words, the blockchain account of the passenger needs to be recharged.
The balance recharging record refers to a transaction record which is generated by recharging in the blockchain account of the passenger.
If the passenger pays for the ride through the passenger's blockchain account, a payout is correspondingly generated in the passenger's blockchain account. The riding consumption record refers to a transaction record correspondingly generated by paying out through a blockchain account of the passenger.
If the blockchain account defining the passenger can only be used to pay the ride cost, the ride consumption record refers to a transaction record generated corresponding to the payment of the ride cost through the blockchain account of the passenger. That is, in this case, the payout account in the ride consumption record is the blockchain account of the corresponding passenger, and the receiving account is the blockchain account of the operator.
In other embodiments, other payment rights may be given to the blockchain account of the passenger, such as making shopping payments, transfers, etc., and the corresponding passenger's consumption record corresponds to the transaction record generated by making shopping payments, transfers, etc.
As described above, in the present disclosure, the purchased period card corresponds to a valid period of time, and if the usage time exceeds the valid period of time, the period card cannot be used for outbound; if the time of use is within the effective riding period, the passenger waiting to be outbound can be released according to the period card.
Thus, if the transaction record of the passenger obtained from the blockchain includes a periodic card transaction record, and the current time is within the effective period of the periodic card corresponding to the periodic card transaction record, it indicates that the passenger can go out based on the periodic card corresponding to the periodic card transaction record. Thus, the passenger satisfies the outbound condition.
If the transaction record for the passenger obtained from the blockchain does not include a periodic card transaction record, or includes a periodic card transaction record but the current time is not within the valid ride period for the periodic card corresponding to the periodic card transaction record, then the ride cost may only be paid by the balance in the blockchain account of the passenger. In this case, if the balance in the passenger's blockchain account is not lower than the calculated ride cost, it indicates that the passenger's blockchain account can pay the ride cost of this ride, and thus the passenger satisfies the outbound condition.
Further, when the passenger to be outbound arrives at the inbound station, the inbound gate obtains the user identifier of the passenger correspondingly, and the process of obtaining the user identifier of the passenger by the inbound gate is similar to the process of obtaining the user identifier of the passenger by the outbound gate, which is not described herein.
After the user identification of the passenger is obtained, the inbound gate generates an inbound record according to the user identification of the passenger and a second station identification of the inbound station, and sends the inbound record to a node in the blockchain system.
Therefore, after receiving the outbound request, the node in the blockchain system correspondingly acquires the inbound record corresponding to the user identifier according to the user identifier in the outbound request, and further, takes the second station identifier in the acquired inbound record as the second station identifier of the passenger to be outbound.
After the first station identifier and the second station identifier corresponding to the passengers waiting to be discharged are determined, the passengers waiting to be discharged are correspondingly calculated to obtain the riding expense of the riding according to the preset riding charging rule.
It should be noted that multiple operators may be connected in the blockchain system, and the bus charging rules of different operators may be different, so before calculating the bus fee, the bus charging rules are obtained according to the corresponding operator to which the first station identifier or the second station identifier belongs. On the basis, the calculation of the bus charge is carried out according to the acquired bus charge rule, the first station identifier and the second station identifier.
In one embodiment, a common blockchain account is provided in the blockchain system, and the common blockchain account is used as a transfer account for the passenger to purchase the periodic card, as shown in fig. 5, step 370 includes:
If the transaction record corresponding to the user identifier does not include the periodic card purchase record, or the transaction record corresponding to the user identifier includes the periodic card purchase record and the current time is not within the valid period of the periodic card purchase record, step 510 is executed: and transferring accounts of the blockchain of the operators to which the outbound site belongs from the blockchain accounts corresponding to the user identifications according to the riding fees.
If the transaction record corresponding to the user identifier includes a periodic card purchase record and the current time is within a valid period of the periodic card purchase record, then step 530 is performed: and transferring accounts from the public blockchain account to the blockchain account of the operator to which the outbound site belongs according to the preset amount.
As described above, if a passenger purchases a periodic card and the current ride time is within the valid ride of the purchased periodic card, the passenger may be outbound from the periodic card without spending the balance in the blockchain account of the ride.
The preset amount may be calculated according to the riding cost and the preset proportion, or may be a preset fixed value, which is not particularly limited herein.
In the solution of the present embodiment, in order to effectively account for the blockchain account of the ride, a common blockchain account is provided in the blockchain system. When the user purchases the periodic card, the account of the public blockchain is transferred according to the corresponding amount of the periodic card.
When the passenger goes out based on the purchased periodic card, the public blockchain account is used for transferring accounts to the blockchain account of the operator to which the outbound site belongs, so that the balance in the blockchain account is not spent when the passenger goes out based on the purchased periodic card.
That is, the passenger purchases the periodic card, which corresponds to storing in advance a payment for paying the cost of riding, which is not stored in the blockchain account of the passenger (avoiding confusion with the amount charged by the blockchain account), nor in the blockchain account of any operator, but in the public blockchain. Thus, the payment of the riding fee can be carried out in time.
Through the public blockchain account, when a passenger purchases the periodic card, the public blockchain account is correspondingly transferred to the public blockchain account, so that the passenger pays the blockchain account of the subway operator based on the amount transferred by the passenger during the period card riding based on the amount transferred by the passenger during the period card purchasing, the passenger riding after the period card purchasing is realized, and the balance in the blockchain account of the passenger is not required to be spent for riding settlement.
In one embodiment, after the step of transferring the ride charge from the blockchain account corresponding to the user identification to the blockchain account of the operator to which the outbound site belongs, the method further comprises:
And generating a riding consumption record according to the blockchain account identifier corresponding to the user identifier and riding cost.
The generated bus consumption record is used for representing the money flow in the blockchain account corresponding to the user identifier, for example, in the process of paying bus fees, at least representing the specific amount of the bus fees and the transfer account (the blockchain account corresponding to the user identifier). In other embodiments, the ride consumption record may also include a transfer account (blockchain account of the operator to whom the outbound site belongs).
In another embodiment, after the step of transferring the money amount from the common blockchain account to the blockchain account of the operator to which the outbound site belongs, the method further includes:
And generating a second consumption record through the preset amount and the account identifier corresponding to the public blockchain account. In other embodiments, the second consumption record may further include an account identifier corresponding to a blockchain account of an operator to which the outbound site belongs. And recording the outflow condition of the money in the public blockchain account through the second consumption record.
In one embodiment, the transaction record comprises a balance refill record, as shown in FIG. 6, the method further comprising:
At step 610, a recharge request is obtained, the recharge request indicating a recharge amount and a first target blockchain account.
The recharge request may be initiated by the passenger through the client, in other words, the recharge request may be initiated by the passenger node where the passenger is located.
The first target blockchain account generally refers to a blockchain account to be recharged.
At step 630, a transfer is made to the first target blockchain account in accordance with the recharge amount.
And 650, if the transfer is successful, generating a balance recharging record according to the account identifier and the recharging amount of the first target blockchain account.
The balance recharge record refers to the transaction record resulting from the transfer of the amount to the blockchain account. For a passenger, the passenger's balance recharge record is a transaction record that results from an amount transfer made to the passenger's blockchain account.
And recording the funds inflow condition in the corresponding blockchain account through the generated balance recharging record, so as to realize billing.
In one embodiment, as shown in FIG. 7, the transaction records include periodic card purchase records, a common blockchain account is provided in the blockchain system, and the method further includes:
step 710, a periodic card purchase request is obtained, the periodic card purchase request indicating a periodic card for the requested purchase and a user identification of the requested purchase passenger.
The recharge request may be initiated by the passenger through the client, in other words, the recharge request may be initiated by the passenger node where the passenger is located.
The user identification of the passenger requesting to purchase in the periodic card purchase request is used for informing the node of the corresponding use object of the periodic card purchased.
And 730, according to the periodic card purchase request, transferring accounts to the public blockchain accounts according to the corresponding amount of the periodic card purchased by the request.
And 750, if the transfer is successful, generating a periodic card purchase record according to the user identification of the passenger requesting to purchase, the periodic card identification corresponding to the periodic card requesting to purchase and the account identification corresponding to the public blockchain account.
And recording the periodic card purchase condition of the passenger indicated by the user identification through the generated periodic card purchase record, so that when the periodic card indicated by the user identification is in a valid riding period, the riding expense of the passenger is paid through the public blockchain account without spending the balance in the corresponding blockchain account of the user identification.
In one embodiment, as shown in fig. 8, the method further comprises:
step 810, a cash out request is received, the cash out request indicating a cash out amount, a target transfer account, and a blockchain account of an operator.
Step 820, obtaining the transaction record of the operator from the blockchain according to the rendering request.
And step 830, calculating to obtain the balance in the blockchain account of the operator according to the transaction record of the operator.
If the balance in the operator's blockchain account is not less than the present amount, then the transfer is made from the operator's blockchain account to the target transfer account according to the present amount, step 840.
And 850, if the transfer is successful, generating a cash-on-hand transaction record according to the account identifier of the target transfer account, the blockchain account identifier of the operator and the cash-on-hand amount.
As described above, the nodes in the blockchain system may be passenger nodes where passengers are located or operator nodes where operators are located. For the operator node, its blockchain account in the blockchain system belongs to the party that is the recipient. Therefore, in the scheme of the disclosure, the operator node can initiate a request for embodiment, and transfer the money of the own blockchain account to other accounts.
For transactions occurring in the blockchain system, transaction records corresponding to the transactions are written into the blockchain, so that corresponding transaction records corresponding to operators are obtained from the blockchain according to the operator identification in the embodiment request.
The transaction record of the operator records the amount variation condition in the blockchain account of the operator, so that the balance condition of the blockchain account of the operator can be correspondingly determined according to the transaction record of the operator, and a balance information request does not need to be initiated to the blockchain account of the operator.
If the balance in the blockchain account of the operator is not less than the withdrawal amount requested by the withdrawal request, continuing to execute 840-850; otherwise, if the balance in the blockchain account of the operator is lower than the withdrawal amount requested by the withdrawal request, a prompt message is returned to the operator node to indicate that the balance in the corresponding blockchain account is smaller than the withdrawal amount at the time.
And after the transfer is successful, recording the promotion expense condition in the blockchain account of the operator through the generated promotion transaction record.
In one embodiment, as shown in fig. 9, the method further comprises:
Step 910, after the node generates the transaction record, performing hash operation on the generated transaction record to obtain summary data, where the transaction record includes any one of a bus consumption record, a balance recharging record, a periodic card purchase record and a cash withdrawal transaction record.
And 930, signing the abstract data through the private key of the node to obtain signature data.
In step 950, release data is generated from the public key of the node itself, the transaction record, and the signature data.
At step 970, the published data is published into a record pool of the blockchain system to await writing of the ride consumption record to the blockchain.
The blockchain system correspondingly generates a key pair for each node, the key pair including a private key and a public key. Thus, the node can sign the digest data based on its own private key.
The record pool of the blockchain system is used for caching the release data.
Issuing the transaction record in the form of issue data awaiting writing the transaction record in the issue data to the blockchain is accomplished by steps 910-970.
In one embodiment, as shown in fig. 10, the method further comprises:
In step 1010, the published data in the record pool of the blockchain system is obtained, the published data comprises a transaction record, signature data and a public key of a publisher corresponding to the published data, the signature data is obtained by signing summary data through a private key of the publisher, and the summary data is obtained by carrying out hash operation on the transaction record.
Step 1030, decrypting the signature data in the published data by the public key of the publisher corresponding to the published data, to obtain the first decrypted data.
And step 1050, performing hash operation on the transaction record in the release data to obtain the first data.
In step 1070, if the first data is consistent with the first decrypted data, the block is constructed according to the consumption record in the distribution data.
At step 1090, the blocks are linked to the blockchain and synchronized in the blockchain system.
If the first data is consistent with the first decryption data, indicating that the transaction record in the release data is not tampered; otherwise, if the first data is inconsistent with the first decryption data, the transaction record in the release data is tampered, and the transaction record is discarded.
Through the steps, the node verifies the transaction record in the release data, and writes the transaction record which is not tampered in the release data into the blockchain when the verification determines that the transaction record is not tampered, so that the accuracy and the effectiveness of the written data of the blockchain are ensured.
In one embodiment, as shown in fig. 11, the method further comprises:
step 1110, a registration request is obtained.
Step 1130, a private key is generated for the user requesting registration in accordance with the registration request.
In step 1150, the private key is encrypted by an elliptic encryption algorithm to obtain the public key of the user.
Step 1170 returns the public and private keys to the originator of the registration request to enable the user to log into the blockchain system with the private and public keys.
And step 1190, performing hash operation on the public key to obtain a wallet address, and using the wallet address as a blockchain account identifier of the corresponding user in the blockchain system.
If a user wants to realize riding settlement based on the blockchain system, the user needs to register in the blockchain system, namely, a registration request is sent to a node in the blockchain system.
The user requested to register may be a passenger, an operator, or other non-passenger, non-operator users, and is not specifically limited herein.
The node generates a private key and a public key for the user requested to register according to the registration request, and opens a blockchain account for the user requested to register according to the registration request.
After the node generates the private key and the public key for the user, the client where the user is located logs in to the blockchain system through the private key and the public key (for example, the public key is taken as the user account and the private key is taken as the password for logging in). After the client where the user is located logs in to the blockchain system, the client of the logged-in user correspondingly becomes another node in the blockchain system.
Wherein the private key and the public key generated by the node for the user are corresponding. Specifically, if a private key is used to sign a certain data, the signed data U can be decrypted only by the corresponding public key; conversely, if a user's public key is used to encrypt certain data, the private key of the user can only be used to decrypt the encrypted data.
In one embodiment, the process of generating the wallet address in step 1190 is: carrying out SHA-256 hash calculation on the public key to obtain a first hash value; RIPEMD-160 calculation is carried out on the first hash value, and a second hash value is obtained; carrying out SHA-256 hash calculation on the second hash value to obtain a third hash value; carrying out SHA-256 hash calculation on the third hash value again to obtain a fourth hash value; the first several bytes, e.g. four bytes, of the third hash value are added to the back of the fourth hash value, resulting in a wallet address of the requesting registered user.
It should be noted that, based on the characteristics of elliptic curve cryptography and hashing, the process of generating the private key, public key and wallet address for the user by the node is irreversible. In other words, although the generation process is private key→public key→wallet address, if the wallet address of the user is known, the public key of the user cannot be calculated reversely; also, the private key of the user cannot be calculated in reverse if the public key of the user is known.
The following describes embodiments of the apparatus of the present application that may be used to perform the methods of the above-described embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
The application discloses a riding settlement device 1200 based on a blockchain, which is applied to nodes in a blockchain system, as shown in fig. 12, and comprises the following components.
The outbound request receiving module 1210 is configured to receive an outbound request sent by an outbound gate, where the outbound request includes a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located.
The transaction record acquisition module 1230 is configured to acquire a transaction record corresponding to the user identifier from the blockchain.
A determining module 1250 is configured to determine whether the outbound condition is satisfied according to the transaction record corresponding to the user identifier.
The control transfer module 1270 is configured to control transfer to a blockchain account of an operator to which the outbound site belongs if it is determined that the outbound condition is satisfied.
In one embodiment, determination module 1250 includes:
And the first determining unit is used for determining that the outbound condition is met if the transaction record corresponding to the user identifier comprises the periodic card purchase record and the current time is in the effective bus period of the periodic card indicated by the periodic card purchase record.
And the second determining unit is used for calculating to obtain the balance in the blockchain account corresponding to the user identifier according to the balance recharging record and the riding consumption record in the transaction record corresponding to the user identifier if the transaction record corresponding to the user identifier does not comprise the periodic card purchasing record or the transaction record corresponding to the user identifier comprises the periodic card purchasing record and the current time is not in the effective riding period of the corresponding periodic card, and determining that the outbound condition is met if the balance is not lower than riding cost, wherein the riding cost is determined according to the first station identifier and the second station identifier of the inbound station corresponding to the passenger to be outbound, and the second station identifier is determined according to the inbound record of the passenger to be outbound.
In one embodiment, a common blockchain account is provided in the blockchain system, the common blockchain account being a transfer account for a passenger to purchase a periodic card, and the control transfer module 1270 includes:
The first transfer unit is used for transferring money from the blockchain account corresponding to the user identifier to the blockchain account of the operator belonging to the outbound site according to the bus charge if the transaction record corresponding to the user identifier does not comprise the periodic card purchase record or the transaction record corresponding to the user identifier comprises the periodic card purchase record and the current time is not in the effective bus period of the periodic card purchase record;
and the second transfer unit is used for transferring the money from the public blockchain account to the blockchain account of the operator to which the outbound site belongs according to the preset amount if the transaction record corresponding to the user identifier comprises the periodic card purchase record and the current time is in the effective riding period of the periodic card purchase record.
In one embodiment, the apparatus further comprises:
And the riding consumption record generation module is used for generating riding consumption records according to the blockchain account identifications and riding fees corresponding to the user identifications.
In one embodiment, the transaction record comprises a balance refill record, the apparatus further comprising:
and the recharging request acquisition module is used for acquiring a recharging request, wherein the recharging request indicates the recharging amount and the first target blockchain account.
And the first transfer module is used for transferring accounts to the first target blockchain account according to the recharging amount.
And the balance recharging record generating module is used for generating a balance recharging record according to the account identifier and the recharging amount of the first target blockchain account if the transfer is successful.
In one embodiment, the transaction records include periodic card purchase records, and the blockchain system has a common blockchain account therein, the apparatus further comprising:
and the periodic card purchase request acquisition module is used for acquiring a periodic card purchase request, wherein the periodic card purchase request indicates the periodic card for requesting purchase and the user identification of the passenger for requesting purchase.
And the second transfer module is used for transferring accounts to the public blockchain according to the amount corresponding to the periodical card required to be purchased according to the periodical card purchasing request.
And the periodic card purchase record generation module is used for generating a periodic card purchase record according to the user identification of the passenger requesting to purchase, the periodic card identification corresponding to the periodic card requesting to purchase and the account identification corresponding to the public blockchain account if the transfer is successful.
In one embodiment, the apparatus further comprises:
And the rendering request receiving module is used for receiving a rendering request, wherein the rendering request indicates the rendering amount, the target transfer account and the blockchain account of the operator.
And the first acquisition module is used for acquiring the transaction record of the operator from the blockchain according to the rendering request.
And the balance calculation module is used for calculating the balance in the blockchain account of the operator according to the transaction record of the operator.
And the third transfer module is used for transferring accounts from the blockchain account of the operator to the target according to the cash-out amount if the balance in the blockchain account of the operator is not lower than the cash-out amount.
And the cash-out transaction record generation module is used for generating a cash-out transaction record according to the account identifier of the target transfer account, the blockchain account identifier of the operator and the cash-out amount if the third transfer module transfers the money successfully.
In one embodiment, the apparatus further comprises:
The second acquisition module is used for acquiring transaction records generated by the nodes, wherein the transaction records comprise any one of riding consumption records, balance recharging records, periodic card purchase records and presentation transaction records.
The first hash operation module is used for carrying out hash operation on the transaction record to obtain abstract data;
And the signature module is used for signing the abstract data through the private key of the node to obtain signature data.
And the release data generation module is used for generating release data according to the public key of the node, the transaction record and the signature data.
And the issuing module is used for issuing the issuing data to a record pool of the blockchain system so as to wait for writing the riding consumption record into the blockchain.
In one embodiment, the apparatus further comprises:
The issuing data acquisition module is used for acquiring issuing data in a record pool of the blockchain system, the issuing data comprises transaction records, signature data and public keys of issuing parties corresponding to the issuing data, the signature data is obtained by signing summary data through private keys of the issuing parties, and the summary data is obtained by carrying out hash operation on the transaction records.
And the decryption module is used for decrypting the signature data in the release data through the public key of the release party corresponding to the release data to obtain first decryption data.
And the second hash operation module is used for carrying out hash operation on the transaction record in the release data to obtain the first data.
And the block construction module is used for constructing a block according to the consumption record in the release data if the first data is consistent with the first decryption data.
And the linking and synchronizing module is used for linking the blocks to the blockchain and synchronizing the blocks in the blockchain system.
The implementation process of the functions and roles of each module in the device is specifically shown in the implementation process of the corresponding steps in the block chain-based riding settlement method, and is not repeated here.
It is to be understood that these modules may be implemented in hardware, software, or a combination of both. When implemented in hardware, these modules may be implemented as one or more hardware modules, such as one or more application specific integrated circuits. When implemented in software, the modules may be implemented as one or more computer programs executing on one or more processors.
Fig. 13 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
It should be noted that, the computer system 1300 of the electronic device shown in fig. 13 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 13, the computer system 1300 includes a central processing unit (Central Processing Unit, CPU) 1301, which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory (ROM) 1302 or a program loaded from a storage portion 1308 into a random access Memory (Random Access Memory, RAM) 1303, for example, performing the method described in the above embodiment. In the RAM 1303, various programs and data required for the system operation are also stored. The CPU 1301, ROM 1302, and RAM 1303 are connected to each other through a bus 1304. An Input/Output (I/O) interface 1305 is also connected to bus 1304.
The following components are connected to the I/O interface 1305: an input section 1306 including a keyboard, a mouse, and the like; an output portion 1307 including a Cathode Ray Tube (CRT), a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), and a speaker, etc.; a storage portion 1308 including a hard disk or the like; and a communication section 1309 including a network interface card such as a LAN (Local Area Network ) card, a modem, or the like. The communication section 1309 performs a communication process via a network such as the internet. The drive 1310 is also connected to the I/O interface 1305 as needed. Removable media 1311, such as magnetic disks, optical disks, magneto-optical disks, semiconductor memory, and the like, is installed as needed on drive 1310 so that a computer program read therefrom is installed as needed into storage portion 1308.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flowcharts. In such embodiments, the computer program may be downloaded and installed from a network via the communication portion 1309 and/or installed from the removable medium 1311. When executed by a Central Processing Unit (CPU) 1301, performs various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), a flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts 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 application. Where 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 or flowchart illustration, and combinations of blocks in the block diagrams 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 involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As another aspect, the present application also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
References herein to "a plurality" means two or more. "and/or", describes an association relationship of an association object, and indicates that there may be three relationships, for example, a and/or B, and may indicate: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (8)

1. The utility model provides a riding settlement method based on blockchain, which is characterized in that the method is applied to the node in a blockchain system, wherein the node is the passenger node where passengers are located or the operator node where operators are located, a public blockchain account, a blockchain account corresponding to user identification and a blockchain account of a plurality of operators are arranged in the blockchain system, and the public blockchain account is a transfer account of a passenger purchase period card, and the method comprises the following steps:
The node receives an outbound request sent by an outbound gate, wherein the outbound request comprises a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located;
The node obtains transaction records corresponding to the user identifications from a blockchain of the blockchain system, wherein the transaction records corresponding to the user identifications comprise transaction records representing the fund flow condition in a blockchain account corresponding to the user identifications and transaction records generated by purchasing a periodic card by a passenger indicated by the user identifications;
If the transaction records corresponding to the user identifications do not comprise periodic card purchase records, or the transaction records corresponding to the user identifications comprise periodic card purchase records and the current time is not in the effective bus taking period of the corresponding periodic card, the node calculates a balance in a blockchain account corresponding to the user identifications according to balance charge records and bus taking consumption records in the transaction records corresponding to the user identifications, obtains an inbound record corresponding to the user identifications according to the user identifications in the outbound request, obtains a second station identification in the inbound record, obtains a bus taking rule according to the corresponding operator of the first station identification or the second station identification, calculates bus taking expense according to the bus taking rule, the first station identification and the second station identification, and if the balance is not lower than the bus taking expense, the node transfers a account from the blockchain account corresponding to the user identifications to the blockchain account of the outbound operator according to the bus taking expense;
And if the transaction record corresponding to the user identifier comprises a periodic card purchase record and the current time is within the effective riding period of the periodic card indicated by the periodic card purchase record, the node transfers the money from the public blockchain account to the blockchain account of the operator to which the outbound site belongs according to the preset amount.
2. The method of claim 1, wherein after the node transfers from the blockchain account to which the user identification corresponds to the blockchain account to which the outbound site belongs in accordance with the ride cost, the method further comprises:
And the node generates a riding consumption record according to the blockchain account identifier corresponding to the user identifier and the riding cost.
3. The method of claim 1, wherein the transaction record comprises a balance refill record, the method further comprising:
The node obtaining a recharge request, the recharge request indicating a recharge amount and a first target blockchain account;
the node transfers accounts to the first target blockchain account according to the recharging amount;
and if the transfer is successful, the node generates a balance recharging record according to the account identifier of the first target blockchain account and the recharging amount.
4. The method according to claim 1, wherein the method further comprises:
The node obtaining a periodic card purchase request, the periodic card purchase request indicating a periodic card for the requested purchase and a user identification of the requested purchase passenger;
the node transfers accounts to the public blockchain according to the amount corresponding to the periodical card requested to be purchased according to the periodical card purchase request;
And if the transfer is successful, the node generates a periodic card purchase record according to the user identification of the passenger requesting to purchase, the periodic card identification corresponding to the periodic card requesting to purchase and the account identification corresponding to the public blockchain account.
5. The method according to claim 1, wherein the method further comprises:
The node receives a cash-out request, wherein the cash-out request indicates cash-out amount, a target transfer account and a blockchain account of an operator;
The node acquires a transaction record of the operator from the blockchain according to the rendering request;
The node calculates the balance in the blockchain account of the operator according to the transaction record of the operator;
If the balance in the blockchain account of the operator is not lower than the withdrawal amount, the node transfers accounts from the blockchain account of the operator to the target transfer account according to the withdrawal amount;
And if the transfer is successful, the node generates a cash-on-hand transaction record according to the account identifier of the target transfer account, the blockchain account identifier of the operator and the cash-on-hand amount.
6. The method according to any one of claims 2-5, further comprising:
After the node generates a transaction record, the node carries out hash operation on the generated transaction record to obtain abstract data, wherein the transaction record comprises any one of a riding consumption record, a balance recharging record, a periodic card purchasing record and a cash withdrawal transaction record;
the node signs the abstract data through the private key of the node to obtain signature data;
The node generates release data according to the public key of the node, the transaction record and the signature data;
the node publishes the published data to a record pool of the blockchain system to await writing the ride consumption record to the blockchain.
7. The method according to claim 1, wherein the method further comprises:
Acquiring release data in a record pool of the blockchain system, wherein the release data comprises transaction records, signature data and a public key of a release party corresponding to the release data, the signature data is obtained by signing summary data through a private key of the release party, and the summary data is obtained by carrying out hash operation on the transaction records;
Decrypting the signature data in the release data through a public key of a release party corresponding to the release data to obtain first decrypted data; and
Carrying out hash operation on the transaction records in the release data to obtain first data;
If the first data is consistent with the first decryption data, constructing a block according to the consumption record in the release data;
The blockchain is linked to the blockchain and synchronized in the blockchain system.
8. The utility model provides a take a bus and settle accounts device based on blockchain, its characterized in that is applied to the node in the blockchain system, the node is the passenger node that the passenger is located, or the operator node that the operator is located, be equipped with public blockchain account, the corresponding blockchain account of user identification and the blockchain account of a plurality of operators in the blockchain system, public blockchain account is the account of turning into of passenger's purchase cycle card, the device includes:
The system comprises an outbound request receiving module, a gateway module and an outbound request receiving module, wherein the outbound request receiving module is used for receiving an outbound request sent by an outbound gateway, and the outbound request comprises a user identifier of a passenger to be outbound and a first station identifier of an outbound station where the passenger to be outbound is located;
A transaction record acquisition module, configured to acquire a transaction record corresponding to the user identifier from a blockchain of the blockchain system, where the transaction record corresponding to the user identifier includes a transaction record that characterizes a fund flow condition in a blockchain account corresponding to the user identifier, and a transaction record generated by purchasing a periodic card by a passenger indicated by the user identifier;
The control transfer module is used for obtaining the balance in the blockchain account corresponding to the user identifier according to the balance recharging record and the riding consumption record in the transaction record corresponding to the user identifier if the transaction record corresponding to the user identifier does not comprise the periodic card purchasing record or the transaction record corresponding to the user identifier comprises the periodic card purchasing record and the current time is not in the effective riding period of the corresponding periodic card, obtaining the inbound record corresponding to the user identifier according to the user identifier in the outbound request, obtaining the riding charging rule according to the operator corresponding to the first site identifier or the second site identifier, calculating the riding cost according to the riding charging rule, the first site identifier and the second site identifier, and carrying out transfer from the blockchain account corresponding to the user identifier to the blockchain account according to the riding cost if the balance is not lower than the riding cost; and if the transaction record corresponding to the user identifier comprises a periodic card purchase record and the current time is within the effective riding period of the periodic card indicated by the periodic card purchase record, transferring accounts from the public blockchain account to the blockchain account of the operator to which the outbound site belongs according to a preset amount.
CN202010008356.5A 2020-01-03 2020-01-03 Riding settlement method and device based on blockchain Active CN111242603B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010008356.5A CN111242603B (en) 2020-01-03 2020-01-03 Riding settlement method and device based on blockchain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010008356.5A CN111242603B (en) 2020-01-03 2020-01-03 Riding settlement method and device based on blockchain

Publications (2)

Publication Number Publication Date
CN111242603A CN111242603A (en) 2020-06-05
CN111242603B true CN111242603B (en) 2024-06-11

Family

ID=70876003

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010008356.5A Active CN111242603B (en) 2020-01-03 2020-01-03 Riding settlement method and device based on blockchain

Country Status (1)

Country Link
CN (1) CN111242603B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112348976B (en) * 2020-10-15 2022-11-18 成都市以太节点科技有限公司 Railway passenger ticket management method and system
CN112785291A (en) * 2021-01-13 2021-05-11 宁波大学 Public transport multi-payment platform settlement method and system based on block chain
CN115063136A (en) * 2021-03-29 2022-09-16 支付宝(杭州)信息技术有限公司 Bus fare payment method and device

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0624191A (en) * 1992-07-03 1994-02-01 Shibaura Eng Works Co Ltd Prepaid card and processing device and processing system of the card
JPH07244755A (en) * 1994-03-04 1995-09-19 Toshiba Corp Prepaid card type automatic ticket examination device and card reader printer
CN106127478A (en) * 2016-06-20 2016-11-16 上海易码信息科技有限公司 Prepaid card account carrier is used to carry out the method for mobile payment under line
CN108305169A (en) * 2018-02-28 2018-07-20 易百信息技术(上海)股份有限公司 Prepaid card transactions data save method and device
CN108446969A (en) * 2018-03-29 2018-08-24 张文昌 A kind of unified public transport book keeping operation and transaction system based on block chain
CN109241778A (en) * 2018-08-13 2019-01-18 阿里巴巴集团控股有限公司 A kind of public transport data processing method and device based on block chain
CN109299928A (en) * 2018-08-31 2019-02-01 阿里巴巴集团控股有限公司 Charging method and device by bus
CN109801056A (en) * 2019-01-16 2019-05-24 新华三技术有限公司 A kind of method and device of traffic charging
CN110111102A (en) * 2019-03-29 2019-08-09 广东岭南通股份有限公司 A kind of virtual traffic card system and distribution method of commerce based on block chain technology
CN110443603A (en) * 2019-07-26 2019-11-12 南京熊猫电子股份有限公司 A kind of method and system that code passes in and out lock real-time matching and settles accounts by bus for track transportation industry

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20130001439A (en) * 2011-06-27 2013-01-04 주식회사 케이티 Method, application function apparatus, and policy and charging rules function apparatus
CN103379462B (en) * 2012-04-23 2017-03-01 阿尔卡特朗讯 A kind of method and apparatus for processing accounting request
US20150356558A1 (en) * 2014-06-09 2015-12-10 Cubic Corporation Customer authentication based on action the user has done within a transit system
CN110633975B (en) * 2018-06-22 2022-08-26 腾讯科技(深圳)有限公司 Travel control system, method and device in public transport and traffic payment method

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0624191A (en) * 1992-07-03 1994-02-01 Shibaura Eng Works Co Ltd Prepaid card and processing device and processing system of the card
JPH07244755A (en) * 1994-03-04 1995-09-19 Toshiba Corp Prepaid card type automatic ticket examination device and card reader printer
CN106127478A (en) * 2016-06-20 2016-11-16 上海易码信息科技有限公司 Prepaid card account carrier is used to carry out the method for mobile payment under line
CN108305169A (en) * 2018-02-28 2018-07-20 易百信息技术(上海)股份有限公司 Prepaid card transactions data save method and device
CN108446969A (en) * 2018-03-29 2018-08-24 张文昌 A kind of unified public transport book keeping operation and transaction system based on block chain
CN109241778A (en) * 2018-08-13 2019-01-18 阿里巴巴集团控股有限公司 A kind of public transport data processing method and device based on block chain
CN109299928A (en) * 2018-08-31 2019-02-01 阿里巴巴集团控股有限公司 Charging method and device by bus
CN109801056A (en) * 2019-01-16 2019-05-24 新华三技术有限公司 A kind of method and device of traffic charging
CN110111102A (en) * 2019-03-29 2019-08-09 广东岭南通股份有限公司 A kind of virtual traffic card system and distribution method of commerce based on block chain technology
CN110443603A (en) * 2019-07-26 2019-11-12 南京熊猫电子股份有限公司 A kind of method and system that code passes in and out lock real-time matching and settles accounts by bus for track transportation industry

Also Published As

Publication number Publication date
CN111242603A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
US11809608B2 (en) Methods and systems for using digital signatures to create trusted digital asset transfers
CN108369703B (en) Method and system for managing payments and payment alternatives using a cryptocurrency system
JP2023065536A (en) Block chain-implemented method and system
US11108566B2 (en) Methods and systems for using digital signatures to create trusted digital asset transfers
CN110582790A (en) system and method for restricted transaction processing
CN110612546A (en) Digital asset account management
EP3475903A1 (en) Digital asset account management
CN111242603B (en) Riding settlement method and device based on blockchain
US20140372315A1 (en) Method and system for managing data and enabling payment transactions between multiple entities
KR20190028517A (en) Distributing digital assets by transactional devices
US20190005496A1 (en) Managing customer uniqueness in tokenised systems
KR102249864B1 (en) Server and method for credit transaction using blockchain network
CN110008716A (en) Block chain method of commerce and device, electronic equipment, storage medium
WO2022262527A1 (en) Digital currency-based payment method, platform, terminal, and payment system
CN110033370A (en) Account creation method and device, electronic equipment, storage medium
CN107852333A (en) System and method for the mandate of sharable content object
CN114787845A (en) Plan interaction with passwords
CN108352017B (en) Method for identifying fund source of electronic transaction and payment terminal
JP6943282B2 (en) Cryptocurrency payment agency, virtual currency payment agency method and program
CN110009323A (en) Block chain method of commerce and device, electronic equipment, storage medium
CN116802661A (en) Token-based out-of-chain interaction authorization
US20230020553A1 (en) Methods, apparatuses, and systems for user account-affiliated payment and billing, consolidated digital biller-payment wallets
JP6885457B2 (en) Virtual currency payment agency, virtual currency payment agency method and program
KR101878876B1 (en) A method for processing dutch transactions using virtual account and a server, a transaction terminal and a portable terminal performing the method
CN111127006A (en) Transaction processing method and system based on block chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40024174

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant