Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Accardo on August 30, 2023, 09:03:06 AM



Title: Resources and Tools for debugging and simulating Bitcoin Scripts
Post by: Accardo on August 30, 2023, 09:03:06 AM
I always thought of making this thread, not sure how useful it'll be for individual readers, but the resources and tools are great. The thread contains few explanation and links to articles or docs that fully describe how the tools work; debugging, constructing wallets, verifying ECDSA signature, etc.

Below are some useful tools

Bitauth IDE (https://ide.bitauth.com/) designs advanced scripts for bitcoin or any other cryptocurrency, in it are different features for line by line debugging used to visualize the status of the program execution. Templates are used to represent projects on Bitauth, which include a variable system for generating automatically, private keys, public keys and correct signature in locking and unlocking scripts. This writeup (https://blog.bitjson.com/bitauth-ide-write-and-debug-custom-bitcoin-scripts/) explains deeply about the project, its usage and other useful terms in bitcoin scripts.

Bitcoin IDE  (https://siminchen.github.io/bitcoinIDE/build/editor.html#) Provides step by step ways or processes for learning, teaching and testing a bitcoin script. Its features include; Synthax highlighting, auto complete, translation to and from assembly, Stack visualizer and step by step debugger. The github repository for bitcoinIDE can be found here https://github.com/siminchen/bitcoinIDE

Btc Deb (https://github.com/kallewoof/btcdeb) contains different utilities or tools for debugging bitcoin scripts and building bitcoin compatible scripts. The tools can be compiled into javascript using https://emscripten.org/ every information about the BTC DEB is on the first link that begins this section you can further read here https://github.com/kallewoof/btcdeb/blob/master/doc/btcdeb.md

ECDSA Generator (https://kjur.github.io/jsrsasign/sample/sample-ecdsa.html) This tool solves for generating keys, public and private and signs them using bitcoin curve secp256k1, its friendly user interface is easy to navigate. I tried generating keys myself and it played out to be fast and responsive.

Below are some useful resources

Bitcoin Script: A reading list (https://blog.bitjson.com/bitcoin-script-a-reading-list/) written by Jason Dreyzehner the developer of the above Bitauth IDE tool, focuses primarily on bitcoin scripts, list of tools, links to different useful terms like P2SH required in building bitcoin scripts, bitcoin development language etc. It's a good read for anyone that needs supports building bitcoin scripts.

Bitcoin Contracts (https://curiosity-driven.org/bitcoin-contracts) Is an article powered by a script Bitcoin Contract Compiler (https://github.com/curiosity-driven/bitcoin-contracts-compiler) that goes in details about the technical aspect and practical sample of how bitcoin contracts works. It's mainly encouraged to be used for learning purposes.

Online Bitcoin Simulator or Debugger (https://bitcoin.stackexchange.com/questions/42576/online-bitcoin-script-simulator-or-debugger/109681#)
A stack thread where most of the tools used in debugging and simulating bitcoin scripts were shared by individual developers and users. I got most of the tools shared in this thread on the same thread, I would have simply shared the thread link instead of arranging them this way, but most of the links to tools don't work anymore, so this thread consists of the ones I found useful and still working. You are welcome to contribute.

Use Testnets to work on these tools, don't use your private keys to test on any of the tools. I feel like I've done something this morning.


Title: Re: Resources and Tools for debugging and simulating Bitcoin Scripts
Post by: BlackHatCoiner on August 30, 2023, 03:50:57 PM
Great idea to gather these tools and resources in one place.

Here's another two:
- https://bitcoin-script-debugger.visvirial.com/, for debugging Bitcoin scripts.
- https://bip32jp.github.io/english/createp2sh.html, for managing P2SH.

Bitcoin Contract Compiler (https://github.com/curiosity-driven/bitcoin-contracts-compiler)
This one is really cool. So, basically you can write a small program in JS, and it will convert it to Bitcoin script. You can check how it does it in scripts/emitter.js (https://github.com/curiosity-driven/bitcoin-contracts-compiler/blob/master/scripts/emitter.js), it was a fun read.


Title: Re: Resources and Tools for debugging and simulating Bitcoin Scripts
Post by: o_e_l_e_o on August 31, 2023, 08:05:44 AM
I'll add another one:

https://nioctib.tech

Put in the TXID of any confirmed transaction and hit the "debug" button underneath any of the inputs, and then you can click "Next" and "Prev" as it simulates the script and shows elements being moved to the stack. You can also hit the "Raw" icon to see a color annotated breakdown of the raw transaction data.


Title: Re: Resources and Tools for debugging and simulating Bitcoin Scripts
Post by: iBaba on September 10, 2023, 07:11:05 AM
Let me add another three for more options:

• bitcoin4s script debugger | https://github.com/h0ngcha0/bitcoin4s (https://github.com/h0ngcha0/bitcoin4s)
• Bitcoin Script Symbolic Tracer | https://github.com/dgpv/bsst/ (https://github.com/dgpv/bsst/)
• cmarsh script debugger.

Enjoy!  ;)


Title: Re: Resources and Tools for debugging and simulating Bitcoin Scripts
Post by: MusaMohamed on September 13, 2023, 02:07:13 AM
I am checking https://bitcoindevlist.com/ and hope that from their projects, I can find more tools to add them here.

Two websites can be helpful if they continue to list more debugging & simulating tools in future. From them, I found some tools which are already listed here.

https://cryptolinks.com/
https://github.com/igorbarinov/awesome-bitcoin


Title: Re: Resources and Tools for debugging and simulating Bitcoin Scripts
Post by: Kruw on September 13, 2023, 02:59:40 AM
https://ide.scriptwiz.app/ is another one for your list  :)