Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: block.header.getHash is not a function #167

Open
7flash opened this issue Aug 16, 2018 · 0 comments
Open

TypeError: block.header.getHash is not a function #167

7flash opened this issue Aug 16, 2018 · 0 comments

Comments

@7flash
Copy link

7flash commented Aug 16, 2018

block argument is object with data fields, but without any specific methods

this.emit(`block:${block.header.getHash().toString('base64')}`, block)

example.js

let { Peer } = require('bitcoin-net')
const net = require("net")

const socket = net.connect({ port: 8333, host: 'vilha.info' }, () => {
  const peer = new Peer({ magic: 0xd9b4bef9, defaultPort: 8333 }, { socket })

  peer.once('ready', () => {
    peer.getBlocks([Buffer.from('0000000000000000002b0fcdc0bdedcc71fcce092633885628c3b50d43200002', 'hex').reverse()],
      (err, headers) => {
        console.log(headers)
      })
  })
})

package.json

  "dependencies": {
    "bitcoin-inventory": "^1.0.2",
    "bitcoin-merkle-proof": "0.0.6",
    "bitcoin-net": "^5.0.0",
    "bitcoin-protocol": "^3.0.1",
    "blockchain-spv": "^3.1.6",
    "crypto": "^1.0.1",
    "debug": "^2.2.0",
    "event-cleanup": "^1.0.3",
    "object-assign": "^4.1.0",
    "through2": "^2.0.1",
    "webcoin-bitcoin": "^3.1.4"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant