Ongoing guide. If you have suggestions/comments, or want to write about it leave a note below.
Why we need it?
Let's say you want to build an app and you want to fetch data from the blockchain, how do you read/write it? Let's talk about that.
You can access blockchain data like the way you access normal data in any MVC where you fetch data from database ,manipulate it in backend and display the result in front end. In case of blockchain,what all you need to understand is it is nothing but a decentralized database where transactions occur dynamically and the data is distributed among all the nodes.
So to explain how the data is actually fetched from blockchain, what I do is Crawl each block in the blockchain and store the data in your preferred data base like MySql or Mongo.
Use 1 API to access all Blockchains, not only 1, that is also decentralized.
As I see it there are two ways of doing this, the ground up focusing on infrastructure or using a service and focusing on the product only. Here are them:
- From Ground up:
If you want to query the balance use a json-rpc req through an ETH full node.
You can do that on any blockchain through whatever nodes or requests they support. You just need access to a full node.
For notifications on balance changes just use web sockets instead.
There are already services that provide this kind of data and they continue to innovate, the advantage of this is that if the startup company is small 1-10 employees, the development can be way faster and secure by using services such as Covalenthq to use as API to retrieve data from blockchain. There are other useful services such as parsiq to turn blockchain data into actions, cryptocurrencyalerting to get crypto alerts, epns for Ethereum Push Notifications and thegraph as API interact with the Etherium blockchain.
There are different purposes for accessing data, in this case I want to access it for development purposes, read here how data can be read using Covalenthq.
If you are planning to track crypto using excel sheets, you could use something like Cryptosheets.
Other more advanced methods involve creating creating RPC-JSON calls with Websockets/webhooks, but this one is a full implementation and require deep understanding.