1. scriptPubKey for both addresses contains 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 part, which is, afaik, actuall public key. First byte differs, which makes sense, since it's prefix, 00 for legacy and 05 for segwit respectively.
No, this is wrong.
First of all, 0x05 does not mean segwit, it means P2SH. Bitcoin Core by default creates addresses that are P2WPKH nested inside of a P2SH address. That is why you see
embedded in the
getaddressinfo output.
Your pool software is incorrect here, and that is the source of the problems. The scriptPubKey that you should have used is
a91409763cb05dcea0f98f53b0f08651f92c5d2d2f3887 which maps to the address
32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM. The
09763cb05dcea0f98f53b0f08651f92c5d2d2f38 part is the hash160 of the redeemScript. Since this is a P2WPKH nested in a P2SH, the redeemScript is
00142ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0. However, what your pool software did was it ignored the version byte (the 0x05) which indicates that the hash160 encoded in the address should use a P2SH scriptPubKey. Instead, it made a P2PKH scriptPubKey using the provided hash160 which is why you see that the coins were sent to
1s2iywx94HudryMHsU2g1K9x8DB1cahGc.
regarding output for 1s2iywx94HudryMHsU2g1K9x8DB1cahGc :
2. pubkey property is missing, which is weird, because usually its included for legacy addresses
It is missing because the pubkey does not exist in your wallet. What it is looking for is a pubkey that has a hash160 of
09763cb05dcea0f98f53b0f08651f92c5d2d2f38. But what you have is a redeemScript that has a hash160 of
09763cb05dcea0f98f53b0f08651f92c5d2d2f38. The pubkey that is in that redeemScript is unrelated to this address entirely.
3. isMine property equals false, wich means that wallet does not recognize this address relation to wallet PK.
The address is unrelated to the pubkey.
So, can anyone please provide some insight and tell us if (and how?) we can access those funds, or we've lost them for good? Thanks in advance.
Your coins are lost, you cannot recover them. You would need a public key which hashes to
09763cb05dcea0f98f53b0f08651f92c5d2d2f38 and its associated private key. All you have is a redeemScript that has that hash. That redeemScript is not a public key. Thus you cannot get those coins as you cannot spend them.
Which means your ScriptPubKey is if you use P2WPKH (bc1q9mn8mp.... address):
00 14 2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0
Or it is the following if you use P2WPKH nested in P2SH
a9 14 2ee67d879ccf17daec87b4ed4a6cecdd9b3f64a0 87
But what your program was doing to create your address (32Z3eXSPgxcHj2fnQy8d6dg66eVtZfxrBM) is the following:
a9 14 09763cb05dcea0f98f53b0f08651f92c5d2d2f38 87
0976... is your
ScriptHash which means it was a "redeem script" that got hashed not a public key. Possibly means more than 1 key was used but I may be mistaken about that.
No No No! You are horribly mistaken and completely wrong. That is not how P2WPKH is nested in P2SH. Doing this will cause your coins to be lost. P2WPKH nested in P2SH uses the scriptPubKey of the P2WPKH output as the redeemScript. It does not use the keyhash as the hash in the P2SH scriptPubKey. The P2SH address OP has is correct, his pool software is just broken.