CRYPTO NEWS

How to properly use the rpc command `listunspent` with `bitcore-lib` to create a transaction and get the transaction hash?

I am trying to use the rpc command listunspent to get all the UTXOs relevant to an address, and then I am trying to pass it to a transaction, using bitcore-lib. Below is my code:

const Client = require('bitcoin-core'); const bitcore = require('bitcore-lib'); const client = new Client({    network: 'regtest',    username: 'bitcoinuser',    password: 'bitcoinpass',    port: 18443  });  var tx = new bitcore.Transaction();  var sourceAddress = ["mwkT2k1o6k4dF7ZZQ2VBbw7VedBkQA2CBK"]; var minconf = 6; var maxconf = 999999; var targetAddress = "2Mw3iwZdVXjeb7BN5hWqegFs8VdfZo5Rmdo"; var privateKey = "cQqVxdtPz95monJe8QJUE4h5JVtSSAjTQ1SU6z8PL9pmFj5V7ieA";  var txns = []; client.listUnspent(minconf, maxconf, sourceAddress)     .then(function(help){     txns = help.slice();     return txns;   }).then(function(txns){     return tx.from(txns).to(targetAddress, 15000).sign(privateKey);   }).then(function(result){     console.log(result);   }); 

The result is similar to the transaction object.

What I want is to receive the transaction hash, which I can then broadcast.

Note: I am trying to run my core in regtest mode, I do not want to use livenet or testnet. I have also disclosed the public and private keys, as they do not hold any real value.

The first few lines of the output looks like this:

Transaction {   inputs:    [ PublicKeyInput {        witnesses: [],        output:         Output {           _satoshisBN:            BN { negative: 0, words: [ 16972032, 37 ], length: 2, red: null  },           _satoshis: 2500000000,           _scriptBuffer:            <Buffer 21 02 0b 0f c0 79 9d 39 8d 83 be 39 08 2c 72 49 0a 57 00 0e c2 f5 e0 01 ab a1 ee 9b 07 19 cc bd fb e3 ac>,           _script:            Script {              chunks:               [ { buf:                    <Buffer 02 0b 0f c0 79 9d 39 8d 83 be 39 08 2c 72 49 0a 57 00 0e c2 f5 e0 01 ab a1 ee 9b 07 19 cc bd fb e3>,                   len: 33,                   opcodenum: 33 },                 { opcodenum: 172 } ],              _isOutput: true } },        prevTxId:         <Buffer e1 45 8a fb cd df 9b 8b aa 4c a7 a0 13 b7 f6 d3 91 87 8f a3 02 94 78 92 ef 59 03 0e 40 f5 51 00>,        outputIndex: 0,        sequenceNumber: 4294967295,        _script: Script { chunks: [], _isInput: true },        _scriptBuffer: <Buffer > },      PublicKeyInput {        witnesses: [],        output:         Output {           _satoshisBN: 

Crypto Hats, Crypto Shirts, Crypto Socks, Crypto Clothing

BGW Multiplication: How does it work?

I could not understand how multiplication is carried out in the BGW protocol for 3 parties. Reference: https://crypto.stanford.edu/pbc/notes/crypto/bgw.html I’ve understood that in multiplication, we calculate r(x) = p(x)q(x) but this means that r(x) is a polynomial of degree 2t. How is this polynomial redistributed in the circuit to get an O(n^2) complexity in multiplication over::Listen

I could not understand how multiplication is carried out in the BGW protocol for 3 parties. Reference: https://crypto.stanford.edu/pbc/notes/crypto/bgw.html

I’ve understood that in multiplication, we calculate r(x) = p(x)q(x) but this means that r(x) is a polynomial of degree 2t. How is this polynomial redistributed in the circuit to get an O(n^2) complexity in multiplication over BGW protocol?

Note that p(x) and q(x) are both polynomials of degree t and as I am taking the case of semi-honest adversaries, t < n/2.

How to properly use the rpc command `listunspent` with `bitcore-lib` to create a transaction and get the transaction hash?

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