ordinals / ord

👁‍🗨 Rare and exotic sats
https://ordinals.com
Creative Commons Zero v1.0 Universal
3.83k stars 1.36k forks source link

How configure correctly a CPFP ? #3224

Open starker-xp opened 7 months ago

starker-xp commented 7 months ago

Do we have any instructions on how to use CPFP to speed up the reveal transaction using bitcoin-cli? I read up the generic instructions but the issue is how would i sign the transaction using bitcoin-cli? My ord wallet is different than bitcoind wallet. In work in regtest ATM and I want to understand how to set up a cpfp transaction. I use :

bitcoin-cli createwallet dev
bitcoin-cli generatetoaddress 101 $(bitcoin-cli -rpcwallet=dev getnewaddress)

ord -r  wallet --name=ord_dev create
bitcoin-cli -rpcwallet=dev sendtoaddress $(ord -r  wallet --name=ord_dev receive) 0.47
bitcoin-cli -rpcwallet=dev -generate 1
bitcoin-cli -rpcwallet=dev sendtoaddress $(ord -r  wallet --name=ord_dev receive) 0.47
bitcoin-cli -rpcwallet=dev -generate 1
bitcoin-cli -rpcwallet=dev sendtoaddress $(ord -r  wallet --name=ord_dev receive) 0.06
bitcoin-cli -rpcwallet=dev -generate 1

Now i have 1 BTC on my ord_dev and i try to inscribe one inscription

ord -r  wallet --name=ord_dev inscribe --fee-rate 2 --file ".1.html"
{
  "commit": "8f0c01aadc09e4ee2b0c3c63d225f3dfa248390801af73b6f6acb330fa97fa12",
  "inscriptions": [
    {
      "id": "e06ccf2fc50c7499998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8di0",
      "location": "e06ccf2fc50c7499998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8d:0:0"
    }
  ],
  "parent": null,
  "reveal": "e06ccf2fc50c7499998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8d",
  "total_fees": 5696
}

I get the inputs and outputs :

bitcoin-cli -rpcwallet=ord_dev decoderawtransaction $(bitcoin-cli -rpcwallet=ord_dev getrawtransaction e06ccf2fc50c7499998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8d 2 | jq '.hex') | jq '[.vin[] | {txid: .txid, vout: .vout} ]' -c`

[{"txid":"8f0c01aadc09e4ee2b0c3c63d225f3dfa248390801af73b6f6acb330fa97fa12","vout":0}]

bitcoin-cli -rpcwallet=ord_dev decoderawtransaction $(bitcoin-cli -rpcwallet=ord_dev getrawtransaction e06ccf2fc50c7499998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8d 2 | jq '.hex') | jq '[.vout[] | .value]' -c` 

[0.0001]

bitcoin-cli -rpcwallet=ord_dev listunspent | jq '[.[] | select(.amount > 0) | {txid: .txid, vout: .vout} ]' -c

[] <= because its a refresh wallet

ord -r  wallet --name=ord_dev inscriptions

[] <= because its a refresh wallet

And from then on, it becomes a nebula. I've tried createrawtransaction, walletcreatefundedpsbt, converttopsbt, but I either get a message like "not enough additional fees to relay; 0.00 < 0.00000111" or the transaction goes through but I don't have a registration.

and I can't see how to import these wallets into sparrow. I'd like to stay on the command line.

I've already read the issue https://github.com/ordinals/ord/issues/1519#issuecomment-1464834295 and try this script but not working https://github.com/MMCGW/restore-ord-txs

felipelincoln commented 7 months ago

Do we have any instructions on how to use CPFP to speed up the reveal transaction using bitcoin-cli?

bitcoin-cli createrawtransaction '[{"txid": "reveal_output_txid", "vout": "reveal_output_vout"}]' '{"your_address": 0.00010000}'
bitcoin-cli fundrawtransaction <TX_HEX>
bitcoin-cli signrawtransactionwithwallet <TX_HEX>
bitcoin-cli sendrawtransaction <TX_HEX>
starker-xp commented 7 months ago

So I'm back to this mistake!

error code: -26
error message:
insufficient fee, rejecting replacement fa43fce148d8e0d103a9874875f27a94a290ff38aec6825bc48cd9b4762d7ff9; new feerate 0.00001000 BTC/kvB <= old feerate 0.00002000 BTC/kvB

How do I get around it? I add inputs and outputs and when I use the fundrawtransaction command I make sure to select the new output?

felipelincoln commented 7 months ago

Oh sorry, you have to also specify the fee rate to use Example

bitcoin-cli fundrawtransaction <TX_HEX> '{"fee_rate": 10}'
raphjaph commented 6 months ago

I think this would be great addition to the docs, if anyone feels motivated :)

starker-xp commented 6 months ago

In fact, I don't think I understand how to retrieve the reveal_output_txid and reveal_output_vout values. If I take the example above, isn't the value of reveal_output_txid e06ccf2fc50c74998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8d? If so, how do I get the vout back? If not, how do I retrieve the information?

Once I've got the hang of it, I'll be happy to write the doc or even the command directly in the CLI.

felipelincoln commented 6 months ago

The way the ord client creates the reveal transaction, it will usually be vout 0: inscription vout 1: your BTC change (if any)

if your inscription has a parent: vout 0: parent inscription vout 1: inscription vout 2: your BTC change (if any)

in your case: txid: e06ccf2fc50c74998503d107b517fc3ea96a3fc0ae05ac8b28318683b73e8d vout: 0

bingryan commented 6 months ago

this feat is TX Accelerator. Do we need a command to add this feat?

Usage

ord wallet accelerator <TxID> <FeeRate>

@casey @raphjaph

raphjaph commented 6 months ago

Sounds good