I’m trying to create a mulisig-to-multisig transaction using JS and Counterblockd JSON-RPC API.
I have 2 multisig addresses: MS1 = 3_ADDR1_ADDR2_ADDR3_3 and MS2 = 3_ADDR4_ADDR5_ADDR6_3.
Addresses ADDR1 - ADDR6 have private keys PK1 - PK6 and public keys PUB1 - PUB6 respectively.
Addresses ADDR1 - ADDR6 have private keys PK1 - PK6 and public keys PUB1 - PUB6 respectively.
I want to send 1 coin of my ASSET asset from MS1 to MS2.
First, I created an unsigned transaction using “create_send” Counterpartyd API method.
var tx = Bitcoin.Transaction.fromHex(UTXhex);
{
method: ‘create_send’,
params: {
asset: ASSET,
source: MS1,
destination: MS2,
quantity: 10000000,
allow_unconfirmed_inputs: true,
encoding: ‘multisig’,
pubkey: [ PUB1, PUB2, PUB3, PUB4, PUB5, PUB6 ]
}
}
I got a hex of unsigned transaction - UTXhex.
Then I sign this transaction using Bitcoin-JS lib and corresponding private keys.
tx.sign(0, PK1); // Sign by ADDR1 of 3_ADDR1_ADDR2_ADDR3_3 address
tx.sign(0, PK2); // Sign by ADDR2 of 3_ADDR1_ADDR2_ADDR3_3 address
tx.sign(0, PK3); // Sign by ADDR3 of 3_ADDR1_ADDR2_ADDR3_3 address
var signedTx = tx.toHex();
Now I have a signed transaction hex.
Trying to broadcast it:
{
method: ‘broadcast_tx’,
params: {
signed_tx_hex: signedTx
}
}
}
Result: 'Invalid request/response’
Looking deeper I found that Bitcoind throws an exception with code -25 and without any error message.
RPC_VERIFY_ERROR = -25, //! General error during transaction or block submission
So, I have no Idea now what am I doing wrong.
Any help is appreciated!
Thanks!