1

Parsing an input script of a transaction, I’ve come across two public keys in the script. Either public key is 33 byte long.

I know how to transform a single 33 byte long public into an address.

What is the mechanism of obtaining an address from two or more public keys?

Note I’m not interested in the bitcoind technique via the createmultisig command.

1
  • 1
    See this answer which describes how to create a multisig script with multiple addresses and then turn that script into a redeem script hash, which is further converted into a P2SH address: bitcoin.stackexchange.com/a/26878/21052 Nov 16, 2014 at 12:47

1 Answer 1

2

I answer my question for the benefit of future generations of readers.

If you have only one 33-byte-long public key, you obtain an address by applying a standard technique that consists of 5-7 steps, depending on how you view the technique.

If you have more than one 33-byte-long public keys, you have to construct a so-called redemption script or, in bitcoin parlance, redeemscript. After you’ve constructed the redemption script, you apply the standard technique to the entire redemption script.

Technically, a redemption script is a byte array. Suppose you have two public keys. Conceptually, your byte array should look like this:

[OP_1][length of public key 1][public key 1][length of public key 2][public key 2][OP_2][OP_CHECKMULTISIG]

In my question, I said that I had parsed the input script of a transaction. Therefore, I didn’t have to construct the array. The redemption-script array was already in the input script. I made a “mistake” of extracting the public keys from the redemption script, believing I should massage only the public keys. I should have taken all the bytes of the redemption-script array.

Your Answer

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

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