Created
October 23, 2013 14:54
-
-
Save svasva/7120319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# util | |
script_to_pubkey: (pubkey) -> | |
b = [] | |
if pubkey[..1] == '04' | |
b.push new Buffer([0x41]) | |
else | |
b.push new Buffer([0x21]) | |
b.push util.unhexlify(pubkey) | |
b.push new Buffer([0xAC]) | |
return Buffer.concat(b) | |
# transaction | |
serialize: -> | |
b = [] | |
b.push binpack.packUInt32(@version, 'little') | |
if @pos | |
b.push binpack.packUInt32(@time, 'little') | |
b.push util.ser_vector(@vin) | |
b.push util.ser_vector(@vout) | |
b.push binpack.packUInt32(@lockTime, 'little') | |
if @pos && @algo == 'sha256' | |
b.push util.ser_string(@message) | |
return Buffer.concat(b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment