A Parking Space Sharing Settlement Method and System Based on Blockchain and Smart Contracts
By using blockchain and smart contract technologies, the dynamic allocation and flexible settlement of parking space usage rights have been achieved, solving the single point of failure risk and resource waste problem of centralized platforms, and improving the efficiency and fairness of the parking space sharing system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING TIMES ZHONGTIAN PARKING MANAGEMENT CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-07-31
AI Technical Summary
In existing parking space sharing systems, the risk of single point of failure of centralized platforms leads to reliability and fairness issues, and the lack of a flexible and efficient parking space usage right replenishment mechanism results in resource waste and low sharing efficiency.
By employing blockchain and smart contract technologies, exclusive and supplementary usage right certificates are generated through a priority calculation function. This automates the dynamic allocation and settlement of parking space usage rights, ensuring fairness and transparency. Furthermore, when an exclusive usage right expires early, a supplementary usage right is automatically activated, achieving efficient utilization of parking spaces.
This improved parking space turnover and overall utilization efficiency, reduced transaction friction and operating costs, ensured the accuracy and fairness of the settlement process, and established a sustainable parking space sharing incentive mechanism.
Smart Images

Figure CN122492294A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent transportation and blockchain technology, and in particular to a parking space sharing settlement method and system based on blockchain and smart contracts. Background Technology
[0002] With the continuous growth of urban motor vehicle ownership, parking space shortages have become a widespread problem. To improve parking space utilization, parking space sharing services based on the sharing economy model have emerged. In this technological field, existing conventional practices typically rely on centralized service platforms to coordinate parking space reservations and usage. Users submit reservation requests to the platform via mobile devices, and the platform allocates the right to use a parking space for a specific time period according to a first-come, first-served or simple bidding rule, generating corresponding electronic vouchers. After use, the platform deducts payment from the user's account and settles the account with the parking space owner according to predetermined billing rules.
[0003] This centralized coordination model has inherent flaws. The centralized platform, as the sole trust intermediary and rule enforcer, is responsible for handling all reservation requests, allocating time slots, managing credentials, and completing fund settlements. The reliability and fairness of the entire system highly depend on the platform's stable operation and trustworthy conduct. If the platform server malfunctions or is attacked, reservation queues, usage rights status, and settlement records may be lost or corrupted, leading to disputes among users. The single point of failure risk of the platform operator becomes a critical bottleneck affecting service availability and reliability.
[0004] Furthermore, existing solutions lack a flexible and efficient replenishment mechanism for the dynamic transfer of parking space usage rights. When a user ends their use early, the parking space often remains idle for the remaining time slots. Although some systems allow users to cancel reservations, the re-released time slots require other users to actively initiate new reservation requests before they can be reassigned. This process introduces a time delay, making it impossible to achieve a seamless transition of usage rights. Parking space resources are not fully utilized in the time dimension, resulting in resource waste. Existing methods struggle to automate and accurately match released remaining time slots to subsequent users with potential needs in real time, hindering further improvements in overall sharing efficiency. Summary of the Invention
[0005] This invention provides a parking space sharing settlement method and system based on blockchain and smart contracts, which can solve the problems in the prior art.
[0006] A first aspect of this invention provides a parking space sharing settlement method based on blockchain and smart contracts, comprising:
[0007] Each user terminal exchanges negotiation data containing user identifier, appointment time and location information through the network. Each user terminal inputs all the received negotiation data into a preset priority calculation function to obtain the sorting result.
[0008] Each user terminal calculates the usage period based on its own priority number in the sorting results, generates an exclusive usage right certificate, and generates a supplementary usage right certificate for other user identifiers based on the sorting results. The supplementary usage right certificate records the associated exclusive usage right certificate identifier.
[0009] When the holder of the exclusive right certificate terminates the use early, the server calculates the remaining time, locates the holder of the replacement right certificate associated with the exclusive right certificate, and sends an activation notification containing the remaining time to the holder of the replacement right certificate. The holder of the replacement right certificate updates the usage period according to the remaining time.
[0010] The smart contract executes settlement based on the actual usage duration recorded by the exclusive right certificate. When the holder of the supplementary right certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive right certificate holder's account according to a preset allocation ratio.
[0011] Each user terminal exchanges negotiation data containing user identifiers, appointment times, and location information via the network. Each user terminal inputs all received negotiation data into a preset priority calculation function to obtain the sorting results, including:
[0012] Each user terminal generates negotiation data locally, which includes user identifier, appointment time and location information. The negotiation data is combined with the generation time and a hash value is calculated as the negotiation data identifier.
[0013] Each user terminal carries negotiation data with negotiation data identifiers via network broadcast. Each user terminal receives negotiation data broadcast by other user terminals and deduplicates it according to the negotiation data identifiers. All the deduplicated negotiation data is then arranged in lexicographical order according to the negotiation data identifiers to form an ordered negotiation data set.
[0014] Input the ordered negotiation data set into the preset priority calculation function, perform a hash operation on the ordered negotiation data set to generate a set fingerprint, and use the set fingerprint as a seed to initialize the pseudo-random number generator;
[0015] The pseudo-random number generator generates a random offset for each user identifier in the ordered negotiation data set. The adjusted reservation time is obtained by adding the reservation time of each user identifier to the corresponding random offset.
[0016] Sort user IDs according to the adjusted reservation time. When the adjusted reservation times are the same, sort them according to the distance between the location information and the parking space coordinates. Output the sorted result containing user ID and priority number.
[0017] Each user terminal calculates its usage period based on its own priority number in the sorting results, generates an exclusive usage right certificate, and simultaneously generates supplementary usage right certificates for other users based on the sorting results, including:
[0018] Extract its own priority number from the sorting results, convert its own priority number into a time offset, and then add it to the parking space availability start time to calculate the usage period;
[0019] The usage period is combined with the user's own identifier to generate an exclusive usage right certificate identifier through a hash operation. An asymmetric key pair is derived based on the exclusive usage right certificate identifier. The usage period is digitally signed using the private key in the asymmetric key pair to obtain the usage period signature. The exclusive usage right certificate identifier, the usage period signature, and the public key in the asymmetric key pair are then encapsulated to generate an exclusive usage right certificate.
[0020] Extract all other user identifiers located after its own priority number from the sorting results;
[0021] The exclusive usage right certificate identifier is hashed with each other user identifier to generate a corresponding supplementary association identifier. The hash value difference between the supplementary association identifier and the exclusive usage right certificate identifier is calculated to obtain the identifier difference. The identifier difference is normalized to obtain the supplementary activation weight.
[0022] For each other user identifier, the usage period is used as a backup period. The exclusive usage right certificate identifier, the backup activation weight, and the backup period are encapsulated to generate the corresponding backup usage right certificate.
[0023] Asymmetric key pairs are derived based on the exclusive right-to-use credential identifier. The usage period signature is obtained by digitally signing the usage period using the private key from the asymmetric key pair, including:
[0024] An extended key sequence is obtained by iteratively hashing the exclusive use right certificate identifier. A fixed-length private key seed is extracted from the extended key sequence. The private key seed is then subjected to modulo constraint processing to obtain the private key. Based on the private key, the corresponding public key coordinates are generated by multiplying the base point of an elliptic curve. The public key coordinates are then encoded to obtain the public key. The private key and the public key constitute an asymmetric key pair.
[0025] Convert the usage period into a standard timestamp format to obtain timestamp data, and concatenate the timestamp data with the exclusive right of use certificate identifier in the order of timestamp first to obtain the original data to be signed.
[0026] The original data to be signed is hashed and compressed to obtain a data digest. The data digest is then XORed with the extended key sequence to obtain an enhanced digest.
[0027] The original signature data is generated by performing elliptic curve signature operation on the enhanced digest using the private key in the asymmetric key pair. The signature coordinate values are then extracted from the original signature data and concatenated with the data digest to obtain the composite signature data.
[0028] The hash fingerprint of the extended key sequence is added to the composite signature data to obtain the complete signature data. The complete signature data is then bound and encapsulated with the public key in the asymmetric key pair to obtain the usage period signature.
[0029] When an exclusive usage right certificate holder terminates their use early, the server calculates the remaining duration, locates the associated replacement usage right certificate holder based on the exclusive usage right certificate identifier, and sends an activation notification containing the remaining duration to the replacement usage right certificate holder. The replacement usage right certificate holder then updates their usage period based on the remaining duration, including:
[0030] The server obtains the planned end time and the actual end time of the exclusive usage right certificate, calculates the time difference between the two time points to obtain the remaining duration, and encapsulates the remaining duration and the exclusive usage right certificate identifier to obtain the remaining duration data packet.
[0031] The resource association field is parsed from the exclusive right of use certificate identifier. Based on the resource association field, the list of pre-bound supplementary right of use certificate holders is located, sorted by registration time, and the first supplementary right of use certificate holder is selected as the associated supplementary right of use certificate holder.
[0032] Encapsulate the remaining duration data packet into an activation notification containing the remaining duration and send the activation notification containing the remaining duration to the associated supplementary usage right certificate holder;
[0033] The associated supplementary usage right certificate holder parses the remaining duration, exclusive usage right certificate identifier, and duration verification code from the activation notification containing the remaining duration. The remaining duration and exclusive usage right certificate identifier are hashed to obtain the local verification code. After the verification is passed by comparing with the duration verification code, the start time of the usage period is set to the current time, and the end time of the usage period is set to the current time plus the remaining duration to obtain the updated usage period.
[0034] The resource association field is parsed from the exclusive usage right certificate identifier, and the list of pre-bound supplementary usage right certificate holders is located based on the resource association field, including:
[0035] The exclusive right of use certificate identifier is divided into fields according to a preset delimiter to obtain an identifier field set. The identifier field set is traversed to extract fields with resource association tags to obtain resource association fields. The resource association fields are hashed to obtain resource hash values. The resource hash values are used as index keys to extract the embedded supplementary right of use certificate holder identity identifier set.
[0036] Parse the registration timestamp carried by each identity from the set of identity identifiers of the holders of the supplementary right of use certificate, convert it into a timestamp value and concatenate it with the identity identifier to obtain the time priority code;
[0037] The sorted codes are obtained by sorting the timestamp values in the time priority code in ascending order. The sorted codes are then encapsulated with the corresponding identity identifiers to obtain a pre-bound list of supplementary right holders.
[0038] The smart contract executes settlement based on the actual usage duration recorded in the exclusive usage right certificate. When the holder of the supplementary usage right certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive usage right certificate holder's account according to a preset allocation ratio, including:
[0039] The actual usage duration recorded in the exclusive usage right certificate is calculated by extracting time information from the exclusive usage right certificate. The exclusive settlement amount is generated based on the actual usage duration recorded in the exclusive usage right certificate and hashed to obtain the exclusive settlement certificate.
[0040] The actual usage time generated by the holder of the supplementary right of use certificate using the updated usage period is calculated from the extraction time information of the supplementary right of use certificate, and the supplementary settlement amount is generated based on the actual usage time generated by the holder of the supplementary right of use certificate using the updated usage period.
[0041] The preset allocation ratio is parsed into an allocation coefficient. The supplementary settlement amount is multiplied by the allocation coefficient to obtain the transaction amount transferred to the parking space owner's account and the transaction amount transferred to the exclusive right of use certificate holder's account. The transaction amount transferred to the parking space owner's account and the transaction amount transferred to the exclusive right of use certificate holder's account are hashed to obtain the supplementary settlement certificate.
[0042] Based on the exclusive settlement voucher, the exclusive settlement amount is transferred to the exclusive right-to-use voucher holder's account; based on the supplementary settlement voucher, the owner's transaction amount is transferred to the parking space owner's account and the holder's transaction amount is transferred to the exclusive right-to-use voucher holder's account.
[0043] A second aspect of this invention provides a parking space sharing settlement system based on blockchain and smart contracts, comprising:
[0044] The negotiation and sorting unit is used for each user terminal to exchange negotiation data containing user identifier, appointment time and location information through the network. Each user terminal inputs all the received negotiation data into a preset priority calculation function to obtain the sorting result.
[0045] The certificate generation unit is used by each user terminal to calculate the usage period based on its own priority number in the sorting result, generate an exclusive usage right certificate, and generate a supplementary usage right certificate for other users based on the sorting result. The supplementary usage right certificate records the associated exclusive usage right certificate identifier.
[0046] The supplementary activation unit is used by the server to calculate the remaining time when the exclusive right holder terminates the use early, locate the associated supplementary right holder based on the exclusive right holder identifier, and send an activation notification containing the remaining time to the supplementary right holder. The supplementary right holder updates the usage period according to the remaining time.
[0047] The settlement and allocation unit is used by smart contracts to perform settlement based on the actual usage duration recorded by the exclusive right-to-use certificate. When the holder of the supplementary right-to-use certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive right-to-use certificate holder's account according to the preset allocation ratio.
[0048] A third aspect of the present invention provides an electronic device, comprising:
[0049] processor;
[0050] Memory used to store processor-executable instructions;
[0051] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0052] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0053] This solution utilizes blockchain and smart contracts to build a parking space sharing settlement system, enabling dynamic allocation and flexible settlement of parking space usage rights. By processing all negotiated data through a pre-defined priority calculation function, a globally consistent ranking result is generated, ensuring fairness and transparency in the parking space allocation process and avoiding single points of failure and trust issues that may exist in traditional centralized systems. Each user terminal autonomously generates exclusive and supplementary usage right certificates based on the ranking result. These certificates are linked by identifiers, forming a clear chain of rights and laying a reliable foundation for subsequent ownership transfer and settlement.
[0054] The system supports the dynamic transfer and efficient utilization of parking space usage rights. When a holder of an exclusive usage right certificate terminates their use early, the server can automatically calculate the remaining time and accurately locate the associated holder of the replacement usage right certificate based on the certificate identifier. By sending an activation notification to the replacement holder, the system prompts them to update their usage time in a timely manner, thereby effectively reducing the idle waste of parking space resources. This mechanism significantly improves the turnover rate and overall utilization efficiency of parking spaces, meeting the core requirement of on-demand resource allocation in the sharing economy scenario.
[0055] The automated execution of smart contracts ensures the accuracy, security, and reliability of the settlement process. The contract automatically triggers the settlement process based on the actual usage duration recorded on the exclusive right certificate, requiring no manual intervention. When a supplementary right is activated and actual consumption occurs, the contract automatically transfers the corresponding transaction amount to the accounts of the parking space owner and the original exclusive right holder according to a preset allocation ratio. This blockchain-based automated settlement not only significantly reduces transaction friction and operating costs but also ensures the fairness of revenue distribution among all parties through tamper-proof ledger records, building a sustainable parking space sharing incentive mechanism. Attached Figure Description
[0056] Figure 1 This is a flowchart illustrating the parking space sharing settlement method based on blockchain and smart contracts in this embodiment.
[0057] Figure 2 This is a flowchart of the time-period signature generation and encapsulation operation used in this embodiment. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0059] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0060] Figure 1 This is a flowchart illustrating the parking space sharing settlement method based on blockchain and smart contracts, as described in an embodiment of the present invention. Figure 1 As shown, the parking space sharing settlement method based on blockchain and smart contracts includes:
[0061] Each user terminal exchanges negotiation data containing user identifier, appointment time and location information through the network. Each user terminal inputs all the received negotiation data into a preset priority calculation function to obtain the sorting result.
[0062] Each user terminal calculates the usage period based on its own priority number in the sorting results, generates an exclusive usage right certificate, and generates a supplementary usage right certificate for other user identifiers based on the sorting results. The supplementary usage right certificate records the associated exclusive usage right certificate identifier.
[0063] When the holder of the exclusive right certificate terminates the use early, the server calculates the remaining time, locates the holder of the replacement right certificate associated with the exclusive right certificate, and sends an activation notification containing the remaining time to the holder of the replacement right certificate. The holder of the replacement right certificate updates the usage period according to the remaining time.
[0064] The smart contract executes settlement based on the actual usage duration recorded by the exclusive right certificate. When the holder of the supplementary right certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive right certificate holder's account according to a preset allocation ratio.
[0065] Each user terminal exchanges negotiation data containing user identifiers, appointment times, and location information via the network. Each user terminal inputs all received negotiation data into a preset priority calculation function to obtain the sorting results, including:
[0066] Each user terminal generates negotiation data locally, which includes user identifier, appointment time and location information. The negotiation data is combined with the generation time and a hash value is calculated as the negotiation data identifier.
[0067] Each user terminal carries negotiation data with negotiation data identifiers via network broadcast. Each user terminal receives negotiation data broadcast by other user terminals and deduplicates it according to the negotiation data identifiers. All the deduplicated negotiation data is then arranged in lexicographical order according to the negotiation data identifiers to form an ordered negotiation data set.
[0068] Input the ordered negotiation data set into the preset priority calculation function, perform a hash operation on the ordered negotiation data set to generate a set fingerprint, and use the set fingerprint as a seed to initialize the pseudo-random number generator;
[0069] The pseudo-random number generator generates a random offset for each user identifier in the ordered negotiation data set. The adjusted reservation time is obtained by adding the reservation time of each user identifier to the corresponding random offset.
[0070] Sort user IDs according to the adjusted reservation time. When the adjusted reservation times are the same, sort them according to the distance between the location information and the parking space coordinates. Output the sorted result containing user ID and priority number.
[0071] In the actual operation of the parking space sharing system, each user terminal first needs to build a negotiation data structure locally. The negotiation data contains three core fields: the user identifier, which uses a globally unique hash address and is a 64-bit hexadecimal string. This string is obtained by hashing the public key generated by the user during system initialization using an asymmetric encryption algorithm using SHA-256; the reservation time field records the start time of the user's desired parking space usage, using a Unix timestamp format with second-level precision. For example, if a user wants to use the parking space starting at 14:30 on March 15, 2024, the value of this field is 1710484200; and the location information field uses the WGS-84 coordinate system, containing two floating-point numbers for longitude and latitude, with precision retained to six decimal places. For example, the user's current location is 116.403694 degrees east longitude and 39.915214 degrees north latitude. When generating the negotiation data, the user terminal synchronously obtains the current time of the system clock as the generation time, which also uses a Unix timestamp format.
[0072] To ensure the unique identification of negotiated data during network transmission, the user terminal concatenates the three fields of the negotiated data in a fixed order. Specifically, the 64-bit hexadecimal string of the user identifier is first converted to 32 bytes of binary data. Then, the timestamp of the appointment time is converted to an 8-byte big-endian integer. Next, the longitude and latitude are each converted to 8-byte IEEE 754 double-precision floating-point numbers. Finally, the generation time is converted to an 8-byte big-endian integer. These five binary data segments are concatenated to form a raw data block of 64 bytes. A SHA-256 hash operation is then performed on this raw data block to obtain a 32-byte hash value, which serves as the negotiated data identifier. This construction method ensures that even if two users have identical negotiated content, their negotiated data identifiers will be different due to the difference in generation time, thus avoiding data confusion during network transmission.
[0073] The user terminal broadcasts negotiation data to all nodes within the same local area network (LAN) or a designated subnet via the UDP protocol. The payload of the broadcast data packet contains two fields: a negotiation data identifier (32 bytes) and the negotiation data itself (56 bytes), for a total packet size of 88 bytes. Upon receiving the broadcast data packet, the receiving user terminal first extracts the negotiation data identifier and searches for it in a locally maintained set of received data identifiers. This set is implemented using a hash table structure, resulting in constant-time complexity for the search. If the negotiation data identifier already exists in the set, the packet is discarded; otherwise, it is inserted into the set, and the complete negotiation data is stored in the local negotiation data buffer.
[0074] After the user terminal completes the broadcast and reception phases of the negotiation data, all negotiation data in the buffer needs to be standardized and sorted. The sorting is based on the negotiation data identifier. Since the negotiation data identifier is essentially a 32-byte binary sequence, it is treated as a 256-bit unsigned integer and arranged in ascending order of value. This sorting method is equivalent to lexicographical sorting, that is, comparing byte by byte starting from the most significant byte. After sorting, the user terminal obtains an ordered negotiation data set containing N negotiation data items, where N represents the total number of users participating in this round of parking space sharing negotiation. The order of each element in the ordered negotiation data set remains completely consistent across all normally functioning user terminals; this is the basis for the deterministic nature of subsequent priority calculations.
[0075] To generate a deterministic priority ranking result, the ordered negotiation data set needs to be transformed into a unique set fingerprint. The specific calculation method is as follows: The negotiation data identifiers in the ordered negotiation data set are concatenated sequentially according to their sorting order, forming a continuous data stream of length 32N bytes. A SHA-256 hash operation is then performed on this data stream to obtain a 32-byte set fingerprint. This set fingerprint has the following characteristics: as long as the set of users participating in the negotiation is the same and the negotiation data of each user is completely identical, the result of the set fingerprint will be the same regardless of which user terminal it is calculated on; even a slight change in the negotiation data of any user will result in a completely different set fingerprint.
[0076] Using the set fingerprint as the initialization seed for the pseudo-random number generator ensures that all user terminals generate the same random number sequence. The pseudo-random number generator employs the Mason tween algorithm, which, given a fixed seed, generates a deterministic and periodic random number sequence. During initialization, the 32-byte set fingerprint is converted into four 64-bit unsigned integers, which serve as the initial values for the four state variables of the Mason tween algorithm. The pseudo-random number generator then sequentially generates random offsets for each user identifier in the ordered negotiated data set. Random offset corresponding to each user identifier The next random number is obtained by calling a pseudo-random number generator, and then set to the preset offset upper limit. The modulo operation yields the result, i.e. ,in A typical value is 3600 seconds, indicating that the random offset ranges from 0 to 3599 seconds.
[0077] After obtaining the random offset for each user identifier, calculate the adjusted appointment time. For the ordered negotiation dataset... One user, whose original appointment time was Adjusted appointment time Through formula The calculation yielded the results. This adjustment mechanism introduces randomness, avoiding priority conflicts when multiple users have the same appointment time, while ensuring the determinism of the adjustment result, meaning that the adjusted appointment time sequence calculated by all user terminals is completely consistent.
[0078] When sorting user identifiers based on adjusted reservation times, a stable sorting algorithm is used. The primary sorting key is the adjusted reservation time, arranged in ascending order of timestamp values. When two users have the same adjusted reservation time, a secondary sorting key is used. The calculation of the secondary sorting key involves the distance between the location information and the parking space coordinates. The parking space coordinates also use the WGS-84 coordinate system and are provided by the parking space owner during registration, including longitude. with latitude For the first Each user's location information includes longitude. with latitude spherical distance between user and parking space Calculated using the Havesing formula:
[0079] ,in This represents the Earth's average radius, taken as 6,371,000 meters. The calculated distance... The unit is meters. The secondary sorting keys are arranged in ascending order of distance value, with users who are closer to the parking space receiving higher priority.
[0080] After sorting, a priority number is assigned to each user identifier in the ordered sequence. Priority numbers start from 1 and are sequentially numbered; the user identifier in the first position has a priority number of 1, the second has a priority number of 2, and so on. The final output sorted result uses a key-value pair structure, where the key is a 64-bit hexadecimal string representing the user identifier, and the value is the corresponding priority number. Upon receiving the sorted result, the user terminal can directly look up its own priority number, which will be used as the basis for subsequent calculations of the usage time period. Because all user terminals use the same input data and the same calculation logic, the sorted result remains completely consistent across all user terminals, providing a reliable technical guarantee for parking space sharing coordination in a distributed environment.
[0081] Each user terminal calculates its usage period based on its own priority number in the sorting results, generates an exclusive usage right certificate, and simultaneously generates supplementary usage right certificates for other users based on the sorting results, including:
[0082] Extract its own priority number from the sorting results, convert its own priority number into a time offset, and then add it to the parking space availability start time to calculate the usage period;
[0083] The usage period is combined with the user's own identifier to generate an exclusive usage right certificate identifier through a hash operation. An asymmetric key pair is derived based on the exclusive usage right certificate identifier. The usage period is digitally signed using the private key in the asymmetric key pair to obtain the usage period signature. The exclusive usage right certificate identifier, the usage period signature, and the public key in the asymmetric key pair are then encapsulated to generate an exclusive usage right certificate.
[0084] Extract all other user identifiers located after its own priority number from the sorting results;
[0085] The exclusive usage right certificate identifier is hashed with each other user identifier to generate a corresponding supplementary association identifier. The hash value difference between the supplementary association identifier and the exclusive usage right certificate identifier is calculated to obtain the identifier difference. The identifier difference is normalized to obtain the supplementary activation weight.
[0086] For each other user identifier, the usage period is used as a backup period. The exclusive usage right certificate identifier, the backup activation weight, and the backup period are encapsulated to generate the corresponding backup usage right certificate.
[0087] During the implementation of the parking space sharing settlement system, the user terminal receives the negotiation data from all users and sorts it using a priority calculation function. Based on the sorting results, it needs to calculate the usage period and generate vouchers. The user terminal reads its own priority number from the sorting result data structure. This number reflects the current user's queuing position among all participating users. For example, when the total number of participating users is 5, a user might receive a priority number of 3, indicating that the user is third in the queuing sequence.
[0088] The user terminal converts the obtained priority number into a time offset, and the conversion rule is determined based on the preset usage time unit of the parking space. In a specific application scenario, assuming that parking spaces are allocated according to a standard time unit of 30 minutes per user, when the user's priority number is... At that time, the time offset is calculated as follows: Minutes. The user terminal calculates the time from the start time of parking space availability. The start time of parking space availability may be the current time or a future time preset by the parking space owner. The calculated time offset is added to the start time of parking space availability to obtain the start time of the user's usage period. The end time of the usage period is the start time plus a standard duration unit. For example, if the start time of parking space availability is 14:00 and a user's priority number is 3, then the start time of the user's usage period is 14:00 + (3-1) × 30 minutes = 15:00, and the usage period is from 15:00 to 15:30.
[0089] After calculating the usage period, the user terminal needs to generate a cryptographically secure exclusive usage right credential. The user terminal combines the calculated usage period data with its own user identifier, which can be a unique account address in the blockchain system or an authenticated digital identity. The timestamp of the usage period is concatenated with the user identifier to form a string, which is then processed using the SHA-256 hash function to generate a 256-bit hash value as the exclusive usage right credential identifier. This credential identifier is unique and unpredictable, and can serve as seed data for subsequent key derivation.
[0090] The user terminal derives an asymmetric key pair based on the exclusive access right credential identifier and generates the key pair using an elliptic curve digital signature algorithm. The exclusive access right credential identifier is used as the seed input to a random number generator, and a private key with a length of 256 bits is generated through a deterministic key derivation process. The corresponding public key is calculated based on the elliptic curve parameters and the private key; the public key is represented by the coordinates of a point on the elliptic curve. The private key is securely stored by the user terminal and not transmitted externally, while the public key is encapsulated as part of the credential.
[0091] The user terminal uses the generated private key to digitally sign the usage period data. The start and end times of the usage period are converted into Unix timestamp format to form the data to be signed. The private key is then used to perform an elliptic curve digital signature algorithm on the data to be signed, generating a two-component digital signature, which can be verified using the corresponding public key. The digital signature ensures the integrity and immutability of the usage period data; any modification to the usage period will cause signature verification to fail.
[0092] The user terminal encapsulates the exclusive usage right credential identifier, usage period signature, and public key to form a complete exclusive usage right credential data structure. This data structure can be encoded using JSO7 format or other structured data formats, and includes credential identifier fields, signature fields, public key fields, and usage period fields. After the exclusive usage right credential is generated, it is stored in the user terminal's local storage and can also be uploaded to the blockchain network or server for backup and verification.
[0093] While generating exclusive usage rights certificates, the user terminal also needs to generate supplementary usage rights certificates for other users. The user terminal extracts the identifiers of all other users whose priority numbers are after its own from the sorting results. These users are located after the current user in the queuing sequence. For example, if the current user's priority number is 3 and there are 7 users in the sorting results, then the identifiers of users with priority numbers 4, 5, 6, and 7 need to be extracted.
[0094] For each extracted other user identifier, the user terminal executes the process of generating a supplementary usage right certificate. The exclusive usage right certificate identifier is concatenated with the currently processed other user identifiers, and the result is processed using the SHA-256 hash function to generate a corresponding supplementary association identifier. This supplementary association identifier establishes a cryptographic association between the exclusive usage right certificate and the supplementary usage right certificate, ensuring that the supplementary certificate can only be activated if the corresponding exclusive certificate is released prematurely.
[0095] The user terminal calculates the hash difference between the supplementary association identifier and the exclusive usage right certificate identifier. The two hash values are treated as 256-bit unsigned integers, and a subtraction operation is performed. The absolute value is taken to obtain the identifier difference. This identifier difference reflects the distance between the supplementary association identifier and the exclusive usage right certificate identifier in the hash space, and this distance is used to determine the priority of supplementary activation.
[0096] The identifier difference is normalized by dividing it by the maximum value of a 256-bit unsigned integer, resulting in a normalized value between 0 and 1. This normalized value serves as the supplementary activation weight; a smaller weight indicates a higher activation priority for the supplementary right-to-use certificate in the event of early release of the exclusive right-to-use certificate. The design of the supplementary activation weight allows the system to fairly allocate supplementary rights according to deterministic rules, avoiding human intervention and competition conflicts.
[0097] The user terminal generates a corresponding supplementary usage right certificate for each other user identifier, and uses the usage period corresponding to the exclusive usage right certificate as the waiting period for the supplementary usage right certificate. The waiting period maintains the same time range as the exclusive usage right certificate in the initial state of the supplementary usage right certificate. When the holder of the exclusive usage right certificate terminates the use early, the waiting period will be updated according to the remaining time.
[0098] The user terminal encapsulates the exclusive usage right certificate identifier, the supplementary activation weight, and the waiting period to generate a supplementary usage right certificate data structure. The supplementary usage right certificate adopts a similar data format to the exclusive usage right certificate, including a certificate identifier field, an associated exclusive usage right certificate identifier field, a supplementary activation weight field, a waiting period field, and a target user identifier field. After generation, the supplementary usage right certificate is sent to other corresponding user terminals via a blockchain network or peer-to-peer communication. These other user terminals receive and store the supplementary usage right certificate, awaiting any subsequent activation notifications.
[0099] The entire voucher generation process uses cryptographic algorithms to ensure the uniqueness, unforgeability, and verifiability of the vouchers. A fair time-slot replacement mechanism is implemented through the design of replacement activation weights, providing a reliable voucher basis for subsequent parking space usage and settlement operations.
[0100] like Figure 2 As shown, Figure 2 This is a flowchart of the time-period signature generation and encapsulation operation used in this embodiment.
[0101] Asymmetric key pairs are derived based on the exclusive right-to-use credential identifier. The usage period signature is obtained by digitally signing the usage period using the private key from the asymmetric key pair, including:
[0102] An extended key sequence is obtained by iteratively hashing the exclusive use right certificate identifier. A fixed-length private key seed is extracted from the extended key sequence. The private key seed is then subjected to modulo constraint processing to obtain the private key. Based on the private key, the corresponding public key coordinates are generated by multiplying the base point of an elliptic curve. The public key coordinates are then encoded to obtain the public key. The private key and the public key constitute an asymmetric key pair.
[0103] Convert the usage period into a standard timestamp format to obtain timestamp data, and concatenate the timestamp data with the exclusive right of use certificate identifier in the order of timestamp first to obtain the original data to be signed.
[0104] The original data to be signed is hashed and compressed to obtain a data digest. The data digest is then XORed with the extended key sequence to obtain an enhanced digest.
[0105] The original signature data is generated by performing elliptic curve signature operation on the enhanced digest using the private key in the asymmetric key pair. The signature coordinate values are then extracted from the original signature data and concatenated with the data digest to obtain the composite signature data.
[0106] The hash fingerprint of the extended key sequence is added to the composite signature data to obtain the complete signature data. The complete signature data is then bound and encapsulated with the public key in the asymmetric key pair to obtain the usage period signature.
[0107] In parking space sharing systems, to ensure the integrity and non-repudiation of usage time data, a dedicated key pair is derived based on the exclusive usage right credential identifier and digitally signed. The exclusive usage right credential identifier is typically a 64-byte hexadecimal string containing a combination of the credential generation timestamp and the user's hash value. When performing iterative hash expansion on this identifier, the SHA-256 algorithm is first used to hash the credential identifier to obtain an initial hash value. Then, the initial hash value is concatenated with the credential identifier, and another hash operation is performed. This iterative process is repeated 15 times, with each iteration outputting 32 bytes, ultimately forming a 480-byte extended key sequence. Starting from the 128th byte of the extended key sequence, a continuous 32 bytes are extracted as the private key seed. This seed, after modulo constraint processing, must satisfy the finite field constraint of the elliptic curve secp256k1. This is specifically achieved by calculating the modulo operation of the private key seed with respect to the order of the curve, ensuring the result falls within the finite field constraints. Within the range, This represents the order of the elliptic curve. The processed value is the private key. Its bit length is 256 bits.
[0108] Elliptic curve dot product is used when generating the public key, and the private key is... The base point of the secp256k1 curve Perform scalar multiplication to calculate the coordinates of points on the elliptic curve. The coordinates of this point are determined by the x-axis. with the vertical axis The structure consists of 32 bytes for each coordinate. Due to the symmetry of the elliptic curve, a compressed format can be used to encode the public key, and the ordinate... Parity is indicated by a single-byte prefix, either 0x02 or 0x03, and is related to the x-coordinate. Concatenate the public key to form a 33-byte compressed public key. If using an uncompressed format, add a 0x04 prefix before the x and y axes to form a complete 65-byte public key. After encoding the public key, the private key... Together with the corresponding compressed or uncompressed public key, they form an asymmetric key pair, which is valid only for the lifetime of the current exclusive right of use credential.
[0109] The time period includes two key parameters: start time and end time. When converting to the standard timestamp format, the UTC time zone is used as the base, and the start and end times are converted to second-level timestamps starting from 00:00 on January 1, 1970. The timestamp corresponding to the start time is denoted as... The timestamp corresponding to the end time is . Both timestamps are 10-digit decimal integers. The two timestamps are organized into timestamp data in order of start time first, followed by end time, and connected by a fixed separator (0x7C), forming a 21-byte timestamp data structure. When concatenating the timestamp data with the exclusive usage right certificate identifier, the order of timestamps must be strictly followed: first write the 21-byte timestamp data, then write the 64-byte certificate identifier, resulting in 85 bytes of original data to be signed.
[0110] The SHA-256 algorithm is used to perform hash compression on the original data to be signed, compressing the 85-byte input into a 32-byte data digest. To enhance the signature's collision resistance, the data digest is XORed with the aforementioned extended key sequence. 32 bytes, starting from byte 320 of the extended key sequence, are extracted as the mixing key. XOR operation This yields a 32-byte enhanced digest. This enhanced digest introduces a derived feature of the exclusive right-to-use credential identifier, so that different credentials will produce completely different digest values even if they are signed for the same usage period.
[0111] Elliptic curve signature computation follows the ECDSA algorithm specification and selects random numbers. As a temporary key, calculate the elliptic curve points. Extraction point x-coordinate Then take the modulus of the curve order. Calculate the signature parameters. ,in random numbers In the model Multiplicative inverse in the sense of the original signature data. With parameters The data is composed of 32-byte values, totaling 64 bytes. The signature coordinates extracted from the original signature data are... Yes, compare the coordinate values with the data summary. During the concatenation process, a 64-byte signature coordinate value is first written, followed by a 32-byte data digest, forming a 96-byte composite signature data.
[0112] To support key sequence tracing during signature verification, a hash fingerprint needs to be generated from the extended key sequence. The SHA-256 algorithm is used to hash the complete 480-byte extended key sequence, and the first 16 bytes of the result are used as the hash fingerprint. The hash fingerprint is appended to the end of the composite signature data, forming a complete 112-byte signature data. When the complete signature data is bound and encapsulated with the public key in the asymmetric key pair, an encapsulation structure containing the public key identifier, signature data, and version information is constructed. The public key identifier is obtained by performing a RIPEMD-160 hash operation on the public key to obtain a 20-byte hash value, and the version information occupies 2 bytes to identify the signature algorithm type and parameter configuration. The encapsulation structure is organized in the order of version information, public key identifier, and complete signature data, with a total length of 134 bytes. A 4-byte checksum is added to the end of the encapsulation structure. The checksum is obtained by performing a double SHA-256 hash operation on the aforementioned 134 bytes of data and taking the first 4 bytes, finally forming a 138-byte usage-time signature data packet.
[0113] After receiving the usage period signature, the parking space server first parses the version information from the encapsulation structure to verify the signature algorithm compatibility, and extracts the public key identifier and complete signature data. Based on the public key identifier, it retrieves the corresponding complete public key from the distributed ledger and uses this public key to verify the signature data. During the verification process, the enhanced digest is reconstructed, and the parameters from the signature coordinate values are substituted into the verification formula. and Calculate the points of the elliptic curve If point x-coordinate and signature coordinates If they are equal, the verification passes. After successful verification, the data digest is extracted from the composite signature data and compared with the recalculated original data digest to confirm that the data used during the period has not been tampered with. The hash fingerprint is used to verify the correctness of the extended key sequence, prevent man-in-the-middle attacks during the key derivation process, and ensure that the signer truly holds a valid exclusive right to use the data.
[0114] When an exclusive usage right certificate holder terminates their use early, the server calculates the remaining duration, locates the associated replacement usage right certificate holder based on the exclusive usage right certificate identifier, and sends an activation notification containing the remaining duration to the replacement usage right certificate holder. The replacement usage right certificate holder then updates their usage period based on the remaining duration, including:
[0115] The server obtains the planned end time and the actual end time of the exclusive usage right certificate, calculates the time difference between the two time points to obtain the remaining duration, and encapsulates the remaining duration and the exclusive usage right certificate identifier to obtain the remaining duration data packet.
[0116] The resource association field is parsed from the exclusive right of use certificate identifier. Based on the resource association field, the list of pre-bound supplementary right of use certificate holders is located, sorted by registration time, and the first supplementary right of use certificate holder is selected as the associated supplementary right of use certificate holder.
[0117] Encapsulate the remaining duration data packet into an activation notification containing the remaining duration and send the activation notification containing the remaining duration to the associated supplementary usage right certificate holder;
[0118] The associated supplementary usage right certificate holder parses the remaining duration, exclusive usage right certificate identifier, and duration verification code from the activation notification containing the remaining duration. The remaining duration and exclusive usage right certificate identifier are hashed to obtain the local verification code. After the verification is passed by comparing with the duration verification code, the start time of the usage period is set to the current time, and the end time of the usage period is set to the current time plus the remaining duration to obtain the updated usage period.
[0119] During the use of shared parking spaces, it is common to encounter situations where holders of exclusive usage rights terminate their use prematurely. To fully utilize the remaining time slots, a precise mechanism for calculating remaining time and activating replacement permissions is needed. The server monitors the status changes of exclusive usage rights in real time to capture premature termination events. When it detects that the holder of the exclusive usage rights terminates the use via the parking space exit sensor, manually via the mobile application, or when no vehicle signal is detected after the timeout, the remaining time calculation process is immediately triggered.
[0120] The server extracts the planned end time field from the exclusive usage right certificate's data structure. This field is automatically set based on the reservation duration when the certificate is generated. For example, if a user reserves a parking space for 3 hours with a start time of 14:00, the planned end time is recorded as 17:00. Simultaneously, the server obtains the actual end time, which is derived from the vehicle departure time reported by the parking space sensor or the user's actively submitted request to end the usage period. If the user leaves early at 15:30, the actual end time is recorded as 15:30. The two time points are processed using a time difference calculation function, parsed using a standard time format, and then subtracted to obtain a remaining duration of 90 minutes.
[0121] To ensure the integrity and tamper-proof nature of the remaining time data during transmission, the server encapsulates the remaining time and the exclusive usage right credential identifier in a structured manner. During encapsulation, a JSO7 formatted data object is constructed, containing three core fields: the remaining time field records the value 90 in minutes, the exclusive usage right credential identifier field records the complete credential hash value, and the timestamp field records the time the encapsulation was generated. After encapsulation, the server performs a hash operation on the entire data object to generate a time verification code, which is then embedded as an additional field into the data packet, forming a remaining time data packet containing the verification mechanism.
[0122] Locating the holder of the supplementary right-to-use certificate requires parsing the resource association field in the exclusive right-to-use certificate identifier. The exclusive right-to-use certificate identifier uses a multi-segment structure, including the parking space number segment, time period identifier, user sequence number segment, and resource association field. The resource association field records the index of all reservation records for this parking space during the current time period. By extracting the 16-bit hexadecimal code from this field, the server can quickly access the corresponding set of reservation records in the distributed database. This set of records contains information on all holders of supplementary right-to-use certificates generated for this parking space during this time period. Each record includes the user identifier, registration time, supplementary priority, and contact information.
[0123] The server performs a time-based sorting operation on the obtained list of supplementary right holders. The registration time field records the precise moment each user generated their supplementary right holder's certificate, stored in Unix timestamp format. The sorting algorithm uses quicksort, with ascending order of registration time as the sorting criterion, ensuring that the earliest registered supplementary user is at the top of the list. In scenarios with multiple supplementary users, for example, five users generating supplementary certificates at 14:05, 14:12, 14:08, 14:20, and 14:15 respectively, the sorted order is 14:05, 14:08, 14:12, 14:15, and 14:20. The server extracts the first element of the sorted list to obtain the user's complete information as the associated supplementary right holder.
[0124] The activation notification encapsulation requires integrating the remaining duration data packet and notification protocol fields. The server creates a notification message object, embedding the remaining duration data packet as the payload, and adding message type identifier, priority flag, expiration time, and retry mechanism parameters. The message type identifier is set to "FALLBACK_ACTIVATIO7", the priority flag is set to high priority to ensure timely delivery, and the expiration time is set to 50% of the remaining duration to avoid a significant reduction in available time due to notification delays. The retry mechanism is set to attempt three pushes, each 5 seconds apart. If no confirmation response is received after three attempts, the notification is sent to the next lower priority user in the list.
[0125] The notification process employs a multi-channel push strategy, simultaneously sending messages to the mobile applications of associated supplementary usage right holders, sending SMS notifications, and triggering email alerts. Mobile application pushes are delivered in real-time via WebSocket persistent connections. SMS notifications include parking space location, remaining time, and a confirmation link, while email alerts provide detailed usage instructions and credential activation steps. This multi-channel strategy ensures users receive activation signals promptly in various usage scenarios, improving the effective utilization rate of supplementary permissions.
[0126] Upon receiving the activation notification, the mobile application automatically parses the notification message body. The parsing module extracts the remaining duration field, the exclusive usage right certificate identifier field, and the duration verification code field from the JSO7 structure. The remaining duration field is parsed as the integer 90, the exclusive usage right certificate identifier is parsed as a 64-byte hexadecimal string, and the duration verification code is parsed as a 32-byte hash value. To prevent man-in-the-middle attacks or data tampering, the mobile application performs verification calculations locally, concatenating the parsed remaining duration and exclusive usage right certificate identifier into a string in a predetermined order, and performing a SHA-256 hash operation on this string to generate a local verification code.
[0127] The local verification code is compared byte-by-byte with the duration verification code carried in the notification, using a constant time comparison algorithm to avoid the risk of timing attacks. If the two verification codes match exactly, the verification passes, confirming that the remaining duration and credential identifier have not been tampered with and are of reliable origin. If verification fails, the mobile application refuses the activation operation and reports the anomaly to the server, while also alerting the user that the notification data may pose a security risk. After successful verification, the mobile application enters the usage time update process.
[0128] The usage period update operation directly modifies the time field of the replacement usage right certificate. The mobile application obtains the device's current time as the start time of the usage period, which is calibrated using the Network Time Protocol (NTP) to ensure accuracy. Assuming the user receives the activation notification and confirms use at 15:32, the start time of the usage period is set to 15:32. The end time of the usage period is calculated by adding the current time 15:32 to the remaining 90 minutes, resulting in an end time of 17:02. The updated usage period extends from 15:32 to 17:02, during which the replacement usage right certificate holder can legally use the parking space.
[0129] After the update, the mobile application synchronizes the updated usage time slots to the blockchain network. A voucher update transaction is generated, containing the new start and end times. This transaction uses the hash value of the original supplementary usage right voucher as the parent voucher and records the activation notification identifier and verification code as traceability. The transaction is digitally signed and broadcast to the blockchain network. After consensus verification, it is written into a new block, changing the supplementary usage right voucher's status from pending activation to activated. The smart contract monitors changes in voucher status and automatically updates the parking space occupancy schedule to ensure that subsequent reservation requests do not conflict with the already activated supplementary usage time slots.
[0130] To address situations where replacement users fail to respond to activation notifications promptly, a timeout degradation mechanism is implemented on the server side. If the first replacement user does not confirm activation within 5 minutes, the server automatically sends a notification to the next highest priority replacement user, and so on, until the remaining time is exhausted or activation is successful. This mechanism is implemented through a priority queue and a timer to ensure maximum utilization of parking space resources and prevent the waste of remaining time due to unresponsive notifications. The entire remaining time calculation and replacement activation process is implemented using a distributed event-driven architecture, with each step decoupled through message queues to ensure system stability and responsiveness under high concurrency scenarios.
[0131] The resource association field is parsed from the exclusive usage right certificate identifier, and the list of pre-bound supplementary usage right certificate holders is located based on the resource association field, including:
[0132] The exclusive right of use certificate identifier is divided into fields according to a preset delimiter to obtain an identifier field set. The identifier field set is traversed to extract fields with resource association tags to obtain resource association fields. The resource association fields are hashed to obtain resource hash values. The resource hash values are used as index keys to extract the embedded supplementary right of use certificate holder identity identifier set.
[0133] Parse the registration timestamp carried by each identity from the set of identity identifiers of the holders of the supplementary right of use certificate, convert it into a timestamp value and concatenate it with the identity identifier to obtain the time priority code;
[0134] The sorted codes are obtained by sorting the timestamp values in the time priority code in ascending order. The sorted codes are then encapsulated with the corresponding identity identifiers to obtain a pre-bound list of supplementary right holders.
[0135] In the actual operation of a parking space sharing system, when a holder of an exclusive right-to-use certificate terminates their use of a parking space early, it is necessary to quickly and accurately locate all associated holders of replacement right-to-use certificates. To achieve this, when generating an exclusive right-to-use certificate, special resource association information is embedded in its identifier. This information establishes a mapping relationship with the holders of replacement right-to-use certificates through specific coding rules.
[0136] Exclusive access rights credential identifiers typically consist of multiple fields, distinguished by preset delimiters. These delimiters can be underscores, vertical bars, or specific control characters. For example, using double underscores as delimiters, a typical exclusive access rights credential identifier might present a structure with a primary user identifier area (double underscores), a timestamp area (double underscores), a resource association marker, and a resource information checksum (double underscores). During field segmentation, the complete credential identifier string is split according to the preset delimiters, resulting in a set of identifier fields containing several independent fields. For example, splitting the credential identifier USER001__20240115103000__RES#ParkingLot05Slot12__CRC8A3 yields a set containing four elements: USER001, 20240115103000, RES#ParkingLot05Slot12, and CRC8A3.
[0137] When traversing the set of identifier fields, it is necessary to check whether each field carries a resource association marker. A resource association marker is a pre-defined prefix or identifier used to identify that the field contains resource association information. In this implementation scenario, RES# is used as the resource association marker; when a field begins with RES#, it indicates that the field is a resource association field. Through string matching or regular expression detection, the resource association field RES#ParkingLot05Slot12 is extracted from the set of identifier fields. The content of this field after removing the marker prefix, ParkingLot05Slot12, is the actual resource association information, identifying the specific parking lot number and parking space number.
[0138] After obtaining the resource association field, it needs to be hashed to generate a resource hash value. The hash operation uses standard hash algorithms such as SHA-256 or MD5 to convert the string content of the resource association field into a fixed-length hash value. Performing a SHA-256 operation on the string "ParkingLot05Slot12" might yield a hexadecimal hash value like "7f3b8a92e1d4c56a0b9e8f2d3c1a5e4b6d7c8f9a0b1c2d3e4f5a6b7c8d9e0f1a". This hash value is unique and irreversible, and can be used as a stable index key.
[0139] In the system's data storage layer, a mapping table is pre-established using resource hash values as index keys. This mapping table is constructed synchronously when a user makes a parking space reservation and when a supplementary usage right certificate is generated, storing the set of identity identifiers of all supplementary usage right certificate holders corresponding to each exclusive usage right certificate under the corresponding hash value index. Using the resource hash value 7f3b8a92e1d4c56a0b9e8f2d3c1a5e4b6d7c8f9a0b1c2d3e4f5a6b7c8d9e0f1a as the query key, the set of identity identifiers of supplementary usage right certificate holders associated with the exclusive usage right certificate is retrieved from the mapping table. This set may contain the identity identifiers of multiple users such as USER005, USER012, and USER023.
[0140] When the supplementary usage right certificate holder's identity is generated, a registration timestamp is attached. The registration timestamp records the precise time when the user submitted the supplementary appointment request, typically in a complete time representation of year, month, day, hour, minute, second, and millisecond. The identity identifier can carry the timestamp by connecting specific separators, such as USER005@20240115091523456, where the string of numbers after the @ symbol is the registration timestamp, indicating that the user submitted the supplementary appointment request at 09:15:23:456 on January 15, 2024.
[0141] When parsing the registration timestamp from the identity identifier, the identity identifier and timestamp are separated through string splitting. For the format USER005@20240115091523456, the @ symbol is used as the separator to extract USER005 as the pure identity identifier and 20240115091523456 as the timestamp string. The process of converting the timestamp string to a timestamp value involves calculating each part of the year, month, day, hour, minute, second, and millisecond according to the time base, converting it to the number of milliseconds or microseconds since a fixed point in time. For example, converting it to Unix timestamp format yields a pure numerical form like 1705294523456.
[0142] After converting the timestamp values, they need to be concatenated with the corresponding identity identifiers to generate time priority codes. The concatenation method uses the timestamp value first, followed by the identity identifier, using a specific connector, such as an underscore, to obtain an code like 1705294523456_USER005. This encoding method makes the timestamp value the primary sorting criterion, with the identity identifier appended as secondary identification information. The same conversion and concatenation operation is performed on each member of the identity identifier set, resulting in a time priority code set containing elements such as 1705294523456_USER005, 1705294528891_USER012, and 1705294531247_USER023.
[0143] The codes are sorted in ascending order based on the timestamp values in the time priority codes, which essentially sorts them according to the order in which users submitted their supplementary reservation requests. Efficient algorithms such as quicksort or mergesort can be used for sorting. The comparison rule involves extracting the numerical portion before the underscore in the code and comparing its size. After sorting, codes with smaller timestamp values are placed first, followed by codes with larger timestamp values, resulting in the ordered sequence of codes 1705294523456_USER005, 1705294528891_USER012, and 1705294531247_USER023.
[0144] The sorted coded sequences are encapsulated with their corresponding identity identifiers to construct the final list of holders of supplementary usage right certificates. The encapsulation operation parses each time priority code, extracting the timestamp value and identity identifier to construct a structured data object containing complete information such as sequence number, identity identifier, registration timestamp, and priority level. For example, the first record is encapsulated as a data item containing sequence number 1, identity identifier USER005, registration timestamp 1705294523456, and a "high" priority level; the second record is encapsulated as sequence number 2, identity identifier USER012, registration timestamp 1705294528891, and a "middle" priority level. The entire list is organized as an array or linked list, with each element corresponding to the complete information of a holder of a supplementary usage right certificate. The list order strictly follows the chronological order of the registration timestamps, ensuring that users who submit supplementary reservations earlier have a higher priority to receive the remaining time activation notification.
[0145] This mechanism, which generates a list of holders by parsing resource association fields, locating them using hash indexes, and sorting them by timestamps, enables rapid and accurate replacement of users and fair allocation of remaining time when a holder of an exclusive right to use the parking space terminates their use early. This ensures efficient use of parking space resources and reasonable protection of user rights.
[0146] The smart contract executes settlement based on the actual usage duration recorded in the exclusive usage right certificate. When the holder of the supplementary usage right certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive usage right certificate holder's account according to a preset allocation ratio, including:
[0147] The actual usage duration recorded in the exclusive usage right certificate is calculated by extracting time information from the exclusive usage right certificate. The exclusive settlement amount is generated based on the actual usage duration recorded in the exclusive usage right certificate and hashed to obtain the exclusive settlement certificate.
[0148] The actual usage time generated by the holder of the supplementary right of use certificate using the updated usage period is calculated from the extraction time information of the supplementary right of use certificate, and the supplementary settlement amount is generated based on the actual usage time generated by the holder of the supplementary right of use certificate using the updated usage period.
[0149] The preset allocation ratio is parsed into an allocation coefficient. The supplementary settlement amount is multiplied by the allocation coefficient to obtain the transaction amount transferred to the parking space owner's account and the transaction amount transferred to the exclusive right of use certificate holder's account. The transaction amount transferred to the parking space owner's account and the transaction amount transferred to the exclusive right of use certificate holder's account are hashed to obtain the supplementary settlement certificate.
[0150] Based on the exclusive settlement voucher, the exclusive settlement amount is transferred to the exclusive right-to-use voucher holder's account; based on the supplementary settlement voucher, the owner's transaction amount is transferred to the parking space owner's account and the holder's transaction amount is transferred to the exclusive right-to-use voucher holder's account.
[0151] In parking space sharing scenarios, the settlement process is automated through smart contracts to handle processing and fund allocation. After the holder of the exclusive right to use the parking space completes their use, the smart contract first extracts the entry and exit timestamps from the time field of the certificate; the difference between the two is the actual usage duration. Billing is based on a preset unit time standard. The exclusive settlement amount was calculated. To ensure the immutability of on-chain settlements, the settlement amount will be exclusively controlled. The exclusive settlement document is generated by hashing the unique identifier of the exclusive right certificate. This hash value serves as the triggering credential for subsequent on-chain transfers, ensuring that the binding relationship between the settlement amount and the usage record cannot be forged.
[0152] When the holder of the supplementary usage right certificate receives the activation notification and actually uses the updated usage period, the smart contract also extracts the time information from the supplementary usage right certificate. The supplementary usage right certificate records the originally allocated time period and the updated actual usage period. By parsing the updated start and end timestamps, the actual usage duration of the supplementary usage right certificate holder is calculated. Based on the same billing standard Generate supplementary settlement amount The special feature of supplementary settlement is that the amount needs to be allocated between the parking space owner and the holder of the exclusive right of use certificate, because the holder of the exclusive right of use certificate released the right of use in advance, making supplementary use possible.
[0153] The pre-defined allocation ratio is written into the contract code during smart contract deployment. For example, the allocation ratio might be set so that the parking space owner receives 70% of the supplementary settlement amount, and the holder of the exclusive right to use the parking space receives 30%. The smart contract resolves this ratio into two allocation coefficients. and ,in In the example above, , The transaction amount transferred to the parking space owner's account is calculated using multiplication. Transaction amount transferred to the exclusive right certificate holder's account .
[0154] To prevent data tampering during on-chain transfers, the amounts of the two transactions are hashed together with the identifier of the supplementary right-to-use certificate to generate a supplementary settlement certificate. .
[0155] The smart contract receives the exclusive settlement certificate Next, the validity of the hash value is verified by recalculating the exclusive settlement amount and comparing the hashes to confirm that the data has not been tampered with. Once verification is successful, an on-chain transfer operation is triggered to transfer the exclusive settlement amount. The transaction is transferred from the contract escrow account to the blockchain account of the exclusive usage right certificate holder. This transfer record is written into a new block, containing information such as the transaction initiator's address, the recipient's address, the transaction amount, and a timestamp. After consensus verification by network nodes, the transaction status is marked as confirmed.
[0156] For supplementary settlement vouchers The smart contract executes a double transfer operation. First, it triggers the owner's transaction amount. The transfer to the parking space owner's account is recorded in a separate transaction hash. This subsequently triggers a transaction for the holder. The transfer to the exclusive usage right certificate holder's account also generates a separate transaction hash. Both transfer operations must meet the gas consumption limit preset by the smart contract, and the state machine transition is performed through the Ethereum Virtual Machine or other blockchain virtual machines to ensure the atomicity of the account balance update. When executing a transfer, the smart contract checks whether the supplementary settlement certificate has been used, and prevents the same certificate from triggering a transfer repeatedly by maintaining a mapping table of used certificates.
[0157] In practical applications, the account of an exclusive usage right certificate holder may receive two payments within a short period: one from the settlement of their own exclusive use, and the other from the share generated by the supplementary usage right certificate holder using their early release period. The smart contract maintains a transaction log on-chain, recording the source certificate hash, transaction amount, transfer timestamp, and block height for each transaction, providing a traceable data foundation for subsequent auditing and dispute resolution.
[0158] To ensure settlement accuracy, the smart contract uses second-level precision when calculating actual usage time, and the timestamp is stored in U7IX time format. When the departure timestamp recorded on the exclusive usage right certificate is earlier than the predetermined end timestamp, the difference represents the remaining time released early. This remaining time is transmitted to the holder of the replacement usage right certificate via an activation notification. After updating their usage period, the holder of the replacement usage right certificate cannot exceed the received remaining time in actual usage time. The smart contract compares the actual usage time... With remaining time ,make sure This is to prevent settlement errors caused by exceeding the time limit.
[0159] The allocation coefficient design takes into account the balance of interests among multiple parties. Parking space owners, as providers of parking space resources, still need to receive the main benefit in the replenishment usage scenario. Holders of exclusive usage rights, by releasing their usage rights early, promote increased parking space utilization and therefore receive a portion of the replenishment settlement amount as an incentive. The specific allocation ratio can be adjusted according to different application scenarios. For example, during peak hours, the share for holders of exclusive usage rights may be increased to 40% to encourage more users to proactively release their idle time slots.
[0160] Before executing a transfer, the smart contract checks if the balance in the contract's escrow account is sufficient to cover all outstanding settlement amounts. If the balance is insufficient, the contract triggers an exception handling mechanism, suspending the settlement process and sending a notification to the relevant user terminal indicating insufficient balance. Holders of supplementary usage rights certificates need to complete a prepayment before using the parking space, transferring the supplementary settlement amount. The funds are locked in the escrow account of the smart contract in advance to ensure that there are sufficient funds for distribution during subsequent settlement.
[0161] The hash operation uses the SHA-256 algorithm to generate a 256-bit hash value. Exclusive settlement voucher. With supplementary settlement vouchers All transactions are stored in the smart contract state variables on the blockchain. Any query operation on the settlement voucher will consume a small gas fee, but will not modify the on-chain state. User terminals can verify the authenticity of the settlement operation by calling the read-only function of the smart contract, entering the voucher identifier, and querying the corresponding settlement voucher hash value.
[0162] In a multi-tiered supplementary settlement scenario, if the holder of the supplementary usage right certificate releases the usage right prematurely, triggering a second-tier supplementary usage, the smart contract will generate a new supplementary settlement certificate and calculate the transaction amount for each party according to the multi-tiered allocation rules. At this point, the original exclusive usage right certificate holder can still receive a smaller percentage of the proceeds from the second-tier supplementary settlement, forming a multi-tiered profit-sharing mechanism. All settlement certificates establish a traceability link through the associated exclusive usage right certificate identifier, ensuring the transparency and auditability of fund flows.
[0163] A second aspect of this invention provides a parking space sharing settlement system based on blockchain and smart contracts, comprising:
[0164] The negotiation and sorting unit is used for each user terminal to exchange negotiation data containing user identifier, appointment time and location information through the network. Each user terminal inputs all the received negotiation data into a preset priority calculation function to obtain the sorting result.
[0165] The certificate generation unit is used by each user terminal to calculate the usage period based on its own priority number in the sorting result, generate an exclusive usage right certificate, and generate a supplementary usage right certificate for other users based on the sorting result. The supplementary usage right certificate records the associated exclusive usage right certificate identifier.
[0166] The supplementary activation unit is used by the server to calculate the remaining time when the exclusive right holder terminates the use early, locate the associated supplementary right holder based on the exclusive right holder identifier, and send an activation notification containing the remaining time to the supplementary right holder. The supplementary right holder updates the usage period according to the remaining time.
[0167] The settlement and allocation unit is used by smart contracts to perform settlement based on the actual usage duration recorded by the exclusive right-to-use certificate. When the holder of the supplementary right-to-use certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive right-to-use certificate holder's account according to the preset allocation ratio.
[0168] A third aspect of the present invention provides an electronic device, comprising:
[0169] processor;
[0170] Memory used to store processor-executable instructions;
[0171] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0172] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0173] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0174] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A parking space sharing settlement method based on blockchain and smart contracts, characterized in that, include: Each user terminal exchanges negotiation data containing user identifier, appointment time and location information through the network. Each user terminal inputs all the received negotiation data into a preset priority calculation function to obtain the sorting result. Each user terminal calculates the usage period based on its own priority number in the sorting results, generates an exclusive usage right certificate, and generates a supplementary usage right certificate for other user identifiers based on the sorting results. The supplementary usage right certificate records the associated exclusive usage right certificate identifier. When the holder of the exclusive right certificate terminates the use early, the server calculates the remaining time, locates the holder of the replacement right certificate associated with the exclusive right certificate, and sends an activation notification containing the remaining time to the holder of the replacement right certificate. The holder of the replacement right certificate updates the usage period according to the remaining time. The smart contract executes settlement based on the actual usage duration recorded by the exclusive right certificate. When the holder of the supplementary right certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive right certificate holder's account according to a preset allocation ratio.
2. The method according to claim 1, characterized in that, Each user terminal exchanges negotiation data containing user identifiers, appointment times, and location information via the network. Each user terminal inputs all received negotiation data into a preset priority calculation function to obtain the sorting results, including: Each user terminal generates negotiation data locally, which includes user identifier, appointment time and location information. The negotiation data is combined with the generation time and a hash value is calculated as the negotiation data identifier. Each user terminal carries negotiation data with negotiation data identifiers via network broadcast. Each user terminal receives negotiation data broadcast by other user terminals and deduplicates it according to the negotiation data identifiers. All the deduplicated negotiation data is then arranged in lexicographical order according to the negotiation data identifiers to form an ordered negotiation data set. Input the ordered negotiation data set into the preset priority calculation function, perform a hash operation on the ordered negotiation data set to generate a set fingerprint, and use the set fingerprint as a seed to initialize the pseudo-random number generator; The pseudo-random number generator generates a random offset for each user identifier in the ordered negotiation data set. The adjusted reservation time is obtained by adding the reservation time of each user identifier to the corresponding random offset. Sort user IDs according to the adjusted reservation time. When the adjusted reservation times are the same, sort them according to the distance between the location information and the parking space coordinates. Output the sorted result containing user ID and priority number.
3. The method according to claim 1, characterized in that, Each user terminal calculates its usage period based on its own priority number in the sorting results, generates an exclusive usage right certificate, and simultaneously generates supplementary usage right certificates for other users based on the sorting results, including: Extract its own priority number from the sorting results, convert its own priority number into a time offset, and then add it to the parking space availability start time to calculate the usage period; The usage period is combined with the user's own identifier to generate an exclusive usage right certificate identifier through a hash operation. An asymmetric key pair is derived based on the exclusive usage right certificate identifier. The usage period is digitally signed using the private key in the asymmetric key pair to obtain the usage period signature. The exclusive usage right certificate identifier, the usage period signature, and the public key in the asymmetric key pair are then encapsulated to generate an exclusive usage right certificate. Extract all other user identifiers located after its own priority number from the sorting results; The exclusive usage right certificate identifier is hashed with each other user identifier to generate a corresponding supplementary association identifier. The hash value difference between the supplementary association identifier and the exclusive usage right certificate identifier is calculated to obtain the identifier difference. The identifier difference is normalized to obtain the supplementary activation weight. For each other user identifier, the usage period is used as a backup period. The exclusive usage right certificate identifier, the backup activation weight, and the backup period are encapsulated to generate the corresponding backup usage right certificate.
4. The method according to claim 3, characterized in that, Asymmetric key pairs are derived based on the exclusive right-to-use credential identifier. The usage period signature is obtained by digitally signing the usage period using the private key from the asymmetric key pair, including: An extended key sequence is obtained by iteratively hashing the exclusive use right certificate identifier. A fixed-length private key seed is extracted from the extended key sequence. The private key seed is then subjected to modulo constraint processing to obtain the private key. Based on the private key, the corresponding public key coordinates are generated by multiplying the base point of an elliptic curve. The public key coordinates are then encoded to obtain the public key. The private key and the public key constitute an asymmetric key pair. The usage period is converted into a standard timestamp format to obtain timestamp data. The timestamp data and the exclusive right of use certificate identifier are concatenated byte by byte in the order of timestamp first to obtain the original data to be signed. The original data to be signed is hashed and compressed to obtain a data digest. The data digest is then XORed with the extended key sequence to obtain an enhanced digest. The original signature data is generated by performing elliptic curve signature operation on the enhanced digest using the private key in the asymmetric key pair. The signature coordinate values are then extracted from the original signature data and concatenated with the data digest to obtain the composite signature data. The hash fingerprint of the extended key sequence is added to the composite signature data to obtain the complete signature data. The complete signature data is then bound and encapsulated with the public key in the asymmetric key pair to obtain the usage period signature.
5. The method according to claim 1, characterized in that, When an exclusive usage right certificate holder terminates their use early, the server calculates the remaining duration, locates the associated replacement usage right certificate holder based on the exclusive usage right certificate identifier, and sends an activation notification containing the remaining duration to the replacement usage right certificate holder. The replacement usage right certificate holder then updates their usage period based on the remaining duration, including: The server obtains the planned end time and the actual end time of the exclusive usage right certificate, calculates the time difference between the two time points to obtain the remaining duration, and encapsulates the remaining duration and the exclusive usage right certificate identifier to obtain the remaining duration data packet. The resource association field is parsed from the exclusive right of use certificate identifier. Based on the resource association field, the list of pre-bound supplementary right of use certificate holders is located, sorted by registration time, and the first supplementary right of use certificate holder is selected as the associated supplementary right of use certificate holder. Encapsulate the remaining duration data packet into an activation notification containing the remaining duration and send the activation notification containing the remaining duration to the associated supplementary usage right certificate holder; The associated supplementary usage right certificate holder parses the remaining duration, exclusive usage right certificate identifier, and duration verification code from the activation notification containing the remaining duration. The remaining duration and exclusive usage right certificate identifier are hashed to obtain the local verification code. After the verification is passed by comparing with the duration verification code, the start time of the usage period is set to the current time, and the end time of the usage period is set to the current time plus the remaining duration to obtain the updated usage period.
6. The method according to claim 5, characterized in that, The resource association field is parsed from the exclusive usage right certificate identifier, and the list of pre-bound supplementary usage right certificate holders is located based on the resource association field, including: The exclusive right of use certificate identifier is divided into fields according to a preset delimiter to obtain an identifier field set. The identifier field set is traversed to extract fields with resource association tags to obtain resource association fields. The resource association fields are hashed to obtain resource hash values. The resource hash values are used as index keys to extract the embedded supplementary right of use certificate holder identity identifier set. Parse the registration timestamp carried by each identity from the set of identity identifiers of the holders of the supplementary right of use certificate, convert it into a timestamp value and concatenate it with the identity identifier to obtain the time priority code; The sorted codes are obtained by sorting the timestamp values in the time priority code in ascending order. The sorted codes are then encapsulated with the corresponding identity identifiers to obtain a pre-bound list of supplementary right holders.
7. The method according to claim 1, characterized in that, The smart contract executes settlement based on the actual usage duration recorded in the exclusive usage right certificate. When the holder of the supplementary usage right certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive usage right certificate holder's account according to a preset allocation ratio, including: The actual usage duration recorded in the exclusive usage right certificate is calculated by extracting time information from the exclusive usage right certificate. The exclusive settlement amount is generated based on the actual usage duration recorded in the exclusive usage right certificate and hashed to obtain the exclusive settlement certificate. The actual usage time generated by the holder of the supplementary right of use certificate using the updated usage period is calculated from the extraction time information of the supplementary right of use certificate, and the supplementary settlement amount is generated based on the actual usage time generated by the holder of the supplementary right of use certificate using the updated usage period. The preset allocation ratio is parsed into an allocation coefficient. The supplementary settlement amount is multiplied by the allocation coefficient to obtain the transaction amount transferred to the parking space owner's account and the transaction amount transferred to the exclusive right of use certificate holder's account. The transaction amount transferred to the parking space owner's account and the transaction amount transferred to the exclusive right of use certificate holder's account are hashed to obtain the supplementary settlement certificate. Based on the exclusive settlement voucher, the exclusive settlement amount is transferred to the exclusive right-to-use voucher holder's account; based on the supplementary settlement voucher, the owner's transaction amount is transferred to the parking space owner's account and the holder's transaction amount is transferred to the exclusive right-to-use voucher holder's account.
8. A parking space sharing settlement system based on blockchain and smart contracts, used to implement the method as described in any one of claims 1-7, characterized in that, include: The negotiation and sorting unit is used for each user terminal to exchange negotiation data containing user identifier, appointment time and location information through the network. Each user terminal inputs all the received negotiation data into a preset priority calculation function to obtain the sorting result. The certificate generation unit is used by each user terminal to calculate the usage period based on its own priority number in the sorting result, generate an exclusive usage right certificate, and generate a supplementary usage right certificate for other users based on the sorting result. The supplementary usage right certificate records the associated exclusive usage right certificate identifier. The supplementary activation unit is used by the server to calculate the remaining time when the exclusive right holder terminates the use early, locate the associated supplementary right holder based on the exclusive right holder identifier, and send an activation notification containing the remaining time to the supplementary right holder. The supplementary right holder updates the usage period according to the remaining time. The settlement and allocation unit is used by smart contracts to perform settlement based on the actual usage duration recorded by the exclusive right-to-use certificate. When the holder of the supplementary right-to-use certificate generates actual usage duration using the updated usage period, the transaction amount corresponding to the usage duration is transferred to the parking space owner's account and the exclusive right-to-use certificate holder's account according to the preset allocation ratio.
9. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 7.