Bitcoin Forum
May 23, 2019, 08:15:04 AM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to get hands-on with bitcoin script development  (Read 773 times)
ggbtctalk000
Full Member
***
Offline Offline

Activity: 317
Merit: 100


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!
1558599304
Hero Member
*
Offline Offline

Posts: 1558599304

View Profile Personal Message (Offline)

Ignore
1558599304
Reply with quote  #2

1558599304
Report to moderator
If you see garbage posts (off-topic, trolling, spam, no point, etc.), use the "report to moderator" links. All reports are investigated, though you will rarely be contacted about your reports.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1558599304
Hero Member
*
Offline Offline

Posts: 1558599304

View Profile Personal Message (Offline)

Ignore
1558599304
Reply with quote  #2

1558599304
Report to moderator
BitcoinsGreat
Sr. Member
****
Offline Offline

Activity: 388
Merit: 250



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.

                                           ▄▄███████▄▄
      ▄▄███████▄▄                       ▄███████████████▄      ▄▄███████▄▄
   ▄███████████████▄    ▄▄███████▄▄    ███████████████████  ▄███████████████▄      ▄▄███████▄▄
  ██████▀▀▀▀▀▀▀▀█████▄███████████████▄██████▌  ▐███▀▀▀████████████▀▀▀▀▀███████  ▄███████████████▄
 ███████   ▄▄▄▄▄████
█████████▀▀▀▀▀██████████   ███▌  ▐█████████     ▄▄▄███████████████████████████
████████   ▀▀▀▀██████████      ▄▄▄█████████▌   ▀▀▀   ██████████   ▀▀▀▀██████████████   ███   ██████
████████   ▄▄▄▄█████████████▌  ▐███████████   ▄▄▄▄   ██████████▌   ▄▄▄███████████████   ▀   ████████
████████   ▀▀▀▀▀████████████▌  ▐██████████▌  ▐███▌  ▐██████████▌   ▀▀   ██████████████▌   ▐█████████
 ███████▄▄▄▄▄▄▄▄██
███████████   █████████████████▄▄▄████████████   ▄▄▄███████████████   ▄   ████████
  ███████████████████████████   ████████▀███████████████▀  █████████████████████████   ███   ██████
   ▀███████████████▀███████████████████    ▀▀███████▀▀      ▀███████████████▀  ███████████████████
      ▀▀███████▀▀    ▀███████████████▀                         ▀▀███████▀▀      ▀███████████████▀
                        ▀▀███████▀▀                                                ▀▀███████▀▀
.BET█▀▀▀▀▀▀▀▀











█▄▄▄▄▄▄▄


██▄▄        ▄▄██
████
██████████████
███████
███████████
 █████
███████████
 ▄██████████████▄
▄████████████████▄
██████████████████
▐██████████████▌
 ▀▀    ▀▀▀▀    ▀▀
.
PLAY NOW
▀▀▀▀▀▀▀▀█











▄▄▄▄▄▄▄█
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.

    ▄█▄
   ██▀  ▄█▄
  ██▀  ▄█▀  ▄▀
 ██▀  ▄█▀  ▄▀
▐█▌  ▄█▀  ▄▀
██   ██   
██   ██   
██   ██   
▐█▌  ▀█▄  ▀▄
 ██▄  ▀█▄  ▀▄
  ██▄  ▀█▄  ▀▄
   ██▄  ▀█▀
    ▀█▀
████
▀▀▀▀
▄▀▀▄▄▄▄▄▄▄▄█████████████▐████
▀▀     ▄▄▄▄▄▀██████████▐████
▄▀▀▄▄▄▄▄█████▀ ▀▄▄▄     ▐████
▀▀     ▄▀███▄▄▄▄       ▐████
▄▄   ▀█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▐████
▀▄▄▀▀▀▀▀██████████████▐████
▄▄   ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▐████

▀▄▄▀▀▀  ██████           ▐████
██████▄▀▀▀▀▀▀▀▀▀ ▐████

▄▄  ████▀▄██████████▐████
▀▄▄▀▀▀▀ ▄████████████▐████
BIDIUM       ▄█▄
   ▄█▄
  ▀██

▀▄  ▀█▄  ▀██
 ▀▄  ▀█▄  ▀██
  ▀▄  ▀█▄  ▐█▌
   █   ██   ██
   █   ██   ██
   █   ██   ██
  ▄▀  ▄█▀  ▐█▌
 ▄▀  ▄█▀  ▄██
▄▀
  ▄█▀  ▄██
   ▀█▀
  ▄██
       ▀█▀






























pebwindkraft
Sr. Member
****
Offline Offline

Activity: 259
Merit: 251


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


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
Full Member
***
Offline Offline

Activity: 317
Merit: 100


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 ETFbitcoin (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
Full Member
***
Offline Offline

Activity: 170
Merit: 177



View Profile WWW
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 .

Github profile ~ Crypto Lyon (french community)  ~ GPG key fingerprint : E13F C145 CD3F 430 ~ LN public key : 03678b4f041fbfbeebcafc076469df75decf81da20a53bd490172e83ce532df1fa
Tutorials/posts : Address from private keyBitcoin smart contracts ~ Setup a Bitcoin node ~ Raw P2PKH transaction in Python ~ P2SH ~ 51% attack
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!