Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme instruction for "Sign the PSBT with sparrow, hal, or bdk-cli." #9

Open
avlo opened this issue Aug 2, 2024 · 1 comment
Open

Comments

@avlo
Copy link
Contributor

avlo commented Aug 2, 2024

the Readme file instruction for:

Sign the PSBT with sparrow, hal, or bdk-cli. (near the bottom of section Sign psbt and broadcast it)

does not have a/any sample instructions for how to sign (using either sparrow, hal or bdk-cli).

please include an example in the Readme (preferably using hal or bdk-cli) for how to do so.


if helpful, below attempt using hal yielded following result:

$ hal psbt finalize --regtest alice.psbt
failed to finalize psbt: Could not satisfy Tr descriptor at index 0

with hal version:

$ hal -V
hal 0.9.5

below is the alice.psbt verification

$ hal psbt decode --regtest alice.psbt
{
  "unsigned_tx": {
    "txid": "a5dfa897c6f6addb2acb6f39188af8374ff3d1b837cb4466c794eaad764acb91",
    "wtxid": "a5dfa897c6f6addb2acb6f39188af8374ff3d1b837cb4466c794eaad764acb91",
    "size": 94,
    "weight": 376,
    "vsize": 94,
    "version": 2,
    "locktime": 0,
    "inputs": [
      {
        "prevout": "ffac0e13d722682e3fc87fa0521d3349663144205644f8b70c5d9013d8afac14:1",
        "txid": "ffac0e13d722682e3fc87fa0521d3349663144205644f8b70c5d9013d8afac14",
        "vout": 1,
        "script_sig": {
          "hex": "",
          "asm": ""
        },
        "sequence": 0,
        "witness": null
      }
    ],
    "outputs": [
      {
        "value": 99999600,
        "script_pub_key": {
          "hex": "5120a765f094379b7d6dde78f419bf943498ed645beb6a5554e5994174736436cba7",
          "asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 a765f094379b7d6dde78f419bf943498ed645beb6a5554e5994174736436cba7",
          "type": "unknown",
          "address": "bcrt1p5ajlp9phnd7kmhnc7svml9p5nrkkgkltdf24feveg968xepkewnsl0dgjt"
        }
      }
    ],
    "total_output_value": 99999600
  },
  "inputs": [
    {
      "witness_utxo": {
        "value": 100000000,
        "script_pub_key": {
          "hex": "51201c47c0efac3f7dd679a0491849f14eb3d5f6f1089dcbf9d66d164bd0338c2923",
          "asm": "OP_PUSHNUM_1 OP_PUSHBYTES_32 1c47c0efac3f7dd679a0491849f14eb3d5f6f1089dcbf9d66d164bd0338c2923",
          "type": "unknown",
          "address": "bcrt1pr3rupmav8a7av7dqfyvynu2wk02lduggnh9ln4ndze9aqvuv9y3sklwrss"
        }
      }
    }
  ],
  "outputs": [
    {}
  ]
}
@bitlightlabs-dev
Copy link
Contributor

$ bdk-cli -n regtest wallet --descriptor "tr(tprv8ZgxMBicQKsPeHzjP5LTL818LxwHbJNLZRa98Qdnn7M98fW15365cB1Sz9QZvYufASRKH6JEPhfpxVuFTKMHxDcEAVboqKuZdMmxzKVhMnW/86'/1'/0'/0/*)" \ 
sign --psbt $(cat alice.psbt | base64 | tr -d '\r\n') | jq -r '.psbt' | base64 --decode > alice.psbt.signed

$ hal psbt finalize alice.psbt.signed
0200000000010184cc73022f7b19317eb3490f10ef7f0...27921857420c21461a205c5b60ca54c00000000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants