Skip to content

Commit

Permalink
a more involved ScriptInterpreter example
Browse files Browse the repository at this point in the history
  • Loading branch information
ethers committed Jul 15, 2014
1 parent 37d73fd commit 1a6ea46
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion examples/ScriptInterpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var run = function() {
var network = bitcore.networks.testnet;


// using "static" method
var scriptPubKeyHR = '0x14 0x3744841e13b90b4aca16fe793a7f88da3a23cc71 EQUAL';
var scriptPubKey = Script.fromHumanReadable(scriptPubKeyHR);

Expand All @@ -19,7 +20,20 @@ var run = function() {
ScriptInterpreter.verifyFull(scriptSig, scriptPubKey, undefined, undefined,
undefined, undefined, function(err, result) {
console.log('script verified successfully? ', result)
})
});

// using an instance
scriptPubKeyHR = '0x26 0x554e5a49500370e53982a1d5201829562c5d9eebf256eb755b92c9b1449afd99f9f8c3265631 DROP HASH256 0x20 0x34b4f6042e1bcfc6182ee2727a3d0069a9071385bc07b318f57e77a28ffa13ac EQUAL';
scriptPubKey = Script.fromHumanReadable(scriptPubKeyHR);

scriptSigHR = '0x41 0x0470e53982a1d5201829562c5d9eebf256eb755b92c9b1449afd99f9f8c3265631142f3bf6954e3bec4bdad1a1a197bf90904a1e6f06c209eb477e2fde00d26691';
scriptSig = Script.fromHumanReadable(scriptSigHR);

var si = new ScriptInterpreter();
si.verifyFull(scriptSig, scriptPubKey, undefined, undefined,
undefined, function(err, result) {
console.log('script verified successfully? ', result)
});
};

module.exports.run = run;
Expand Down

0 comments on commit 1a6ea46

Please sign in to comment.