Skip to content

Conversation

@apoelstra
Copy link
Contributor

@apoelstra apoelstra commented Oct 27, 2025

Introduces several new PSET-manipulation commands to allow using this tool without needing an Elements daemon (other than for blockchain data access, which can be obtained from web APIs instead).

In particular we add:

  • simplicity pset update-input which attaches Simplicity-related data to a specific input
  • simplicity pset finalize which takes a Simplicity program and witness, executes and prunes the program, and attaches the data to the witness
  • simplicity pset extract which constructs a complete transaction from a finalized PSET

This also extends simplicity sighash to work with PSETs rather than requiring the user copy/paste tons of stuff in the CLI interface.

@apoelstra apoelstra force-pushed the 2025-10/pset-signer branch from 72ccfe2 to 07bb2da Compare October 28, 2025 00:08
@schoen
Copy link

schoen commented Oct 28, 2025

I'm not yet sure whether there's a kind of ack that I can appropriately offer here, but I saw this PR's functionality demonstrated successfully against Liquid Testnet this afternoon, so informally I think it's great.

@apoelstra
Copy link
Contributor Author

I will pull it apart into separate PRs and try to get them merged.

I'll make sure that this PR/branch remains usable and complete for purposes of doing end-to-end Simplicity program stuff.

@apoelstra apoelstra force-pushed the 2025-10/pset-signer branch from 07bb2da to 4e73c48 Compare October 28, 2025 21:32
@apoelstra apoelstra force-pushed the 2025-10/pset-signer branch 2 times, most recently from af63781 to 8ce1fe2 Compare November 5, 2025 14:37
Refactor the code a bit to allow parsing arbitrary strings as either
hex or base 64.
We will want to be able to parse this format for PSET support.
If you provide a PSET instead of a raw transaction, then attempt to extract
a transaction from it.
This command takes a PSET where we've updated all the inputs (with
'simplicity pset update-input' for example), as well as a program and
a valid witness. It executes the program, prunes it, then adds it to
the PSET. Then you can extract and send the program with elements-cli.
Now rather than extracting using elements-cli, by running

    elements-cli finalizepsbt <psbt> true

you can do it with hal-simplicity, with

    hal-simplicity simplicity pset extract <psbt>
This should be compatible with any non-pegin non-issuance calls to elements-cli
createpsbt.

Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <[email protected]>
@apoelstra apoelstra marked this pull request as ready for review November 25, 2025 16:21
@apoelstra
Copy link
Contributor Author

cc @canndrew @delta1 this is ready for review

The CLI tests are not up to date. Unsure what to do about those. They are extremely tedious and the chatbot cannot do them.

Copy link

@delta1 delta1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK cacd1f7

CLI tests can be added in a follow-up

#[serde(with = "elements::bitcoin::amount::serde::as_btc")]
amount: elements::bitcoin::Amount,
},
Map(HashMap<String, f64>),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a follow-up to support non-policy assets?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. This is the same as the elements-cli createpsbt interface. If you want non-policy assets then you need to use the verbose form of the command in the other enum variant.

Copy link
Contributor Author

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On cacd1f7 successfully ran local tests

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

Successfully merging this pull request may close these issues.

3 participants