1

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)

1 Answer 1

1

You are right in how your transaction should look like. However, you are getting confused since you are looking for the wrong concept.

You are not sending funds to a multisig address, that is an address shared by multiple users in which some of them need to sign a transaction or order to spend funds from the address. You are (if I've got it right) willing to spend funds from two different addresses (A and B) in order to send funds to a third address: C.

Therefore, what you should build is a transaction with inputs from both addresses A and B, in which each input may be sign by the corresponding address from the latter two.

1
  • In my example the .from function takes two inputs. I wrote output_A,output_B as the inputs because I was thinking of them being the outputs of the previous transaction... we are both correct; thank you! Commented Mar 25, 2017 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.