Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createScript (address) {
address = addressToString(address)
const type = base58.decode(address).toString('hex').substring(0, 2).toUpperCase()
const pubKeyHash = addressToPubKeyHash(address)
if (type === networks.bitcoin_testnet.pubKeyHash) {
return [
'76', // OP_DUP
'a9', // OP_HASH160
'14', // data size to be pushed
pubKeyHash, //
'88', // OP_EQUALVERIFY
'ac' // OP_CHECKSIG
].join('')
} else if (type === networks.bitcoin_testnet.scriptHash) {
return [
'a9', // OP_HASH160
'14', // data size to be pushed
pubKeyHash, //
'87' // OP_EQUAL
createScript (address) {
address = addressToString(address)
const type = base58.decode(address).toString('hex').substring(0, 2).toUpperCase()
const pubKeyHash = addressToPubKeyHash(address)
if (type === this._network.pubKeyHash) {
return [
'76', // OP_DUP
'a9', // OP_HASH160
'14', // data size to be pushed
pubKeyHash, //
'88', // OP_EQUALVERIFY
'ac' // OP_CHECKSIG
].join('')
} else if (type === this._network.scriptHash) {
return [
'a9', // OP_HASH160
'14', // data size to be pushed
pubKeyHash, //
'87' // OP_EQUAL