doc: Add multisig tutorial #22822

pull lsilva01 wants to merge 1 commits into bitcoin:master from lsilva01:multisig_tutorial_doc changing 2 files +242 −0
  1. lsilva01 commented at 1:46 am on August 28, 2021: contributor

    This PR adds a mutisig tutorial, as requested in #21278

    Although there is already a brief explanation and a functional test about the multisig implemented in #22067, this tutorial proposes to use the signet (instead of regtest), bringing the reader closer to a real environment and explaining some functions in more detail.

    I’m not sure if this format should be in this repository or on some wiki page. But as there is an open issue regarding this matter, that is my suggestion.

  2. fanquake added the label Docs on Aug 28, 2021
  3. fanquake commented at 1:48 am on August 28, 2021: member
    Please add a link from the main README.
  4. lsilva01 force-pushed on Aug 28, 2021
  5. lsilva01 commented at 1:53 am on August 28, 2021: contributor
    @fanquake Done.
  6. fanquake requested review from achow101 on Aug 28, 2021
  7. fanquake requested review from Sjors on Aug 28, 2021
  8. fanquake requested review from instagibbs on Aug 28, 2021
  9. instagibbs commented at 11:48 pm on August 28, 2021: member

    @harding might be interested too

    Unsure if here or some wiki page is best, but I can step through the tutorial in a bit and give feedback

  10. in doc/multisig-tutorial.md:30 in 2693a97e51 outdated
    25+done
    26+```
    27+
    28+### 1.2 Create the Descriptor Wallets
    29+
    30+Extract the xpub of each wallet. To do this, the `listdescriptors` RPC is used. By default, Bitcoin Core single-sig wallets are created using path `m/44'/1'/0'` for PKH, `m/84'/1'/0'` for WPKH and `m/49'/1'/0'` for P2WPKH-nested-in-P2SH based accounts. Each of them uses the chain 0 for external addresses and chain 1 for internal ones, as shown in the example below.
    


    unknown commented at 5:47 am on August 29, 2021:
    Should we mention about P2TR and m/86'/1'/0' here?

    lsilva01 commented at 1:14 pm on September 2, 2021:
    Added this path.
  11. in doc/multisig-tutorial.md:3 in 2693a97e51 outdated
    0@@ -0,0 +1,225 @@
    1+# 1. Multisig Tutorial
    2+
    3+Currently, it is possible to create a multig wallet using Bitcoin Core only.
    


    mjdietzx commented at 2:33 pm on August 30, 2021:
    Type-o: “multig” => “multisig”

    lsilva01 commented at 1:14 pm on September 2, 2021:
    Fixed. Thanks.
  12. Sjors commented at 2:35 pm on August 30, 2021: member

    utACK 2693a97e51ee527a5e43c1d9c493a43cbd289af8

    This process is still quite tedious, but it’s good to have it documented.

  13. in doc/multisig-tutorial.md:153 in 2693a97e51 outdated
    148+
    149+Unlike singlesig wallets, multisig wallets cannot create and sign transactions directly because they require the signatures of the co-signers. Instead they create a Partially Signed Bitcoin Transaction (PSBT).
    150+
    151+PSBT is a data format that allows wallets and other tools to exchange information about a Bitcoin transaction and the signatures necessary to complete it. [[source](https://bitcoinops.org/en/topics/psbt/)]
    152+
    153+Te current PSBT version (v0) is defined in [BIP 174](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki).
    


    mjdietzx commented at 2:40 pm on August 30, 2021:
    Type-o: “Te” => “The”

    lsilva01 commented at 1:14 pm on September 2, 2021:
    Fixed.
  14. in doc/multisig-tutorial.md:157 in 2693a97e51 outdated
    152+
    153+Te current PSBT version (v0) is defined in [BIP 174](https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki).
    154+
    155+For simplicity, the destination address is taken from the `participant_1` wallet in the code above, but it can be any valid bitcoin address.
    156+
    157+The `walletcreatefundedpsbt` RPC is used to create and fund a transaction in the PSBT format. It is the first step in creating the PSBT.\
    


    mjdietzx commented at 2:41 pm on August 30, 2021:
    Type-o: “.\” => “.” at end of line

    lsilva01 commented at 1:14 pm on September 2, 2021:
    Fixed.
  15. mjdietzx commented at 2:47 pm on August 30, 2021: contributor
    Concept ACK. Just commented on some minor type-os for now
  16. in doc/multisig-tutorial.md:60 in 2693a97e51 outdated
    55+
    56+```bash
    57+for x in "${!xpubs[@]}"; do printf "[%s]=%s\n" "$x" "${xpubs[$x]}" ; done
    58+```
    59+
    60+Note that this step extracts the `m/84'/1'/0'` account and does not conform to [BIP 45](https://github.com/bitcoin/bips/blob/master/bip-0045.mediawiki) or [BIP 87](https://github.com/bitcoin/bips/blob/master/bip-0087.mediawiki).
    


    Sjors commented at 3:15 pm on August 30, 2021:
    It’s good to point out this limitation at the top too.

    lsilva01 commented at 1:16 pm on September 2, 2021:
    Done. Thanks.
  17. in doc/multisig-tutorial.md:25 in 2693a97e51 outdated
    14+
    15+## 1.1 Basic Multisig Workflow
    16+
    17+### 1.1 Create the Descriptor Wallets
    18+
    19+For a 2-of-3 multisig, create 3 descriptor wallets. It is important that they are of the descriptor type in order to retrieve the wallet descriptors. These wallets contain HD seed and private keys, which will be used to sign the PSBTs and derive the xpub.
    


    Sjors commented at 3:16 pm on August 30, 2021:

    In addition, these three wallets should not be used directly for privacy reasons (public key reuse). They should only be used to sign transactions for the (watch-only) multisig wallet.

    (that said, I find this restriction annoying)


    lsilva01 commented at 1:16 pm on September 2, 2021:
    Text added.
  18. in doc/multisig-tutorial.md:5 in 2693a97e51 outdated
    0@@ -0,0 +1,225 @@
    1+# 1. Multisig Tutorial
    2+
    3+Currently, it is possible to create a multig wallet using Bitcoin Core only.
    4+
    5+Although there is already a brief explanation and a functional test about the multisig implemented in [PR 22067](https://github.com/bitcoin/bitcoin/pull/22067), this tutorial proposes to use the signet (instead of regtest), bringing the reader closer to a real environment and explaining some functions in more detail.
    


    S3RK commented at 6:59 am on August 31, 2021:

    Is regtest vs signet the main difference? I’d expect the guide to have the same steps regardless of the chain used.

    What’s the long-term plan for this guide and the guide from #22067? Do we plan to maintain both of them or keep only one?


    Sjors commented at 10:08 am on August 31, 2021:
    The “Basic multisig example” in 22067 should probably link to this guide, but let’s see what gets merged first.
  19. jaysonmald35 commented at 7:46 am on August 31, 2021: none
    Thank u
  20. Rspigler commented at 7:18 am on September 1, 2021: contributor

    I don’t quite understand the point of this, when we have #22067

    22067 simply explains how to set up a multisig wallet using the GUI and RPC commands, why have another document with bash scripts? Other improvements can be added to the other PR

  21. lsilva01 commented at 12:33 pm on September 2, 2021: contributor

    The purpose of this PR is to add a tutorial (step by step) on multisig that explains some current functions and limitations in more detail.

    Thus, the reader who doesn’t understand the Test Framework or python will still be able to reproduce these steps on signet or even mainnet .

    If this is a valid proposal, it can be a complement to PR #22067.

  22. lsilva01 force-pushed on Sep 2, 2021
  23. jonatack commented at 1:46 pm on September 2, 2021: member
    Concept ACK, provided people continue to maintain this and keep it up-to-date. Links between this and the docs + test in #22067 may be good to avoid information siloing.
  24. Sjors commented at 1:55 pm on September 2, 2021: member

    Thus, the reader who doesn’t understand the Test Framework or python will still be able to reproduce these steps on signet or even mainnet .

    Conversely, the purpose of tests is to ensure we don’t accidentally break functionality.

    I agree it’s useful if the toturial points to the test and vv, and we try to keep them somewhat consistent (although the test may continue to use earlier methods to ensure we don’t break those as we change the recommended workflow for new users)

  25. shaavan commented at 2:49 pm on September 2, 2021: contributor

    Concept ACK I successfully followed the tutorial on Ubuntu 20.04 to create a multisig transaction over the signet network. Thank you very much for creating such a detailed guide. I have some suggestions that might help to improve this tutorial further. This suggestion includes the occasional situation where I had some confusion following the tutorial or needed additional help from the internet. Suggestions:

    • OP should mention .src/bitcoind -signet -daemon instead of .src/bitcoind -signet; otherwise, the terminal starts a non-finishing process which might off-put a new user. -daemon does the same job, just starts the process in the background.
    • Dependencies like jq that are required to run the code should be mentioned at starting of the file.
    • In the earlier parts of the tutorial, the instructions and reasoning precede the code. In contrast, in the later sections, after 1.4 Create the MultiSig Wallet, code precedes the instruction. This should be standardized, and the same style should be followed throughout the tutorial document.
    • Following line 126, OP should provide instruction to copy the receive_address. Something like: “To copy the receiving address onto the clipboard, use the following command.”
    0echo -n "$receiving_address" | xclip -sel clip
    
    • When a wallet is once created, and this process needs to be repeated, one has to load it instead of recreating wallets. This should be explicitly mentioned and explained in the tutorial file.
    0for ((n=1;n<=3;n++)); do  ./src/bitcoin-cli -signet loadwallet "participant_${n}"; done
    
    0./src/bitcoin-cli -signet loadwallet "multisig_wallet_01"
    

    I hope these suggestions will be of help to the OP to improve upon the tutorial.

  26. michaelfolkson commented at 3:22 pm on September 2, 2021: contributor

    I don’t quite understand the point of this, when we have #22067

    22067 simply explains how to set up a multisig wallet using the GUI and RPC commands, why have another document with bash scripts? Other improvements can be added to the other PR

    I agree with @Rspigler. I’d prefer this was a StackExchange post given that the process will likely repeatedly change in future and introduces maintenance burden. It looks good though, just quibbling on the best location for it given we want to avoid bloated, outdated docs in the repo in future.

    edit: Feel free to put it here if you agree with above. Once the (optimal) process has crystallized I’d be more comfortable transferring it back as a stable doc to the repo.

    I put up a StackExchange post by @ben-kaufman there on multisig backups which seems to me to be in a similar vein.

  27. lsilva01 force-pushed on Sep 8, 2021
  28. lsilva01 commented at 11:25 pm on September 8, 2021: contributor

    Thanks for suggestions @shaavan. I added them. @michaelfolkson I will add a short version of this tutorial to the StackExchange question you created.

    I don’t have a strong opinion whether this type of documentation is better to be in the repo or on another site.

    The advantage of listing the procedures here is that it is extensively reviewed, so it is much more reliable and is part of the reference implementation.

    The downside, as already mentioned, is the maintenance burden.

  29. shaavan commented at 2:28 pm on September 16, 2021: contributor

    The document looks a lot better now. Great Work, @lsilva01! Just a tiny thing to add. Since xclip is now being used to copy the address, it should also be mentioned as a dependency along with jq as it is not usually preinstalled in a Debian-based system.

    edit: Feel free to put it here if you agree with the above. Once the (optimal) process has crystallized, I’d be more comfortable transferring it back as a stable doc to the repo.

    I am no expert when it comes to maintenance, but I understand that it would be a burden to keep updating the doc as the process keeps changing. But posting this as a StackExchange answer doesn’t feel right to me. I think so because most people searching for the same question do not end up on the same StackExchange article, resulting in not many people being aware of this thorough documentation.

    It would be great if we could figure out some middle ground where the documentation is visible to the audience who needs a multisig tutorial. But at the same time, not being a maintenance burden to the bitcoin in general.

  30. S3RK commented at 3:58 pm on September 16, 2021: member

    I have a slight preference towards more concise guide from #22067.

    But in case this will be merged sooner, I’ll repeat my concern for both this PR and #22067

    Why not have just one wallet? Having two wallets is less intuitive, complicates backups and could lead to user confusion and even loss of funds. Especially taking into account that you need to backup both wallets to restore your funds. This doesn’t come through the documentation.

    See my comment for suggestions

  31. ghost commented at 4:41 pm on September 16, 2021: none

    I have a slight preference towards more concise guide from #22067.

    whynotboth.gif

    Although I like this tutorial. Other PR adds lot of things which can be useful for devs but docs from repository are also used by power users.

    Concept ACK and thanks for your contribution @lsilva01

    I want to use this tutorial and make some GUI or script to make it even easier for users before reviewing this PR in detail. Because multisig still feels like something only devs and few users can do.

    https://unchained-capital.github.io/caravan/ is a nice web app although I don’t have the skills to create such things, I will try doing a console application/desktop application/scripts. Also it would be better if we can avoid reference to open PRs in docs.

  32. Rspigler commented at 4:41 am on September 21, 2021: contributor
    @S3RK I think it is better to have the setup with 2 wallets, because that is how offline multisig should be run (1 wallet for the offline privkey/signing, another wallet for the online coordinator/node).
  33. in doc/multisig-tutorial.md:136 in d92210e01b outdated
    132+At time of writing, the url is [`https://signetfaucet.com`](https://signetfaucet.com).
    133+
    134+Coins received by the wallet must have at least 1 confirmation before they can be spent. It is necessary to wait for a new block to be mined before continuing.
    135+
    136+```bash
    137+receiving_address=$(./src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getnewaddress)
    


    unknown commented at 5:14 am on September 21, 2021:

    This gives error:

    0error code: -4
    1error message:
    2Error: This wallet has no available keys
    

    lsilva01 commented at 11:15 pm on September 21, 2021:

    The multisig wallet is created without keys (line 114), so you can import the descriptors (line 116). If you forget to do this, this error message is displayed.

    You can check if the wallet has descriptors imported with the command command ./src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" listdescriptors .


    unknown commented at 10:38 am on September 28, 2021:
    @lsilva01 Sorry I missed importing descriptors. Will be working on this today.
  34. ghost commented at 5:22 am on September 21, 2021: none

    I have also started working on a desktop application based on this tutorial. Hopefully will be completed by end of this week.

    image

  35. Rspigler commented at 7:25 am on September 21, 2021: contributor

    @prayank23 Awesome!

    Please see #21071 (comment) if you are working on a multisig GUI

  36. in doc/multisig-tutorial.md:36 in d92210e01b outdated
    31+do
    32+ ./src/bitcoin-cli -signet -named createwallet wallet_name="participant_${n}" descriptors=true
    33+done
    34+```
    35+
    36+### 1.2 Create the Descriptor Wallets
    


    unknown commented at 11:07 am on September 28, 2021:

    Line 23 is ### 1.1 Create the Descriptor Wallets and this line ### 1.2 Create the Descriptor Wallets

    Should combine them in one or change 1.2 to something else? I think we list descriptors in 1.2


    lsilva01 commented at 4:11 pm on December 10, 2021:
    Done in 1b58755
  37. laanwj commented at 1:29 pm on October 18, 2021: member

    It would be great if we could figure out some middle ground where the documentation is visible to the audience who needs a multisig tutorial. But at the same time, not being a maintenance burden to the bitcoin in general.

    I think documenting a basic multisig flow is important, as it is something a lot of people want to do nowadays. IMO it’s best to regard it as basic functionality of the wallet not something exotic.

    but I understand that it would be a burden to keep updating the doc as the process keeps changing

    Now that PSBT’s and descriptor wallets have been hammered out. The process shouldn’t change too much anymore, right?

  38. DrahtBot commented at 11:13 am on November 9, 2021: member

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #23711 (docs: RBF policy and mempool limit exemptions by glozow)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  39. laanwj commented at 5:20 pm on December 8, 2021: member
    Anything left to be done here?
  40. Sjors commented at 3:19 am on December 9, 2021: member

    utACK d92210e01b5d38bba5ce5bd80fd4caa59f96eec1

    Looking forward to making this easier over time. I think it’s fine to update this document whenever that happens; it could even make review easier.

  41. in doc/multisig-tutorial.md:5 in d92210e01b outdated
    0@@ -0,0 +1,242 @@
    1+# 1. Multisig Tutorial
    2+
    3+Currently, it is possible to create a multisig wallet using Bitcoin Core only.
    4+
    5+Although there is already a brief explanation and a functional test about the multisig implemented in [PR 22067](https://github.com/bitcoin/bitcoin/pull/22067), this tutorial proposes to use the signet (instead of regtest), bringing the reader closer to a real environment and explaining some functions in more detail.
    


    MarcoFalke commented at 8:38 am on December 10, 2021:
    Not sure if it makes sense to link to a pull request on GitHub for documentation, given that it is already merged.

    Sjors commented at 1:17 pm on December 10, 2021:
    Ah yes, that should link to https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md#multisig now (and maybe vice versa)

    lsilva01 commented at 4:12 pm on December 10, 2021:
    Done in 1b58755
  42. lsilva01 force-pushed on Dec 10, 2021
  43. lsilva01 force-pushed on Dec 10, 2021
  44. Sjors commented at 2:35 am on December 11, 2021: member
    re-utACK 1b58755911a3a3319abc080b72f86b8918ba9b15
  45. Add multisig tutorial 1ef2c03452
  46. in doc/multisig-tutorial.md:129 in 1b58755911 outdated
    124+
    125+### 1.4 Fund the wallet
    126+
    127+The wallet can receive signet coins by generating a new address and passing it as parameters to `getcoins.py` script.
    128+
    129+If the script throws an error such as `Captcha required (reload page)`, the url in the script can be accessed directly.
    


    unknown commented at 3:26 am on December 11, 2021:
    Captcha was added in the script: https://github.com/bitcoin/bitcoin/pull/23162

    lsilva01 commented at 5:35 am on December 13, 2021:
    Good catch. Done in 1ef2c03.
  47. lsilva01 force-pushed on Dec 13, 2021
  48. unknown approved
  49. Sjors commented at 7:38 am on December 13, 2021: member
    re-utACK 1ef2c034523d0dfc36c84186d7a110cfc7de238b
  50. MarcoFalke merged this on Dec 14, 2021
  51. MarcoFalke closed this on Dec 14, 2021

  52. sidhujag referenced this in commit b094bdfb15 on Dec 14, 2021
  53. lsilva01 deleted the branch on Dec 20, 2021
  54. DrahtBot locked this on Jan 6, 2023

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-22 06:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me