I'm trying to parse hex representation of scriptSig, in normal transactions there are variable int, r&s, pubkey. But some are really weird, like those ones:


I was not able to find any information on all types of transactions, their structure and how to decode them. There's always something new and non-standard still Bitcoin Core somehow decodes it.

Unfortunately I barely can read C++ code and sources of Bitcoin Core, but maybe there are any ruby\python\php code which I can use or at least understand how to decode each and every script on the blockchain? Or any documentation which describes all various valid scripts?

  • I know this isn't what you're looking for, but personal experience has taught me that the best reference for anything script-related is usually the Bitcoin Core code, itself. That's why it's called the "reference client". If you want to get into the low-level parts of the Bitcoin protocol, it's probably worth becoming more comfortable with C/C++. That said, I'm sure somebody will suggest a library that does what you want. – Jestin Jun 13 '16 at 19:23
  • python-bitcoinlib has support for parsing scripts. In the CScript module. You may be able to pretty print them using that library. – renlord Jun 14 '16 at 6:00
  • thanks guys, any documents about it except en.bitcoin.it/wiki/Script ? – nateless Jun 15 '16 at 0:18
  • I don't use it but bitcoin-ruby seems to have implemented Script as well: github.com/lian/bitcoin-ruby/blob/master/lib/bitcoin/script.rb – Andreas Blaesus Oct 12 '18 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.