Giter Site home page Giter Site logo

scriptPubKey ? about bitcoin-lib-php HOT 6 CLOSED

coingeek avatar coingeek commented on July 18, 2024
scriptPubKey ?

from bitcoin-lib-php.

Comments (6)

rubensayshi avatar rubensayshi commented on July 18, 2024

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

from bitcoin-lib-php.

coingeek avatar coingeek commented on July 18, 2024

Is it constant or variable for each transaction?

from bitcoin-lib-php.

afk11 avatar afk11 commented on July 18, 2024

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 :)

from bitcoin-lib-php.

coingeek avatar coingeek commented on July 18, 2024

see here in line 30:
https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/examples/raw_transaction.php#L30

from bitcoin-lib-php.

afk11 avatar afk11 commented on July 18, 2024

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 :)

from bitcoin-lib-php.

afk11 avatar afk11 commented on July 18, 2024

@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..

from bitcoin-lib-php.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.