Bitcoin Forum
April 27, 2024, 04:05:41 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Bitcoin Taproot transaction STEP BY STEP on bitcoin-cli...  (Read 470 times)
cfbtcman (OP)
Member
**
Offline Offline

Activity: 264
Merit: 16


View Profile
October 20, 2023, 02:19:18 AM
Last edit: October 20, 2023, 10:59:12 PM by cfbtcman
 #21

Here goes the answers for many posts you made.

Before I was using version 23, but I managed to upgrade to 25, problem was that I was running a service in this website:

https://console.shuken.io/account/

And they were running only version 23.

They said they would upgrade just next month, so I moved on to a VPS and I installed a pruned node.

Now with my own version 25, I got solution for the problem:

"error": "Witness program was passed an empty witness"

What is the problem?
If we add some address to our wallet and we use the option to rescan the wallet since some "timestamp" value it will never work, we will see always that error.

So, if you use a "timestamp" to rescan wallet, at the end you need to always run this command:

bitcoin-cli importdescriptors '[{"desc": "tr(your_private_key)#your-checksum", "timestamp": "now", "internal": false, "label": "your_label"}]'

Sometimes even if you stop the core and restart again you need to do it again what is a pain in the ass.

After that you just create the raw normally with this command:

bitcoin-cli createrawtransaction '[{"txid":"your_txid","vout":your_vout}]' '[{"your_destination_address":your_amount}]'

That will give some output like this:
0200000001...

Then we sign that output RAW with this command:

bitcoin-cli signrawtransactionwithwallet 0200000001...

That will give us some output like this:
020000000001...

And we use it to broadcast it with:

bitcoin-cli sendrawtransaction 020000000001...

That's it.

But now... Here we go again, infatuation !

If we want to use signrawtransactionwithkey and we are using the simplest syntax:

bitcoin-cli signrawtransactionwithkey 0200000001... '["your_private_key"]'

I got the same old f* error:

"error": "Witness program was passed an empty witness"

Now we can't use the bitcoin-cli importdescriptors trick with "timestamp": "now", so, what is the solution?

Try it yourself please and give here feedback about if you have the same results or not.
1714233941
Hero Member
*
Offline Offline

Posts: 1714233941

View Profile Personal Message (Offline)

Ignore
1714233941
Reply with quote  #2

1714233941
Report to moderator
1714233941
Hero Member
*
Offline Offline

Posts: 1714233941

View Profile Personal Message (Offline)

Ignore
1714233941
Reply with quote  #2

1714233941
Report to moderator
1714233941
Hero Member
*
Offline Offline

Posts: 1714233941

View Profile Personal Message (Offline)

Ignore
1714233941
Reply with quote  #2

1714233941
Report to moderator
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714233941
Hero Member
*
Offline Offline

Posts: 1714233941

View Profile Personal Message (Offline)

Ignore
1714233941
Reply with quote  #2

1714233941
Report to moderator
1714233941
Hero Member
*
Offline Offline

Posts: 1714233941

View Profile Personal Message (Offline)

Ignore
1714233941
Reply with quote  #2

1714233941
Report to moderator
nc50lc
Legendary
*
Offline Offline

Activity: 2394
Merit: 5539


Self-proclaimed Genius


View Profile
October 20, 2023, 04:12:01 AM
Merited by DaveF (3)
 #22

That's it.

But now... Here we go again, infatuation !

If we want to use signrawtransactionwithkey and we are using the simplest syntax:
So the issue is specific to signrawtransactionwithkey with TapRoot and not just the goal of signing a transaction?
In that case, although it has the same error, it's not related to your previous issue with signrawtransactionwithwallet.
Bitcoin Core simply doesn't currently support signing TapRoot inputs with signrawtransactionwithkey.

Refer to this post: https://bitcointalk.org/index.php?topic=5462088.msg62647223#msg62647223
And issue: https://github.com/bitcoin/bitcoin/issues/27017

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Greg Tonoski
Member
**
Offline Offline

Activity: 115
Merit: 68


View Profile
October 20, 2023, 11:49:22 AM
Last edit: October 20, 2023, 12:04:02 PM by Greg Tonoski
 #23

I moved on to a VPS and I installed a pruned node.

Now with my own version 25, I got solution for the problem:

"error": "Witness program was passed an empty witness"

What is the problem?
If we add some address to our wallet and we use the option to rescan the wallet since some "timestamp" value it will never work, we will see always that error.

So, if you use a "timestamp" to rescan wallet, at the end you need to always run this command:

bitcoin-cli importdescriptors '[{"desc": "tr(your_private_key)#your-checksum", "timestamp": "now", "internal": false, "label": "your_label"}]'

Sometimes even if you stop the core and restart again you need to do it again what is a pain in the ass.

After that you just create the raw normally with this command:

bitcoin-cli createrawtransaction '[{"txid":"your_txid","vout":your_vout}]' '[{"your_destination_address":your_amount}]'

That will give some output like this:
0200000001...

Then we sign that output RAW with this command:

bitcoin-cli signrawtransactionwithwallet 0200000001...

That will give us some output like this:
020000000001...

And we use it to broadcast it with:

bitcoin-cli sendrawtransaction 020000000001...

That's it.

Thank you for feedback. Indeed, there is the serious issue that many seem to encounter trying to use Bitcoin Core.

The message
Code:
"error": "Witness program was passed an empty witness" 
is not meaningful to a user. It leaves them with no clue what to do next and if anything is possible. There is what happened most probably:
1) A key was imported to a wallet.
2) Wallet searched for UTXO and other Bitcoin blockchain data relevant to the key and found none.
3) User ran signrawtransactionwithwallet RPC command.
4) Wallet didn't perform signing and send the confusing message instead.

Why?
Wallet didn't search for UTXO and other Bitcoin blockchain data in the complete dataset. As a matter of fact, only a small percentage of the dataset was scanned - typically spanning a few hours from the moment of import - as indicated by the "now" timestamp option in the importdescriptor RPC command. The UTXO had been created (transaction took place) earlier. In order to be aware of the UTXO, Bitcoin Core wallet needs (re-)scanning earlier data. There are additional two catches: wallet doesn't search other data automatically (so-called rescan) and shows the same error even if rescanning hasn't completed (after user started it manually). The error message is shown for the next few days or more until rescan is completed (Initial Blockchain Download-long in most cases, especially so-called "prune nodes" with default settings). During rescan Bitcoin Core wallet searches for and records (cache) data relevant for keys it stores. Without the data signing can't succeed and the error message is shown.
cfbtcman (OP)
Member
**
Offline Offline

Activity: 264
Merit: 16


View Profile
October 20, 2023, 11:05:51 PM
 #24

In my case, the trick is importing the address with "timestamp"= date of the block of the first UTXO and let it do it until the end, after that, when I want to move, just repeat the command with "now" and it works perfectly.

About signrawtransactionwithkey maybe it works, I heard many times we couldn't do taproot transactions without PSBT's, etc and I did it, so, maybe everything have solution and the problem is just doing the configuration of the command with all variables.

If someone have success please report it.
Greg Tonoski
Member
**
Offline Offline

Activity: 115
Merit: 68


View Profile
October 21, 2023, 12:54:41 PM
 #25

About signrawtransactionwithkey maybe it works, I heard many times we couldn't do taproot transactions without PSBT's, etc and I did it, so, maybe everything have solution and the problem is just doing the configuration of the command with all variables.

If someone have success please report it.
Contrary to the name signrawtransactionwithkey, the command doesn't sign a transaction unless it isn't of the TapRoot-type, I'm afraid. I have verified it. There isn't any tool to do it.
cfbtcman (OP)
Member
**
Offline Offline

Activity: 264
Merit: 16


View Profile
October 21, 2023, 06:39:12 PM
 #26

I still believe it is possible.

This post:

https://bitcointalk.org/index.php?topic=5462088.msg62647223#msg62647223

Says we could only use PSBT's what is not true, signrawtransactionwithwallet works well.

I believe we can't use signrawtransactionwithkey to sign complex taproot script as the post says, but signing with privatekey path is not complex taproot script, so, maybe it is possible if we create the full command with the respective witness value.
Greg Tonoski
Member
**
Offline Offline

Activity: 115
Merit: 68


View Profile
December 21, 2023, 08:35:04 PM
Merited by ABCbits (1)
 #27

About signrawtransactionwithkey maybe it works, I heard many times we couldn't do taproot transactions without PSBT's, etc and I did it, so, maybe everything have solution and the problem is just doing the configuration of the command with all variables.

If someone have success please report it.
Contrary to the name signrawtransactionwithkey, the command doesn't sign a transaction unless it isn't of the TapRoot-type, I'm afraid. I have verified it. There isn't any tool to do it.

Seems to be fixed in Bitcoin Core 26.0 and it is possible sign TapRoot-type transaction using signrawtransactionwithkey.
ABCbits
Legendary
*
Offline Offline

Activity: 2856
Merit: 7407


Crypto Swap Exchange


View Profile
December 27, 2023, 09:40:28 AM
 #28

--snip--

Is this AI generated text? While it sounds convincing, it has several wrong details such as this one,

#### 2. Create a New Receiving Address:
Generate a new Taproot receiving address using the `getnewaddress` command:
```bash
bitcoin-cli getnewaddress "" "taproot"
```
Note the generated Taproot address; this will be your receiving address.

"taproot" isn't valid value for second parameter. It should be "bech32m".

Quote from: help getnewaddress
2. address_type    (string, optional, default=set by -addresstype) The address type to use. Options are "legacy", "p2sh-segwit", "bech32", and "bech32m".

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!