Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #48 from ethereumjs/readstream-example
Browse files Browse the repository at this point in the history
Added Geth read stream example to the README
  • Loading branch information
holgerd77 committed Jun 26, 2018
2 parents 75dff20 + b973451 commit bc42cde
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -46,6 +46,26 @@ Trie.prove(trie, 'test', function (err, prove) {
})
```

## Read stream on Geth DB

```javascript
var levelup = require('levelup')
var Trie = require('./secure')

var stateRoot = "0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544" // Block #222

var db = levelup('YOUR_PATH_TO_THE_GETH_CHAIN_DB')
var trie = new Trie(db, stateRoot)

trie.createReadStream()
.on('data', function (data) {
console.log(data)
})
.on('end', function() {
console.log('End.')
})
```

# API
[./docs/](./docs/index.md)

Expand Down

0 comments on commit bc42cde

Please sign in to comment.