O'Reilly logo

Mastering Bitcoin, 2nd Edition by Andreas M. Antonopoulos

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix D. Bitcore

Bitcore is a suite of tools provided by BitPay. Its goal is to provide easy-to-use tools for Bitcoin developers. Almost all of Bitcore’s code is written in JavaScript. There are some modules written specifically for NodeJS. Finally, the “node” module of Bitcore includes Bitcoin Core’s C++ code. Please see https://bitcore.io for more information.

Bitcore’s Feature List

  • Bitcoin full node (bitcore-node)

  • Block explorer (insight)

  • Block, transaction, and wallet utilities (bitcore-lib)

  • Communicating directly with Bitcoin’s P2P network (bitcore-p2p)

  • Seed entropy mnemonic generation (bitcore-mnemonic)

  • Payment protocol (bitcore-payment-protocol)

  • Message verification and signing (bitcore-message)

  • Elliptic curve Integrated Encryption Scheme (bitcore-ecies)

  • Wallet service (bitcore-wallet-service)

  • Wallet client (bitcore-wallet-client)

  • Playground (bitcore-playground)

  • Integrating services directly with Bitcoin Core (bitcore-node)

Bitcore Library Examples

Prerequisities

If using NodeJS and the node REPL:

$ npm install -g bitcore-lib bitcore-p2p
$ NODE_PATH=$(npm list -g | head -1)/node_modules node

Wallet Examples using bitcore-lib

Creating a new bitcoin address with associated private key:

> bitcore = require('bitcore-lib')
> privateKey = new bitcore.PrivateKey()
> address = privateKey.toAddress().toString()

Creating a hierarchical deterministic private key and address:

> hdPrivateKey = bitcore.HDPrivateKey() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required