Bit-Wasp/bitcoin-lib-php

scriptPubKey ?

Closed this issue · 6 comments

can you explain this?
and how i can generate this:
'scriptPubKey' => '76a914'.'7e3f939e8ded8c0d93695310d6d481ae5da39616'.'88ac')

it's the scriptPubKey from the transaction that you are spending, use bitcoind getrawtransaction <txhash> 1 or get it from an API or blockexplorer

Is it constant or variable for each transaction?

afk11 commented

The scriptPubKey is basically setting a challenge that the recipient needs to be able to solve. PayToPubKeyHash and PayToScriptHash are types of scripts, that lock funds in a different way.

It's defined by the Txid/ its index in the vout array / the scriptPubKey / the value. The ScriptPubKey sets constraints on how anyone can redeem the value you just sent. You don't want just anyone to be able to redeem them, you want only the intended recipient to receive them.

I don't want to just give the answer, it's important to understand that if you mess up these scripts contents, you will lose your money.

If you read up on these two pages you'll find everything you need to know: https://en.bitcoin.it/wiki/Script and https://en.bitcoin.it/wiki/Transaction

I'd like if you can tell me what type of script you pasted above, and why I separated the 3 strings :)

afk11 commented

What I mean is, since it's important that you know what you're changing and why - check out those documents and try explaining to me what you think the script is/does, and why you need to change what is in the example :)

afk11 commented

@coingeek you never answered me. I think your questions show you're trying but remember you're dealing with a financial instrument ;) It's not something you can gradually pick up as you go.

So - spend time on https://en.bitcoin.it/wiki before asking questions - your altcoin is a perfect place to learn and make mistakes! Or better yet, stick to bitcoin, make a bunch of mistakes that you WILL learn from - because you'll lose real money every time you mess up..