CryptoFly.us | CRYPTOCURRENCY BITCOIN SHIRTS CLOTHING APPAREL HATS

CRYPTO NEWS

BTC price hovers above $61K amid fresh concerns over fate of physical Bitcoin ETF

Suspicions arise over U.S. regulators’ acceptance of physical Bitcoin ETF products later this year, amid reports than investors are voting with their feet.

How to create a Transaction with or without scriptPubKey?

I’m using the bitcore-lib-cash to attempt to create an instance of Transaction (_fromNonP2SH). Transaction.prototype._fromNonP2SH = function(utxo) { var clazz; utxo = new UnspentOutput(utxo); if (utxo.script.isPublicKeyHashOut()) { clazz = PublicKeyHashInput; } else if (utxo.script.isPublicKeyOut()) { clazz = PublicKeyInput; } else { clazz = Input; } this.addInput(new clazz({ output: new Output({ script: utxo.script, satoshis: utxo.satoshis }), prevTxId:::Listen

I’m using the bitcore-lib-cash to attempt to create an instance of Transaction (_fromNonP2SH).

Transaction.prototype._fromNonP2SH = function(utxo) {   var clazz;   utxo = new UnspentOutput(utxo);   if (utxo.script.isPublicKeyHashOut()) {     clazz = PublicKeyHashInput;   } else if (utxo.script.isPublicKeyOut()) {     clazz = PublicKeyInput;   } else {     clazz = Input;   }   this.addInput(new clazz({     output: new Output({       script: utxo.script,       satoshis: utxo.satoshis     }),     prevTxId: utxo.txId,     outputIndex: utxo.outputIndex,     script: Script.empty()   })); }; 

Currently, getting the UTXOs for given address from bch fullstack api using the following endpoint:

https://api.fullstack.cash/v5/electrumx/utxos/{addr}

which returns the following object for each utxo:

{ height: 712701 tx_hash: "76602674d6df5178858b2ed169af115a50525b0c4d56d726bfa72d775596dc56" tx_pos: 0 value: 8272 } 

However, the Transaction method calls new UnspentOutput(utxo) which then expects the above UTXOs to contain a scriptPubKey property.

$.checkArgument(!_.isUndefined(data.scriptPubKey) || !_.isUndefined(data.script),                   'Must provide the scriptPubKey for that output!'); 

I’ve noticed other libraries only require txId and vout. Is there a way to either create a Transaction without a scriptPubKey or obtain the correct scriptPubKey through alternative means?

Crypto Hats, Crypto Shirts, Crypto Socks, Crypto Clothing

BTC price hovers above $61K amid fresh concerns over fate of physical Bitcoin ETF

Shopping cart
There are no products in the cart!
Continue shopping
0