Popular science | Amazing, how can digital currency pay offline

Author: Chen Liren

Source: To Be the Girl

I often see articles on digital currency writing, "It won't be long before you can use the central bank's digital currency on your mobile phone, and payments can be made" offline "without using the network and mobile phone signals. It can be done. "

So magical, do you wonder if there is no network, how can digital currency achieve "offline" payment?

Digital currency, also known as cryptocurrency, is precisely caused by the magic of blockchain, followed by cryptography, and from it, public key private key system (PKI), and digital signatures.

On each phone, a public key and private key generation application will be run. This application makes full use of randomness. Each time it is run, a unique public and private key pair will be generated. This pair will not be generated in history. Repeat, and it won't repeat in the future. If we have to be rigorous, there is still a very small, very small probability that it will repeat, but if the number of pairs is long enough, it can be almost ignored.

The public key is used as the user's account to ensure that each user runs an application differently and can be made public to receive payments initiated by others. The private key is also unique, and only the user running the application knows it is an advanced secret. This secret is only known by the user and should not be revealed to anyone. In the future, for each user-initiated payment, the transaction must be signed with this private key. Because the private key is only known to the user, if there is any transaction signed with this private key, then it must be the user's action and cannot be denied. If the user divulges the private key, the user can only act on his own, and no one else can carry the pot for him.

With these basic knowledge, then it is easy to understand the offline payment of digital currency.

Suppose Alice wants to pay Bob 10 digital currencies. Alice and Bob both have their own mobile digital wallets. It happens that both Alice and Bob are in the wilderness, there is no cell phone signal and no network, but Alice and Bob's mobile phone can communicate via Bluetooth, or point-to-point, or QR code. Because everyone is familiar with scanning QR codes for payment, we assume that they are also completed through QR codes.

First, Bob opens the mobile digital wallet and clicks the QR code to receive the payment. At this time, the mobile phone displays the payment QR code. In fact, the information contained in the QR code is mainly Bob's mobile wallet address, which is Bob's public key.

Next, Alice opened her mobile phone digital wallet, turned on the camera, and scanned Bob's payment QR code. In fact, she got Bob's public key. At this time, Alice packaged Bob's public key, her public key, and information for paying 10 digital currencies into a transaction, and then signed the transaction with a private key that only Alice knew, but she could not write to the chain without the network. on. Of course, the mobile digital wallet will check if Alice has enough digital currency to pay. You might say that Alice used a hacked wallet and could not package and sign the transaction without enough money. But it doesn't matter, we still assume it is normal. Alice's digital wallet then generates a QR code for this signed transaction for Bob to scan.

Next, Bob scans the QR code on the digital wallet of Alice's mobile phone, and saves the transaction that contains Bob's public key, Alice's public key and the information of paying 10 digital currencies. Because there is no Internet at this time, it cannot be written on the chain. For the time being, Alice is an honest person and uses a normal digital wallet. At this time, it is temporarily considered that the offline payment has been completed.

This process is just like Alice gave Bob 10 yuan in cash, both parties wrote down the serial number of 10 yuan in cash and signed it by hand. As for whether the 10 yuan is real or counterfeit, Bob has no way to verify it. Until Bob went to the bank one day, he didn't know the authenticity of the 10 yuan.

During the period when there is no internet, Alice can continue to pay to different people, using a process similar to the above.

Alright, Alice or Bob, back to the bustling urban area, the mobile phone signal is available, the network is available. At this point, Alice goes online, and the mobile wallet will write the signed transaction to the chain. At this time, if there is no problem with the transaction, it will be officially written on the chain. If Alice intentionally is not connected to the network, or the transaction is fake, then there is no information about the transaction on the chain. At this time, only waiting for Bob to go online. As soon as Bob goes online, he will write the transaction that Alice passed to him to write on the chain. If successful, everything is OK. The original offline payment is now online. The payment and transaction were officially completed.

Here comes the problem. If Alice cheats on purpose, using a hacked digital wallet, or forging a transaction, or not enough money to sign the transaction, then Alice and Bob will not succeed in writing the transaction on the chain. At this time, the equivalent of offline transactions is not successful. If Alice is honest and signed with her private key, then Bob can also find Alice and ask her to pay again. If Alice is dishonest and does not use her own private key, then this situation is troublesome. In order to avoid this situation, then Bob had better wait for the Internet, and then ship to Alice or provide services after verification. This is the same as the counterfeit money in the real world can be found in the bank (ignoring the banknote detector first).

From this point of view, offline payments are perfectly fine for honest parties. For dishonest payers, offline is problematic. It can't be solved without writing online to the chain. Just like without a bank, real-world counterfeit currency is not solved. Responsibility can only be achieved after the fact.

At this point, the mystery is solved, do you understand the magic behind.

We will continue to update Blocking; if you have any questions or suggestions, please contact us!

Share:

Was this article helpful?

93 out of 132 found this helpful

Discover more

Blockchain

Astar integrates Polygon's AggLayer, making it the first blockchain to do so.

Astar Network has successfully integrated with Polygon's AggLayer protocol, marking a significant milestone in Polkad...

Blockchain

From Telegram to the Crypto Top Ten Toncoin (TON) Shoots to Stardom with Massive Gains!

Fashionista Alert Toncoin (TON), endorsed by Telegram, is currently making waves as one of the top 100 digital assets...

Blockchain

Oasys Takes the Blockchain Gaming Industry by Storm with Listing on DappRadar

Oasys has enthusiastically chosen DappRadar as its premier platform for showcasing its cutting-edge DApps and games, ...

Blockchain

Quora Raises $75 Million Funding to Accelerate AI Chat Platform and Empower Bot Creators in the Creator Economy

Quora strives to create a distinctive niche in the creator economy by nurturing a thriving community of AI bot develo...

Market

Bullish Trend Emerges in Crypto Market as Binance and DoJ Edge Closer to Resolution

Binance exchange could potentially face a record-breaking $4 fine from the US Department of Justice (DoJ), causing a ...

Market

Argentina has suspended tax concessions for cryptocurrencies in a comprehensive reform bill.

The reform bill in Argentina no longer includes the provision for individuals to disclose their undeclared cryptocurr...