Commit Graph

40 Commits

Author SHA1 Message Date
Manuel Araoz f5b7f73d09 fixing tests for new script internals 2 2014-12-11 16:19:21 -03:00
Manuel Araoz 016bc6e3ed fixing tests for new script internals 2014-12-11 16:19:21 -03:00
Manuel Araoz c085f166b4 add sorting to Script#buildMutlisigOut() 2014-12-10 16:54:30 -03:00
Manuel Araoz ec464681fe add sorting to Script#buildMutlisigOut() 2014-12-10 16:46:20 -03:00
Manuel Araoz 63bc625c33 add Script#removeCodeSeparators tests 2014-12-10 16:09:08 -03:00
Manuel Araoz b61bd6f76a add Script#isPushOnly() 2014-12-10 12:39:09 -03:00
Manuel Araoz ec00ccba4c add script public key hash in tests 2014-12-09 16:11:57 -03:00
Manuel Araoz f231f8a054 fix a browser test 2 2014-12-04 15:40:27 -03:00
Manuel Araoz 6c5198b743 fix a browser test 2014-12-04 15:38:46 -03:00
Manuel Araoz eaaab5c7d0 implement Script.buildScriptHashOut() 2014-12-04 15:06:56 -03:00
Manuel Araoz 4bca5316ea implement Script.buildDDataOut() 2014-12-04 15:06:56 -03:00
Manuel Araoz b87e687fd9 implement Script.buildPublicKeyHashOut() 2014-12-04 15:06:56 -03:00
Manuel Araoz 4fae69807d change isOpReturn to isDataOut 2014-12-04 15:06:56 -03:00
Manuel Araoz d05aa27bed finish all tests 2014-12-04 15:06:56 -03:00
Manuel Araoz ef8f1eabd2 add script.isStandard() 2014-12-02 14:20:58 -03:00
Manuel Araoz 883a7cae54 add unkown script test 2014-12-02 14:20:58 -03:00
Manuel Araoz c4cc6ba56d fix tests with new script api 2014-12-02 14:20:58 -03:00
Manuel Araoz 87c40193b9 add pubkey in pubkey out script types 2014-12-02 14:20:58 -03:00
Manuel Araoz 901d55d129 fix classify tests 2014-12-02 14:20:58 -03:00
Manuel Araoz 7d9151abc6 fix classify tests 2014-12-02 14:20:58 -03:00
Manuel Araoz 9d6ff4dc44 add classify tests 2014-12-02 14:20:58 -03:00
Manuel Araoz 293a3299d4 add classify tests 2014-12-02 14:20:58 -03:00
Manuel Araoz 72b5dcc6af add Script.isMultisigIn 2014-12-02 14:20:58 -03:00
Manuel Araoz 96e1451d28 add script.isMultisigOut 2014-12-02 14:20:58 -03:00
Manuel Araoz 4a6755d0d1 add Script#prepend() 2014-12-02 14:20:57 -03:00
Manuel Araoz 66e96e5fa4 make tests pass with Script refactor 2014-12-02 14:20:02 -03:00
Esteban Ordano 4b201a8db1 Replace grunt with gulp 2014-11-25 21:26:52 -03:00
Braydon Fuller 85ce140aeb Keys: Renamed Privkey to PrivateKey and Pubkey to PublicKey 2014-11-25 13:21:53 -05:00
Manuel Araoz 778977449a fix tests for script 2014-11-20 18:33:26 -03:00
Ryan X. Charles b37e39abca Script().writeXX convenience methods
Script().writeOp('OP_CHECKMULTISIG'), or...
Script().writeOp(174), or...
Script().writeBuffer([push data buffer]), or...
Script().write([op string, number, or push data buffer])

These convenience methods let you easily write a script.
2014-09-23 21:28:03 -07:00
Ryan X. Charles 792e8080c8 classify pubkeyhash and scripthash scripts
...both the "in" (ScriptSig) and "out" (ScriptPubkey)
2014-09-22 16:04:06 -07:00
Ryan X. Charles 27fbdb42ad isOpReturn
standard OP_RETURN scripts contain either just an OP_RETURN or an OP_RETURN
followed by a single pushdata OP with not more than 40 bytes.
2014-09-19 21:59:19 -07:00
Ryan X. Charles e11019a083 toJSON, fromJSON
Every object should have toJSON and fromJSON methods so you can have a reliable
way to store and retrieve objects.
2014-09-18 17:52:02 -07:00
Ryan X. Charles 3b2b725070 Script().fromString(str)
...the format of fromString and toString are deliberately not compatible with
bitcoind. The format here is supposed to be both human-readable, and
byte-for-byte isomorphic to the binary representation. In the future we will
need to add support for bitcoind-like strings, both for the test data (e.g.,
script_invalid.json) or for the bitcoind console style.
2014-09-01 19:42:20 -07:00
Ryan X. Charles 6375941ef8 script.toString() 2014-09-01 18:31:02 -07:00
Ryan X. Charles e6af57f4fa script.toBuffer(); 2014-09-01 18:01:17 -07:00
Ryan X. Charles 378dc923ef preserve claimed length and op code
When parsing OP_PUSHDATAX commands, the the length of data might not require
the size integer of OP_PUSHDATAX. For instance, you might write 1 byte, and yet
use OP_PUSHDATA4. We need to record which OP_PUSHDATAX was used so that when we
write the buffer back out, we can write the same one. Also, the claimed length
may be different. For instance, we may OP_PUSHDATA of length 100 to the stack,
but there may only be 50 bytes left in the script. In that case, buf.length and
chunk.len will be different. I'm not sure if that would be considered a valid
script, but in any case, for script analysis, we need both values.
2014-09-01 17:27:39 -07:00
Ryan X. Charles e3aa93614e one more test to make sure things are working 2014-09-01 16:44:27 -07:00
Ryan X. Charles 697b3e5009 Script().fromBuffer(buf)
...code heavily inspired/copied from bitcore
2014-09-01 16:41:07 -07:00
Ryan X. Charles 8b3ad7ac85 read a buffer, like slicing while iterating pos 2014-09-01 16:40:31 -07:00