Skip to content

Design a user friendly policy structure visualization #148

@rajarshimaitra

Description

@rajarshimaitra

Description

The Bitcoin DevKit library allows developers to quickly design a miniscript-based wallet. Miniscript wallets
are functional, i.e., the wallet code doesn't depend on the miniscript. By providing a custom miniscript, a BDK-based wallet can accommodate any complex bitcoin spending logic. Often called "Contacts" or "Spending Policy". This is also synonymous with "Smart Contracts" in Bitcoin World.

BDK-CLI is a command-line app that can take it any custom descriptor as input and spawn a BDK wallet in the terminal. This is especially useful for quickly trying complex descriptors before proceeding with more elaborate wallet designs. BDK-CLI has various features and can sync the wallet with RPC, Electrum, or Esplora API endpoints. It also provides tooling to generate and work with mnemonic and Xpubs. The wallet can list transactions, get balances, create, sign, and broadcast transactions.

BDK-CLI has a policy command used to visualize complex miniscript policies. This is important for users to choose between
multiple spending paths when signing the transaction. Which is an essential part of user workflow for miniscript-based wallets.

Below is a sample of a 2 of 3 multisig policy visualization.

{
  "external": {
    "contribution": {
      "items": [],
      "m": 2,
      "n": 3,
      "sorted": false,
      "type": "PARTIAL"
    },
    "id": "n2x2uwsd",
    "keys": [
      {
        "pubkey": "029ffbe722b147f3035c87cb1c60b9a5947dd49c774cc31e94773478711a929ac0"
      },
      {
        "pubkey": "025f05815e3a1a8a83bfbb03ce016c9a2ee31066b98f567f6227df1d76ec4bd143"
      },
      {
        "pubkey": "025625f41e4a065efc06d5019cbbd56fe8c07595af1231e7cbc03fafb87ebb71ec"
      }
    ],
    "satisfaction": {
      "items": [],
      "m": 2,
      "n": 3,
      "sorted": false,
      "type": "PARTIAL"
    },
    "threshold": 2,
    "type": "MULTISIG"
  },
  "internal": {
    "contribution": {
      "type": "NONE"
    },
    "fingerprint": "ef2dfe99",
    "id": "f29caev6",
    "satisfaction": {
      "type": "NONE"
    },
    "type": "ECDSASIGNATURE"
  }
}

As can be seen, even for a simple 2 of 3 spending policy, the output needs to be more verbose and easier to visualize the policy.
For more complex policies, users not only need to see the policy structure but also have to separate between different policies meaningfully
and select which one they want to sign for.

This project aims to design a user-friendly policy visualization and an easy way to select among multiple policies.

Expected Outcomes

  • Design an easy-to-understand visualization for policy structures.

  • Implement it for bdk-cli terminal output.

  • Provide a way for bdk-cli users to choose between spending paths.

  • Produce a document outlining the design for this representation and gather feedback from the Bitcoin Design Community.

Resources

Skills Required

  • Hands-on experience with git and GitHub

  • Know how to set up your git/GitHub signing key and sign git commits, see Managing commit signature verification

  • Basic understanding of miniscript and descriptors.

  • Basic operations with bdk-cli app.

Mentor

@rajarshimaitra

Difficulty

Medium

Competency Test

  • Fork the bdk-cli github repo. Create a pull request and add a proposal.md file to the project's root. This file should
    outline the design proposal for the policy structure visualization. The PR should be signed.

  • Go to https://min.sc/ and create the example liquid federation policy in elephant wallet. At the time of signing, the app will create a policy visualization. Take a screenshot of that segment from the app, and add it to your proposal with a brief description of the policy structure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions