multisig without knowing one of the keys I want to construct a 1-of-2 multisig script and I don't know one of the keys, I only know its address. Question is, is that possible?

So I was thinking if it is possible to construct a script that would have 2 branches, first branch would be allowing the first public key which I now to spend the money. And the 2nd branch would need a spending script to provide the public key which would then be duplicated on the stack, then hashed in order to get the address from it, this address would be compared to the address I know and if that matched, it would allow spending the coins.
Indeed, if you have a public key and then the hash of another public key, you can build a script that behaves similarly than a 1-of-2 multisig. Something like this would do the trick:

OP_DUP OP_TOALTSTACK &lt;pubKey1&gt; OP_CHECKSIG
OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY 
OP_CHECKSIGVERIFY OP_ENDIF
&lt;0x01&gt;


The output script will be unlocked if either a signature validated with pubKey1 is provided or a valid signature and a public key that match pubKeyHash2 are provided.

In the first case, the user with pubKey1 spends with a valid signature:

ScriptSig: &lt;signature1&gt;

Evaluation:


&lt;signature1&gt; OP_DUP OP_TOALTSTACK &lt;pubKey1&gt; OP_CHECKSIG OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature1&gt; &lt;signature1&gt; OP_TOALTSTACK &lt;pubKey1&gt; OP_CHECKSIG OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature1&gt; &lt;pubKey1&gt; OP_CHECKSIG OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
0x01 OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;0x01&gt;


Note that since the first OP_CHECKSIG returns True, the opcodes inside the conditional are not executed, and the script terminates succesfully  (leaving 0x01 in the stack).

In the second case, the user with pubKeyHash2 spends with a valid signature and revealing the public key matching the hash:

ScriptSig: &lt;signature2&gt; &lt;pubKey2&gt;

Evaluation:


&lt;signature2&gt; &lt;pubKey2&gt; OP_DUP OP_TOALTSTACK &lt;pubKey1&gt; OP_CHECKSIG OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; &lt;pubKey2&gt; &lt;pubKey2&gt; OP_TOALTSTACK &lt;pubKey1&gt; OP_CHECKSIG OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; &lt;pubKey2&gt; &lt;pubKey1&gt; OP_CHECKSIG OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; 0x00 OP_NOTIF OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; OP_FROMALTSTACK OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; &lt;pubKey2&gt; OP_DUP OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; &lt;pubKey2&gt; &lt;pubKey2&gt; OP_HASH &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; &lt;pubKey2&gt; &lt;pubKeyHash2&gt; &lt;pubKeyHash2&gt; OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;signature2&gt; &lt;pubKey2&gt; OP_CHECKSIGVERIFY OP_ENDIF &lt;0x01&gt;
&lt;0x01&gt;


In this case, the first OP_CHECKSIG fails, so the code inside the conditional is executed. This code validates the signature and public key with pubKeyHash2, and makes the script fail if any of the validations fail. If both validations are passed, then the script pushes 0x01 to the stack, terminating successfully.

PD: Please don't use this script in the mainnet without first having checked that it works as expected ;)