1

I am looking for how to export or save data from ethereum blocks in a json file using quickblocks.

2
  • Hi there. Can you provide a few more details on what you're trying to do? Why do you want the data in JSON format? Does it specifically need to be in JSON? From the QuickBlocks documentation: "We abhor JSON data, which in our estimation, is literally the worst way to deliver data imaginable". Commented Oct 22, 2017 at 9:38
  • QuickBlocks, even though it abhors JSON data, delivers its data in that format by default. It is easy to consume. Exporting the entire blockchain to JSON will take up an astronomical amount of disc space. Commented Oct 22, 2017 at 22:24

2 Answers 2

1

The C++ code example on the referenced page in the above comments shows how to get a single block.

CBlock block;
getBlock(block, 3500000);
cout << block << "\n"

Simply surround that code with for (int i = 0 ; i &lt; getLatestBlock() ; i++) and the entire blockchain will get printed to the screen. Redirect into a file, and you have what you want--but I warn you: it will take up an astronomical amount of disc space.

2
  • then I have to edit the simple.cpp file and modify main to int main(int argc, const char *argv[]) { // Initialize the system and tell it where to find the blockchain data. etherlib_init("infura"); for (int i = 0 ; i &lt; getLatestBlock() ; i++) // Request the 3,500,000th block from Infura. Store it in 'block' CBlock block; getBlock(block, 3500000); // Print the block to the screen cout << block << "\n"; } return 0; } Commented Oct 22, 2017 at 23:02
  • Yep. Then exit the edit and type 'make'. You've contacted us through email, we can continue the conversation there. Commented Oct 23, 2017 at 3:03
1

Though quickblocks.io is dead by the time I am writing this answer, there is a number of free public nodes listed at ethereumnodes.com providing access to JSON RPC API.

Since the question has been asked, the Ethereum data scale has grown significantly. To operate this amount of data, I suggest you exporting the data into S3 and operating it using AWS Athena (Big Data tool, managed). Here is a good article on how to do it: “How to Export a Full History of Ethereum Blockchain to S3” (Medium).

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.