Skip to content

Conversation

@DeRauk
Copy link

@DeRauk DeRauk commented Dec 17, 2025

Summary & Motivation

This adds a witness utxo to segwit psbt inputs for more validation in the parser.

How I Tested These Changes

Locally

➜  with-bitcoin git:(derauk/testing) ✗ pnpm with-policy

> @turnkey/example-with-bitcoin@0.2.0 with-policy /Users/derauk/tkhq/code/sdk/examples/with-bitcoin
> tsx src/signBtcTxWithPolicy.ts

(node:78284) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("file%3A///Users/derauk/tkhq/code/sdk/node_modules/.pnpm/tsx%403.12.7/node_modules/tsx/dist/loader.js", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
(node:78284) UnsupportedWarning: `globalPreload` has been removed; use `initialize` instead.
(Use `node --trace-warnings ...` to show where the warning was created)
✅ Loaded configuration
-> Source address: tb1qmua7s9nua3v9e0e7ssf0rxrjvzrphhnlas6k30
-> Inferred address type: TestnetP2WPKH
Fetching UTXOs...
✔ select UTXOS to spend › 1000 sats (tx # f901114f70e063a7444656dbffbed543bf308664610b56c6f18877ac3a8ea502 @ 0)
✔ Destination BTC address … tb1qkud94hma5vm6de4uedddyqerdnny7dza4wvwkt
✅ Fee estimate: 180 sats
✔ How much to you want to send to tb1qkud94hma5vm6de4uedddyqerdnny7dza4wvwkt? (max: 820 sats, the rest will go back to the source address as change) … 820
✔ change amount going back to your source address will be 0. Looks good? … yes
✔ Enter receiving address to ALLOW signing via policy (to test failure case, enter something other than the receiving address that you entered while creating your PSBT): … tb1qkud94hma5vm6de4uedddyqerdnny7dza4wvwkt
New policy created!
- Name: Bitcoin allow transfer to 'tb1qkud94hma5vm6de4uedddyqerdnny7dza4wvwkt'
- Policy ID: 6ef9853e-4e2a-4f48-891a-d5aa7ee03bb0
- Effect: EFFECT_ALLOW
- Consensus: approvers.count() == 1
- Condition: bitcoin.tx.outputs.count() == 2 && bitcoin.tx.outputs.all(o, o.address in ['tb1qkud94hma5vm6de4uedddyqerdnny7dza4wvwkt','tb1qmua7s9nua3v9e0e7ssf0rxrjvzrphhnlas6k30'])

New user created!
- Name: new-bitcoin-user
- User ID: b7148c73-e19e-4810-926d-86463dbe4337

✅ Transaction signed! To broadcast it, copy and paste the hex payload to https://mempool.space/testnet/tx/push

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 17, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2192aba:

Sandbox Source
@turnkey/example-react-components Configuration

@DeRauk DeRauk force-pushed the derauk/add-prev-output-segwit branch from e46ee86 to 2192aba Compare December 18, 2025 13:54
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.

2 participants