-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
base: master
Are you sure you want to change the base?
Implement burn #3437
Conversation
58c008e
to
61fcd70
Compare
61fcd70
to
7d4947e
Compare
There was a problem hiding this 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.
@raphjaph thanks for the feedback, will get that done asap! |
@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. |
There was a problem hiding this 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.
help = "Target <AMOUNT> postage with sent inscriptions. [default: 10000 sat]" | ||
)] | ||
pub(crate) postage: Option<Amount>, | ||
outgoing: Outgoing, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outgoing: Outgoing, | |
inscription_id: InscriptionId, |
For now we only want to enable burning inscriptions, so let's make sure only that is possible. We'll add burning functionality to the other types (sats, btc, runes) later.
src/subcommand/wallet/send.rs
Outdated
#[derive(Clone, Copy)] | ||
struct AddressParser; | ||
|
||
#[derive(Clone, Debug, PartialEq)] | ||
pub(crate) enum ParsedAddress { | ||
Address(Address<NetworkUnchecked>), | ||
ScriptBuf(ScriptBuf), | ||
} | ||
|
||
fn parse_address(arg: &str) -> Result<ParsedAddress, bitcoin::address::Error> { | ||
Ok(ParsedAddress::Address(Address::from_str(arg)?)) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#[derive(Clone, Copy)] | |
struct AddressParser; | |
#[derive(Clone, Debug, PartialEq)] | |
pub(crate) enum ParsedAddress { | |
Address(Address<NetworkUnchecked>), | |
ScriptBuf(ScriptBuf), | |
} | |
fn parse_address(arg: &str) -> Result<ParsedAddress, bitcoin::address::Error> { | |
Ok(ParsedAddress::Address(Address::from_str(arg)?)) | |
} |
Let's get rid of all of these. The burn command should just use the transaction builder directly with the correct TxOut
, which can include an OP_RETURN script.
src/subcommand/wallet/send.rs
Outdated
address: Address<NetworkUnchecked>, | ||
outgoing: Outgoing, | ||
#[arg(value_parser = parse_address)] | ||
pub(crate) address: ParsedAddress, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) address: ParsedAddress, | |
pub(crate) address: Address, |
@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 |
crates/ordinals/src/charm.rs
Outdated
@@ -62,6 +64,7 @@ impl Charm { | |||
Self::Unbound => "🔓", | |||
Self::Uncommon => "🌱", | |||
Self::Vindicated => "❤️🔥", | |||
Self::Burned => "💀🔥", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self::Burned => "💀🔥", | |
Self::Burned => "🔥", |
That's true, then let's just leave it how it is for now.
Sounds reasonble |
Cool, will adapt to that! |
ebf9b98
to
9666a4f
Compare
Let me know when this is ready for review :) |
@raphjaph Ready for review ✅ |
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.