Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: samspaces on March 21, 2018, 03:12:22 PM



Title: non-segwit to segwit raw transactions
Post by: samspaces on March 21, 2018, 03:12:22 PM
Hi,

Weirdly, I'm not able to find easily identifiable info on the title topic. I have an old wallet and want to move coins to segwit addresses. I used to do offline raw transaction signing in the format:

createrawtransaction '[{"txid":"input_tx_number_long_string","vout":number}]' '{"sendtoaddress": amount}'

I've made transactions to a segwit address this way and it shows fine in the balance. Still I'm a bit worried I'm doing something wrong or overlooking something. And do segwit to segwit raw transactions have the same format as stated above?

Thanks.


Title: Re: non-segwit to segwit raw transactions
Post by: ranochigo on March 21, 2018, 03:31:34 PM
If the transaction has appeared in your bech32 address, then its definitely fine. It wouldn't appear if the transaction is invalid.

Bitcoin Core supports bech32 addresses since 0.16.0 and it is definitely possible to use that command to send to bech32 addresses. If you're using an older version, you've probably sent it to a P2SH address and that is completely fine.


Title: Re: non-segwit to segwit raw transactions
Post by: samspaces on March 21, 2018, 03:44:42 PM
If the transaction has appeared in your bech32 address, then its definitely fine. It wouldn't appear if the transaction is invalid.

Bitcoin Core supports bech32 addresses since 0.16.0 and it is definitely possible to use that command to send to bech32 addresses. If you're using an older version, you've probably sent it to a P2SH address and that is completely fine.

Thanks, I sent it to P2SH addresses, since Bitcoin Core 0.16 wasn't out yet. So you're saying that the above raw transaction format works from and to all Bitcoin address types, right?


Title: Re: non-segwit to segwit raw transactions
Post by: ranochigo on March 21, 2018, 03:53:18 PM
Thanks, I sent it to P2SH addresses, since Bitcoin Core 0.16 wasn't out yet. So you're saying that the above raw transaction format works from and to all Bitcoin address types, right?
Bitcoin Core 0.16 is already out: https://bitcoin.org/en/download.

Anyways, yup. P2SH addresses has been supported for a very long time and bech32 will work for createrawtransaction as well[1]. It's the same arguments.

[1] https://github.com/bitcoin/bitcoin/pull/11167/


Title: Re: non-segwit to segwit raw transactions
Post by: samspaces on March 21, 2018, 07:01:34 PM
Thanks, I sent it to P2SH addresses, since Bitcoin Core 0.16 wasn't out yet. So you're saying that the above raw transaction format works from and to all Bitcoin address types, right?
Bitcoin Core 0.16 is already out: https://bitcoin.org/en/download.

Anyways, yup. P2SH addresses has been supported for a very long time and bech32 will work for createrawtransaction as well[1]. It's the same arguments.

[1] https://github.com/bitcoin/bitcoin/pull/11167/

Great, thanks!
Maybe others out there will find this little thread useful too.