<p>I request information about the <code>block 100001</code> using <code>leveldb and node js</code>. 
Below is my code example.</p>

<pre><code>var level = require('level');
var db = level('E:/download/blockchain/block');
var str = '630010ec274a07f88f9b407da4753f91e15ee6bdf52f0bbc0dfc0dadb6815a6c24';
db.get(new Buffer(str, 'hex'), {
    encoding: 'binary'
}, function (err, value) {
    if (err) {
        console.log(err);
    } else {
        console.log(value);
    }
});
</code></pre>

<p>And i get this answer:</p>

<pre><code>���Zl$]
    at E:\Work\Crypto\node_modules\levelup\lib\levelup.js:164:15
    at E:\Work\Crypto\node_modules\encoding-down\index.js:51:21
</code></pre>

<p>Why is this code throwing an exception, I can't understand. A little help will be appreciated, Thanks </p>

CC BY-SA 4.0
2018-06-07T13:43:36.560Z
looks like it's outputting binary, you need to change the output format?  Maybe change encoding?
JBaczuk
CC BY-SA 4.0
2018-06-07T13:59:49.413Z
Are there any assumptions?
Дима Марков
CC BY-SA 4.0
2018-06-08T03:41:32.393Z
Bitcoin's leveldb is serialized, why not use RPC to parse each block, then each transaction? I don't believe the structure of leveldb is in a format that would allow you to get any useful information just by reading the raw bytes.
m1xolyd1an
CC BY-SA 4.0
2018-06-08T08:48:59.370Z
Thanks for the answer. Do you think that this will not take much time? I just need to scan a lot of addresses for the transactions that come to them.
Дима Марков
CC BY-SA 4.0
2018-06-10T04:27:20.067Z
If you want to learn about transactions affecting certain addresses, make the wallet watch for those addresses. There is no information per address available in Bitcoin Core's LevelDB database, plus if you do this kind of thing while Bitcoin Core is running you may corrupt the database. It is not designed to be usable or useful for any other applications, or any purpose besides validating transactions.
Pieter Wuille
<bitcoin-core><bitcoind><bitcoin-core-development><node.js><leveldb>
Get value from leveldb bitcoin using node.js?
Дима Марков
# Get value from leveldb bitcoin using node.js?

(Asked by: username_0 on 2018-06-07)

I request information about the `block 100001` using `leveldb and node js`.
Below is my code example.

```
var level = require('level');
var db = level('E:/download/blockchain/block');
var str = '630010ec274a07f88f9b407da4753f91e15ee6bdf52f0bbc0dfc0dadb6815a6c24';
db.get(new Buffer(str, 'hex'), {
    encoding: 'binary'
}, function (err, value) {
    if (err) {
        console.log(err);
    } else {
        console.log(value);
    }
});

```

And i get this answer:

```
���Zl$]
    at E:\Work\Crypto\node_modules\levelup\lib\levelup.js:164:15
    at E:\Work\Crypto\node_modules\encoding-down\index.js:51:21

```

Why is this code throwing an exception, I can't understand. A little help will be appreciated, Thanks

**Tags:** bitcoin-core, bitcoind, bitcoin-core-development, node.js, leveldb

> **Comments:**
> **username_1**: looks like it's outputting binary, you need to change the output format?  Maybe change encoding?  
> **username_0**: Are there any assumptions?  
> **username_2**: Bitcoin's leveldb is serialized, why not use RPC to parse each block, then each transaction? I don't believe the structure of leveldb is in a format that would allow you to get any useful information just by reading the raw bytes.  
> **username_0**: Thanks for the answer. Do you think that this will not take much time? I just need to scan a lot of addresses for the transactions that come to them.  
> **username_3**: If you want to learn about transactions affecting certain addresses, make the wallet watch for those addresses. There is no information per address available in Bitcoin Core's LevelDB database, plus if you do this kind of thing while Bitcoin Core is running you may corrupt the database. It is not designed to be usable or useful for any other applications, or any purpose besides validating transactions.  

---

## 0 answers

