CN110690999B - Bandwidth allocation method, device and equipment based on block chain and storage medium - Google Patents

Bandwidth allocation method, device and equipment based on block chain and storage medium Download PDF

Info

Publication number
CN110690999B
CN110690999B CN201910964417.2A CN201910964417A CN110690999B CN 110690999 B CN110690999 B CN 110690999B CN 201910964417 A CN201910964417 A CN 201910964417A CN 110690999 B CN110690999 B CN 110690999B
Authority
CN
China
Prior art keywords
bandwidth
record
user
block
user terminal
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910964417.2A
Other languages
Chinese (zh)
Other versions
CN110690999A (en
Inventor
刘龙坡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910964417.2A priority Critical patent/CN110690999B/en
Publication of CN110690999A publication Critical patent/CN110690999A/en
Application granted granted Critical
Publication of CN110690999B publication Critical patent/CN110690999B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0896Bandwidth or capacity management, i.e. automatically increasing or decreasing capacities
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The embodiment of the application discloses a block chain-based bandwidth allocation method, a block chain-based bandwidth allocation device, block chain-based bandwidth allocation equipment and a storage medium, and belongs to the technical field of communication. The method comprises the following steps: acquiring a bandwidth expansion request carrying a first user identifier, acquiring a target bandwidth idle record from a block chain system according to the bandwidth expansion request, determining a borrowed bandwidth value according to an idle bandwidth value in the target bandwidth idle record, allocating a bandwidth corresponding to the borrowed bandwidth value to a first user terminal, generating a borrowed record, and adding a first block comprising the borrowed record to a block chain of the block chain system. The bandwidth of the second user terminal is allocated to the first user terminal for use through the bandwidth expansion request and the target bandwidth idle record, so that the bandwidth allocation is realized according to the bandwidth use condition of the user, the idle bandwidth is effectively utilized, the bandwidth utilization rate and the flexibility of the bandwidth allocation are improved, the intelligent scheduling of the flow is realized, and the use amount of the flow is improved.

Description

Bandwidth allocation method, device and equipment based on block chain and storage medium
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a storage medium for bandwidth allocation based on a block chain.
Background
With the rapid development of communication technology, the demands of users on networks are on a diversified trend. In order to ensure that data can be normally transmitted in a limited bandwidth and network congestion caused by excessive data volume is avoided, a network operator needs to allocate bandwidth to a user.
In the related art, when a user accesses a network, a network operator allocates a fixed bandwidth to the user no matter whether the user performs data transmission, and the allocated fixed bandwidth is occupied no matter what the bandwidth of the user performing data transmission is actually, and other users cannot use the fixed bandwidth.
By adopting the method for allocating the fixed bandwidth, the bandwidth cannot be reasonably allocated according to the bandwidth use condition of the user, so that the available bandwidth of part of users is in an idle state, and the bandwidth of other users is insufficient, so that the bandwidth cannot be effectively utilized, and the utilization rate of the bandwidth is low and the flexibility of allocation is poor.
Disclosure of Invention
Embodiments of the present application provide a method, an apparatus, a device, and a storage medium for bandwidth allocation based on a block chain, which can solve the problems of low bandwidth utilization and poor allocation flexibility in the related art. The technical scheme is as follows:
in one aspect, a method for allocating bandwidth based on a block chain is provided, where the method includes:
acquiring a bandwidth expansion request carrying a first user identifier, and acquiring a target bandwidth idle record from a block chain system according to the bandwidth expansion request, wherein the bandwidth expansion request is sent by a first user terminal corresponding to the first user identifier when the bandwidth usage is higher than a first threshold value, and the target bandwidth idle record comprises a second user identifier and an idle bandwidth numerical value;
determining a borrowed bandwidth value according to the idle bandwidth value in the target bandwidth idle record, and allocating the bandwidth corresponding to the borrowed bandwidth value to the first user terminal;
generating a borrowing record, wherein the borrowing record comprises the corresponding relation between the second user identifier, the first user identifier and the borrowed bandwidth value;
broadcasting the borrowing record in the blockchain system, and adding a first block passing through consensus to a blockchain of the blockchain system, wherein the first block comprises the borrowing record.
Optionally, the obtaining a bandwidth expansion request carrying a first user identifier, and obtaining a target bandwidth idle record from a blockchain system according to the bandwidth expansion request includes:
acquiring a bandwidth expansion request carrying a first user identifier, and inquiring a bandwidth borrowing contract comprising the first user identifier from a block chain system according to the bandwidth expansion request;
when the bandwidth borrowing contract is inquired, acquiring a target bandwidth idle record from the block chain system according to the bandwidth expansion request.
In another aspect, an apparatus for allocating bandwidth based on a block chain is provided, the apparatus including:
a record obtaining module, configured to obtain a bandwidth expansion request carrying a first user identifier, and obtain a target bandwidth idle record from a block chain system according to the bandwidth expansion request, where the bandwidth expansion request is sent by a first user terminal corresponding to the first user identifier when a bandwidth usage is higher than a first threshold, and the target bandwidth idle record includes a second user identifier and an idle bandwidth value;
the allocation module is used for determining a borrowed bandwidth value according to the idle bandwidth value in the target bandwidth idle record and allocating the bandwidth corresponding to the borrowed bandwidth value to the first user terminal;
a first generating module, configured to generate a borrowing record, where the borrowing record includes a correspondence between the second user identifier, the first user identifier, and the borrowed bandwidth value;
an adding module, configured to broadcast the borrowing record in the blockchain system, and add a first block passing through a consensus to a blockchain of the blockchain system, where the first block includes the borrowing record.
Optionally, the record obtaining module includes:
a first obtaining unit, configured to obtain a bandwidth expansion request carrying a first user identifier, and query a bandwidth borrowing contract including the first user identifier from a block chain system according to the bandwidth expansion request;
and the second acquisition unit is used for acquiring a target bandwidth idle record from the block chain system according to the bandwidth expansion request when the bandwidth borrowing contract is inquired.
Optionally, the allocation module includes:
a value obtaining unit, configured to obtain an idle bandwidth value in the target bandwidth idle record;
and the determining unit is used for determining the borrowed bandwidth value according to the corresponding relation between the idle bandwidth value and the borrowed bandwidth value.
Optionally, the apparatus further comprises:
the record obtaining module is further configured to obtain a bandwidth returning request carrying the first user identifier, obtain the borrowing record from the blockchain system according to the bandwidth returning request, and send the bandwidth returning request by the first user terminal when the bandwidth usage is not higher than a second threshold;
a first determining module, configured to determine, according to the borrowing record, a second user terminal corresponding to the second user identifier and a borrowed bandwidth value corresponding to the first user identifier;
a second generating module, configured to return the bandwidth corresponding to the borrowed bandwidth value of the first user identifier to the second user terminal, and generate a return record, where the return record includes a correspondence between the second user identifier, the first user identifier, and the borrowed bandwidth value;
the adding module is further configured to broadcast the return record in the blockchain system, and add a second block passing through consensus to a blockchain of the blockchain system, where the second block includes the return record.
Optionally, the first user identifier is a first user public key, and the apparatus further includes:
the third generation module is used for generating a first user private key and a private key password of the first user terminal according to the registration request when the registration request of the first user terminal is obtained;
the encryption module is used for encrypting the hash value spliced by the first user private key and the current timestamp according to the private key password to obtain the first user public key;
the adding module is further configured to broadcast the first user public key in the blockchain system, and add a third block passing through consensus to the blockchain of the blockchain system, where the third block includes the first user public key.
Optionally, the apparatus further comprises:
a fourth generation module, configured to generate an account record including the first user public key and an account amount according to the first user private key;
the adding module is further configured to broadcast the account record in the blockchain system, and add a fourth block passing through consensus to a blockchain of the blockchain system, where the fourth block includes the account record.
Optionally, the apparatus further comprises:
a bandwidth obtaining module, configured to obtain a bandwidth sharing request carrying the first user identifier, and obtain an idle bandwidth value of the first user terminal according to the bandwidth sharing request, where the bandwidth sharing request is sent by the first user terminal when a bandwidth usage amount is not higher than a third threshold;
a fifth generating module, configured to generate a bandwidth idle record, where the bandwidth idle record includes the first subscriber identity and the idle bandwidth value;
the adding module is further configured to broadcast the bandwidth free record in the blockchain system, and add a fifth commonly identified block to a blockchain of the blockchain system, where the fifth block includes the bandwidth free record.
Optionally, the apparatus further comprises:
the record obtaining module is further configured to obtain a bandwidth retrieving request carrying the first user identifier, and obtain a target borrowing record from the block chain system according to the bandwidth retrieving request, where the bandwidth retrieving request is sent by a first user terminal corresponding to the first user identifier when a bandwidth amount is higher than a fourth threshold, and the target borrowing record includes a corresponding relationship between the first user identifier, a third user identifier, and a borrowed bandwidth value;
a second determining module, configured to determine, according to the target borrowing record, a third user terminal corresponding to the third user identifier;
a sixth generating module, configured to retrieve, from the third user terminal, a bandwidth corresponding to a borrowed bandwidth value of the third user identifier, and generate a retrieval record, where the retrieval record includes a correspondence between the first user identifier, the third user identifier, and the borrowed bandwidth value;
the adding module is further configured to broadcast the retraction record in the blockchain system, and add a sixth commonly-identified block to a blockchain of the blockchain system, where the sixth block includes the retraction record.
In another aspect, a node device is provided, which includes a processor and a memory, where at least one program code is stored, and loaded and executed by the processor to implement the operations as performed in the block chain based bandwidth allocation method.
In yet another aspect, a computer-readable storage medium having at least one program code stored therein is provided, the at least one program code being loaded and executed by a processor to implement the operations as performed in the block chain based bandwidth allocation method.
The method, the device, the equipment and the storage medium provided by the embodiment of the application obtain a bandwidth expansion request carrying a first user identifier, obtain a target bandwidth idle record from a block chain system according to the bandwidth expansion request, wherein the target bandwidth idle record comprises a second user identifier and an idle bandwidth numerical value, determine a borrowed bandwidth numerical value according to the idle bandwidth numerical value in the target bandwidth idle record, allocate a bandwidth corresponding to the borrowed bandwidth numerical value to a first user terminal, generate the borrowed record, broadcast the borrowed record in the block chain system, and add a first block passing through a consensus to a block chain of the block chain system, wherein the first block comprises the borrowed record. The bandwidth of the second user terminal is allocated to the first user terminal for use, so that bandwidth allocation according to the bandwidth use condition of the user is realized, the idle bandwidth is effectively utilized, the bandwidth utilization rate and the flexibility of bandwidth allocation are improved, intelligent scheduling of flow is realized, and the use amount of flow is improved.
And blocks are respectively generated according to the account record, the bandwidth idle record, the recovery record, the borrowing record and the return record and added into the block chain of the block chain system, the records can be respectively stored in a plurality of node devices, the distributed storage of the records can be realized, the records stored by each node are consistent, the record tampering can be effectively prevented, and the authenticity and the reliability of the record can be ensured. And the record is stored in the node equipment, so that subsequent query is facilitated, and the traceability of the record is increased.
And the node equipment recovers the borrowed bandwidth of the third user terminal and returns the borrowed bandwidth to the first user terminal according to the bandwidth recovery request, and recovers the borrowed bandwidth of the first user terminal and returns the borrowed bandwidth to the second user terminal according to the bandwidth recovery request, so that the flexibility of bandwidth allocation is further improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a blockchain system according to an embodiment of the present disclosure.
Fig. 2 is a schematic diagram of another block chain system according to an embodiment of the present disclosure.
Fig. 3 is a schematic structural diagram of a blockchain system according to an embodiment of the present disclosure.
Fig. 4 is a schematic diagram of a block structure according to an embodiment of the present disclosure.
Fig. 5 is a flowchart of a method for allocating bandwidth based on a block chain according to an embodiment of the present application.
Fig. 6 is a schematic structural diagram of a bandwidth allocation apparatus based on a block chain according to an embodiment of the present application.
Fig. 7 is a schematic structural diagram of another bandwidth allocation apparatus based on a block chain according to an embodiment of the present application.
Fig. 8 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of a server according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be further described in detail with reference to the accompanying drawings.
In order to facilitate understanding of the technical processes of the embodiments of the present application, some terms referred to in the embodiments of the present application are explained below:
blockchain (Blockchain): the method is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. The blockchain is essentially a decentralized database, which is a string of data blocks associated by cryptography, each data block containing information about a network transaction for verifying the validity (anti-counterfeiting) of the information and generating the next block, each block containing a timestamp and a link to the previous block. In a narrow sense, a blockchain is a distributed ledger of data blocks assembled in a sequential manner into a chain data structure in chronological order and cryptographically secured as non-falsifiable and non-forgeable, i.e. the data in the blockchain will be irreversible once recorded.
Consensus Mechanism (Consensus Mechanism): the block chain system is a mathematical algorithm for establishing trust and obtaining rights and interests among different nodes. In the blockchain system, the verification and confirmation of the transaction can be completed in a short time through the voting of a special node or all nodes. Wherein, if several nodes with irrelevant benefits can achieve consensus on a transaction, all nodes in the system can be considered to achieve consensus on the transaction.
Public Key (Public Key) and Private Key (Private Key): is a key pair (i.e., a public key and a private key) obtained by an algorithm, the public key being a public part of the key pair, and the private key being a non-public part. Public keys are typically used to encrypt data, verify digital signatures, and the like. By means of this algorithm it is ensured that the resulting key pair is unique, and that when using this key pair, if one of the keys is used to encrypt a piece of data, the other key must be used to decrypt it, e.g. if the data is encrypted with the public key, the private key must be used to decrypt it, and if the data is encrypted with the private key, the public key must be used to decrypt it, otherwise the decryption will not succeed.
Smart Contract (Smart Contract): is a computer protocol intended to propagate, validate or execute contracts in an informational manner. Each node in the blockchain system can automatically execute a contract program according to a specific condition, can operate data stored in the chain, and is an important way for a user to interact with the blockchain and realize business logic by using the blockchain. The goal of smart contracts is to provide a secure method over traditional contracts and to reduce other transaction costs associated with the contracts, which allows for trusted transactions that are traceable and irreversible without third parties.
Fig. 1 is a schematic diagram of a blockchain system provided in an embodiment of the present application, and referring to fig. 1, the blockchain system includes a plurality of computer devices, which serve as node devices in the blockchain system, and any one node device in the blockchain system may perform one or more steps in the blockchain-based bandwidth allocation method provided in the embodiment of the present application.
The plurality of computer devices may be computer devices of any form, such as a server or a user terminal, which is not specifically limited in this embodiment of the present application.
The plurality of computer devices in the blockchain system may be node devices of a user and node devices of a network operator providing services for the user, the node devices of the user may be user terminals such as computers, smart phones, tablets or other electronic devices, and the node devices of the network operator may be servers. For example, referring to fig. 2, the blockchain system includes at least one network operator and a plurality of users.
The network operator is used for handling broadband services for users, providing bandwidth allocation services, and storing user information and user bandwidth idle records into the blockchain system. The operator allocates fixed bandwidth for the user, when the fixed bandwidth of the user is not enough, the operator requests to expand the bandwidth, and the network operator can allocate the bandwidth of other users for the user according to the bandwidth idle record in the block chain system. In addition, the bandwidth borrowed by the user can be reclaimed according to the borrowing record, and the bandwidth borrowed by the user can be returned to other users.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a blockchain system provided in an embodiment of the present application, where the blockchain system includes a plurality of node devices. The plurality of node devices form a point-To-point (P2P, Peer To Peer) network according To a P2P (Peer To Peer) Protocol, wherein the P2P Protocol is an application layer Protocol operating on a Transmission Control Protocol (TCP). In a blockchain system, any computer device can join to become a node device, such as a server, a user terminal, etc.
Fig. 3 schematically shows functions of each node device in the blockchain system, and the related functions include:
1) routing, a basic function that a node device has for supporting communication between nodes.
Besides the routing function, the node may also have the following functions:
2) the application is used for being deployed in a block chain, realizing specific services according to actual service requirements, recording data related to the realization functions to form recording data, carrying a digital signature in the recording data to represent a source of task data, and sending the recording data to other nodes in the block chain system, so that the other nodes add the recording data to a temporary block when the source and integrity of the recording data are verified successfully.
For example, the services implemented by the application include:
2.1) sharing the account book, which is used for providing the functions of operations such as storage, inquiry and modification of account data, sending the record data of the operation on the account data to other node equipment in the block chain system, and after the other node equipment is verified to be valid, storing the record data into a temporary block as a response for acknowledging that the account data is valid, and also sending confirmation to the node initiating the operation.
And 2.2) bandwidth allocation, which is used for storing the bandwidth use condition of the user into the block chain and allocating the bandwidth of the user according to the bandwidth idle record.
Referring to fig. 4, fig. 4 is a schematic diagram of an optional Block Structure (Block Structure) provided in this embodiment, each Block includes a hash value of the Block storing the transaction record (hash value of the Block) and a hash value of a previous Block, and the blocks are connected by the hash value to form a Block chain. The block may include information such as a time stamp at the time of block generation.
Fig. 5 is a flowchart of a method for allocating bandwidth based on a block chain according to an embodiment of the present application. An execution subject of the embodiment of the present application is any node device in the blockchain system, and referring to fig. 5, the embodiment may include the following steps:
501. the node equipment acquires a registration request of the first user terminal, and generates a first user private key and a private key password of the first user terminal according to the registration request.
The broadband service is an access service for a network operator to provide a user with high-speed access to the internet, and the user can access to the broadband network through ADSL (Asymmetric Digital Subscriber Line, Asymmetric Digital Subscriber loop) or optical fiber, and the like, so as to realize high-speed internet access. The bandwidth allocated to the user is different according to different broadband services handled by the user, and the bandwidth refers to the data volume which can be transmitted by the data transmission channel within a fixed time, that is, reflects the data transmission capacity of the data transmission channel.
When the first user needs to handle the broadband service, the first user can register on the first user terminal, and the first user terminal sends a registration request to the node device. When the node device detects a registration request of the first user terminal, a first user private key and a private key password of the first user terminal may be generated according to the registration request.
The node device may be any node device capable of performing bandwidth allocation in the blockchain system, for example, the node device may perform bandwidth allocation for the user terminal in the blockchain system according to a registration request, a bandwidth expansion request, a bandwidth retraction request, a bandwidth return request, a bandwidth sharing request, and the like in the blockchain system. The node device may belong to a network operator providing broadband services. The node device may be a computer device such as a server and a terminal.
The registration request may carry a first user terminal identifier, a broadband service type, and user information, where the first user terminal identifier may be a unique identifier of the first user terminal, the broadband service type may be any type included in the broadband service, and the user information may include a user name, a user identification number, a user contact information, and the like.
The first user private key and the private key password may be random numbers generated by the node device, where the first user private key may be used for performing identity verification, decryption, transaction signature, and the like, and the first user private key and the private key password may also be used for generating a corresponding first user public key.
Optionally, an application program for handling the broadband service is installed on the first user terminal, the first user logs in the application program, and when the first user needs to handle the broadband service, the first user may fill in user information and select a broadband service type based on the application program, generate a registration request including the user identifier, the broadband service type, and the user information by the first user terminal, and send the registration request to the node device. When the node device detects a registration request sent by the first user terminal, the node device can verify user information in the registration request, and when the verification is passed, the node device can generate a first user private key and a private key password according to the registration request, associate the first user private key and the private key password with the user identifier, and return registration success information to the first user terminal, wherein the registration success information comprises the first user private key and the private key password.
502. The node equipment encrypts the hash value after splicing the first user private key and the current timestamp according to the private key password to obtain a first user public key, broadcasts the first user public key in the block chain system, and adds a third block passing through the consensus to a block chain of the block chain system, wherein the third block comprises the first user public key.
The node device can obtain the time for generating the first user private key and the private key password, the time is used as a current timestamp, the first user private key and the current timestamp are spliced, the hash value of the spliced result is calculated to obtain a unique hash value, the hash value is encrypted by combining an encryption algorithm and the private key password to obtain a unique identifier, and the identifier is used as a first user public key. The node device broadcasts a first user public key in the block chain system, any node device in the block chain system generates a third block comprising the first user public key, the plurality of node devices identify the third block in common, and after the third block passes the identification in common, the node device adds the third block passing the identification in the block chain of the block chain system.
For example, if the first user private key is "xxxxxx", the current timestamp is "YYY", and the private key password is "ZZZ", the result obtained by splicing the first user private key and the current timestamp is "xxxxyyy", hash value calculation is performed on "xxxxyyyy", and the hash value is encrypted by an encryption algorithm in combination with the private key password "ZZZ" to obtain the first user public key "mmmmmmm".
The first user public key and the first user private key form a pair of key pairs, the first user public key is a public part of the key pairs, any node device in the block chain system can obtain the first user public key, the first user private key is a private part of the key pairs, and only the first user terminal can possess the first user private key. When the node equipment sends information to the first user terminal, the information can be encrypted according to the first user public key, and when the first user terminal receives the encrypted information, the information can be decrypted according to the first user private key; when the first user terminal sends a message to the node device, the message can be signed according to the first user private key, and when the node device receives the signed message, the node device can verify according to the first user public key.
In one possible implementation, the process of generating the third block may be:
the last block in the block chain system is called as a previous block, the node device can acquire all information of the previous block from the block chain system, so that a block head characteristic value of the previous block can be generated based on all the information of the previous block, characteristic value calculation is carried out on a first user public key which needs to be stored in the third block, a block main body characteristic value of the third block is obtained, and further, the node device can store the block head characteristic value of the previous block and the block main body characteristic value of the third block to a block head of the third block, and store the first user public key to a block main body of the third block, so that the third block is generated. Therefore, the last block and the third block are related by the block head characteristic value of the last block, and the purpose of connecting blocks in series in a block chain system can be realized, so that the next block can be used for verifying whether the previous block is correct or not. It should be noted that the above description of the block generation process is only an exemplary description of one block generation method, and the embodiment of the present application does not limit which block generation method is specifically adopted.
In one possible implementation, the process of adding the third chunk to the chunk chain may be:
after any node device generates the third block, the third block is identified. The node devices broadcast the verification result in the blockchain system, and when the verification result in the blockchain system is that the number of the node devices passing through is greater than the target ratio, the blockchain system can determine that the third block passes through the consensus and add the third block to the blockchain in the blockchain system. The target ratio may be set by a developer, and this is not limited in the embodiment of the present application. The consensus process can be implemented based on a consensus mechanism, for example, the consensus mechanism can be a workload proving mechanism, a rights and interests proving mechanism, a shares authorization proving mechanism, and the like. It should be noted that the above-mentioned consensus process is only an exemplary description, and the embodiments of the present application do not limit this.
Any node device in the block chain system can acquire the first user public key in the third block, so that the first user public key can be stored in a plurality of node devices respectively, distributed storage of the first user public key can be realized, account record tampering can be effectively prevented, and authenticity, uniqueness and non-tampering property of the first user public key are ensured.
Alternatively, the node device may create a personal account for the first user according to the registration request of the first user terminal, and perform settlement of fees, such as deposit and deduction, according to the personal account. The first user can carry out signature according to the private key of the first user and carry out deposit operation in the personal account. The node device can deduct money from the personal account of the first user according to the broadband service type corresponding to the public key of the first user. When the node device detects that the deposit or deduction is completed, an account record including the first user public key and the account amount is generated.
That is, after the third block passing the consensus is added to the blockchain of the blockchain system, the node device may generate an account record including the first user public key and the account amount according to the first user private key. Broadcasting the account record in the blockchain system, generating a fourth block comprising the account record by any node equipment in the blockchain system, commonly identifying the fourth block by a plurality of node equipment, and adding the commonly identified fourth block to the blockchain of the blockchain system after the fourth block passes the common identification.
Optionally, the node device may package a plurality of account records generated within a period of time, broadcast the packaged plurality of account records in the blockchain system, generate a fourth block including the plurality of account records by any node device in the blockchain system, the plurality of node devices agree on the fourth block, and when the fourth block passes the agreement, add the third block passing the agreement to the blockchain of the blockchain system.
Any node device in the block chain system can acquire the account record in the fourth block, so that the account record can be respectively stored in a plurality of node devices, distributed storage of the account record can be realized, the account records stored in all nodes are consistent, the account record can be effectively prevented from being tampered, and the authenticity of the account record is ensured.
For example, referring to table 1, when the node device creates a personal account for the first user, the account amount is 0 yuan, the node device generates an account record a, and the account record a includes the public key of the first user and the account amount 0 yuan; when a first user deposits 300 yuan in a personal account, the node equipment generates an account record B, and the account record B comprises 300 yuan of account amount of a public key of the first user; when the first user pays the bandwidth usage fee of 100 yuan in the personal account, the node device generates an account record C, and the account record C comprises the first user public key and the account amount of 200 yuan.
TABLE 1
Account record a: first user public key 0 yuan
And account record B: first user public key 300 Yuan
Account record C: first user public key 200 yuan
The process of adding the identified fourth block to the blockchain system by the node device is similar to the process of adding the identified third block to the blockchain system in step 501, and is not described in detail here. By synchronizing the account records into the blockchain system, any node device in the blockchain system stores the account records, and the first user can inquire transaction information such as deposit and deduction according to the account records, so that the traceability of the transaction information is ensured.
503. And when the node equipment acquires the bandwidth sharing request carrying the public key of the first user, acquiring the idle bandwidth value of the first user terminal according to the bandwidth sharing request.
When the registration request of the first user terminal is responded by successful registration, the first user terminal can obtain the preset bandwidth, and the first user terminal can use the network within the flow speed of the traffic allowed by the preset bandwidth, that is, the actual bandwidth occupied currently when the network is used is not higher than the preset bandwidth allocated.
Since the preset bandwidth of the first user terminal is in the idle state when the first user terminal does not use the network or the actual bandwidth occupied by the network is small, when the first user terminal has the idle bandwidth, the first user terminal can allocate the idle bandwidth to other user terminals.
Therefore, when the first user terminal detects that the bandwidth usage is not higher than the third threshold, a bandwidth sharing request is generated, the bandwidth sharing request carries the first user public key, the first user terminal sends the bandwidth sharing request to the node device, and when the node device detects the bandwidth sharing request, the idle bandwidth value of the first user terminal is obtained.
The bandwidth usage refers to an actual bandwidth currently occupied when the network is used, and is used for reflecting a current bandwidth usage condition, and the bandwidth usage can be represented by a traffic flow speed. The third threshold may be set by the first user terminal by default or set by the first user himself, and may be a flow rate. The first user terminal may determine the current bandwidth usage of the first user according to a size relationship between the bandwidth usage and the third threshold. When the first user terminal detects that the bandwidth usage is not higher than the third threshold, the first user terminal considers that the bandwidth usage is not used or the actual bandwidth usage is less, and the preset bandwidth or a part of the preset bandwidth can be shared by other user terminals for use; when the first user terminal detects that the bandwidth usage is higher than the third threshold, the first user terminal is considered to be using the network, the preset bandwidth is in a non-idle state, and the preset bandwidth is not shared with other user terminals for use.
The idle bandwidth value refers to a bandwidth value allocated to the first user equipment and not currently used by the first user equipment. Optionally, when the node device obtains the bandwidth sharing request, the preset bandwidth value of the first user terminal may be used as the idle bandwidth value, or a part of the preset bandwidth value may also be used as the idle bandwidth value, for example, 90% of the preset bandwidth value is used as the idle bandwidth value.
The bandwidth sharing request is used for indicating that the current first user terminal does not use the bandwidth or the actual bandwidth usage amount is less, and indicating that the node device can share the bandwidth corresponding to the idle bandwidth value of the first user terminal to other user terminals.
In a possible implementation manner, the node device obtains a bandwidth sharing request carrying a first user public key, queries a bandwidth sharing contract including the first user public key from the blockchain system according to the bandwidth sharing request, and obtains an idle bandwidth value of the first user terminal according to the bandwidth expansion request when the bandwidth sharing contract is queried.
When any user wants to share the bandwidth to other users, a bandwidth sharing contract is signed with a network operator providing the bandwidth allocation service, and the bandwidth sharing contract indicates that the bandwidth of any user can be shared to other users for use. When the node device receives the bandwidth sharing contract of any user, the bandwidth sharing contract is stored in a block chain of the block chain system.
Therefore, when the node device obtains the bandwidth sharing request carrying the first user public key, the bandwidth sharing contract comprising the first user public key is inquired from the blockchain system. When the bandwidth sharing contract is inquired, the bandwidth of the first user can be shared to other users for use, and then the idle bandwidth value of the first user terminal is obtained; when the bandwidth sharing contract is not inquired, the bandwidth sharing contract indicates that the bandwidth of the first user is not allowed to be shared by other users, so that the operation of sharing the bandwidth of the first user to other users is not executed without acquiring the idle bandwidth value of the first user terminal.
In another possible implementation manner, when the first user terminal detects that the bandwidth usage is not higher than the third threshold and the duration of the bandwidth usage that is not higher than the third threshold is greater than the preset duration, the bandwidth sharing request is generated. By setting the preset duration, the situation that the user is mistakenly considered not to use the network at present due to the fact that the bandwidth usage is not higher than the third threshold value in a short time can be avoided.
For example, the node device allocates 10M (megabits) of bandwidth to the first user terminal, both the bandwidth usage and the third threshold are traffic flow rates, the third threshold is set to 1KB/s, and the preset time duration is 15 minutes. When the first user terminal detects that the bandwidth usage is not higher than 1KB/s and the duration of the bandwidth usage is not higher than 1KB/s is longer than 15 minutes, the first user terminal is considered not to use the network currently, and a bandwidth sharing request is generated. When the node device obtains the bandwidth sharing request, the idle bandwidth value of the first user terminal is determined to be 10M (million).
504. The node device generates a bandwidth vacancy record, broadcasts the bandwidth vacancy record in the blockchain system, and adds a fifth block which passes through the consensus to a blockchain of the blockchain system, wherein the fifth block comprises the bandwidth vacancy record.
The node equipment generates a bandwidth idle record according to the idle bandwidth of the first user terminal, the node equipment broadcasts the bandwidth idle record in the block chain system, any node equipment in the block chain system generates a fifth block comprising the bandwidth idle record, the plurality of node equipment identifies the fifth block, and after the fifth block passes the identification, the identified fifth block is added into the block chain of the block chain system.
The bandwidth idle record comprises a first user public key and an idle bandwidth numerical value, and the bandwidth idle record indicates that a first user terminal corresponding to the first user public key does not use a network currently, and allows the node device to allocate a bandwidth corresponding to the idle bandwidth numerical value of the first user terminal to other user terminals for use.
The process of adding the identified fifth block to the blockchain system by the node device is similar to the process of adding the identified third block to the blockchain system in step 501, and is not described in detail here.
Optionally, the node device packages a plurality of bandwidth idle records generated within a period of time, broadcasts the packaged plurality of bandwidth idle records in the blockchain system, any node device in the blockchain system generates a fifth block including the plurality of bandwidth idle records, the plurality of node devices agree on the fifth block, and after the fifth block passes the agreement, the plurality of bandwidth idle records in the fifth block may be synchronized to any node device in the blockchain system.
Any node device in the block chain system can acquire the bandwidth idle record in the fifth block, so that the bandwidth idle record can be stored in a plurality of node devices respectively, distributed storage of the bandwidth idle record can be realized, the bandwidth idle records stored in all the nodes are consistent, the bandwidth idle record can be effectively prevented from being tampered, and the authenticity of the bandwidth idle record is ensured.
505. The node equipment acquires a bandwidth retraction request carrying a first user public key, acquires a target borrowing record from the block chain system according to the bandwidth retraction request, and determines a third user terminal corresponding to a third user public key according to the target borrowing record.
After the commonly-identified fifth block is added to the block chain of the block chain system, when the node device obtains a bandwidth expansion request of other user terminals, the node device may obtain the bandwidth vacancy record from the block chain system according to the bandwidth expansion request, determine a borrowed bandwidth value to be borrowed by the first user terminal according to the vacancy bandwidth value in the bandwidth vacancy record, allocate the bandwidth corresponding to the borrowed bandwidth value to a third user terminal needing bandwidth expansion, that is, borrow the bandwidth of the first user terminal corresponding to the first user public key to the third user terminal corresponding to the third user public key for use, and generate a target borrowing record. The target borrowing record comprises the corresponding relation of the first user public key, the third user public key and the borrowed bandwidth value. The detailed process is shown in step 507-509, which will not be described herein.
Therefore, when the remaining bandwidth of the first user terminal cannot meet the internet surfing requirement, the node device is to reclaim the bandwidth borrowed by the third user terminal and redistribute the bandwidth borrowed by the third user terminal to the first user terminal.
When the first user terminal corresponding to the first user public key detects that the bandwidth usage is higher than the fourth threshold value, a bandwidth recovery request is generated, the first user terminal sends the bandwidth recovery request to the node device, when the node device obtains the bandwidth recovery request, a target borrowing record is obtained from the block chain system according to the bandwidth recovery request, and a third user terminal corresponding to a third user public key is determined according to the target borrowing record.
The fourth threshold may be set by the first user terminal by default or set by the first user, and may be a flow rate. The first user terminal may determine the current bandwidth usage of the first user according to the size relationship between the bandwidth usage and the fourth threshold. When the first user terminal detects that the bandwidth usage is higher than the fourth threshold, the first user terminal considers that the residual bandwidth of the first user terminal cannot meet the internet access requirement, and the bandwidth shared by other user terminals needs to be recovered; when the first user terminal detects that the bandwidth usage is not higher than the fourth threshold, the first user terminal is considered not to use the network at present or the remaining bandwidth can meet the internet access requirement, and the bandwidth shared by other user terminals does not need to be recovered.
For example, the fourth threshold is 5KB/s, and when the first user terminal detects that the bandwidth usage is higher than 5KB/s, it is determined that the remaining bandwidth of the first user terminal cannot meet the internet access requirement, and the bandwidth shared by other user terminals needs to be recovered.
The bandwidth reclaiming request carries a first user public key, and the bandwidth reclaiming request is used for indicating the node equipment to reclaim the bandwidth shared by the first user terminal.
The target borrowing record comprises the corresponding relation between the first user public key, the third user public key and the borrowing bandwidth value. The first user terminal corresponding to the first user public key is a bandwidth lender, the third user terminal corresponding to the third user public key is a bandwidth lender, and the borrowed bandwidth is the bandwidth value borrowed from the third user terminal to the first user terminal.
506. And the node equipment recovers the bandwidth corresponding to the borrowed bandwidth value of the third user public key from the third user terminal, generates a recovery record, broadcasts the recovery record in the blockchain system, and adds a sixth commonly identified block to the blockchain of the blockchain system, wherein the sixth block comprises the recovery record.
The node equipment recovers the bandwidth corresponding to the borrowed bandwidth numerical value of the third user public key from the third user terminal, redistributes the bandwidth to the first user terminal corresponding to the first user public key, generates a recovery record, broadcasts the recovery record in the block chain system, any node equipment in the block chain system generates a sixth block comprising the recovery record, the sixth block is identified by the plurality of node equipment, and after the sixth block passes the identification, the sixth block passing the identification is added to the block chain of the block chain system.
The recovery record comprises a corresponding relation between a first user public key, a third user public key and a borrowed bandwidth numerical value, a first user terminal corresponding to the first user public key is a bandwidth recovery party, a third user terminal corresponding to the third user public key is a bandwidth return party, and the borrowed bandwidth numerical value is a bandwidth numerical value returned to the first user terminal by the third user terminal. The retraction record indicates that the bandwidth of the first user terminal that has borrowed the third user terminal is retracted.
The retrieved bandwidth may be a borrowed bandwidth shared by the first user terminal to the third user terminal, or may be a bandwidth in a preset bandwidth allocated to the third user terminal, and it is only required to ensure that the value of the retrieved bandwidth is the same as the value of the borrowed bandwidth.
The process of adding the identified sixth block to the blockchain system by the node device is similar to the process of adding the identified third block to the blockchain system in step 501, and is not described in detail here.
Optionally, the node device packages a plurality of recovery records generated within a period of time, broadcasts the plurality of recovery records after packaging in the blockchain system, any node device in the blockchain system generates a sixth block including the plurality of recovery records, the plurality of node devices agree on the sixth block, and after the sixth block passes the agreement, the plurality of recovery records in the sixth block may be synchronized to any node device in the blockchain system.
Any node device in the block chain system can acquire the recovery record in the sixth block, so that the recovery record can be stored in a plurality of node devices respectively, distributed storage of the recovery record can be realized, the recovery records stored in all the nodes are consistent, the recovery record can be effectively prevented from being tampered, and the authenticity of the recovery record is ensured.
507. The node equipment acquires a bandwidth expansion request carrying a first user public key, and acquires a target bandwidth idle record from the block chain system according to the bandwidth expansion request.
When the first user terminal uses the network, the situation that the allocated preset bandwidth cannot meet the requirement of internet surfing occurs. For example, the preset bandwidth of the first user terminal is 10M (megabyte), the maximum traffic flow speed allowed by the preset bandwidth is 1.25MB/s, the first user terminal needs to download data with the size of 1024MB, and due to the fact that the amount of data needing to be downloaded is too large, the data downloading cannot be completed in time at the traffic flow speed. Therefore, the node device is required to perform bandwidth expansion for the first user terminal, so as to meet the internet access requirement of the first user.
When a first user terminal corresponding to the first user public key detects that the bandwidth usage is higher than a first threshold value, a bandwidth expansion request is generated, the bandwidth expansion request carries the first user public key, the first user terminal sends the bandwidth expansion request to the node equipment, and when the node equipment obtains the bandwidth expansion request, a target bandwidth idle record is obtained from the block chain system according to the bandwidth expansion request.
The first threshold may be set by the first user terminal by default or set by the first user, and the first threshold may be a flow rate. The first user terminal may determine the current bandwidth usage of the first user according to the size relationship between the bandwidth usage and the first threshold. When the first user terminal detects that the bandwidth usage is higher than a first threshold value, the preset bandwidth of the first user terminal is considered to be incapable of meeting the internet surfing requirement, and bandwidth expansion is required; when the first user terminal detects that the bandwidth usage is not higher than the first threshold, the preset bandwidth of the first user terminal is considered to meet the internet access requirement, and bandwidth expansion is not needed.
The bandwidth expansion request is used for indicating that the first user terminal needs to perform bandwidth expansion and indicating the node equipment to acquire a target bandwidth idle record.
And the target bandwidth idle record comprises a second user public key and an idle bandwidth value. The target bandwidth spare record is similar to the bandwidth spare record in step 504, and is not described in detail here.
In one possible implementation manner, the node device obtains a bandwidth expansion request carrying a first user public key, queries a bandwidth borrowing contract comprising the first user public key from the blockchain system according to the bandwidth expansion request, and obtains a target bandwidth idle record from the blockchain system according to the bandwidth expansion request when the bandwidth borrowing contract is queried.
When any user wants to enjoy the bandwidth borrowing service, a bandwidth borrowing contract is signed with a network operator providing the bandwidth allocation service, and the bandwidth borrowing contract indicates that the bandwidth of other users can be borrowed for the use of the any user. When a node device receives a bandwidth borrowing contract for any user, the bandwidth borrowing contract is stored in a blockchain of a blockchain system.
Therefore, when the node device obtains the bandwidth expansion request carrying the first user public key, the bandwidth borrowing contract comprising the first user public key is inquired from the blockchain system. When the bandwidth borrowing contract is inquired, the first user is shown to enjoy the bandwidth borrowing service, namely the bandwidth of other users is allowed to be borrowed to the first user for use, a target bandwidth idle record is obtained, and the bandwidth of other users is allocated to the first user according to the target bandwidth idle record; when the bandwidth borrowing contract is not inquired, the first user does not enjoy the bandwidth borrowing service, namely, the bandwidth of other users is not allowed to be borrowed to the first user, so that the target bandwidth idle record does not need to be acquired, and the operation of borrowing the bandwidth of other users to the first user is not executed.
In another possible implementation manner, a plurality of bandwidth idle records are obtained from the blockchain system, each bandwidth idle record comprises a user public key and an idle bandwidth value, and a target bandwidth idle record with the largest idle bandwidth value is determined from the plurality of bandwidth idle records. By obtaining the target bandwidth idle record with the maximum idle bandwidth value, the bandwidth allocated to the first user terminal can be ensured to be sufficient, the situation that the bandwidth is still insufficient after once expansion and needs to be expanded for many times is avoided, the time is saved, and the efficiency of bandwidth allocation can be improved.
In another possible implementation manner, a plurality of bandwidth idle records are obtained from the blockchain system, each bandwidth idle record includes a user public key and an idle bandwidth value, each bandwidth idle record carries a timestamp for generating the bandwidth idle record, and a target bandwidth idle record with the latest timestamp, that is, the latest target bandwidth idle record in the plurality of bandwidth idle records, is determined from the plurality of bandwidth idle records. Because the time generated by the target bandwidth idle record is closest to the time of currently detecting the bandwidth expansion request, the probability that the second user terminal corresponding to the target bandwidth idle record does not use the network is greater than the probability that other user terminals corresponding to other bandwidth idle records do not use the network, and therefore, the probability that the bandwidth retraction request of the second user terminal is detected after the bandwidth of the second user terminal is shared is smaller than the probability that the bandwidth retraction request of other user terminals is detected after the bandwidths of other user terminals are shared. Therefore, the situation that the node device withdraws the bandwidth when the first user terminal still needs to use the bandwidth after the bandwidth is allocated to the first user terminal can be effectively avoided, bandwidth expansion for the first user terminal is not needed again, time is saved, and the efficiency of bandwidth allocation can be improved.
In another possible implementation manner, an application program for handling broadband services is installed in the first user terminal, and when the first user terminal detects that the bandwidth usage is higher than the first threshold value, different borrowing bandwidth values are provided for the first user based on the application program and are selected by the first user. The node equipment determines a target borrowed bandwidth value selected by a first user, generates a bandwidth expansion request carrying the target borrowed bandwidth value and a public key of the first user, and acquires a target bandwidth idle record from a block chain system according to the target borrowed bandwidth value when the node equipment detects the bandwidth expansion request. By providing different borrowing bandwidth values for the first user, the user can independently select whether to perform bandwidth expansion and how much bandwidth to expand, the selectivity of bandwidth expansion is increased, the freedom of performing bandwidth expansion transaction is improved, and the openness and the transparency of bandwidth expansion are also increased.
Optionally, the node device obtains a plurality of bandwidth idle records in the blockchain system, where the bandwidth idle records include a user public key and an idle bandwidth value. Obtaining the difference value between the plurality of idle bandwidth values and the target borrowed bandwidth value, determining a target bandwidth idle record with the minimum corresponding difference value in the plurality of bandwidth idle records, wherein the idle bandwidth value in the target bandwidth idle record is larger than the target borrowed bandwidth value, and subsequently allocating the bandwidth of the second user terminal in the target bandwidth idle record to the first user terminal. The target bandwidth idle record with the minimum corresponding difference is selected because the target borrowed bandwidth value required to be expanded by the user is determined, so that the condition of wasting bandwidth resources due to excessive bandwidth expansion can be avoided, and the utilization rate of the bandwidth is further improved.
Optionally, the node device obtains a plurality of bandwidth idle records in the blockchain system, and a plurality of idle bandwidth values in the plurality of bandwidth idle records are all smaller than the target borrowed bandwidth value, so that the node device obtains a plurality of target bandwidth idle records from the plurality of bandwidth idle records.
508. And the node equipment determines a borrowed bandwidth value according to the idle bandwidth value in the target bandwidth idle record, and allocates the bandwidth corresponding to the borrowed bandwidth value to the first user terminal.
When the node equipment acquires a target bandwidth idle record from the block chain system, determining a second user public key and an idle bandwidth numerical value in the target bandwidth idle record, determining a borrowed bandwidth numerical value according to the idle bandwidth numerical value, determining a second user terminal corresponding to the second user public key, and allocating a bandwidth corresponding to the borrowed bandwidth numerical value of the second user terminal to the first user terminal.
Optionally, an idle bandwidth value in the target bandwidth idle record is obtained, and the borrowed bandwidth value is determined according to a corresponding relationship between the idle bandwidth value and the borrowed bandwidth value. The corresponding relationship between the idle bandwidth value and the borrowed bandwidth value can be determined according to a preset proportion. The preset proportion may be set by default by the node device or the user terminal, or may be set by the user, and may be 50%, 80%, 90%, 100%, or the like.
For example, the predetermined ratio is 80%, the borrowed bandwidth value is 80% of the idle bandwidth value, and when the idle bandwidth value is 10M (mega), the borrowed bandwidth value is 8M (mega). When the preset proportion is lower than 100%, namely a part of the idle bandwidth of the second user terminal is borrowed to the first user terminal, and the second user terminal reserves a part of the bandwidth, so that the bandwidth is available when the second user terminal needs to use the network, and the condition that the second user terminal cannot surf the internet when the node equipment does not return the borrowed bandwidth to the second user terminal is avoided.
509. The node device generates a borrow record, broadcasts the borrow record in the blockchain system, and adds a first block passing through the consensus to a blockchain of the blockchain system, wherein the first block comprises the borrow record.
When the node device distributes the bandwidth corresponding to the borrowed bandwidth value to the first user terminal, a borrowed record is generated, the node device broadcasts the borrowed record in the block chain system, any node device in the block chain system generates a first block comprising the borrowed record, the plurality of node devices share the first block, and when the first block passes the sharing, the first block passing the sharing is added to the block chain of the block chain system.
The borrowing record comprises the corresponding relation of the second user public key, the first user public key and the borrowed bandwidth value. The borrowing record indicates that the second user public key corresponding to the second user terminal is a bandwidth lender, the first user terminal corresponding to the first user public key is a bandwidth borrower, and the borrowed bandwidth value is a bandwidth value borrowed from the first user terminal to the second user terminal. According to the borrowing record, the bandwidth borrowed by the first user terminal can be reclaimed, and the bandwidth borrowed by the second user terminal can be returned.
The process of adding the first block passing through the consensus to the blockchain system by the node device is similar to the process of adding the third block passing through the consensus to the blockchain system in step 501, and is not repeated here.
Optionally, the node device packages a plurality of borrowing records generated in a period of time, broadcasts the plurality of packed borrowing records in the blockchain system, any node device in the blockchain system generates a first block including the plurality of borrowing records, the plurality of node devices perform consensus on the first block, and after the first block passes the consensus, the plurality of borrowing records in the first block can be synchronized to any node device in the blockchain system.
Any node device in the block chain system can acquire the borrowing records in the first block, so that the borrowing records can be stored in a plurality of node devices respectively, distributed storage of the borrowing records can be realized, the borrowing records stored in all the nodes are consistent, the borrowing records can be effectively prevented from being tampered, and the authenticity of the borrowing records is ensured.
510. The node equipment acquires a bandwidth returning request carrying a first user public key, acquires a borrowing record from the block chain system according to the bandwidth returning request, and determines a second user terminal corresponding to the second user public key and a borrowed bandwidth value corresponding to the first user public key according to the borrowing record.
After the node device performs bandwidth expansion on the first user terminal, when the preset bandwidth of the first user terminal can meet the requirement of internet surfing, the first user terminal does not need to use the borrowed bandwidth any more, and at this time, the first user terminal can return the borrowed bandwidth to the second user terminal.
When detecting that the bandwidth usage is not higher than the second threshold, the first user terminal may generate a bandwidth returning request, where the bandwidth returning request carries the first user public key, and the first user terminal sends the bandwidth returning request to the node device, and when detecting the bandwidth returning request, the node device obtains the borrowing record in step 509 from the blockchain system.
The second threshold may be set by the first user terminal by default or set by the first user, and the second threshold may be a flow rate. The first user terminal may determine the current bandwidth usage of the first user according to the size relationship between the bandwidth usage and the second threshold. When the first user terminal detects that the bandwidth usage is not higher than the second threshold, the preset bandwidth of the first user terminal is considered to meet the internet surfing requirement, and the borrowed bandwidth does not need to be used; when the first user terminal detects that the bandwidth usage is higher than the second threshold, the preset bandwidth of the first user terminal is considered to meet the internet surfing requirement, and the borrowed bandwidth still needs to be used.
The bandwidth returning request is used for indicating that the first user terminal does not need to use the borrowed bandwidth, the node equipment is indicated to obtain the borrowed record, and the subsequent node equipment can return the borrowed bandwidth of the first user terminal to the second user terminal according to the borrowed record.
511. And the node equipment returns the bandwidth corresponding to the borrowed bandwidth value of the first user public key to the second user terminal to generate a return record, broadcasts the return record in the block chain system, and adds the second block passing the consensus to the block chain of the block chain system, wherein the second block comprises the return record.
The node equipment withdraws the bandwidth corresponding to the borrowed bandwidth value of the first user public key from the first user terminal, returns the bandwidth to the second user terminal corresponding to the second user public key, generates a return record, broadcasts the return record in the block chain system, any node equipment in the block chain system generates a second block comprising the return record, the plurality of node equipment identifies the second block, and after the second block passes the identification, the identified second block is added to the block chain of the block chain system.
The returning record comprises a corresponding relation of a second user public key, a first user public key and a borrowed bandwidth numerical value, a second user terminal corresponding to the second user public key is a bandwidth withdrawing party, a first user terminal corresponding to the first user public key is a bandwidth returning party, and the borrowed bandwidth numerical value is a numerical value of bandwidth returned to the second user terminal by the first user terminal. The reclaim record indicates that the bandwidth of the second user terminal that has borrowed the first user terminal is returned.
The returned bandwidth may be a borrowed bandwidth of a third user terminal borrowed by the first user terminal, or may be a bandwidth in a preset bandwidth allocated to the first user terminal, and it is only required to ensure that the value of the returned bandwidth is the same as the value of the borrowed bandwidth.
The process of adding the second block passing through the consensus to the blockchain system by the node device is similar to the process of adding the third block passing through the consensus to the blockchain system in step 501, and is not repeated here.
Optionally, the node device packages a plurality of return records generated within a period of time, broadcasts the packaged plurality of return records in the blockchain system, any node device in the blockchain system generates a second block including the plurality of return records, the plurality of node devices agree on the second block, and after the second block passes the agreement, the plurality of return records in the second block can be synchronized to any node device in the blockchain system.
Any node device in the block chain system can acquire the return records in the second block, so that the return records can be respectively stored in a plurality of node devices, distributed storage of the return records can be realized, the return records stored in each node are consistent, the return records can be effectively prevented from being tampered, and the authenticity of the return records is ensured.
It should be noted that, in the embodiment of the present application, a user public key generated by a node device is used as a user identifier, an identity of a user is determined by using the user public key, and a process of bandwidth expansion, bandwidth return, bandwidth sharing, and bandwidth retraction is described. In another embodiment, the public key of the user in steps 503 and 511 may be replaced by other user identifications capable of determining the user identity, for example, the user identification may be a user account number, a user nickname, a telephone number, a user number, and the like.
It should be noted that, in the embodiment of the present application, only the first user terminal loans a bandwidth to the third user terminal and the first user terminal loans a bandwidth to the second user terminal are taken as an example for description, and any user terminal in the block chain system can loan or borrow a bandwidth, so that the first user terminal, the second user terminal, and the third user terminal mentioned in the embodiment of the present application can all be any user terminal.
It should be noted that, in the embodiment of the present application, the user terminal may send a bandwidth expansion request, a bandwidth returning request, a bandwidth sharing request, and a bandwidth retrieving request to the node device, so as to instruct the node device to perform bandwidth allocation for the user terminal. In another embodiment, the user terminal may first send the bandwidth expansion request and then send the bandwidth return request, and then send the bandwidth sharing request and then send the bandwidth return request, that is, first perform step 507 and step 511, and then perform step 503 and step 506. The embodiment of the application does not limit the sequence of sending the bandwidth sharing request and sending the bandwidth expansion request, and only needs to ensure that the bandwidth returning request is sent before the bandwidth sharing request is sent and the bandwidth returning request is sent before the bandwidth expansion request is sent.
It should be noted that the bandwidth retraction request mentioned in the embodiment of the present application is generated by the user terminal of the bandwidth borrower, and when the node device detects the bandwidth retraction request, the borrowed bandwidth of the bandwidth borrower is retracted and returned to the bandwidth borrower; the bandwidth returning request mentioned in the embodiment of the present application is generated by a user terminal of a bandwidth borrower, and when the node device detects the bandwidth returning request, the borrowed bandwidth of the bandwidth borrower is returned to the bandwidth borrower.
It should be noted that, in this embodiment of the present application, the node device may automatically perform the bandwidth allocation operation according to an intelligent contract in the block chain, where the intelligent contract specifies the operation performed by the node device in the above step 501 and step 511.
The method provided by the embodiment of the application comprises the steps of obtaining a bandwidth expansion request carrying a first user public key, obtaining a target bandwidth idle record from a block chain system according to the bandwidth expansion request, wherein the target bandwidth idle record comprises a second user public key and an idle bandwidth numerical value, determining a borrowing bandwidth numerical value according to the idle bandwidth numerical value in the target bandwidth idle record, distributing a bandwidth corresponding to the borrowing bandwidth numerical value to a first user terminal, generating a borrowing record, broadcasting the borrowing record in the block chain system, and adding a first block passing through consensus to the block chain of the block chain system, wherein the first block comprises the borrowing record. The bandwidth of the second user terminal is allocated to the first user terminal for use, so that bandwidth allocation according to the bandwidth use condition of the user is realized, the idle bandwidth is effectively utilized, the bandwidth utilization rate and the flexibility of bandwidth allocation are improved, intelligent scheduling of flow is realized, and the use amount of flow is improved.
And blocks are respectively generated according to the account record, the bandwidth idle record, the recovery record, the borrowing record and the return record and added into the block chain of the block chain system, the records can be respectively stored in a plurality of node devices, the distributed storage of the records can be realized, the records stored by each node are consistent, the record tampering can be effectively prevented, and the authenticity and the reliability of the record can be ensured. And the record is stored in the node equipment, so that subsequent query is facilitated, and the traceability of the record is increased.
And the node equipment recovers the borrowed bandwidth of the third user terminal and returns the borrowed bandwidth to the first user terminal according to the bandwidth recovery request, and recovers the borrowed bandwidth of the first user terminal and returns the borrowed bandwidth to the second user terminal according to the bandwidth recovery request, so that the flexibility of bandwidth allocation is further improved.
Fig. 6 is a schematic structural diagram of a bandwidth allocation apparatus based on a block chain according to an embodiment of the present application.
Referring to fig. 6, the apparatus includes:
a record obtaining module 601, configured to obtain a bandwidth expansion request carrying a first user identifier, and obtain a target bandwidth idle record from a block chain system according to the bandwidth expansion request, where the bandwidth expansion request is sent by a first user terminal corresponding to the first user identifier when a bandwidth usage is higher than a first threshold, and the target bandwidth idle record includes a second user identifier and an idle bandwidth value;
an allocating module 602, configured to determine a borrowed bandwidth value according to an idle bandwidth value in the target bandwidth idle record, and allocate a bandwidth corresponding to the borrowed bandwidth value to the first user terminal;
a first generating module 603, configured to generate a borrowing record, where the borrowing record includes a correspondence between a second user identifier, a first user identifier, and a borrowed bandwidth value;
an adding module 604, configured to broadcast the borrowing record in the blockchain system, add a first block passing through the consensus to the blockchain of the blockchain system, where the first block includes the borrowing record.
Optionally, referring to fig. 7, the record obtaining module 601 includes:
a first obtaining unit 6011, configured to obtain a bandwidth expansion request carrying a first user identifier, and query a bandwidth borrowing contract including the first user identifier from a block chain system according to the bandwidth expansion request;
a second obtaining unit 6012, configured to obtain, when a bandwidth borrowing contract is queried, a target bandwidth idle record from the blockchain system according to the bandwidth expansion request.
Optionally, referring to fig. 7, the assignment module 602 includes:
a value obtaining unit 6021, configured to obtain an idle bandwidth value in the target bandwidth idle record;
a determining unit 6022, configured to determine the borrowed bandwidth value according to the corresponding relationship between the idle bandwidth value and the borrowed bandwidth value.
Optionally, referring to fig. 7, the apparatus further comprises:
the record obtaining module 601 is further configured to obtain a borrowing record from the blockchain system according to the bandwidth returning request when the bandwidth returning request carrying the first user identifier is obtained, where the bandwidth returning request is sent by the first user terminal when the bandwidth usage is not higher than the second threshold;
a first determining module 605, configured to determine, according to the borrowing record, a second user terminal corresponding to the second user identifier and a borrowed bandwidth value corresponding to the first user identifier;
a second generating module 606, configured to return the bandwidth corresponding to the borrowed bandwidth value of the first user identifier to the second user terminal, and generate a return record, where the return record includes a correspondence between the second user identifier, the first user identifier, and the borrowed bandwidth value;
the adding module 604 is further configured to broadcast a return record in the blockchain system, and add a second block passing through the consensus to the blockchain of the blockchain system, where the second block includes the return record.
Optionally, referring to fig. 7, the first user identifier is a first user public key, and the apparatus further includes:
a third generating module 607, configured to generate a first user private key and a private key password of the first user terminal according to the registration request when acquiring the registration request of the first user terminal;
the encryption module 608 is configured to encrypt the hash value obtained by splicing the first user private key and the current timestamp according to the private key password to obtain a first user public key;
the adding module 604 is further configured to broadcast the first user public key in the blockchain system, and add a third block passing the consensus to the blockchain of the blockchain system, where the third block includes the first user public key.
Optionally, referring to fig. 7, the apparatus further comprises:
a fourth generating module 609, configured to generate an account record including the first user public key and the account amount according to the first user private key;
the adding module 604 is further configured to broadcast the account record in the blockchain system, and add a fourth block passing through the consensus to the blockchain of the blockchain system, where the fourth block includes the account record.
Optionally, referring to fig. 7, the apparatus further comprises:
a bandwidth obtaining module 610, configured to obtain a bandwidth sharing request carrying a first user identifier, and obtain an idle bandwidth value of the first user terminal according to the bandwidth sharing request, where the bandwidth sharing request is sent by the first user terminal when a bandwidth usage amount is not higher than a third threshold;
a fifth generating module 611, configured to generate a bandwidth idle record, where the bandwidth idle record includes the first subscriber identity and an idle bandwidth value;
the adding module 604 is further configured to broadcast the bandwidth vacancy record in the blockchain system, and add a fifth block passing through the consensus to the blockchain of the blockchain system, where the fifth block includes the bandwidth vacancy record.
Optionally, referring to fig. 7, the apparatus further comprises:
the record obtaining module 601 is further configured to obtain a target borrowing record from the blockchain system according to the bandwidth retraction request when the bandwidth retraction request carrying the first user identifier is obtained, where the bandwidth retraction request is sent by a first user terminal corresponding to the first user identifier when the bandwidth usage is higher than a fourth threshold, and the target borrowing record includes a corresponding relationship between the first user identifier, a third user identifier, and a borrowed bandwidth value;
a second determining module 612, configured to determine, according to the target borrowing record, a third user terminal corresponding to the third user identifier;
a sixth generating module 613, configured to retrieve, from the third user terminal, a bandwidth corresponding to the borrowed bandwidth value of the third user identifier, and generate a retrieval record, where the retrieval record includes a correspondence between the first user identifier, the third user identifier, and the borrowed bandwidth value;
the adding module 604 is further configured to broadcast an eviction record in the blockchain system, and add a sixth block passing through the consensus to the blockchain of the blockchain system, where the sixth block includes the eviction record.
It should be noted that: in the bandwidth allocation apparatus based on the block chain according to the foregoing embodiment, only the division of the functional modules is illustrated, and in practical applications, the function allocation may be completed by different functional modules according to needs, that is, an internal structure of the apparatus is divided into different functional modules, so as to complete all or part of the functions described above. In addition, the block chain based bandwidth allocation apparatus provided in the foregoing embodiment and the block chain based bandwidth allocation method embodiment belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment and are not described herein again.
The node device provided by the technical scheme can be a terminal or a server. For example, fig. 8 shows a schematic structural diagram of a terminal 800 according to an exemplary embodiment of the present application.
In general, the terminal 800 includes: a processor 801 and a memory 802.
The processor 801 may include one or more processing cores, such as a 4-core processor, a 5-core processor, and so forth. The processor 801 may be implemented in at least one hardware form of a DSP (Digital Signal Processing), an FPGA (Field-Programmable Gate Array), and a PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor, where the main processor is a processor for Processing data in an awake state, and is also called a Central Processing Unit (CPU); a coprocessor is a low power processor for processing data in a standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit, image Processing interactor) which is responsible for rendering and drawing the content required to be displayed on the display screen. In some embodiments, the processor 801 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
Memory 802 may include one or more computer-readable storage media, which may be non-transitory. Memory 802 may also include high speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash memory storage devices. In some embodiments, a non-transitory computer readable storage medium in memory 802 is used to store at least one program code for being carried by processor 801 to implement the blockchain based bandwidth allocation methods provided by the method embodiments herein.
In some embodiments, the terminal 800 may further include: a peripheral interface 803 and at least one peripheral. The processor 801, memory 802 and peripheral interface 803 may be connected by bus or signal lines. Various peripheral devices may be connected to peripheral interface 803 by a bus, signal line, or circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 804, a touch screen display 805, a camera 806, an audio circuit 807, a positioning component 808, and a power supply 809.
The peripheral interface 803 may be used to connect at least one peripheral related to I/O (Input/Output) to the processor 801 and the memory 802. In some embodiments, the processor 801, memory 802, and peripheral interface 803 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 801, the memory 802, and the peripheral interface 803 may be implemented on separate chips or circuit boards, which are not limited by this embodiment.
The Radio Frequency circuit 804 is used for receiving and transmitting RF (Radio Frequency) signals, also called electromagnetic signals. The radio frequency circuitry 804 communicates with communication networks and other communication devices via electromagnetic signals. The rf circuit 804 converts an electrical signal into an electromagnetic signal to be transmitted, or converts a received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 804 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a subscriber identity module card, and so forth. The radio frequency circuitry 804 may communicate with other devices via at least one wireless communication protocol. The wireless communication protocols include, but are not limited to: metropolitan area networks, various generation mobile communication networks (2G, 3G, 4G, and 8G), Wireless local area networks, and/or WiFi (Wireless Fidelity) networks. In some embodiments, the radio frequency circuit 804 may further include NFC (Near Field Communication) related circuits, which are not limited in this application.
The display screen 805 is used to display a UI (User Interface). The UI may include graphics, text, icons, video, and any combination thereof. When the display 805 is a touch display, the display 805 also has the ability to capture touch signals on or above the surface of the display 805. The touch signal may be input to the processor 801 as a control signal for processing. At this point, the display 805 may also be used to provide virtual buttons and/or a virtual keyboard, also referred to as soft buttons and/or a soft keyboard. In some embodiments, the display 805 may be one, providing the front panel of the terminal 800; in other embodiments, the display 805 may be at least two, respectively disposed on different surfaces of the terminal 800 or in a folded design; in some embodiments, display 805 may be a flexible display disposed on a curved surface or a folded surface of terminal 800. Even further, the display 805 may be arranged in a non-rectangular irregular pattern, i.e., a shaped screen. The Display 805 can be made of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), and other materials.
The camera assembly 806 is used to capture images or video. Optionally, camera assembly 806 includes a front camera and a rear camera. Generally, a front camera is provided at a front panel of the terminal 800, and a rear camera is provided at a rear surface of the terminal 800. In some embodiments, the number of the rear cameras is at least two, and each rear camera is any one of a main camera, a depth-of-field camera, a wide-angle camera and a telephoto camera, so that the main camera and the depth-of-field camera are fused to realize a background blurring function, and the main camera and the wide-angle camera are fused to realize panoramic shooting and VR (Virtual Reality) shooting functions or other fusion shooting functions. In some embodiments, camera assembly 806 may also include a flash. The flash lamp can be a monochrome temperature flash lamp or a bicolor temperature flash lamp. The double-color-temperature flash lamp is a combination of a warm-light flash lamp and a cold-light flash lamp, and can be used for light compensation at different color temperatures.
The audio circuit 807 may include a microphone and a speaker. The microphone is used for collecting sound waves of a user and the environment, converting the sound waves into electric signals, and inputting the electric signals to the processor 801 for processing or inputting the electric signals to the radio frequency circuit 804 to realize voice communication. For the purpose of stereo sound collection or noise reduction, a plurality of microphones may be provided at different portions of the terminal 800. The microphone may also be an array microphone or an omni-directional pick-up microphone. The speaker is used to convert electrical signals from the processor 801 or the radio frequency circuit 804 into sound waves. The loudspeaker can be a traditional film loudspeaker or a piezoelectric ceramic loudspeaker. When the speaker is a piezoelectric ceramic speaker, the speaker can be used for purposes such as converting an electric signal into a sound wave audible to a human being, or converting an electric signal into a sound wave inaudible to a human being to measure a distance. In some embodiments, the audio circuitry 807 may also include a headphone jack.
The positioning component 808 is used to locate the current geographic position of the terminal 800 for navigation or LBS (Location Based Service). The Positioning component 808 may be a Positioning component based on the GPS (Global Positioning System) in the united states, the beidou System in china, the graves System in russia, or the galileo System in the european union.
Power supply 809 is used to provide power to various components in terminal 800. The power supply 809 can be ac, dc, disposable or rechargeable. When the power source 809 comprises a rechargeable battery, the rechargeable battery may support wired or wireless charging. The rechargeable battery may also be used to support fast charge technology.
In some embodiments, terminal 800 also includes one or more sensors 810. The one or more sensors 810 include, but are not limited to: acceleration sensor 811, gyro sensor 812, pressure sensor 813, fingerprint sensor 814, optical sensor 815 and proximity sensor 816.
The acceleration sensor 811 may detect the magnitude of acceleration in three coordinate axes of the coordinate system established with the terminal 800. For example, the acceleration sensor 811 may be used to detect the components of the gravitational acceleration in three coordinate axes. The processor 801 may control the touch screen 805 to display the user interface in a landscape view or a portrait view according to the gravitational acceleration signal collected by the acceleration sensor 811. The acceleration sensor 811 may also be used for acquisition of motion data of a game or a user.
The gyro sensor 812 may detect a body direction and a rotation angle of the terminal 800, and the gyro sensor 812 may cooperate with the acceleration sensor 811 to acquire a 3D motion of the user with respect to the terminal 800. From the data collected by the gyro sensor 812, the processor 801 may implement the following functions: motion sensing (such as changing the UI according to a user's tilting operation), image stabilization at the time of photographing, game control, and inertial navigation.
Pressure sensors 813 may be disposed on the side bezel of terminal 800 and/or underneath touch display 805. When the pressure sensor 813 is disposed on the side frame of the terminal 800, the holding signal of the user to the terminal 800 can be detected, and the processor 801 performs left-right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 813. When the pressure sensor 813 is disposed at a lower layer of the touch display screen 805, the processor 801 controls the operability control on the UI interface according to the pressure operation of the user on the touch display screen 805. The operability control comprises at least one of a button control, a scroll bar control, an icon control and a menu control.
The fingerprint sensor 814 is used for collecting a fingerprint of the user, and the processor 801 identifies the identity of the user according to the fingerprint collected by the fingerprint sensor 814, or the fingerprint sensor 814 identifies the identity of the user according to the collected fingerprint. Upon identifying that the user's identity is a trusted identity, the user is authorized by the processor 801 to have associated sensitive operations including unlocking the screen, viewing encrypted information, downloading software, paying for and changing settings, etc. Fingerprint sensor 814 may be disposed on the front, back, or side of terminal 800. When a physical button or a vendor Logo is provided on the terminal 800, the fingerprint sensor 814 may be integrated with the physical button or the vendor Logo.
The optical sensor 815 is used to collect the ambient light intensity. In one embodiment, the processor 801 may control the display brightness of the touch screen 805 based on the ambient light intensity collected by the optical sensor 815. Specifically, when the ambient light intensity is high, the display brightness of the touch display screen 805 is increased; when the ambient light intensity is low, the display brightness of the touch display 805 is turned down. In another embodiment, the processor 801 may also dynamically adjust the shooting parameters of the camera assembly 806 based on the ambient light intensity collected by the optical sensor 815.
A proximity sensor 816, also known as a distance sensor, is typically provided on the front panel of the terminal 800. The proximity sensor 816 is used to collect the distance between the user and the front surface of the terminal 800. In one embodiment, when the proximity sensor 816 detects that the distance between the user and the front surface of the terminal 800 gradually decreases, the processor 801 controls the touch display 805 to switch from the bright screen state to the dark screen state; when the proximity sensor 816 detects that the distance between the user and the front surface of the terminal 800 becomes gradually larger, the processor 801 controls the touch display 805 to switch from the screen-on state to the screen-on state.
Those skilled in the art will appreciate that the configuration shown in fig. 8 is not intended to be limiting of terminal 800 and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components may be used.
Fig. 9 is a schematic structural diagram of a server provided in this embodiment of the present application, where the server 900 may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 901 and one or more memories 902, where the memory 902 stores at least one program code, and the at least one program code is loaded and executed by the processors 901 to implement the methods provided by the above method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the application server may also include other components for implementing the functions of the device, which are not described herein again.
The server 900 may be configured to perform the steps performed by the node device in the above block chain based bandwidth allocation method.
The embodiment of the present application further provides a node device, where the node device includes a processor and a memory, where at least one program code is stored in the memory, and the at least one program code is loaded and executed by the processor, so as to implement the operations in the block chain based bandwidth allocation method in the foregoing embodiment.
The present application further provides a computer-readable storage medium, where at least one program code is stored, and the at least one program code is loaded and executed by a processor to implement the operations in the block chain based bandwidth allocation method of the foregoing embodiments.
The present application further provides a computer program, where the computer program includes at least one program code, and the at least one program code is loaded and executed by a processor to implement the operations in the block chain based bandwidth allocation method of the foregoing embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only a preferred embodiment of the present application and should not be taken as limiting the present application, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A bandwidth allocation method based on a blockchain is applied to any node device in a blockchain system, and the method comprises the following steps:
acquiring a bandwidth expansion request carrying a first user identifier, and acquiring a target bandwidth idle record from a block chain system according to the bandwidth expansion request, wherein the bandwidth expansion request is sent by a first user terminal corresponding to the first user identifier when the bandwidth usage is higher than a first threshold value, and the target bandwidth idle record comprises a second user identifier and an idle bandwidth numerical value;
determining a borrowed bandwidth value according to the idle bandwidth value in the target bandwidth idle record, and allocating the bandwidth corresponding to the borrowed bandwidth value to the first user terminal;
generating a borrowing record, wherein the borrowing record comprises the corresponding relation between the second user identifier, the first user identifier and the borrowed bandwidth value;
broadcasting the borrowing record in the blockchain system, and adding a first block passing through consensus to a blockchain of the blockchain system, wherein the first block comprises the borrowing record.
2. The method of claim 1, wherein determining a borrowed bandwidth value from the spare bandwidth values in the target bandwidth spare record comprises:
acquiring an idle bandwidth value in the target bandwidth idle record;
and determining the borrowed bandwidth value according to the corresponding relation between the idle bandwidth value and the borrowed bandwidth value.
3. The method of claim 1, wherein after adding the first block passing the consensus to the blockchain of the blockchain system, the method further comprises:
acquiring a bandwidth returning request carrying the first user identifier, and acquiring the borrowing record from the block chain system according to the bandwidth returning request, wherein the bandwidth returning request is sent by the first user terminal when the bandwidth usage is not higher than a second threshold;
according to the borrowing record, determining a second user terminal corresponding to the second user identifier and a borrowed bandwidth numerical value corresponding to the first user identifier;
returning the bandwidth corresponding to the borrowed bandwidth value of the first user identifier to the second user terminal to generate a returning record, wherein the returning record comprises the corresponding relation among the second user identifier, the first user identifier and the borrowed bandwidth value;
broadcasting the return record in the blockchain system, and adding a second block passing through the consensus to a blockchain of the blockchain system, wherein the second block comprises the return record.
4. The method of claim 1, wherein the first subscriber identity is a first public subscriber key, and before the obtaining a bandwidth expansion request carrying the first subscriber identity and obtaining a target bandwidth free record from a blockchain system according to the bandwidth expansion request, the method further comprises:
acquiring a registration request of a first user terminal, and generating a first user private key and a private key password of the first user terminal according to the registration request;
encrypting the hash value spliced by the first user private key and the current timestamp according to the private key password to obtain the first user public key;
broadcasting the first user public key in the block chain system, and adding a third block which passes through consensus to a block chain of the block chain system, wherein the third block comprises the first user public key.
5. The method according to claim 4, wherein after the first user public key is obtained by encrypting the hash value after the first user private key and the current timestamp are spliced according to the private key password, the method further comprises:
generating an account record comprising the first user public key and the account amount according to the first user private key;
broadcasting the account record in the blockchain system, and adding a fourth block passing through the consensus to a blockchain of the blockchain system, wherein the fourth block comprises the account record.
6. The method of claim 4, wherein after adding the third block by consensus to the blockchain of the blockchain system, the method further comprises:
acquiring a bandwidth sharing request carrying the first user identifier, and acquiring an idle bandwidth value of the first user terminal according to the bandwidth sharing request, wherein the bandwidth sharing request is sent by the first user terminal when the bandwidth usage is not higher than a third threshold;
generating a bandwidth vacancy record, wherein the bandwidth vacancy record comprises the first subscriber identity and the vacancy bandwidth value;
broadcasting the bandwidth free record in the blockchain system, and adding a fifth block which passes through the consensus to a blockchain of the blockchain system, wherein the fifth block comprises the bandwidth free record.
7. The method of claim 6, wherein after adding the fifth block through consensus to the blockchain of the blockchain system, the method further comprises:
acquiring a bandwidth reclaiming request carrying the first user identifier, and acquiring a target borrowing record from the block chain system according to the bandwidth reclaiming request, wherein the bandwidth reclaiming request is sent by a first user terminal corresponding to the first user identifier when the bandwidth utilization is higher than a fourth threshold value, and the target borrowing record comprises a corresponding relation among the first user identifier, a third user identifier and a borrowed bandwidth numerical value;
determining a third user terminal corresponding to the third user identifier according to the target borrowing record;
withdrawing the bandwidth corresponding to the borrowed bandwidth value of the third user identifier from the third user terminal, and generating a withdrawal record, wherein the withdrawal record comprises a corresponding relation between the first user identifier, the third user identifier and the borrowed bandwidth value;
broadcasting the recovery record in the blockchain system, and adding a sixth block which passes the consensus to a blockchain of the blockchain system, wherein the sixth block comprises the recovery record.
8. An apparatus for block chain based bandwidth allocation, the apparatus comprising:
a record obtaining module, configured to obtain a bandwidth expansion request carrying a first user identifier, and obtain a target bandwidth idle record from a block chain system according to the bandwidth expansion request, where the bandwidth expansion request is sent by a first user terminal corresponding to the first user identifier when a bandwidth usage is higher than a first threshold, and the target bandwidth idle record includes a second user identifier and an idle bandwidth value;
the allocation module is used for determining a borrowed bandwidth value according to the idle bandwidth value in the target bandwidth idle record and allocating the bandwidth corresponding to the borrowed bandwidth value to the first user terminal;
a first generating module, configured to generate a borrowing record, where the borrowing record includes a correspondence between the second user identifier, the first user identifier, and the borrowed bandwidth value;
an adding module, configured to broadcast the borrowing record in the blockchain system, and add a first block passing through a consensus to a blockchain of the blockchain system, where the first block includes the borrowing record.
9. A node device, characterized in that it comprises a processor and a memory, in which at least one program code is stored, which is loaded and executed by the processor to implement the block chain based bandwidth allocation method according to any of claims 1 to 7.
10. A computer-readable storage medium having at least one program code stored therein, the at least one program code being loaded and executed by a processor to implement the method for blockchain based bandwidth allocation according to any one of claims 1 to 7.
CN201910964417.2A 2019-10-11 2019-10-11 Bandwidth allocation method, device and equipment based on block chain and storage medium Active CN110690999B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910964417.2A CN110690999B (en) 2019-10-11 2019-10-11 Bandwidth allocation method, device and equipment based on block chain and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910964417.2A CN110690999B (en) 2019-10-11 2019-10-11 Bandwidth allocation method, device and equipment based on block chain and storage medium

Publications (2)

Publication Number Publication Date
CN110690999A CN110690999A (en) 2020-01-14
CN110690999B true CN110690999B (en) 2021-06-11

Family

ID=69112125

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910964417.2A Active CN110690999B (en) 2019-10-11 2019-10-11 Bandwidth allocation method, device and equipment based on block chain and storage medium

Country Status (1)

Country Link
CN (1) CN110690999B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111385755B (en) * 2020-03-18 2021-12-03 成都西加云杉科技有限公司 Bandwidth resource sharing method, device, equipment and readable storage medium
CN112203102A (en) * 2020-09-27 2021-01-08 平安国际智慧城市科技股份有限公司 Network monitoring method, device, electronic equipment and medium
CN112488834B (en) * 2020-11-24 2024-03-19 成都质数斯达克科技有限公司 Node management method, node management device, electronic equipment and readable storage medium
US20230336498A1 (en) * 2022-04-19 2023-10-19 Mediatek Inc. Data bandwidth management method and device
CN114896080B (en) * 2022-06-13 2023-07-21 深圳信息职业技术学院 Method and device for processing distributed system to avoid deadlock based on block chain technology

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361664A (en) * 2018-10-11 2019-02-19 腾讯科技(深圳)有限公司 Data verification method, system and computer readable storage medium based on block chain
CN110012068A (en) * 2019-03-01 2019-07-12 北京奇艺世纪科技有限公司 A kind of download control method, device and storage medium
CN110213224A (en) * 2019-04-19 2019-09-06 北京清红微谷技术开发有限责任公司 Data packet asynchronous forwarding method and system, data processing system and common recognition nodal terminal

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10230530B2 (en) * 2017-08-05 2019-03-12 Proclus Technologies Limited Method and system for securing a blockchain with proof-of-transactions

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361664A (en) * 2018-10-11 2019-02-19 腾讯科技(深圳)有限公司 Data verification method, system and computer readable storage medium based on block chain
CN110012068A (en) * 2019-03-01 2019-07-12 北京奇艺世纪科技有限公司 A kind of download control method, device and storage medium
CN110213224A (en) * 2019-04-19 2019-09-06 北京清红微谷技术开发有限责任公司 Data packet asynchronous forwarding method and system, data processing system and common recognition nodal terminal

Also Published As

Publication number Publication date
CN110690999A (en) 2020-01-14

Similar Documents

Publication Publication Date Title
CN110690999B (en) Bandwidth allocation method, device and equipment based on block chain and storage medium
CN110245144B (en) Protocol data management method, device, storage medium and system
CN110401715B (en) Resource collection task management method, device, storage medium and system
CN109615516B (en) Resource transfer method, device, electronic equipment and storage medium
CN109615515B (en) Credit right certificate transfer method, device, electronic equipment and storage medium
CN110378678B (en) Numerical value integration method, device, system, node equipment and storage medium
CN110598482A (en) Block chain-based digital certificate management method, device, equipment and storage medium
CN108833607B (en) Physical address acquisition method, device and readable medium
CN111339086B (en) Block processing method, and data query method and device based on block chain
CN110290146B (en) Method and device for generating shared password, server and storage medium
CN110826103B (en) Method, device, equipment and storage medium for processing document authority based on blockchain
CN110597924B (en) Block chain-based user identification processing method, device, equipment and storage medium
CN111506884A (en) User invitation method, device, computer equipment and computer readable storage medium
CN111241115B (en) Data synchronization method, device, equipment and storage medium
CN111414598B (en) Monitoring method, device and equipment based on block chain and storage medium
CN110598386B (en) Block chain-based data processing method, device, equipment and storage medium
CN110581891A (en) Game data processing method, device, equipment and storage medium based on block chain
CN111866140A (en) Fusion management apparatus, management system, service calling method, and medium
CN110677262B (en) Information notarization method, device and system based on blockchain
CN113852459A (en) Key agreement method, device and computer readable storage medium
CN110727894B (en) Target material setting method, device, equipment and storage medium
CN109547444B (en) Virtual object acquisition method and device and electronic equipment
CN111198922A (en) Game resource management method and device based on block chain
CN110597868A (en) Information query method, device, terminal and storage medium based on block chain
CN114565388B (en) Method and device for updating consensus rounds, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant