How to read the blockchain state ?

How to read the blockchain state ?


What if I told you that you can’t read the blockchain state ? You’d maybe think that there is a trick somewhere, there is no trick.

The issue with light clients

Let me explain, by you I mean you using what we call a light client, basically a device that is not part of a blockchain network. The blockchain state is the state of the virtual machine that many computers share and maintain consensus on, the rules to modify this state are governed by Proof of Work or Proof of Stake.

There are thousands of applications that use the blockchain, and need to read from it. They do it today through very common API endpoints, for example Infura’s job is to maintain a robust infrastructure, and allow programs to communicate (read or write) with the blockchain through APIs.

Then I guess I just have to issue an API call to Infura or a node of the network to read from the blockchain.

Precisely no, remember that a blockchain state exists only out of consensus between multiple peers, the state of one computer is not the blockchain state.

When you issue a request to a node of the blockchain, you ask a node to tell you about its internal state. This node is free to tell you anything it wants in return, this is how for example OpenSea manages to censor or remove entire collections of NFTs from its platform (not saying this is good or bad here).

The state of one computer is not the blockchain state and if you ask a computer to tell you about its internal state you can only guess that it will answer honestly. Blockchain state exists only out of a consensus between independant peers, when you query a single peer you instantly loose this property, there is no consensus at all in this operation.

99.9% of dapps, DeFi websites, blockchain web applications hit unique API endpoints today. They do not read the blockchain state, but instead connect to trusted centralized gateways. This relates very much to an article I posted back in 2019 Dapps are not decentralized.

Any solution ?

The whole dappy project started on these analysis and findings. We are developing a rock solid availability network that will allow light clients to truly read from the blockchain in a trustless manner. We firstly use this mechanism for the no-DNS name system we are building, and also for many other things.

So yes there are solutions for this issue. And they are quite simple:

  • Solution one is issuing multi-requests : basically you will never ever hit a single API endpoint, but rather you will hit 2, 3 or 20 endpoints, each belonging to different companies. Then you will perform very simple math/consensus operations on the answers you have received.
  • Solution two is issuing a single request, but also check that what you have received is signed by different identities that you want to put your trust in. It can be signed on the blockchain, or on the fly when your request is processed. For example if you know 10 PoS validators of a given blockchain, you will expect your data to have been signed by those 10 identities, or at least a major portion of them.

Dappy is a disruptive name system and web browser that will provide any company, organization or individual with protocol-level guarantees that meet the need for ultra secure, accurate and confidential exchange of information on the internet network.

We provide free assistance for companies that wish to try dappy, you can reach out to us by email contact[at]fabco.tech or through the dappy.tech/contact form.