Author

Topic: How to get hands-on with bitcoin script development (Read 930 times)

sr. member
Activity: 279
Merit: 435
I covered and had basic fundamental understanding of how the scripting (lock or formerly ScriptPubKey and unlock or formerl ScriptSig). The "mastering bitcoin" had fairly good coverage on how scripting works and what purpose it does. However there are faily large number of script op codes available in the appendix, so I am wondering what are good way to get hands-on and write a script and deploy it on live platform?
My wild guess, is most bitcoin wallets will only work with a Pay-to-public-key hash, i imagine one has to develop the proprietary wallet that can send and received bitcoin based on signing of custom scripts. I am going to take another shot at it by saying existing wallets that can send/receive bitcoin using P2SH (pay-to-script-hash) will work. But I believe one still has to write the script and some integrate with the wallet.  
Thanks!
Hi,

I made this in Python to experiment (basic, but still powerful) raw Bitcoin transactions and scripting : https://github.com/darosior/raw-transactions . Modify `gen_rawtx.py` with your script. Since there is no README, feel free to ask me questions.
EDIT : Here is a blog post related to the code, it might help you getting around it : https://medium.com/@darosior/bitcoin-raw-transactions-the-hard-way-f139615f195b .
jr. member
Activity: 42
Merit: 7
I've been looking for a tool to experiment with bitcoin script for a while now, and I finally finished developing one myself: https://bitauth.com/ide/

BitAuth IDE is an open source project for designing advanced scripts for bitcoin and bitcoin-like cryptocurrencies. It’s both a learning sandbox and a tool for designing new kinds of wallets.

It includes a live-updating, interactive, line-by-line debugger, which visualizes that state of the stack over the entire execution of the program. There's also an entity and variable system for automatically generating private keys, public keys, and correct signatures across locking and unlocking scripts.

See here for a more detailed tour and a video walkthrough:
https://blog.bitjson.com/bitauth-ide-write-and-debug-custom-bitcoin-scripts-aad51f6e3f44

And the source is on GitHub: https://github.com/bitauth/bitauth-ide
full member
Activity: 394
Merit: 101
ok, it is purely for edu purposes to get hands-on with scripts and op-codes. I may spend few satoshis but not planning to do any trading or gain here.
member
Activity: 86
Merit: 26
Somewhere I heard that at the moment some nodes only allow some predefined scripts.
But I don't know if this is true or not.

The idea behind this was, that you don't burn your coins with some "experimental" scripts where you are not able to spend them anymore.

There are several problems with homemade scripts
  • Possibility, that the coins will get burned if script has an error
  • Possiblility of unintended behaviour. The script could do what you expect, but it could possible also do something you did not expect when it is used with a different set of parameters for example. Maybe someone who use the script differently could steal coins from this script if you don't think of all possiblities (As happend with the Ethereum DAO hack).

To minimize the risk of having such troubles, you should test your scripts always in testnet and also show the script to some experienced people who may find some vulnerabilities before releasing it to the main net.
sr. member
Activity: 257
Merit: 343
yup, and Andreas' book is great!
There are lots of OpCodes not used, or their combinations creates transactions, which are not forwarded.
I think this is a protection of the network, to avoid loops in scripts and similiar. But the experts need to confirm.
When trying to play with scripts, there is lot of history here, maybe a bit longer ago, but search the forum (maybe the keywords like "OpCode" and "bitcoin contracts").
And when you have an idea, try it on testnet first, then go to live net. I had a lot of help here: http://bitcoin-script-debugger.visvirial.com/

p.s.:
found the reference here in the forum: https://bitcointalksearch.org/topic/is-there-a-newbie-friendly-source-for-learning-bitcoin-scripting-1840303
hero member
Activity: 560
Merit: 500
Not many people have touched what you are talking about because there is really no market for it right now, but you can play away. I would say to grab a copy of core and use the testnet and a small private network and see what you can do that will get the public interest and show them the possibilities and that might make more action in the coding world, you never know.
sr. member
Activity: 1022
Merit: 280
I covered and had basic fundamental understanding of how the scripting (lock or formerly ScriptPubKey and unlock or formerl ScriptSig). The "mastering bitcoin" had fairly good coverage on how scripting works and what purpose it does. However there are faily large number of script op codes available in the appendix, so I am wondering what are good way to get hands-on and write a script and deploy it on live platform?
My wild guess, is most bitcoin wallets will only work with a Pay-to-public-key hash, i imagine one has to develop the proprietary wallet that can send and received bitcoin based on signing of custom scripts. I am going to take another shot at it by saying existing wallets that can send/receive bitcoin using P2SH (pay-to-script-hash) will work. But I believe one still has to write the script and some integrate with the wallet. 
Thanks!

Are you trying to get info on writing these in yourself or looking for pre-existing examples? You can try looking at what is happening in the background of something like NXT or ETH.
full member
Activity: 394
Merit: 101
I covered and had basic fundamental understanding of how the scripting (lock or formerly ScriptPubKey and unlock or formerl ScriptSig). The "mastering bitcoin" had fairly good coverage on how scripting works and what purpose it does. However there are faily large number of script op codes available in the appendix, so I am wondering what are good way to get hands-on and write a script and deploy it on live platform?
My wild guess, is most bitcoin wallets will only work with a Pay-to-public-key hash, i imagine one has to develop the proprietary wallet that can send and received bitcoin based on signing of custom scripts. I am going to take another shot at it by saying existing wallets that can send/receive bitcoin using P2SH (pay-to-script-hash) will work. But I believe one still has to write the script and some integrate with the wallet. 
Thanks!
Jump to: