laitimes

Interpreting Nostr: a censorship-resistant centralized social protocol

The way to preserve information for about 100 million years, they emphasized, this is the only feasible way known so far, it is——" Luo Ji raised his crutches above his head, his white hair and long beard danced, and he looked like Moses who separated the Red Sea, and shouted solemnly, "Engrave the words in stone!"

—By "The Three-Body Problem"

background

How does the information survive? With the deafening voice from the preface: carve the words in stone!

How can information not be blocked? That can be carved into more stone, the more the better.

How does information prove ownership? Based on a function as beautiful as an elliptic curve, there is a mathematical theory of infinite and unique correspondence.

This is a week of being brushed by the string public key, whether in the circle of friends or Twitter Facebook, the key event is that former CEO of Twitter Jack Dorsey tweeted that social products based on the decentralized social protocol Nostr Damus and Amethyst have been launched on the Apple App Store and Google Google Play Store respectively, and the web side snort.social is also officially opened. Among them, the number of Damus users has exceeded 72W in just a few days.

Although a sentence covers many product terms, but in fact, the relationship is very clear, Nostr is essentially an information transmission protocol for decentralized social scenarios, and Damus, Amethyst, and snort.social are third-party applications developed according to this protocol.

Why is there a demand scenario for Nostr?

The Internet masses who have experienced the anti-monopoly year, that is, hate the abuse and infringement of data by centralized institutions, and are unable to detach from excellent application experience and non-selective market, in the final analysis, behind the social products is the company for the institution to operate, is the company has the obligation to accept supervision and review, all his responsible objects are shareholders and the government of the place of registration, essentially pursuing commercial success, not the ideal of freedom of speech.

Since the central organization cannot do it and has no position to do it, the yearning for freedom has spawned a decentralized protocol that uses code to protect freedom: Nostr

Nostr protocol architecture

In fact, Nostr is very concise and clear, and can be summarized in one word:

Have everyone run a client program, sign the text with their own private key and send it to multiple repeaters. If you want to obtain information, you will ask each repeater. The client then verifies the authenticity of the obtained information with its public key.

Role relationships

There are only two roles in the protocol: repeater and client

, as a repeater can have any number, the mission is to accept and store the information reported by the client, and return the local query results according to the client request.

 , that is, the client can also have any number, stored in the user's device, the core to be done is signing and verification.

From such a concise role relationship, it can be seen that the user client does not interact with other user clients, not in the form of P2P, and there is no need for interaction between repeaters, and there is no need for information communication between them, which also means that there is no consensus level problem.

In general, it belongs to a strong client, weak server (relay) structure, multiple servers can replace each other, thereby diluting its importance, which is also the basis of anti-censorship, users have the right to choose the relay independently, which can trigger competition at the relay level, greater capacity, faster speed, better network incentives and the ability to filter spam content.

Account system

An identity in a Nostr consists of a public and a private key. So without a password or a unique username (or the public key is the username), anyone creating a new public-private key pair is cost-free, essentially an existing relationship.

Interpreting Nostr: a censorship-resistant centralized social protocol

However, what is significantly different from previous decentralized social products is that he is not on the chain throughout the process, which can be said to have nothing to do with the chain itself, but only applies the most conventional public and private key account system on the blockchain.

We can already see the role of public and private keys from many scenarios, which is an excellent account weapon for users who can accept the risk of self-controlled private key management, with EOA as the bottom and MPC as the optimization, and the contract wallet as the carrier of the current account abstract AA.

Secondly, in front of the majority of NFT players, they often encounter various whitelist Mints, which are also based on public and private key signatures and unsigning

Operational behavior

Nostr's NIP is a mechanism similar to Ethereum's EIP proposal, and NIP-01 illustrates the content of each message.

From the perspective of the user client, we can perform the following operations

Operation 1, sign release information: EVENT

When a user wants to publish information, he or she signs a string of content with the private key stored by his local client, and finally generates the following type of data

The id here is actually calculated with a hash based on the combination of the current content, because there is a timestamp involved, so the id will not be repeated under normal circumstances.

Operation 2: Subscribe to the target event: REQ

As a message transmission, there are back and forth, and the instruction REQ needs to send a random ID as the subscription ID to the repeater, as well as a filter information. The settings that the current protocol can support are as follows:

From the perspective of filter conditions, it is basically equivalent to paying attention to this function, neither need the permission of the other party to pull the information released by the other party (in fact, the essence is public), and the filter is only a better definition, who is in what time period, the one that was released

Of course, due to the design of repeaters, it is possible that some repeaters do not store the information of the target user, so the user needs to try to pull from different repeaters, once the repeater is hung, or even all the associated repeaters are hung, then this piece of information is lost.

Operation 3: End subscription: CLOSE

The last type of information that the client can initiate to the repeater is the close command, that is, close the subscription, then the client will not continuously obtain the latest event information.

From a technical point of view, this protocol uses the subscription ID mode, which means that the repeater will establish a continuous link, once the repeater receives the information of the followed user, it will actively initiate a request to the subscriber's client to synchronize, although this mode is more loaded for the repeater, but also can get real-time followed data such as the number of followed, is a way to motivate users to publish more valuable information.

And the protocol has multiple "e" and "p", although this kind of information is not required, but it can make each relay address fission and propagate between clients, which is the key to improving censorship resistance.

Nostr's dilemma and solution

Through the above combing of the role relationship, account system, and operation behavior in the Nostr protocol, we can basically understand the operation principle of such a simple and elegant set of transmission protocols.

However, compared to everyone, everyone also has the same questions as the fourteen kings, is it as simple as that? Yes, the process of combing by the author is like doing the programming homework of computer networks when I was a freshman, and realizing a local area network chat software.

The explosion of Nostr was essentially the success of philosophical ideas. Only the minimum necessary elements are defined, and the control ability is released, any developer, even a freshman or sophomore computer student, can develop a repeater service, and the low entry threshold brings a huge experience competition.

As can be seen from the extended link at the end of the article, there have been 228 github open source implementation cases as of the post, and some of them have also shown full creativity in exploring commercialization this time.

Social scenes have always been considered to be the Internet category with the deepest moat. Many of these demands need to be further optimized based on Nostr to solve.

Dilemma 1: Social privacy issues

The current Nostr repeater is just a dump of simple JSON data. The client gets it through a filter. This makes Nostr a common data sharing platform between clients, so how to solve the scenario of private information transmission needs? After all, even social squares like Twitter will have the need for private messages.

The best solution is the DH algorithm (Diffie-Herman Key Exchange), a set of algorithms that came out in 1976. It is the first practical way to create a shared secret in a non-protected channel. As long as the shared secret key is obtained, both parties using Nostr can publish the encrypted information, enabling peer-to-peer private communication. Since privacy often has the appeal of burning after reading, the server storage cost can be further reduced.

Dilemma 2, anti-DOS problem

It is the repeater layer that will be attacked, and the current Nostr protocol does not directly guide and determine how to make repeaters resistant to DOS attacks and spam, so it is also the focus of many repeater implementations.

Starting from payment, because the relay has a high degree of autonomy, then he can set the payment conditions, that is, some relay services only allow transactions that complete payment to be posted on it, and financial costs are the best spam filters.

Starting from proof-of-work, it can also increase the mining cost of a single release of information, although Nostr and the blockchain are basically unrelated, but the account system based on the public private key and signature allows it to attach requirements in the released event, such as how difficult to publish an ID (based on the result of hash calculation) (such as the first 5 digits are 0), which is a publishing method that holds information and has proof of work.

Dilemma 3: High-cost storage and spam filtering

Although the repeaters do not need to share any information, but they have a common demand, that is, to meet the user's wishes and improve the experience, then they will be happy to share some blacklists, and communicate with each other to collect more information posted by users, so that their inventory is getting bigger and bigger.

For the party that pays the cost, there must be a party that collects benefits, because the cost of resources such as network video pictures is high, and the ability to easily reduce cannot be seen, there will inevitably be a small network based on the charging model, and finally Nostr is a data island, even if it is reachable and needs to pay a cost.

At last

Despite the explosion of Nostr in front of me, I still believe that the core problem of creating a decentralized media platform is not a technical problem, but a social dilemma.

Social is the pearl, is the deepest category of the moat of the Internet tracks, this is because he has a strong network effect, the oligopolistic effect brought by the social graph is particularly obvious, such as the social endpoint of most social applications including Tantan, Momo, etc. is actually WeChat, making it difficult for anyone to leave the social relationship precipitated by WeChat. Network effects and monopoly advantages largely come from closure and permission, and after users build their own circles, the cost of users exiting these platforms is very high, because they cannot take away social connections and graphs.

While social products are very afraid of losing contact, Nostr implements censorship-resistant repeater logic, but it also brings uncertainty, the message has a layer of separation from the publishing end to the receiving end, and the HTTP stable connection establishment condition of 3 handshakes and 4 waves of hands cannot be manually implemented by users.

In the social appeal, most of the user data control appeal may be weaker than the user's inner needs, in the early years QQ space was all the rage, and later when it turned to the mobile Internet, the huge difference between the WeChat circle of friends is the two functions of likes and comments, acquaintances can be seen and all staff can be clearly distinguished, and the subsequent results are also obvious to all.

There are more web2 social platform advantages are not to list, the current Nostr-based implementation of Damus and so on, although famous, but overall full of various bugs, a good experience still has a long way to catch up.

Reference Links:

https://github.com/nostr-protocol/nostr

https://github.com/nostr-protocol/nips/blob/master/01.md

https://bips.xyz/340

https://zh.wikipedia.org/wiki/ Diffie-Herman key exchange

https://github.com/aljazceru/awesome-nostr

【Fourteen Jun - Original Review】

Read on