Socket
Socket
Sign inDemoInstall

bitcore-lib

Package Overview
Dependencies
Maintainers
3
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcore-lib - npm Package Compare versions

Comparing version 8.25.25 to 8.25.28

4

docs/browser.md
# Browser Builds
Bitcore and most official submodules work in the browser, thanks to [browserify](http://browserify.org/) (some modules are not fully compatible with web browsers).
Bitcore Javascript Library and most official submodules work in the browser, thanks to [browserify](http://browserify.org/) (some modules are not fully compatible with web browsers).
The easiest and recommended way to use them, is via [Bower](http://bower.io/), a browser package manager, and get the release bundles. For example, when building an app that uses `bitcore` and `bitcore-mnemonic`, you do:
The easiest and recommended way to use them, is via [Bower](http://bower.io/), a browser package manager, and get the release bundles. For example, when building an app that uses `bitcore-lib` and `bitcore-mnemonic`, you do:

@@ -7,0 +7,0 @@ ```sh

@@ -1,2 +0,2 @@

# Bitcore examples
# Bitcore Javascript Library examples

@@ -3,0 +3,0 @@ ## Generate a random address

# Transaction
Bitcore provides a very simple API for creating transactions. We expect this API to be accessible for developers without knowing the working internals of bitcoin in deep detail. What follows is a small introduction to transactions with some basic knowledge required to use this API.
Bitcore JavaScript Library provides a very simple API for creating transactions. We expect this API to be accessible for developers without knowing the working internals of bitcoin in deep detail. What follows is a small introduction to transactions with some basic knowledge required to use this API.

@@ -89,3 +89,3 @@ A Transaction contains a set of inputs and a set of outputs. Each input contains a reference to another transaction's output, and a signature that allows the value referenced in that output to be used in this transaction.

- `outputIndex`: a `number` the index of the output in the previous transaction
- `sequenceNumber`: a `number`, the sequence number, see [bitcoin's developer guide on nLockTime and the sequence number](https://bitcoin.org/en/developer-guide#locktime-and-sequence-number).
- `sequenceNumber`: a `number`, the sequence number, see [bitcoin's developer guide on nLockTime and the sequence number](https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number).
- `script`: the `Script` instance for this input. Usually called `scriptSig` in the bitcoin community.

@@ -99,3 +99,3 @@ - `output`: if available, a `Output` instance of the output associated with this input.

- `from`: A high level interface to add an input from a UTXO. It has a series of variants:
- `from(utxo)`: add an input from an [Unspent Transaction Output](http://bitcore.io/guide/unspentoutput.html). Currently, only P2PKH outputs are supported.
- `from(utxo)`: add an input from an [Unspent Transaction Output](unspentoutput.md).
- `from(utxos)`: same as above, but passing in an array of Unspent Outputs.

@@ -119,4 +119,4 @@ - `from(utxo, publicKeys, threshold)`: add an input that spends a UTXO with a P2SH output for a Multisig script. The `publicKeys` argument is an array of public keys, and `threshold` is the number of required signatures in the Multisig script.

- `getSignatures`: takes an array of `PrivateKey` or strings from which a `PrivateKey` can be instantiated; the transaction to be signed; the kind of [signature hash to use](https://bitcoin.org/en/developer-guide#signature-hash-types). Returns an array of objects with the following properties:
- `signature`: an instance of [Signature](https://github.com/bitpay/bitcore/blob/master/lib/crypto/signature.js)
- `getSignatures`: takes an array of `PrivateKey` or strings from which a `PrivateKey` can be instantiated; the transaction to be signed; the kind of [signature hash to use](https://developer.bitcoin.org/devguide/transactions.html#signature-hash-types). Returns an array of objects with the following properties:
- `signature`: an instance of [Signature](https://github.com/bitpay/bitcore/blob/master/packages/bitcore-lib/lib/transaction/signature.js)
- `prevTxId`: this input's `prevTxId`,

@@ -148,3 +148,3 @@ - `outputIndex`: this input's `outputIndex`,

- `toJSON`: Will be called when using `JSON.stringify` to return JSON-encoded string using the output from `toObject`.
- `toString` or `uncheckedSerialize`: Returns an hexadecimal serialization of the transaction, in the [serialization format for bitcoin](https://bitcoin.org/en/developer-reference#raw-transaction-format).
- `toString` or `uncheckedSerialize`: Returns an hexadecimal serialization of the transaction, in the [serialization format for bitcoin](https://developer.bitcoin.org/reference/transactions.html#raw-transaction-format).
- `serialize`: Does a series of checks before serializing the transaction

@@ -185,3 +185,3 @@ - `inspect`: Returns a string with some information about the transaction (currently a string formatted as `<Transaction 000...000>`, that only shows the serialized value of the transaction.

All bitcoin transactions contain a locktime field. The locktime indicates the earliest time a transaction can be added to the blockchain. Locktime allows signers to create time-locked transactions which will only become valid in the future, giving the signers a chance to change their minds. Locktime can be set in the form of a bitcoin block height (the transaction can only be included in a block with a higher height than specified) or a linux timestamp (transaction can only be confirmed after that time). For more information see [bitcoin's development guide section on locktime](https://bitcoin.org/en/developer-guide#locktime-and-sequence-number).
All bitcoin transactions contain a locktime field. The locktime indicates the earliest time a transaction can be added to the blockchain. Locktime allows signers to create time-locked transactions which will only become valid in the future, giving the signers a chance to change their minds. Locktime can be set in the form of a bitcoin block height (the transaction can only be included in a block with a higher height than specified) or a linux timestamp (transaction can only be confirmed after that time). For more information see [bitcoin's development guide section on locktime](https://developer.bitcoin.org/devguide/transactions.html#locktime-and-sequence-number).

@@ -200,4 +200,1 @@ In bitcore, you can set a `Transaction`'s locktime by using the methods `Transaction#lockUntilDate` and `Transaction#lockUntilBlockHeight`. You can also get a friendly version of the locktime field via `Transaction#getLockTime`;

## Upcoming changes
We're debating an API for Merge Avoidance, CoinJoin, Smart contracts, CoinSwap, and Stealth Addresses. We're expecting to have all of them by some time in 2015. Payment channel creation is available in the [bitcore-channel](https://github.com/bitpay/bitcore-channel) module.

@@ -10,3 +10,3 @@ # Unit

8198999.999999999
> var bitcore = require('bitcore');
> var bitcore = require('bitcore-lib');
> var Unit = bitcore.Unit;

@@ -13,0 +13,0 @@ > Unit.fromMilis(81.99).toSatoshis() // correct

{
"name": "bitcore-lib",
"version": "8.25.25",
"version": "8.25.28",
"description": "A pure and powerful JavaScript Bitcoin library.",

@@ -55,3 +55,3 @@ "author": "BitPay <dev@bitpay.com>",

"license": "MIT",
"gitHead": "3e58c226e5feacb3851049667b66b07eeac75b38"
"gitHead": "713d540373cd442327f7fed479c2b69dfd239ab7"
}

@@ -1,2 +0,2 @@

# Bitcore Lib
# Bitcore JavaScript Library for Bitcoin

@@ -7,34 +7,20 @@ [![NPM Package](https://img.shields.io/npm/v/bitcore-lib.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-lib)

**A pure and powerful JavaScript Bitcoin library.**
**A pure and powerful JavaScript library for Bitcoin.**
## Principles
Bitcoin is a powerful new peer-to-peer platform for the next generation of financial technology. The decentralized nature of the Bitcoin network allows for highly resilient bitcoin infrastructure, and the developer community needs reliable, open-source tools to implement bitcoin apps and services.
Bitcoin is a powerful new peer-to-peer platform for the next generation of financial technology. The decentralized nature of the Bitcoin network allows for highly resilient bitcoin infrastructure, and the developer community needs reliable, open-source tools to implement bitcoin apps and services. Bitcore JavaScript Library provides a reliable API for JavaScript apps that need to interface with Bitcoin.
## Get Started
Clone the Bitcore monorepo and `npm install`:
```sh
npm install bitcore-lib
git clone https://github.com/bitpay/bitcore.git
npm install
```
`cd` into bitcore-lib repository:
```sh
bower install bitcore-lib
cd packages/bitcore-lib
```
## Documentation
The complete docs are hosted here: [bitcore documentation](https://github.com/bitpay/bitcore). There's also a [bitcore API reference](https://github.com/bitpay/bitcore/blob/master/packages/bitcore-node/docs/api-documentation.md) available generated from the JSDocs of the project, where you'll find low-level details on each bitcore utility.
## Examples
- [Generate a random address](docs/examples.md#generate-a-random-address)
- [Generate a address from a SHA256 hash](docs/examples.md#generate-a-address-from-a-sha256-hash)
- [Import an address via WIF](docs/examples.md#import-an-address-via-wif)
- [Create a Transaction](docs/examples.md#create-a-transaction)
- [Sign a Bitcoin message](docs/examples.md#sign-a-bitcoin-message)
- [Verify a Bitcoin message](docs/examples.md#verify-a-bitcoin-message)
- [Create an OP RETURN transaction](docs/examples.md#create-an-op-return-transaction)
- [Create a 2-of-3 multisig P2SH address](docs/examples.md#create-a-2-of-3-multisig-p2sh-address)
- [Spend from a 2-of-2 multisig P2SH address](docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address)
## Building the Browser Bundle

@@ -50,23 +36,67 @@

You can also use our pre-generated files, provided for each release along with a PGP signature by one of the project's maintainers. To get them, checkout the [releases](https://github.com/bitpay/bitcore/blob/master/packages/bitcore-lib/CHANGELOG.md).
## Running Tests
## Development & Tests
```sh
git clone https://github.com/bitpay/bitcore-lib
cd bitcore-lib
npm install
npm test
```
Run all the tests:
You can also run just the Node.js tests with `gulp test:node`, just the browser tests with `gulp test:browser` or create a test coverage report (you can open `coverage/lcov-report/index.html` to visualize it) with `gulp coverage`.
```sh
gulp test
```
## Documentation
You can also run just the Node.js tests with `gulp test:node`, just the browser tests with `gulp test:browser` or create a test coverage report (you can open `coverage/lcov-report/index.html` to visualize it) with `gulp coverage`.
### Addresses and Key Management
- [Addresses](docs/address.md)
- [Using Different Networks](docs/networks.md)
- [Private Keys](docs/privatekey.md) and [Public Keys](docs/publickey.md)
- [Hierarchically-derived Private and Public Keys](docs/hierarchical.md)
### Payment Handling
- [Using Different Units](docs/unit.md)
- [Acknowledging and Requesting Payments: Bitcoin URIs](docs/uri.md)
- [The Transaction Class](docs/transaction.md)
- [Unspent Transaction Output Class](docs/unspentoutput.md)
### Bitcoin Internals
- [Scripts](docs/script.md)
- [Block](docs/block.md)
### Extra
- [Crypto](docs/crypto.md)
- [Encoding](docs/encoding.md)
### Module Development
- [Browser Builds](docs/browser.md)
### Modules
Some functionality is implemented as a module that can be installed separately:
- [Peer to Peer Networking](https://github.com/bitpay/bitcore/tree/master/packages/bitcore-p2p)
- [Bitcoin Core JSON-RPC](https://github.com/bitpay/bitcoind-rpc)
- [Payment Channels](https://github.com/bitpay/bitcore-channel)
- [Mnemonics](https://github.com/bitpay/bitcore/tree/master/packages/bitcore-mnemonic)
- [Elliptical Curve Integrated Encryption Scheme](https://github.com/bitpay/bitcore-ecies)
- [Blockchain Explorers](https://github.com/bitpay/bitcore-explorers)
- [Signed Messages](https://github.com/bitpay/bitcore-message)
## Examples
- [Generate a random address](docs/examples.md#generate-a-random-address)
- [Generate a address from a SHA256 hash](docs/examples.md#generate-a-address-from-a-sha256-hash)
- [Import an address via WIF](docs/examples.md#import-an-address-via-wif)
- [Create a Transaction](docs/examples.md#create-a-transaction)
- [Sign a Bitcoin message](docs/examples.md#sign-a-bitcoin-message)
- [Verify a Bitcoin message](docs/examples.md#verify-a-bitcoin-message)
- [Create an OP RETURN transaction](docs/examples.md#create-an-op-return-transaction)
- [Create a 2-of-3 multisig P2SH address](docs/examples.md#create-a-2-of-3-multisig-p2sh-address)
- [Spend from a 2-of-2 multisig P2SH address](docs/examples.md#spend-from-a-2-of-2-multisig-p2sh-address)
## Security
We're using Bitcore in production, as are many others, but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.
We're using the Bitcore JavaScript Library in production, as are many others, but please use common sense when doing anything related to finances! We take no responsibility for your implementation decisions.

@@ -83,2 +113,2 @@ If you find a security issue, please email security@bitpay.com.

Copyright 2013-2019 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
Copyright 2013-2022 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.

@@ -13,3 +13,3 @@ 'use strict';

var versionRE = /v[0-9]+\.[0-9]+/;
var docIndex = fs.readFileSync('./docs/index.md', 'ascii');
var docIndex = fs.readFileSync('./README.md', 'ascii');
var docVersion = docIndex.match(versionRE)[0];

@@ -16,0 +16,0 @@ bitcore.version.indexOf(docVersion).should.equal(0);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc