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. Incase of blockchain,what ayou need to understand is it is nothing but a decentralized database where transactions occor dynamically and the data is distibuted 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
You can use rpc
getblockhash "n", which will return the hash of the block "n", for example:
You can retrieve the block's contents by calling
get block "b", where "b" is the hash. Which can look like this:
"hash" : "eee7f58d111ef0b25f7f6e8703d80ab6b51ca957170daea949e93e6467906889",
"confirmations" : 176023,
"size" : 261,
"height" : 0,
"version" : 1,
"merkleroot" : "695191c2e8f8fddc75331a38d658ab07672970b09981ad77c29c4b0b17580941",
"tx" : [
"time" : 1518520240,
"nonce" : 2084635057,
"bits" : "1e0ffff0",
"difficulty" : 0.00024414,
"nextblockhash" : "1bb4a4c35103a363ad63bf59bf7fa45c06babcfa8d848ceeb7e4958f9a9f660e"
Now every key value of above output replicates some important concept which cannot be ignored. But for now lets just focus on "tx",
the array of tx are the list of transaction that have been mined in the "n"th block, and now you can crawl each and evry transaction given in tx array using rpc
getrawtransaction to know the detail of each transaction.
Personally, I store the details in MongoDB so I can keep track of my applications' users, their addresses and the transactions they have done.
So this is a simple approach by which you can access data from a blockchain.