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

Implement burn #3437

Merged
merged 24 commits into from
Sep 30, 2024
Merged

Implement burn #3437

merged 24 commits into from
Sep 30, 2024

Conversation

onchainguy-btc
Copy link
Contributor

After my first burn PR (#2766) got a bit outdated, I created a new one. Tried to make as less changes as possible. This PR does not support burn messages yet. Hope we can get the general burning merged first and then I'm happy to add support for an optional burn message via data pushes.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

Finally having a look at this. There's just two things but they probably require a bit of refactoring. Especially the new command ord wallet burn I think is important because burning is quite drastic and we want it to be a very distinct action.

src/subcommand/wallet/send.rs Outdated Show resolved Hide resolved
src/wallet/transaction_builder.rs Outdated Show resolved Hide resolved
@onchainguy-btc
Copy link
Contributor Author

@raphjaph thanks for the feedback, will get that done asap!

@onchainguy-btc
Copy link
Contributor Author

@raphjaph just implemented the changes. Let me know if I can improve on anything else. Can also write some more tests if you have ideas for some good ones.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

In OP_RETURNs there is no dust_limit and I see that you correctly disable the check for that. One thing you could try doing is only burn the exact sat that the inscription is on instead of the whole UTXO. This will require some careful changes to the TransactionBuilder, which should then be tested as well in the unit tests of the transaction_builder.rs file.

src/subcommand/wallet/burn.rs Outdated Show resolved Hide resolved
src/subcommand/wallet/send.rs Outdated Show resolved Hide resolved
src/subcommand/wallet/send.rs Outdated Show resolved Hide resolved
@onchainguy-btc
Copy link
Contributor Author

In OP_RETURNs there is no dust_limit and I see that you correctly disable the check for that. One thing you could try doing is only burn the exact sat that the inscription is on instead of the whole UTXO. This will require some careful changes to the TransactionBuilder, which should then be tested as well in the unit tests of the transaction_builder.rs file.

@raphjaph Do you think that's worth it? If I'm not mistaking doing so would add additional inputs to the transaction for extracting the sat. The fee for that could potentially be higher than what the inscription sats are worth.

As an alternative idea: What if we exit the ord wallet burn command with an error if the inscription is on a utxo with more than 10_000 sats. This way we can prevent burning large bitcoin amounts by mistake. If people still want to burn the inscriptions, they can first transfer it to a different, smaller output.

crates/ordinals/src/charm.rs Outdated Show resolved Hide resolved
@raphjaph
Copy link
Collaborator

@raphjaph Do you think that's worth it? If I'm not mistaking doing so would add additional inputs to the transaction for extracting the sat. The fee for that could potentially be higher than what the inscription sats are worth.

That's true, then let's just leave it how it is for now.

As an alternative idea: What if we exit the ord wallet burn command with an error if the inscription is on a utxo with more than 10_000 sats. This way we can prevent burning large bitcoin amounts by mistake. If people still want to burn the inscriptions, they can first transfer it to a different, smaller output.

Sounds reasonble

@onchainguy-btc
Copy link
Contributor Author

@raphjaph Do you think that's worth it? If I'm not mistaking doing so would add additional inputs to the transaction for extracting the sat. The fee for that could potentially be higher than what the inscription sats are worth.

That's true, then let's just leave it how it is for now.

As an alternative idea: What if we exit the ord wallet burn command with an error if the inscription is on a utxo with more than 10_000 sats. This way we can prevent burning large bitcoin amounts by mistake. If people still want to burn the inscriptions, they can first transfer it to a different, smaller output.

Sounds reasonble

Cool, will adapt to that!

@raphjaph
Copy link
Collaborator

raphjaph commented Jun 2, 2024

Let me know when this is ready for review :)

@onchainguy-btc
Copy link
Contributor Author

@raphjaph Ready for review ✅

@onchainguy-btc
Copy link
Contributor Author

@raphjaph just saw you merged master? Was that on purpose? I can also just rebase if you like.

@raphjaph
Copy link
Collaborator

raphjaph commented Jun 28, 2024

@onchainguy-btc don't worry about rebasing, I'm going to squash merge this anyway. Gonna have a look at this today or tomorrow.

The tests and linting also don't seem to pass yet. If you could fix, that would be great :)

You can run our CI if you install just and run just ci.

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

See comments above

@onchainguy-btc
Copy link
Contributor Author

@raphjaph just implemented the tests you requested ✅

Copy link
Collaborator

@raphjaph raphjaph left a comment

Choose a reason for hiding this comment

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

Awesome, LGTM!

@raphjaph raphjaph enabled auto-merge (squash) September 30, 2024 14:17
@raphjaph raphjaph merged commit 9bc83eb into ordinals:master Sep 30, 2024
5 checks passed
dcorral added a commit to sadoprotocol/ord that referenced this pull request Oct 24, 2024
* Change test-bitcoincore-rpc to mockcore in README.md (ordinals#3842)

* Commit twice to work around redb off-by-one bug (ordinals#3856)

* Release 0.19.1 (ordinals#3864)

- Bump version: 0.19.0 → 0.19.1
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Update Portuguese Translation pt.po (ordinals#3837)

* Updated Chinese translation  (ordinals#3881)

* Fix rune links for runes with no symbol (ordinals#3849)

* Suppress printing sat_ranges by default (ordinals#3867)

* Re-enter beta (ordinals#3884)

* Update pointer specification (ordinals#3861)

* Clarify that unused runes tags should not be used (ordinals#3885)

* Migrate object.rs to snafu error handling (ordinals#3858)

* Make index settings harder to misuse (ordinals#3893)

* Don't unnecessarily insert into utxo cache when indexing addresses (ordinals#3894)

* Remove trailing space from runes specification (ordinals#3896)

* Serve responses with cross origin isolation headers (ordinals#3898)

* List all Bitcoin Core wallets (ordinals#3902)

* Make first first and last sat in range clickable (ordinals#3903)

* Migrate Outgoing to SnafuError (ordinals#3854)

* Update Bitcoin Core deploy to 27.1 (ordinals#3912)

* Add sat_balance to address API (ordinals#3905)

Co-authored-by: raph <raphjaph@protonmail.com>

* Add Dutch translation to Ordinals Handbook (ordinals#3907)

* Migrate chain.rs to snafu error (ordinals#3904)

* Bump version to 0.20.0-dev (ordinals#3916)

* Revert "Serve responses with cross origin isolation headers" (ordinals#3920)

* Remove inscription content type counts from /status page (ordinals#3922)

* Unified OUTPOINT_TO_UTXO_ENTRY table (ordinals#3915)

- Upgrade `redb` to 2.1.1
- Remove `--index-spent-sats`
- Remove redundant pointer handling in `index_inscriptions()`
- Fix incorrect `is_output_spent()` results when not using `--index-sats`
- Unify UTXO index data in `OUTPOINT_TO_UTXO_ENTRY` table
- Read addresses from index when exporting

* Add address field to `/r/inscription/:id` (ordinals#3891)

* Add inscriptions and runes details to address API endpoint (ordinals#3924)

* Release 0.20.0 (ordinals#3928)

- Bump ord version: 0.19.1 → 0.20.0
- Bump ordinals version: 0.0.9 → 0.0.10
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Bump version to 0.20.0-dev (ordinals#3929)

* Add test to remind us to fix the UtxoEntry redb type name (ordinals#3934)

* Put AddressInfo into api module (ordinals#3933)

* Fix clippy lint (ordinals#3937)

* Add inscription index to /status (ordinals#3938)

* Remove unnecessary symbols in docs/src/guides/testing.md (ordinals#3945)

* Add inscription examples to handbook (ordinals#3769)

* Allow scrolling in iframe (ordinals#3947)

* Skip serializing None in batch::File (ordinals#3943)

* Fix /output page (ordinals#3948)

* Add `/satpoint/<SATPOINT>` endpoint (ordinals#3949)

* Don't log RPC connections to bitcoind (ordinals#3952)

* Start indexing at correct block height (ordinals#3956)

* Fix output API struct (ordinals#3957)

* Remove dependency on `ord-bitcoincore-rpc` crate (ordinals#3959)

* Keep sat ranges in low-level format (ordinals#3963)

* Implement burn for wallet command (ordinals#3437)

* Add multi parent support to wallet (ordinals#3228)

* Get parents using `as_slice` instead of converting to `Vec` (ordinals#3972)

* Rename parents_values -> parent_values (ordinals#3973)

* Fix non-existant output lookup (ordinals#3968)

* Release 0.20.1 (ordinals#3975)

* Refactor burn command (ordinals#3976)

* Remove regtest.ordinals.net just recipes (ordinals#3978)

* Add `ord verify` (ordinals#3906)

* Release 0.21.0 (ordinals#3997)

- Bump version: 0.20.1 → 0.21.0
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Remove /runes/balances API endpoint (ordinals#3980)

* Update rust-bitcoin in ord (ordinals#3962)

* Revert redb to 2.1.3 (ordinals#4003)

* Release 0.21.1 (ordinals#4006)

* Update Bitcoin Core install script (ordinals#4007)

* Remove pre-alpha warning from ord help (ordinals#4011)

* Change mint progress to `mints / terms.cap` (ordinals#4012)

* Only show rune mint progress during mint (ordinals#4013)

* Show if JSON API is enabled on /status (ordinals#4014)

* Fix build error

---------

Co-authored-by: Anchor <49644098+TheHeBoy@users.noreply.github.com>
Co-authored-by: Casey Rodarmor <casey@rodarmor.com>
Co-authored-by: 0xArtur <metaverseartur@gmail.com>
Co-authored-by: Dr.JingLee <95461562+DrJingLee@users.noreply.github.com>
Co-authored-by: nine <118634361+cryptoni9n@users.noreply.github.com>
Co-authored-by: Bohdan Cryptolions <37701692+ansigroup@users.noreply.github.com>
Co-authored-by: raph <raphjaph@protonmail.com>
Co-authored-by: Patrick Collins <patrick@collinatorstudios.com>
Co-authored-by: Tibebtc <tibedekock@live.nl>
Co-authored-by: partialord <178683722+partialord@users.noreply.github.com>
Co-authored-by: Eloc <42568538+elocremarc@users.noreply.github.com>
Co-authored-by: twosatsmaxi <vashalpesh@gmail.com>
Co-authored-by: tiaoxizhan <tiaoxizhan@outlook.com>
Co-authored-by: onchainguy <1436535+onchainguy-btc@users.noreply.github.com>
Co-authored-by: lifofifo <134870335+lifofifoX@users.noreply.github.com>
Co-authored-by: dcorral <hi@dcorral.com>
danadi7 pushed a commit to sadoprotocol/ord that referenced this pull request Nov 20, 2024
* Change test-bitcoincore-rpc to mockcore in README.md (ordinals#3842)

* Commit twice to work around redb off-by-one bug (ordinals#3856)

* Release 0.19.1 (ordinals#3864)

- Bump version: 0.19.0 → 0.19.1
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Update Portuguese Translation pt.po (ordinals#3837)

* Updated Chinese translation  (ordinals#3881)

* Fix rune links for runes with no symbol (ordinals#3849)

* Suppress printing sat_ranges by default (ordinals#3867)

* Re-enter beta (ordinals#3884)

* Update pointer specification (ordinals#3861)

* Clarify that unused runes tags should not be used (ordinals#3885)

* Migrate object.rs to snafu error handling (ordinals#3858)

* Make index settings harder to misuse (ordinals#3893)

* Don't unnecessarily insert into utxo cache when indexing addresses (ordinals#3894)

* Remove trailing space from runes specification (ordinals#3896)

* Serve responses with cross origin isolation headers (ordinals#3898)

* List all Bitcoin Core wallets (ordinals#3902)

* Make first first and last sat in range clickable (ordinals#3903)

* Migrate Outgoing to SnafuError (ordinals#3854)

* Update Bitcoin Core deploy to 27.1 (ordinals#3912)

* Add sat_balance to address API (ordinals#3905)

Co-authored-by: raph <raphjaph@protonmail.com>

* Add Dutch translation to Ordinals Handbook (ordinals#3907)

* Migrate chain.rs to snafu error (ordinals#3904)

* Bump version to 0.20.0-dev (ordinals#3916)

* Revert "Serve responses with cross origin isolation headers" (ordinals#3920)

* Remove inscription content type counts from /status page (ordinals#3922)

* Unified OUTPOINT_TO_UTXO_ENTRY table (ordinals#3915)

- Upgrade `redb` to 2.1.1
- Remove `--index-spent-sats`
- Remove redundant pointer handling in `index_inscriptions()`
- Fix incorrect `is_output_spent()` results when not using `--index-sats`
- Unify UTXO index data in `OUTPOINT_TO_UTXO_ENTRY` table
- Read addresses from index when exporting

* Add address field to `/r/inscription/:id` (ordinals#3891)

* Add inscriptions and runes details to address API endpoint (ordinals#3924)

* Release 0.20.0 (ordinals#3928)

- Bump ord version: 0.19.1 → 0.20.0
- Bump ordinals version: 0.0.9 → 0.0.10
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Bump version to 0.20.0-dev (ordinals#3929)

* Add test to remind us to fix the UtxoEntry redb type name (ordinals#3934)

* Put AddressInfo into api module (ordinals#3933)

* Fix clippy lint (ordinals#3937)

* Add inscription index to /status (ordinals#3938)

* Remove unnecessary symbols in docs/src/guides/testing.md (ordinals#3945)

* Add inscription examples to handbook (ordinals#3769)

* Allow scrolling in iframe (ordinals#3947)

* Skip serializing None in batch::File (ordinals#3943)

* Fix /output page (ordinals#3948)

* Add `/satpoint/<SATPOINT>` endpoint (ordinals#3949)

* Don't log RPC connections to bitcoind (ordinals#3952)

* Start indexing at correct block height (ordinals#3956)

* Fix output API struct (ordinals#3957)

* Remove dependency on `ord-bitcoincore-rpc` crate (ordinals#3959)

* Keep sat ranges in low-level format (ordinals#3963)

* Implement burn for wallet command (ordinals#3437)

* Add multi parent support to wallet (ordinals#3228)

* Get parents using `as_slice` instead of converting to `Vec` (ordinals#3972)

* Rename parents_values -> parent_values (ordinals#3973)

* Fix non-existant output lookup (ordinals#3968)

* Release 0.20.1 (ordinals#3975)

* Refactor burn command (ordinals#3976)

* Remove regtest.ordinals.net just recipes (ordinals#3978)

* Add `ord verify` (ordinals#3906)

* Release 0.21.0 (ordinals#3997)

- Bump version: 0.20.1 → 0.21.0
- Update changelog
- Update changelog contributor credits
- Update dependencies

* Remove /runes/balances API endpoint (ordinals#3980)

* Update rust-bitcoin in ord (ordinals#3962)

* Revert redb to 2.1.3 (ordinals#4003)

* Release 0.21.1 (ordinals#4006)

* Update Bitcoin Core install script (ordinals#4007)

* Remove pre-alpha warning from ord help (ordinals#4011)

* Change mint progress to `mints / terms.cap` (ordinals#4012)

* Only show rune mint progress during mint (ordinals#4013)

* Show if JSON API is enabled on /status (ordinals#4014)

* Update JSON-API & Recursive documentation (ordinals#3984)

* Document POST method for /inscriptions (ordinals#4017)

* Add authors to Handbook (ordinals#4018)

* Add more info to `wallet outputs` (ordinals#4019)

* Add `wallet addresses` (ordinals#4005)

* Add BIP322 `wallet sign` (ordinals#3988)

* Add `/r/undelegated-content/<INSCRIPTION_ID>` (ordinals#3932)

* Show total child count (ordinals#4009)

* Create change output when inputs containing non-outgoing runes are selected (ordinals#4028)

* Release 0.21.2 (ordinals#4029)

- Bump version: 0.21.1 → 0.21.2
- Update changelog
- Update changelog contributor credits

* Allow fallback for satpoints and addresses (ordinals#4033)

* Un-pin redb dependency and update to 2.2.0 (ordinals#4032)

* Add `ord wallet split` command for splitting utxos (ordinals#4030)

* Hide image preview and thumbnail scrollbars (ordinals#4042)

* Rescan wallet on restore (ordinals#4041)

* Do not chunk runestone data pushes (ordinals#4036)

* Add simple taproot HD wallet to mockcore (ordinals#4038)

* Collapse long strings in HTML (ordinals#4053)

* BIP322 sign file (ordinals#4026)

* Identify collapsible nodes with class=collapse (ordinals#4055)

* Add assert_html function (ordinals#4058)

* Allow including metadata when burning inscriptions (ordinals#4045)

* Get output information by address (ordinals#4056)

* Document split command (ordinals#4062)

* Add palindrome charm (ordinals#4064)

* Allow restoring wallet with custom timestamp (ordinals#4065)

* Release 0.21.3 (ordinals#4059)

- Bump version: 0.21.2 → 0.21.3
- Update changelog
- Update changelog contributor credits
- Update dependencies
- Pin `bitcoin` to 0.32.3
- Downgrade `bip322` to 0.0.8

* Add Cargo.lock

---------

Co-authored-by: Anchor <49644098+TheHeBoy@users.noreply.github.com>
Co-authored-by: Casey Rodarmor <casey@rodarmor.com>
Co-authored-by: 0xArtur <metaverseartur@gmail.com>
Co-authored-by: Dr.JingLee <95461562+DrJingLee@users.noreply.github.com>
Co-authored-by: nine <118634361+cryptoni9n@users.noreply.github.com>
Co-authored-by: Bohdan Cryptolions <37701692+ansigroup@users.noreply.github.com>
Co-authored-by: raph <raphjaph@protonmail.com>
Co-authored-by: Patrick Collins <patrick@collinatorstudios.com>
Co-authored-by: Tibebtc <tibedekock@live.nl>
Co-authored-by: partialord <178683722+partialord@users.noreply.github.com>
Co-authored-by: Eloc <42568538+elocremarc@users.noreply.github.com>
Co-authored-by: twosatsmaxi <vashalpesh@gmail.com>
Co-authored-by: tiaoxizhan <tiaoxizhan@outlook.com>
Co-authored-by: onchainguy <1436535+onchainguy-btc@users.noreply.github.com>
Co-authored-by: lifofifo <134870335+lifofifoX@users.noreply.github.com>
Co-authored-by: Arik <arik-so@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants