Hot answers tagged

16 votes
Accepted

LevelDB in Geth, key and values

Let's start with having a look at what we get in geth console for block number 40. Now let's consider a Go program. I Explained everything in code comments about how it is constructing keys and ...
Vishal Sharma's user avatar
10 votes
Accepted

Corruption on data-block while synchronising

Can't really say what could have gone wrong, but your database is corrupted at the LevelDB storage engine level. Something seems to have modified the flat data files that leveldb uses to store its ...
Péter Szilágyi's user avatar
6 votes
Accepted

What is the composition of the blockchain database?

account is a local object to easily track changes on the accounts (with a StateObject db). The size depends on the nbr of transactions you execute with this account. An unused account should be less ...
wiwulo's user avatar
  • 131
4 votes

Format of LevelDB files in nodes directory? Trouble pulling contents with python leveldb API

The contents of the database are blob-ified, so you'll have to de-blobbify them to get anything human-readable. The layout can be found in database.go: // Schema layout for the node database var ( ...
Richard Horrocks's user avatar
4 votes

How to access Geth's state trie

Doing this using web3 over RPC will take forever, as you've found. Reading the .ldb files is the way to go, and is something that's come up in similar questions before. I don't know of any working, ...
Richard Horrocks's user avatar
4 votes

Index and query blockchain data and levelDB

Geth does three operations on the database that you should consider when trying to find alternatives. Geth loads the entire database in levelDB (what I believe you want to do). Geth then deciphers ...
Fortune's user avatar
  • 502
4 votes

Block header format

You can find the block header's structure in the Yellow paper, 4.4 (page 5). I don't have time to go through eveyrthing, but if I do not make any mistake, for example, you could bind the following: ...
Itération 122442's user avatar
4 votes
Accepted

What filesystem should I use for geth and leveldb?

I would recommend choosing between ext4 and xfs filesystems Here is an example of Geth provisioning with some tweaks of ext4 filesystem assuming you are using a Label for the mount (you may change to ...
Roman Shishkin's user avatar
3 votes

Is it possible for multiple geth processes to share chain data?

I don't think that is possible, because it will completely break the goal of the ethereum network and may (and should) break the integrity and network validation of transactions and stored data on the ...
Kaki Master Of Time's user avatar
3 votes
Accepted

How to store storage trie in leveldb?

I am not an expert, but let me share my understanding. Also, please check this question: Ethereum Merkle Patricia Trie and Hashes The trie is stored as key value pairs in levelDB. Each hash (256-bit ...
Muhammad's user avatar
  • 106
3 votes
Accepted

JavaScript merkle-patricia-tree/secure - OutOfMemory when traversing large (~70Gb) state tries

Pull request for the fix https://github.com/ethereumjs/merkle-patricia-tree/pull/38 Previous answer I'm not 100% sure but I think the problem lies in using the async.forEachOf() for traversing the ...
medvedev1088's user avatar
  • 10.9k
3 votes
Accepted

How open local ethereum chain (leveldb) using PyEthereum package?

I had the same issue. It looks like the database layer in pyethereum has been abstracted out such that databases other than leveldb can be used. The challenge is that even if you pass a leveldb object ...
MattPerry's user avatar
  • 146
3 votes

How open local ethereum chain (leveldb) using PyEthereum package?

(This isn't a full answer - as I'm not familiar with how Pythereum does things - but might be a potential starting point.) Have a look at the State() class in state.py. This appears to have some ...
Richard Horrocks's user avatar
3 votes

LDB files reading

...or a Go API library, or to explain me what part of Geth accesses the chain files, for being able to develop it myself? Have a look at Geth's database.go, which is part of the ethdb package. For ...
Richard Horrocks's user avatar
2 votes

Corruption on data-block while synchronising

Note: I've run fsck on the (unmounted) disk without finding any problems. fsck is a good tool to check for filesystem level problems, but not hardware level. I'd always start at the hardware level ...
linagee's user avatar
  • 6,118
2 votes

LevelDB in Geth, key and values

I think keys are needed to organize tree - to know how to move nodes in trie without knowledge of stored information, read about Patricia-Tree. In examples, they use keys to organize trie.
Gudsaf's user avatar
  • 317
2 votes

Ethereum storage implementation at the database level - how is it stored

Instructions that store and retrieve data are: SLOAD: { execute: opSload, gasCost: gasSLoad, validateStack: makeStackFunc(1, 1), valid: true, ...
Nulik's user avatar
  • 4,021
2 votes

Index and query blockchain data and levelDB

There are inherent limitations of this approach: You can't get the world state from the underlying database since all keys are hashed there. It includes: accounts and their balances contract storage ...
medvedev1088's user avatar
  • 10.9k
1 vote
Accepted

How do I check the Ethereum balance and unique transactions count of a Smart Contract over a period of time?

You can get the Ether balance of a smart contract at any block using the Web3 JSON RPC which is exposed through Web3 libraries like Web3.js: getBalance web3.eth.getBalance(address [, defaultBlock] ...
Shawn Tabrizi's user avatar
1 vote

why ethereum can run so much process with level db at the same time?

All the modules you mention: p2p, blocks, rpc, etc, are executed inside a unique process: geth. Inside geth the different modules have access to leveldb synchronized through mutexes and other ...
Ismael's user avatar
  • 31k
1 vote

Viewing account balance of an address

You can get the balance of any account using web3.js using web3.eth.hetBalance('eth_address') A sample code be something like this: custom_func.prototype.GETBALANCE=function(address){ return new ...
Prashant Prabhakar Singh's user avatar
1 vote

reading contract bytecode from leveldb

You can query contract bytecode in this public BigQuery dataset https://medium.com/@medvedev1088/more-blockchain-analysis-on-bigquery-92a863137f01. Additionally you can query blocks, transactions, ...
medvedev1088's user avatar
  • 10.9k
1 vote

Iterating through the ethereum blockchain using Java

The issue was the Dain's levelDB only uses .sst files, please use fusesource's levelDB library.
Fortune's user avatar
  • 502
1 vote

How to access Geth's state trie

You could also read data via a localhost IPC api, which is much faster than the RPC http endpoint.
Michael Quale's user avatar
1 vote
Accepted

Where can i get local merkle-patricia-tree root of my chain for look it in Nodejs?

You can use Geth's dump command to grab block 0, and then grab the top part of the output: $ geth dump 0 | head INFO [11-26|19:58:18] Allocated cache and file handles database=/home/...
Richard Horrocks's user avatar
1 vote
Accepted

How open local ethereum chain (leveldb) using Nodejs levelup package?

Problem was, that i had to use this: var level = require('level') var db = level('/Users/User/WebstormProjects/untitled/bin/chaindata') instead var levelup = require('levelup'); var db = levelup('/...
Gudsaf's user avatar
  • 317
1 vote

How open local ethereum chain (leveldb) using Nodejs levelup package?

Looking at the LevelDB code, that error appears to be returned if the passed in DB is either empty or invalid. You'll need to check your copy is intact and that there's actually something in it (by ...
Richard Horrocks's user avatar
1 vote
Accepted

Block header format

From here Parent hash: This is the Keccak 256-bit hash of the parent (previous) block's header. • Ommers hash: This is the Keccak 256-bit hash of the list of ommers (or uncles) blocks included in ...
Yilmaz's user avatar
  • 1,540
1 vote
Accepted

Why web3.db.putString throws error?

It seems that the web3.db had been removed in geth 1.4, I personally met the same problem before > web3.db { getHex: function(), getString: function(), putHex: function(), putString: ...
jiaxyan's user avatar
  • 46
1 vote

If I stored the blockchain in shared storage, can multiple miners work on it?

Short answer: No, LevelDB is designed to be single threaded.
Herman Junge's user avatar
  • 2,381

Only top scored, non community-wiki answers of a minimum length are eligible