Finding input TX for P2SH addresses

1

I am beginning to work with multi-sig transactions, I understand how they work and how to sign raw transactions but how do you go about A) listing the input transactions for this address using bitcoind and B) more importantly, how do you find the redeemScript and scriptPubKey for constructing the transaction.

user15777

Posted 2014-05-14T22:32:17.537

Reputation: 11

Answers

1

A) Not sure if there is a way to do this with the core client. You could do list all your transactions and search through them yourself (see listtransactions).

B) To get the scriptPubKey, you could make a dummy transaction to your multisig address, decode it, and the scriptPubKey will be in the resulting JSON.

To get the redeemScript, use validateaddress to get the public keys (or get them any other way). Then do:

./bitcoin-cli createmultisig 2 '["0233201f4bc6df77f61affdc0b9a8e13c286050b8203453af3788bb3db781d8003", "020c13c8562c579fa79d78fd6dde15924b615c5c5c0904241ac311eb3954377ea0"]'

This will return something like this:

{
    "address" : "3N5ntrDQAv7M4xqdjnpvzWfpogHnRvtMBm4",
    "redeemScript" : "52210233201f4bc6df77f61affdc0b9a8e13c286050b8203453af3788bb3db781d800321020c13c8562c579fa79d78fd6dde15924b615c5c5c0904241ac311eb3954377ea052ae"
}

morsecoder

Posted 2014-05-14T22:32:17.537

Reputation: 12 624