Skip to content

Fix and improve solo stamping#141

Open
Sjors wants to merge 9 commits intoopentimestamps:masterfrom
Sjors:2023/11/solo-stamp
Open

Fix and improve solo stamping#141
Sjors wants to merge 9 commits intoopentimestamps:masterfrom
Sjors:2023/11/solo-stamp

Conversation

@Sjors
Copy link
Copy Markdown

@Sjors Sjors commented Nov 28, 2023

Currently trying to stamp with --btc-wallet will fail for two reasons:

  1. the signrawtransaction RPC has been deprecated for years
  2. it insists on at least two calendars also accepting the transaction

This PR switches to the replacement signrawtransactionwithwallet RPC. It also skips using the calendars when using --btc-wallet.

In addition it adds a --fee-rate argument so you're not dependent on whatever Bitcoin Core decides.

In case the process fails mid way after broadcasting a transaction, as it did before this PR, there's now a way to resume by passing a --nonce and --txid argument. This has the nice benefit of also making RBF possible.

Finally it documents in the README that this functionality exists, but with a warning.

Unrelated, it also adds a --btc-signet option, though at least for stamping --btc-testnet works fine with signet.

Fixes #139 and #140.

@Sjors Sjors force-pushed the 2023/11/solo-stamp branch from af3b6ab to 496884e Compare February 26, 2024 09:55
@Sjors Sjors force-pushed the 2023/11/solo-stamp branch from 496884e to 640e9c8 Compare March 12, 2024 17:53

blockhash = None

logging.info('Waiting for confirmation. This can be interupted and resumed with:\nots stamp --nonce=%s --txid=%s', nonce.hex(), txid[::-1].hex())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This doesn't actually work as intended. You need to run ots stamp -b --nonce=x --txid=x. If the -b is left out stamping happens normally, ignoring the nonce and txid arguments.

Maybe we want --nonce and --txid to force -b on?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Another issue we have right now is that if you use the txid and nonce options after a block has confirmed, ots fails to find the new block.

Maybe we could query the wallet for the transaction? Or maybe we also need a block height?

If we have all three options, we probably want to do it via a single --resume option that can find the tx even if the txid changes.

Copy link
Copy Markdown
Author

@Sjors Sjors Mar 22, 2026

Choose a reason for hiding this comment

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

I added 3123c98 which creates an .ots.pending file with a nonce and txid. It sets --btc-wallet, so that's a step in the right direction. But it doesn't deal with RBF.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm currently testing RBF tracking, will push if it works.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alright, added 275e6e5 to track replacements.

I tested both update tracking while in mempool and after confirmation. It's preceded by 9505537 which introduces some test coverage for existing behavior.

Sjors added 5 commits March 22, 2026 13:58
signrawtransaction was replaced with signrawtransactionwithwallet in Bitcoin Core v0.17.0

Also added debug logging.
Review hint:
git diff --color-moved=dimmed-zebra --color-moved-ws=ignore-space-change
@Sjors Sjors force-pushed the 2023/11/solo-stamp branch from 640e9c8 to c74f026 Compare March 22, 2026 14:34
@Sjors
Copy link
Copy Markdown
Author

Sjors commented Mar 22, 2026

Alright, I had my agent rebase this, address the feedback and make a small improvement based on its experience of accidentally making two transactions because it didn't bother to store the nonce.

The range-diff with my previous version looks sane to me, but it's been too long to remember what I was originally doing :-)

Used this to timestamp the recent Utrecht and Amsterdam municipal election counts: https://github.com/Sjors/verkiezingen-processen-verbaal/tree/master/2026-GR

@Sjors Sjors force-pushed the 2023/11/solo-stamp branch from c74f026 to a2fb0b5 Compare March 22, 2026 17:00
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.

Do not require calendars with --bitcoin-node

2 participants