You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib).
3
+
A small JavaScript library and accompanying cli tool that derives bitcoin addresses from extended public keys. Built upon [caravan](https://github.com/caravan-bitcoin/caravan) and [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib).
8
4
9
5
For more details refer to the individual packages:
10
6
@@ -19,6 +15,15 @@ For more details refer to the individual packages:
19
15
-[BIP 84](https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki) - Derivation scheme for P2WPKH based accounts
20
16
-[BIP 86](https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki) - Key Derivation for Single Key P2TR Outputs
21
17
22
-
Samourai Wallet wrote a short summary on the differences between [BIP 44, BIP 49, BIP 84](https://samourai.kayako.com/article/65-bip-44-bip-49-and-bip84) and [XPUB's, YPUB's, ZPUB's](https://samourai.kayako.com/article/49-xpub-s-ypub-s-zpub-s). For a detailed explanation on derivation paths refer to [learn me a bitcoin](https://learnmeabitcoin.com/technical/derivation-paths).
18
+
For a detailed explanation on derivation paths refer to [learn me a bitcoin](https://learnmeabitcoin.com/technical/derivation-paths).
19
+
20
+
## Publishing
21
+
22
+
The `xpub-lib` and `xpub-cli` can be published to GitHub Packages by:
23
+
1. Incrementing the version field within the package.json file within each package you want to publish.
24
+
2. Creating a new tag with SemVer sytax (i.e. v0.0.1). Needs to match `v*`.
25
+
3. Creating a new GitHub release using this tag. This will start the publish workflow.
26
+
27
+
The workflow will need to be approved by another user with write access before its executed. If published successfully, the packages will be published [here](https://github.com/orgs/swan-bitcoin/packages).
A small JavaScript library that derives bitcoin addresses from extended public keys. Built upon [caravan](https://github.com/caravan-bitcoin/caravan) and [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib).
4
4
5
-
A small JavaScript library that derives bitcoin addresses from extended public keys. Built upon
and [bitcoinjs-lib](https://github.com/bitcoinjs/bitcoinjs-lib).
5
+
The library supports derivation from `xpub`s, `zpub`s, and `ypub`s, as well as legacy, SegWit, native SegWit (bech32) and Taproot (P2TR) address formats. Both Bitcoin mainnet and testnet are supported. If no network is specified the library defaults to testnet.
8
6
9
-
The library supports derivation from `xpub`s, `zpub`s, and `ypub`s, as well as
10
-
legacy, SegWit, and native SegWit (bech32) address formats. Both Bitcoin
11
-
mainnet and testnet are supported. If no network is specified the library
12
-
defaults to testnet.
13
-
14
-
| BIP | Extended Public Key | Address Type | Address Format | Address Name |
7
+
| BIP | Derivation Path | Address Type | Address Format | Address Name |
Note that the different extended public key formats are interchangeable and
14
+
Note that the different extended public key formats (i.e. xpub, ypub, zpub) are interchangeable and
21
15
not bound to address formats. Every address type can be generated from every
22
-
extended public key. The use of [output descriptors](https://bitcoin.stackexchange.com/questions/89261/why-does-importmulti-not-support-zpub-and-ypub/89281#89281)
23
-
should make this less confusing in the future.
16
+
extended public key.
24
17
25
18
The testnet equivalents are extended public keys starting with `tpub`, `upub`, and `vpub`.
26
19
27
20
## Example Usage
28
21
29
-
Use `addressFromExtPubKey` to derive single addresses. The following example
30
-
derives the first address of the first account from an `xpub` on mainnet.
22
+
```
23
+
yarn add @swan-bitcoin/xpub-lib
24
+
```
25
+
26
+
Use `addressFromExtPubKey` to derive a single addresses. The following example
27
+
derives the first address of the first account from an `xpub` on mainnet. If no purpose is given, it will default to P2WPKH (Native SegWit).
Address derivation will default to bech32 (native SegWit) unless a different
72
-
`purpose` is specified. For example: to derive wrapped SegWit addresses
68
+
To derive wrapped SegWit addresses
73
69
(starting with `3...`) specify the appropriate purpose with `purpose: Purpose.P2SH`.
74
70
75
71
For more examples refer to the tests of this library.
@@ -80,7 +76,8 @@ For more examples refer to the tests of this library.
80
76
-[BIP 44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) - Multi-Account Hierarchy for Deterministic Wallets
81
77
-[BIP 49](https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki) - Derivation scheme for P2WPKH-nested-in-P2SH based accounts
82
78
-[BIP 84](https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki) - Derivation scheme for P2WPKH based accounts
79
+
-[BIP 86](https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki) - Key Derivation for Single Key P2TR Outputs
83
80
84
-
Samourai Wallet wrote a short summary on the differences between [BIP 44, BIP 49, BIP 84](https://support.samourai.io/article/65-bip-44-bip-49-and-bip84) and [XPUB's, YPUB's, ZPUB's](https://support.samourai.io/article/49-xpub-s-ypub-s-zpub-s). For a detailed explanation on derivation paths refer to [learn me a bitcoin](https://learnmeabitcoin.com/technical/derivation-paths).
81
+
For a detailed explanation on derivation paths refer to [learn me a bitcoin](https://learnmeabitcoin.com/technical/derivation-paths).
0 commit comments