|
@ -141,34 +141,47 @@ app.get('/-/request', function(req, res, next) { |
|
|
// number of satoshis to be paid
|
|
|
// number of satoshis to be paid
|
|
|
po.set('amount', value); |
|
|
po.set('amount', value); |
|
|
// a TxOut script where the payment should be sent. similar to OP_CHECKSIG
|
|
|
// a TxOut script where the payment should be sent. similar to OP_CHECKSIG
|
|
|
po.set('script', new Buffer([ |
|
|
if (argv.pubkey || argv.address) { |
|
|
118, // OP_DUP
|
|
|
var pubKey; |
|
|
169, // OP_HASH160
|
|
|
if (argv.address) { |
|
|
76, // OP_PUSHDATA1
|
|
|
pubKey = bitcore.Base58Check.decode(new Buffer(argv.address)); |
|
|
20, // number of bytes
|
|
|
} else { |
|
|
55, |
|
|
pubKey = new Buffer(argv.pubkey, 'hex'); |
|
|
48, |
|
|
} |
|
|
254, |
|
|
var pubKeyHash = bitcore.util.sha256ripe160(pubKey); |
|
|
188, |
|
|
var address = new bitcore.Address(pubKeyHash, 'testnet'); |
|
|
186, |
|
|
var scriptPubKey = addr.getScriptPubKey(); |
|
|
4, |
|
|
po.set('script', scriptPubKey.getBuffer()); |
|
|
186, |
|
|
} else { |
|
|
208, |
|
|
po.set('script', new Buffer([ |
|
|
205, |
|
|
118, // OP_DUP
|
|
|
71, |
|
|
169, // OP_HASH160
|
|
|
108, |
|
|
76, // OP_PUSHDATA1
|
|
|
251, |
|
|
20, // number of bytes
|
|
|
130, |
|
|
55, |
|
|
15, |
|
|
48, |
|
|
156, |
|
|
254, |
|
|
55, |
|
|
188, |
|
|
215, |
|
|
186, |
|
|
70, |
|
|
4, |
|
|
111, |
|
|
186, |
|
|
217, |
|
|
208, |
|
|
136, // OP_EQUALVERIFY
|
|
|
205, |
|
|
172 // OP_CHECKSIG
|
|
|
71, |
|
|
])); |
|
|
108, |
|
|
|
|
|
251, |
|
|
|
|
|
130, |
|
|
|
|
|
15, |
|
|
|
|
|
156, |
|
|
|
|
|
55, |
|
|
|
|
|
215, |
|
|
|
|
|
70, |
|
|
|
|
|
111, |
|
|
|
|
|
217, |
|
|
|
|
|
136, // OP_EQUALVERIFY
|
|
|
|
|
|
172 // OP_CHECKSIG
|
|
|
|
|
|
])); |
|
|
|
|
|
} |
|
|
outputs.push(po.message); |
|
|
outputs.push(po.message); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|