-
Notifications
You must be signed in to change notification settings - Fork 63
Updated API docs (Geth compatibility PR #47) #48
Conversation
@vpulim Ok, have updated the docs caring all the stuff together manually (phew, the other way would have been definitely more fun 🐌 😄 Can you have a look? |
Here is the readable version: https://github.com/ethereumjs/ethereumjs-blockchain/blob/9ec717dfeafe58a8cd77ff1c7e7ae550c096caa3/README.md |
README.md
Outdated
const utils = require('ethereumjs-util') | ||
|
||
var gethDbPath = './chaindata' // Add your own path here | ||
var db = levelup(gethDbPath, { db: leveldown }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nitpick: these should be const
declarations. (my fault)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
```javascript | ||
const levelup = require('levelup') | ||
const leveldown = require('leveldown') | ||
const Blockchain = require('./index.js') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be require('ethereumjs-blockchain')
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's a depending on what installation context one is executing the example. This is for executing e.g. out of a cloned repo context. I think people will get what to insert here, other ethereumjs
library examples are also written from this perspective, so I'll leave it.
README.md
Outdated
- `totallDifficulty` - The totall difficulty which is the some of a the difficulty of all the prevous blocks | ||
[DEPRECATION NOTE] | ||
The old separated DB constructor parameters `opts.blockDB` and `opts.detailsDB` from before the Geth DB-compatible ``v3.0.0`` release are deprecated and continued usage is discouraged. When provided `opts.blockDB` will be used | ||
as `opts.db` and `opts.detailsDB` is ignored. On storage level DB formats are not compatible and it is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a typo: "On storage level DB formats..."?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made this a bit clearer.
README.md
Outdated
|
||
#### `blockchain.getHead(name, callback)` | ||
Returns that head block. | ||
- `name` - name of the state root head |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name is optional (defaults to 'vm')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
Awesome! Thanks for doing this. Overall, it looks great. I'm a little OCD so I left some comments on some minor typos/nitpicks above :) |
README.md
Outdated
- [`blockchain.getBlockHashes(parentHash, count, cb)`](#blockchaingetblockhashesparenthash-count-cb) | ||
- [`blockchain.getBlockChain(startingHashes, count, cb)`](#blockchaingetblockhashesparenthash-count-cb) | ||
- [`blockchain.selectNeededHashes(hashes, cb)`](#blockchainselectneededhasheshashes-cb) | ||
- [`blockchain.getBlocks(blockId, maxBlocks, skip, reverse, [cb])`](#blockchaingetblocksblockid-maxblocks-skip-reverse-cb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[cb]
should be [callback]
for consistent naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did this the other way around and now use cb
everywhere since this is also the naming in all the function declarations.
README.md
Outdated
- [`blockchain.getBlocks(blockId, maxBlocks, skip, reverse, [cb])`](#blockchaingetblocksblockid-maxblocks-skip-reverse-cb) | ||
- [`blockchain.selectNeededHashes(hashes, [callback])`](#blockchainselectneededhasheshashes-callback) | ||
- [`blockchain.delBlock(blockHash, [callback])`](#blockchaindelblockblockhash-callback) | ||
- [`blockchain.iterator(name, onBlock, [cb])`](#blockchainiteratorname-onblock-cb) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here ([cb]
=> [callback]
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
…ity), added example code snippet
Updated README API documentation according to #47 (Geth compatibility), added example code snippet.