bitcoin-elixir v0.0.1 Bitcoin.Script
Bitcoin Script interpreter.
Opcodes numbers are coming from: https://github.com/bitcoin/bitcoin/blob/master/src/script/script.h
Implemented from the scratch based on the wiki (https://en.bitcoin.it/wiki/Script) and script test cases from bitcoinj/bitcore.
There is still a long road ahead to 100% of valid/invalid scripts test suite (it’s really good). List of issues to remember can be find in the source file with an upcase ‘todo’ tag.
Summary
Functions
Parse binary script into a form consumable by the interpreter (ops list). Parsed script looks like this
Parse script from the string in a format that is outputed by bitcoid
Parse script from a strig form familiar from test cases
Represent parsed script (list of :OP_CODES and binary data), in it’s original binary form
Returns string representation of the provided parsed script in the same form as bitcoind decodescript command
Functions
Parse binary script into a form consumable by the interpreter (ops list). Parsed script looks like this:
[:OP_10, :OP_10, :OP_ADD, <<20>>, :OP_EQUAL]
Parse script from the string in a format that is outputed by bitcoid.
E.g. “2 OP_IF 0 OP_ELSE 1 OP_ENDIF”
Parse script from a strig form familiar from test cases.
E.g. “128 SIZE 2 EQUAL”
Binaries appear in the 0x form or literaly in single quotes.
Represent parsed script (list of :OP_CODES and binary data), in it’s original binary form.
Returns string representation of the provided parsed script in the same form as bitcoind decodescript command