Related: Using bitcore to create a transaction with two addresses and change address
I would like to create a transaction from addresses A and B sending to address C
In the above question I get a little confused (it looks like hes doing one transaction that sends from addresses A and B to addresses C and D receiving change at address E) because it looks like he is signing it with the two receiving addresses!
Usually when I create and sign a tx with Bitcore I sign it with the sending address's private key not the receiving address (in my case the receiving address would be a user I do not personally know)
The bitcore docs say:
To send a transaction to a multisig address, the API is the same as
in the above example. To spend outputs that require multiple signatures, the process needs extra information: the public keys of the signers that can unlock that output.
var multiSigTx = new Transaction()
.from(utxo, publicKeys, threshold)
.change(address)
.sign(myKeys);
var serialized = multiSigTx.toObject();
The two parts to this that confuse me are:
- Bitcore quote - To send a transaction to a multisig address...
Is this different from a regular address? I notice that the example is lacking .to(address, amount)
- Why is Richard from the related question signing with the receiving address's private keys?
Logically shouldn't my desired action look something like this?:
var transaction=new Bitcore.Transaction()
.fee(fee)
.from([output_A,output_B])
.to(pubkey_C,satoshis-fee)
.change(address_A) //don't loose the change
.sign([privatekey_A,privatekey_B]);
output_A is from address A and output_B is from address B (both my addresses)