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 ...
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 ...
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 ...
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 (
...
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, ...
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 ...
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:
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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.
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,
...
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
...
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] ...
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 ...
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 ...
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, ...
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.
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.
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/...
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('/...
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 ...
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 ...
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: ...
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.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
leveldb × 63go-ethereum × 22
merkle-patricia-tries × 10
blockchain × 9
storage × 9
database × 9
state-trie × 5
web3js × 4
private-blockchain × 4
evm × 4
nodes × 4
python × 4
transactions × 3
nodejs × 3
ethereumjs × 3
pyethereum × 3
rlp × 3
chaindata × 3
storage-trie × 3
solidity × 2
javascript × 2
synchronization × 2
cpp-ethereum × 2
geth-debugging × 2
ethereumj × 2