It is the same if you used the address you generated from the wallet to generate blocks.
When you execute generatetoaddress
you also have to specify the address where the block rewards go.
When I follow this course, it executes a segwit transaction, which renders the debugging video pretty well unhelpful in this context. Is there a way to force it to execute a pay-to-pubkey-hash?
Also, I’m still getting “absurdly-high-free” error despite creating the raw change address.
error message:
absurdly-high-fee, 2600000000 > 1100000
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest getrawchangeaddress
bcrt1qly3wksl2muvwe6ug6vj3tpxj28vxgluqqdykyk
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest createrawtransaction ‘[{“txid”: “886ab3d54395ccf90915b4a883efb6c521e7c6cb3460096a8a4a5ef4936065c4”,“vout”: 0}]’ ‘{“bcrt1q96mnrxz70we28xyu0ey4xhztm79uf38rufkvmt”:24, “bcrt1qly3wksl2muvwe6ug6vj3tpxj28vxgluqqdykyk”: 0.99 }’
0200000001c4656093f45e4a8a6a096034cbc6e721c5b6ef83a8b41509f9cc9543d5b36a880000000000ffffffff0200180d8f000000001600142eb731985e7bb2a3989c7e49535c4bdf8bc4c4e3c09ee60500000000160014f922eb43eadf18eceb88d3251584d251d8647f8000000000
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest signrawtransactionwithwallet 0200000001c4656093f45e4a8a6a096034cbc6e721c5b6ef83a8b41509f9cc9543d5b36a880000000000ffffffff0200180d8f000000001600142eb731985e7bb2a3989c7e49535c4bdf8bc4c4e3c09ee60500000000160014f922eb43eadf18eceb88d3251584d251d8647f8000000000
{
“hex”: “02000000000101c4656093f45e4a8a6a096034cbc6e721c5b6ef83a8b41509f9cc9543d5b36a880000000000ffffffff0200180d8f000000001600142eb731985e7bb2a3989c7e49535c4bdf8bc4c4e3c09ee60500000000160014f922eb43eadf18eceb88d3251584d251d8647f80024730440220497660302d269f24e29a3c40744ed488f96a5f2665a24ae9e32d5211871ab32d0220390d80435f3eafc7cde67ffce3084187c487d890bcf4f0a51f3704c058979288012102daf5d8a5cba3f4c4b935e0934f7e2d0511a418422bfcec6f4813ba7dede001bc00000000”,
“complete”: true
}
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest sendrawtransaction 02000000000101c4656093f45e4a8a6a096034cbc6e721c5b6ef83a8b41509f9cc9543d5b36a880000000000ffffffff0200180d8f000000001600142eb731985e7bb2a3989c7e49535c4bdf8bc4c4e3c09ee60500000000160014f922eb43eadf18eceb88d3251584d251d8647f80024730440220497660302d269f24e29a3c40744ed488f96a5f2665a24ae9e32d5211871ab32d0220390d80435f3eafc7cde67ffce3084187c487d890bcf4f0a51f3704c058979288012102daf5d8a5cba3f4c4b935e0934f7e2d0511a418422bfcec6f4813ba7dede001bc00000000
error code: -26
error message:
absurdly-high-fee, 2501000000 > 1410000
You’re creating a tx that has almost 26 BTC fee. The UTXO you’re trying to spend probably has 50 BTC in it (50 - 24 - 0.99 = 25,01)
ahhhh thank you I didn’t realize I was sending the transaction to my raw change address !
Raw transactions in Linux terminal
General remark
This is indeed the part of the course I’ve been looking forward to. Many thanks for that!
That being said, I (and probably many others) would hugely appreciate if parts of it could be updated to cover some of the topics/issues that have been discussed in this forum thread.
Of course it’s part of the experience to do your own research, figure things out, and collaborate as a community here. Some topics, however, get buried in a thread rather quickly…
Linux screenshots
The following screenshots show:
-
The initial input for a raw transaction written in Gedit (a minimalistic and clean code editor for Linux). As mentioned by others already there should be no escaping necessary in a UNIX terminal.
-
A signed and then decoded SegWit address/transaction which is the default for newer versions of bitcoin core as far as I understand. It shows the empty ScriptSig portion and the newer witness portion (The part in the upper tmux pane is just bitcoind running in -regtest mode.)
I hope this helps some confused Linux tinkerers to cope with their doubts and speed up their research.
Have fun!
Hey, thanks a lot for this! Good job yes there are a few things that are different and we have updated the bonus section recently. However for changes like witness location we didn’t think its such a big change be needing to re record the entire section.
We can’t do much about different editors and terminals there are so many of them and people that use them are usually resourceful enough to figure out the differences between the one in the video and the one they are using themself. If we would support all terminals the video would be 10 hours long
Hello
excuse me I have a question when I looked my sign transaction, there is something different in it .
PS C:\Program Files\Bitcoin\daemon> ./bitcoin-cli -regtest decoderawtransaction 02000000000101ff0c3b01585661604c5ea56762cc31e7c739a8c8ba314b39fe90464d78c490b70000000000ffffffff0100f2052a01000000160014bd79b77783f62a844d6e0f53ba307257956ab1fd0247304402201029d43e24f743e924b1dcf1a1f171f86e21b3289ca4f6dfcffb5997bcd338a30220337583cacadf97f50db66bf96a6a0922feeb14dd78f3069848610ee8c7edecdc012103b3bdda3c70e1da516118e7c7563a1f548da3c6da91f66310a504cf63ad0c3f1600000000
{
"txid": "95ce1e1d4745b0619a640071a178a55b0c0efe5f306b4f656712d66116e1abed",
"hash": "9b010c8f008d78f3cf409584af0adcb3da3d81b84403d3e913ce614c0696c22d",
"version": 2,
"size": 191,
"vsize": 110,
"weight": 437,
"locktime": 0,
"vin": [
{
"txid": "b790c4784d4690fe394b31bac8a839c7e731cc6267a55e4c60615658013b0cff",
"vout": 0,
**"scriptSig": {**
** "asm": "",**
** "hex": ""**
** },**
**"txinwitness": [**
** "304402201029d43e24f743e924b1dcf1a1f171f86e21b3289ca4f6dfcffb5997bcd338a30220337583cacadf97f50db66bf96a6a0922feeb14dd78f3069848610ee8c7edecdc01",**
** "03b3bdda3c70e1da516118e7c7563a1f548da3c6da91f66310a504cf63ad0c3f16"**
** ],**
"sequence": 4294967295
}
],
"vout": [
{
"value": 50.00000000,
"n": 0,
"scriptPubKey": {
"asm": "0 bd79b77783f62a844d6e0f53ba307257956ab1fd",
"hex": "0014bd79b77783f62a844d6e0f53ba307257956ab1fd",
"reqSigs": 1,
"type": "witness_v0_keyhash",
"addresses": [
"bcrt1qh4umwaur7c4ggntwpafm5vrj272k4v0am6tzqr"
]
}
}
]
}
PS C:\Program Files\Bitcoin\daemon>
Maybe the wallet by default used Segregated Witness ?
Yes Bitcoin core uses segwit by default that is why the witness is in the txinwitness
part.
When i try to send block to another address a message pop error parsing JSON what i can do to resolve the issue?
PS C:\Users\antho\Documents\bitcoin core\Bitcoin\daemon> ./bitcoin-cli -regtest generatetoaddress 1 ‘[{“txid”:“07cd2742cfa12dd5ca130fc9e449794834a18539d18e6a85c35caffcb53e5bec”,“vout”:0,}]’ ‘{“bcrt1qkfp8na0467hllnen5y0tpsnve6h4uwg5pk2g3d”:30,}’
error: Error parsing JSON:{“bcrt1qkfp8na0467hllnen5y0tpsnve6h4uwg5pk2g3d”:30,}
Seems like you’re trying to send a transaction with generatetoaddress
which is used to generate blocks.
You should first create a transaction and then generate a block.
Also it seems you have additional comas at the end of the json structure which some parsers might not like.
Thank for the help i finally generate a raw transaction.
Hey guys,
So I run into the fee issue like in the video:
And so I generate a change address and format it correctly in my JSON line (I’m using terminal on macOS):
'''[{"txid":"'9f73e44a1b0c0dacd510cc394540022b8d0affebdae81662047b68239e3de909'","vout": '0'}]''' '''{"'bcrt1qqvp6pnwl6am0jvtudzwf7l72kuhlak4emz6vd4'":'49’,“’bcrt1q9cay8ye7advjz6zlkwdpmdsxg7wfd7s3khrdvs'”:'0.99'}’’’
Then back in the terminal, I use my JSON line:
./bitcoin-cli -regtest createrawtransaction '''[{"txid":"'9f73e44a1b0c0dacd510cc394540022b8d0affebdae81662047b68239e3de909'","vout": '0'}]''' '''{"'bcrt1qqvp6pnwl6am0jvtudzwf7l72kuhlak4emz6vd4'":'49’,“’bcrt1q9cay8ye7advjz6zlkwdpmdsxg7wfd7s3khrdvs'”:'0.99'}’’’
And at this point I get no response from the terminal, help?
Thanks!
What do you mean no response? Is your daemon running?
To get around the fee error you should specify the fallback fee when starting the daemon bitcoind -regtest -fallbackfee=0.001
Yes I had the daemon running using
./bitcoind -regtest -fallbackfee=0.001
As all my other commands have been running but specifically when I add the change address to the JSON string then nothing happens:
Thanks for the help!
You’re using different quotes at the end of the command than the rest. Notice the ’’’
instead of '''
.
Also the entire format of your JSON is like this, you’re also mixing ”
with "
and you don’t need to use quotes for numbers.
This worked for me:
bitcoin-cli -regtest createrawtransaction '[{"txid":"9f73e44a1b0c0dacd510cc394540022b8d0affebdae81662047b68239e3de909","vout": 0}]' '{"bcrt1qqvp6pnwl6am0jvtudzwf7l72kuhlak4emz6vd4":49,"bcrt1q9cay8ye7advjz6zlkwdpmdsxg7wfd7s3khrdvs":0.99}'
Wow thanks so much. It worked.
I went off one of the JSON formattings listed above. I was unaware of differences in those quotes. Is there something I can google to look that up? I’m looking at my keyboard and I can’t tell how to type the slanted quotes from the straight vertical quotes.
Thanks for all the help!
Hmmm, hard to help you here because different layouts have these quotes on different locations.
The slovenian (or South Slavic Latin I think officially) has the '
quote left of 0 key, the "
I get by pressing SHIFT + 2 and the ` that I use for marking up code in text here I get by pressing ALT GR + 7
The english layout has "
and '
quotes the second key to the right of L (alternating by using SHIFT) and the ` is left of 1 key
Hi @filip,
Thank you for your knowledge. I’m tagging your because I’m always a bit confuse when you say in your videos through the whole course that you will add ressources, the right command for mac user for instance. I have nothing at the bottom or the video or anywhere else. Is there a link where we can find all the ressources and links please ? Maybe I just didn’t find where to look at but it seems that many times it’s missing.
Thanks in advance!
Cheers
Using mac isn’t any different. You just have to cd to the proper directory where bitcoind is installed.
I’m using createrawtransaction
to get a complex transaction of 2 inputs and two outputs as discussed here: https://developer.bitcoin.org/examples/transactions.html
bitcoin-cli -regtest createrawtransaction '''
[
{
"txid": "'$UTXO1_TXID'",
"vout": '$UTXO1_VOUT'
},
{
"txid": "'$UTXO2_TXID'",
"vout": '$UTXO2_VOUT'
}
]
''' '''
{
"'$NEW_ADDRESS1'": 79.9999,
"'$NEW_ADDRESS2'": 10
}'''
0200000002ea34a15b5c6b1ec4d3e9d2a1fdb8f80c29b0aa93d1762359b5ba30b63437973a0000000000ffffffff3d38a74c05e837f87b7a0eb0b7c688396972ffe670fda8b7ba689c76acca24300000000000ffffffff02f028d6dc01000000160014e38542852b468886d97748b4ca3786387e9e9cdc00ca9a3b00000000160014f8dd22acbd0867c5ad1edd3c3ca6e8768845cb1d00000000
I assign this value to RAW_TX as described:
RAW_TX=0200000002ea34a15b5c6b1ec4d3e9d2a1fdb8f80c29b0aa93d1762359b5ba30b63437973a0000000000ffffffff3d38a74c05e837f87b7a0eb0b7c688396972ffe670fda8b7ba689c76acca24300000000000ffffffff02f028d6dc01000000160014e38542852b468886d97748b4ca3786387e9e9cdc00ca9a3b00000000160014f8dd22acbd0867c5ad1edd3c3ca6e8768845cb1d00000000
But then I run into problems. When using the private key I get an error saying it’s not a valid sighash parameter. Since signrawtransaction
is deprecated I’m using signrawtransactionwithwallet
:
bitcoin-cli -regtest signrawtransactionwithwallet $RAW_TX '[]' '''
> [
> "'$UTXO1_PRIVATE_KEY'"
> ]'''
error code: -1
error message:
[
"cUS7vndDv6nzJ3qEa5YG74dAzzEwTxRmbBFKXCn2fu2C4GSCbRKa"
] is not a valid sighash parameter.
I’m have no idea why it’s not working. Please advise!