1

I have read that the blockchain is a public ledger with all transactions of a decentralized community, furthermore i read that everyone can check that ledger for transactions that happened within the network. My question is how i am able to look into the blockchain to check for transactions without using sites like blockchain.info.

3
  • Are you referring to transactions or trades on an exchange?
    – JBaczuk
    Commented Feb 11, 2019 at 22:07
  • No what I meant is how and where I can get the same data like you can see on sites like blockchain.info show. Commented Feb 12, 2019 at 21:49
  • It would be better to specify the blockchain platform that you're referring to. For example, Bitcoin blockchain, as the blockchain is referred to as a "data structure", while the Bitcoin is referred to as a "protocol" that uses the blockchain. Each blockchain platform may have different behavior and features depending on whether blockchain-based protocol is public permission-less or private permissioned etc. Briefly blockchain does not include necessarily all of Bitcoin features such as transparency etc.
    – Questioner
    Commented Feb 27, 2019 at 15:22

1 Answer 1

5

All of the transaction history is communicated between peers over a binary gossip protocol. You can request specific blocks, sequences of blocks, or specific transactions, and clients will normally communicate by broadcasting all of the information they receive to other peers they are connected to - enabling each client to stay mostly up-to-date once they've downloaded the historical ledger. It is required that you connect to multiple peers to request information so that you are sure to get up-to-date information if a potentially malicious peer tries to withold information.

If you are already running a full node (which is a software client which uses the above protocol and stores the valid information it receives), then you already have the transaction history on your machine running the software. For Bitcoin Core, the files are stored in the ./store/blocks/ subdirectory of bitcoin's storage directory. The directory contains many files named blkXXXXX.dat, which are serialized sequences of blocks. Each file contains many Block File structures in serial, up to a limit of 128MB per file. The files are numbered ascendingly, with blk00000.dat being the oldest containing the genesis block as its first Block File. The Block File structure mimics the structure of the information of a block message received over the message protocol, except is prefixed with a magic number and size of the block.

Typically, if you want to write a block explorer, it would be simpler to read the information from the block files stored by Bitcoin Core, unless you need your block explorer to contain live information, in which case you will need to get information over the gossip protocol directly, or through Bitcoin Core's ZMQ interface, because the node software only commits confirmed transactions into block files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.