You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

17 lines
490 B

var bitcore = require('../bitcore');
var Address = bitcore.Address;
var bitcoreUtil = bitcore.util;
var Script = bitcore.Script;
var network = bitcore.networks.livenet;
var script = ''; // write down your script here
var s = Script.fromHumanReadable(script);
var hash = bitcoreUtil.sha256ripe160(s.getBuffer());
var version = network.addressScript;
var addr = new Address(version, hash);
var addrStr = addr.as('base58');
// This outputs the "address" of thescript
console.log(addrStr);