Script: add createPubKeyScriptPubKey

This commit is contained in:
Daniel Cousens 2014-05-25 10:21:04 +10:00
parent 05d0baae7c
commit 08951be66f
3 changed files with 44 additions and 6 deletions

View file

@ -268,6 +268,16 @@ Script.prototype.writeBytes = function(data) {
this.chunks.push(data)
}
// {pubKey} OP_CHECKSIG
Script.createPubKeyScriptPubKey = function(pubKey) {
var script = new Script()
script.writeBytes(pubKey.toBuffer())
script.writeOp(opcodes.OP_CHECKSIG)
return script
}
// OP_DUP OP_HASH160 {pubKeyHash} OP_EQUALVERIFY OP_CHECKSIG
Script.createPubKeyHashScriptPubKey = function(hash) {
var script = new Script()
@ -309,6 +319,13 @@ Script.createMultisigScriptPubKey = function(m, pubKeys) {
return script
}
// {signature}
Script.createPubKeyScriptSig = function(signature) {
var script = new Script()
script.writeBytes(signature)
return script
}
// {signature} {pubKey}
Script.createPubKeyHashScriptSig = function(signature, pubKey) {
var script = new Script()