Author

Topic: P2SH addresses: need some help understanding (0.01BTC reward) (Read 1536 times)

legendary
Activity: 2320
Merit: 1292
Encrypted Money, Baby!
knightdk, DannyHamilton: now, several days later, I want to thank you again for your help. It has really motivated me to wrap my head around raw transactions, and to get to know the "inner workings" of Bitcoin a bit better. Result: my very first successful raw transaction from said 3FuckUp address - without any fuckup! Cheesy

https://blockchain.info/address/3FuckUpFfo28hxXb89C19Az2kfGh7JhGY4
https://blockchain.info/tx/8c2d600f0cb0d6715fc364c254fd46577ed729e01a98cf6ae3190bea78c8b5f2

(Please ignore the names of the used "vanity" Bitcoin addresses; they resulted from myself playing with the vanitygen tool and they reveal absolutely nothing [I hope] about my character, heh).

Transaction received!
legendary
Activity: 2320
Merit: 1292
Encrypted Money, Baby!
No need to send me anything.  I'm happy to help out wherever I can. Just choose from the following:
  • Keep my share of the 0.01 BTC for yourself, and just do something kind for someone else whenever the opportunity arises
That's what I'm doing, anyway - online and in real life. Smiley
.edit: Dr. Who is just great. Awaiting the next season!

Yep.  It starts in just a few days.  If the production accepted bitcoin somehow, or if I knew of any of the actors or staff that used bitcoin, I'd suggest sending my share of the 0.01 BTC to them. Unfortunately, I don't know of any way to do that.
Oh, didn't know that it's already that short before next season's start. I guess I have to order a big box of wibbly wobbly, timey wimey popcorn, soon. Payment in Bitcoin, of course!  Cheesy
legendary
Activity: 3472
Merit: 4801
As both of you helped me a lot to understand what I can / can't do, and why this is the case, I'm asking both of you to leave me your BTC address here, so I can send the promised .01 - it's not much, but consider it a thank you for your efforts. Smiley

No need to send me anything.  I'm happy to help out wherever I can. Just choose from the following:
  • Keep my share of the 0.01 BTC for yourself, and just do something kind for someone else whenever the opportunity arises
  • Send my share of the 0.01 BTC to knightdk
  • Use my share of the 0.01 BTC to make a bitcoin donation to your favorite bitcoin accepting charity
  • Pay my share of the 0.01 BTC as a transaction fee in the next transaction that you send, to reward the miners for the work they do
  • Send my share of the 0.01 BTC to Satoshi at the following address: 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
  • Slightly improve the value of everyone's bitcoins by sending my share of the 0.01 BTC to the following address: 1BitcoinEaterAddressDontSendf59kuE

.edit: Dr. Who is just great. Awaiting the next season!

Yep.  It starts in just a few days.  If the production accepted bitcoin somehow, or if I knew of any of the actors or staff that used bitcoin, I'd suggest sending my share of the 0.01 BTC to them. Unfortunately, I don't know of any way to do that.
legendary
Activity: 2320
Merit: 1292
Encrypted Money, Baby!
Also, you should NEVER post your private keys here.
No worries - did you try to "read" the key? Wink
Yeah, I just realized that.

Here is my address 16mT7jrpkjnJBD7a3TM2awyxHub58H6r6Z

Also, when you want to spend the Bitcoin from your p2sh address, you will need to use the createrawtransaction, signrawtransaction, and sendrawtransaction to create, sign, and broadcast it. When using createrawtransaction, be careful because you can end up not sending the change to a change address and accidentally making that become part of the fee.
Yep - it was just recently that I read someone attaching some 4.x BTC fee by accident.
I thought about trying to write a piece of code which automates the process for me. I'll use a more or less empty wallet, with only very small amounts, just to make sure. But thanks for the disclaimer - can't be stressed enough, also for anyone else reading this.

Tx sent: https://blockchain.info/tx/baee75e61bb4e261730c2938ac489ae8ce11042a5b1d979b25be05c2a576567c
staff
Activity: 3458
Merit: 6793
Just writing some code
Also, you should NEVER post your private keys here.
No worries - did you try to "read" the key? Wink
Yeah, I just realized that.

Here is my address 16mT7jrpkjnJBD7a3TM2awyxHub58H6r6Z

Also, when you want to spend the Bitcoin from your p2sh address, you will need to use the createrawtransaction, signrawtransaction, and sendrawtransaction to create, sign, and broadcast it. When using createrawtransaction, be careful because you can end up not sending the change to a change address and accidentally making that become part of the fee.
legendary
Activity: 2320
Merit: 1292
Encrypted Money, Baby!
Also, you should NEVER post your private keys here.
No worries - did you try to "read" the key? Wink
Code:
5Th15I5n0tMyPr1v47eK3yS0noN3edT0TrY1fItW0rKstH4nKy4

The first digit is a version number that tells wallets that are sending bitcoins to you what sort of script to build in the transaction output.

Therefore, the answer to your question:
"Are both addresses connected in some way?"

is Yes.

They both share the same private key.


The version 1 address tells any wallet that is sending bitcoins to you to create an output with the following P2PKH script:
OP_DUP OP_HASH160 hash_of_your_public_key OP_EQUALVERIFY OP_CHECKSIG

Where the wallet that is sending to you extracts the hash_of_your_public_key from your version 1 address by converting from base58 back to binary and striping off the version number and the checksum.

Your wallet then recognizes any version 1 scripts that include hash_of_your_public_key, and can provide the signature necessary to spend the outputs that are encumbered with that script.


The version 3 address tells any wallet that is sending bitcoins to you to create an output with the following P2SH script:
OP_HASH160 hash_of_the_P2PKH_you_see_above OP_EQUAL

Where the wallet that is sending to you extracts the hash_of_the_P2PKH_you_see_above from your version 3 address by converting from base58 back to binary and striping off the version number and the checksum.

Your wallet then recognizes any version 3 scripts that include hash_of_the_P2PKH_you_see_above, and can provide BOTH the P2PKH script and the signature necessary to spend the outputs that are encumbered with that script.


This pretty much tells me what I wanted to know.

As both of you helped me a lot to understand what I can / can't do, and why this is the case, I'm asking both of you to leave me your BTC address here, so I can send the promised .01 - it's not much, but consider it a thank you for your efforts. Smiley


.edit: Dr. Who is just great. Awaiting the next season!
legendary
Activity: 3472
Merit: 4801
The first digit is a version number that tells wallets that are sending bitcoins to you what sort of script to build in the transaction output.

Therefore, the answer to your question:
"Are both addresses connected in some way?"

is Yes.

They both share the same private key.


The version 1 address tells any wallet that is sending bitcoins to you to create an output with the following P2PKH script:
OP_DUP OP_HASH160 hash_of_your_public_key OP_EQUALVERIFY OP_CHECKSIG

Where the wallet that is sending to you extracts the hash_of_your_public_key from your version 1 address by converting from base58 back to binary and striping off the version number and the checksum.

Your wallet then recognizes any version 1 scripts that include hash_of_your_public_key, and can provide the signature necessary to spend the outputs that are encumbered with that script.


The version 3 address tells any wallet that is sending bitcoins to you to create an output with the following P2SH script:
OP_HASH160 hash_of_the_P2PKH_you_see_above OP_EQUAL

Where the wallet that is sending to you extracts the hash_of_the_P2PKH_you_see_above from your version 3 address by converting from base58 back to binary and striping off the version number and the checksum.

Your wallet then recognizes any version 3 scripts that include hash_of_the_P2PKH_you_see_above, and can provide BOTH the P2PKH script and the signature necessary to spend the outputs that are encumbered with that script.

staff
Activity: 3458
Merit: 6793
Just writing some code
nvm, I missed a part of your OP.

You did mostly everything correctly. Bitcoin Core doesn't have a GUI for p2sh transactions, so you will need to create the transaction and sign it through the console.

You can also get another client that allows p2sh stuff (also called multisig)

I don't think that mycelium allows you to use p2sh addresses.

Also, you should NEVER post your private keys here.
legendary
Activity: 2320
Merit: 1292
Encrypted Money, Baby!
The 3 addresses are p2sh which are not created the way you did it. In fact, I don't know if there is a way to create vanity p2sh addresses.
Hm, maybe I confused things. I should have inserted the command I used to create them.
Quote
allyourbase@shitbook ~/Source/bitcoin-related/vanitygen $ ./vanitygen -i -F script
3FuckUp
Difficulty: 478688906
Pattern: 3FuckUp                                                               s
P2SHAddress: 3FuckUpFfo28hxXb89C19Az2kfGh7JhGY4
Address: 19JFoRyGrUVN18qGhBSwvj6Cpt8pzTpUCn
Privkey: 5Th15I5n0tMyPr1v47eK3yS0noN3edT0TrY1fItW0rKstH4nKy4
There are only two addresses being involved in the creation process (both in bold print). Creating addresses starting with "3" is accomplished using "-F script" parameter.
staff
Activity: 3458
Merit: 6793
Just writing some code
The 3 addresses are p2sh which are not created the way you did it. In fact, I don't know if there is a way to create vanity p2sh addresses.
legendary
Activity: 2320
Merit: 1292
Encrypted Money, Baby!
Hey guys,

it was just today that I recalled that there is something like "Bitcoin addresses starting with a 3". And as I like 3 more than 1, I thought it would be "cool" to have a similar address, created by vanitygen, as I already own, but starting with a 3.

I already own one with the pattern "FuckUp…", and so I created one with "3FuckUp…".

After successful creation, I got this output:
Code:
3FuckUp
Difficulty: 478688906
Pattern: 3FuckUp                                                               s
P2SHAddress: 3FuckUpFfo28hxXb89C19Az2kfGh7JhGY4
Address: 19JFoRyGrUVN18qGhBSwvj6Cpt8pzTpUCn
Privkey: 5Th15I5n0tMyPr1v47eK3yS0noN3edT0TrY1fItW0rKstH4nKy4
Then, I imported the key using importprivkey, which showed me the address "19JFoRyGrUVN18qGhBSwvj6Cpt8pzTpUCn" in the wallet:
Code:
importprivkey 5Th15I5n0tMyPr1v47eK3yS0noN3edT0TrY1fItW0rKstH4nKy4
Now, I read that, to be able to use the "cool" 3FuckUp address, I have to:
Code:
addmultisigaddress 1 [\"19JFoRyGrUVN18qGhBSwvj6Cpt8pzTpUCn\"]
Et voilà, the wallet (Bitcoin-qt) showed me "3FuckUpFfo28hxXb89C19Az2kfGh7JhGY4" in the list of my addresses I own. I sent a small amount its way, and it shows as received (see 3FuckUp link above).

Now, as the blockchain on my computer is still more than one year behind, I don't want to wait seven weeks to find out myself when the blockchain has completely downloaded, eventualls, I have some questions:
  • When I'm completely synced, will I be able to spend from the 3FuckUp address just like from any other (starting with 1) address?
  • What's the purpose of the 19JFoRyGrUVN18qGhBSwvj6Cpt8pzTpUCn address which was generated while creating the 3FuckUp one? Are both addresses connected in some way?
  • I imported the private key into my mobile Mycelium wallet. And, more or less expectedly, it shows me the 19JFoRyGrUVN18qGhBSwvj6Cpt8pzTpUCn address. Can I get my Mycelium wallet to also show the 3FuckUp one?
I read quite some literature about the P2SH addresses, which led me from contracts to MultiSig and other things on the Bitcoin wiki. To be honest, I did not understand much - there are some explanations and images of Bob and Alice trying to explain things, but I am yet lacking some "real life user experience" material. E.g. "I created P2SH address "a" for purpose "b", got standard BTC address "c" and used all those things in use case "d" which looked like "e".

Can anyone help?
As a thank you, I'm offering 0.01 BTC for the first one who can answer me this in a way I can understand it. It's not much, but people do things here for way less. Smiley
Jump to: