1
0
mirror of https://github.com/bitcoin/bips.git synced 2024-11-19 01:40:05 +01:00
bitcoin-bips/bip-0048.mediawiki

237 lines
5.8 KiB
Plaintext
Raw Normal View History

2020-12-16 12:22:20 +01:00
<pre>
2021-02-24 14:38:46 +01:00
BIP: Number not assigned
2020-12-16 12:22:20 +01:00
Layer: Applications
Title: Multi-Account/Multi-Script Hierarchy for Deterministic Multi Signature Wallets
Author: Peter Denton <dentondevelopment@protonmail.com>
2020-12-16 15:05:54 +01:00
Comments-Summary: No comments
2020-12-16 12:22:20 +01:00
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0048
Status: Proposed
Type: Standards Track
Created: 2020-12-16
</pre>
==Abstract==
This BIP defines a logical hierarchy for deterministic multi-sig wallets based on an algorithm
described in BIP-0067 (BIP67 from now on), BIP-0032 (BIP32 from now on), purpose scheme described in
BIP-0043 (BIP43 from now on), and multi-account hierarchy described in
BIP-0044 (BIP44 from now on).
2020-12-16 12:22:20 +01:00
This BIP is a particular application of BIP43.
==Motivation==
The motivation of this BIP is to define the existing industry wide practice of utilizing m/48'
derivation paths in hierarchical deterministic multi-sig wallets so that other developers may
benefit from a standard. This BIP allows for future script types to easily be appended to the
specification so that a new BIP is not required for every future script type.
2020-12-16 12:22:20 +01:00
The hierarchy proposed in this paper is quite comprehensive. It allows the handling of
multiple accounts, external and internal chains per account, multiple script types and
millions of addresses per chain.
This paper was inspired from BIP44.
2020-12-16 12:22:20 +01:00
==Key sorting==
Any wallet that supports BIP48 inherently supports deterministic key sorting as per BIP67 so that all possible
2020-12-16 15:05:54 +01:00
multi-signature addresses/scripts are derived from deterministically sorted public keys.
2020-12-16 12:22:20 +01:00
==Path levels==
We define the following 6 levels in BIP32 path:
<pre>
m / purpose' / coin_type' / account' / script_type' / change / address_index
</pre>
2020-12-16 15:05:54 +01:00
<code>h</code> or <code>'</code> in the path indicates that BIP32 hardened derivation is used.
2020-12-16 12:22:20 +01:00
Each level has a special meaning, described in the chapters below.
===Purpose===
Purpose is a constant set to 48' following the BIP43 recommendation.
It indicates that the subtree of this node is used according to this specification.
Hardened derivation is used at this level.
===Coin type===
2020-12-16 15:36:43 +01:00
One master node (seed) can be used for multiple Bitcoin networks.
2020-12-16 12:22:20 +01:00
Sharing the same space for various networks has some disadvantages.
Avoiding reusing addresses across networks and improving privacy issues.
2020-12-16 15:05:54 +01:00
Coin type <code>0</code> for mainnet and <code>1</code> for testnet.
2020-12-16 12:22:20 +01:00
Hardened derivation is used at this level.
===Account===
This level splits the key space into independent user identities, following the BIP44 pattern,
2020-12-16 12:22:20 +01:00
so the wallet never mixes the coins across different accounts.
Users can use these accounts to organize the funds in the same
fashion as bank accounts; for donation purposes (where all
addresses are considered public), for saving purposes,
for common expenses etc.
Accounts are numbered from index 0 in sequentially increasing manner.
This number is used as child index in BIP32 derivation.
Hardened derivation is used at this level.
===Script===
This level splits the key space into two separate <code>script_type</code>(s). To provide
forward compatibility for future script types this specification can be easily extended.
2020-12-16 12:22:20 +01:00
Currently the only script types covered by this BIP are Native Segwit (p2wsh) and
Nested Segwit (p2sh-p2wsh).
The following path represents Nested Segwit (p2sh-p2wsh) mainnet, account 0:
2020-12-16 15:05:54 +01:00
<code>1'</code>: Nested Segwit (p2sh-p2wsh) <code>m/48'/0'/0'/1'</code></br>
2021-02-28 02:48:29 +01:00
The following path represents Native Segwit (p2wsh) mainnet, account 0:
2020-12-16 15:05:54 +01:00
<code>2'</code>: Native Segwit (p2wsh) <code>m/48'/0'/0'/2'</code></br>
The recommended default for wallets is pay to witness script hash <code>m/48'/0'/0'/2'</code>.
To add new script types submit a PR to this specification and include it in the list above:
<code>X'</code>: Future script type <code>m/48'/0'/0'/X'</code></br>
2020-12-16 12:22:20 +01:00
===Change===
Constant 0 is used for external chain and constant 1 for internal chain (also
known as change addresses). External chain is used for addresses that are meant
to be visible outside of the wallet (e.g. for receiving payments). Internal
chain is used for addresses which are not meant to be visible outside of the
wallet and is used for return transaction change.
Public derivation is used at this level.
===Index===
Addresses are numbered from index 0 in sequentially increasing manner.
This number is used as child index in BIP32 derivation.
Public derivation is used at this level.
==Examples==
{|
2020-12-16 15:05:54 +01:00
|network
|account
|script
|chain
|address
|path
2020-12-16 12:22:20 +01:00
|-
2020-12-16 15:05:54 +01:00
|mainnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|first
|m / 48' / 0' / 0' / 2' / 0 / 0
|-
2020-12-16 15:05:54 +01:00
|mainnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|second
|m / 48' / 0' / 0' / 2' / 0 / 1
|-
2020-12-16 15:05:54 +01:00
|mainnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|change
|first
|m / 48' / 0' / 0' / 2' / 1 / 0
|-
2020-12-16 15:05:54 +01:00
|mainnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|change
|second
|m / 48' / 0' / 0' / 2' / 1 / 1
|-
2020-12-16 15:05:54 +01:00
|mainnet
2020-12-16 12:22:20 +01:00
|second
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|first
|m / 48' / 0' / 1' / 2' / 0 / 0
|-
2020-12-16 15:05:54 +01:00
|mainnet
2020-12-16 12:22:20 +01:00
|second
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|second
|m / 48' / 0' / 1' / 2' / 0 / 1
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2sh-p2wsh
2020-12-16 12:22:20 +01:00
|external
|first
2020-12-16 15:05:54 +01:00
|m / 48' / 1' / 0' / 1' / 0 / 0
2020-12-16 12:22:20 +01:00
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|second
|m / 48' / 1' / 0' / 2' / 0 / 1
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|change
|first
|m / 48' / 1' / 0' / 2' / 1 / 0
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|first
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|change
|second
|m / 48' / 1' / 0' / 2' / 1 / 1
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|second
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|first
|m / 48' / 1' / 1' / 2' / 0 / 0
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|second
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|external
|second
|m / 48' / 1' / 1' / 2' / 0 / 1
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|second
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|change
|first
|m / 48' / 1' / 1' / 2' / 1 / 0
|-
2020-12-16 15:05:54 +01:00
|testnet
2020-12-16 12:22:20 +01:00
|second
2020-12-16 15:05:54 +01:00
|p2wsh
2020-12-16 12:22:20 +01:00
|change
|second
2020-12-16 15:31:24 +01:00
|m / 48' / 1' / 1' / 2' / 1 / 1
2020-12-16 15:55:38 +01:00
|}
2020-12-16 15:05:54 +01:00
2020-12-16 12:22:20 +01:00
==Reference==
* [[bip-0067.mediawiki|BIP67 - Deterministic Pay-to-script-hash multi-signature addresses through public key sorting]]
* [[bip-0032.mediawiki|BIP32 - Hierarchical Deterministic Wallets]]
* [[bip-0043.mediawiki|BIP43 - Purpose Field for Deterministic Wallets]]
* [[bip-0044.mediawiki|BIP44 - Multi-Account Hierarchy for Deterministic Wallets]]