Bitcoin Forum
November 12, 2024, 03:13:45 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to get hands-on with bitcoin script development  (Read 920 times)
ggbtctalk000 (OP)
Full Member
***
Offline Offline

Activity: 394
Merit: 101


View Profile
September 07, 2017, 04:33:11 PM
 #1

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!
BitcoinsGreat
Sr. Member
****
Offline Offline

Activity: 1022
Merit: 280


View Profile
September 11, 2017, 05:20:38 PM
 #2

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.
mrayazgul
Hero Member
*****
Offline Offline

Activity: 560
Merit: 500


View Profile
September 11, 2017, 05:57:32 PM
 #3

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.
pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
September 12, 2017, 05:05:56 PM
Last edit: September 13, 2017, 10:35:43 AM by pebwindkraft
 #4

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://bitcointalk.org/index.php?topic=1840303.0
Kogs
Member
**
Offline Offline

Activity: 86
Merit: 26


View Profile
September 13, 2017, 07:20:55 AM
 #5

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.
ggbtctalk000 (OP)
Full Member
***
Offline Offline

Activity: 394
Merit: 101


View Profile
September 15, 2017, 09:58:48 PM
 #6

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.
jasondrey13
Jr. Member
*
Offline Offline

Activity: 42
Merit: 7


View Profile
March 05, 2019, 03:23:21 AM
Merited by ABCbits (3), HCP (2), aliashraf (2)
 #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
darosior
Sr. Member
****
Offline Offline

Activity: 279
Merit: 435


View Profile
March 05, 2019, 09:24:44 PM
Merited by LeGaulois (1)
 #8

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 .
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!