The p2sh notification protocol is to pin the p2sh address to the wallets of contract participants and provide aditional informations that will help participants deduce what contract is it.
The main motivation of this protocol is to make p2sh smart contracts recoverable from the seed. Some smart contracts, like Licho Last Will or Moser-Eyal-Sirrer vault may be used for long term storage of savings. In this case it is desirable to have a way to reconstruct the contract address just from the seed.
p2sh notification message is a transaction with 1 OP_RETURN output and as many p2pkh dust outputs as the number of participants of the contract and possibly a change output.
The OP_RETURN output consists of:
0x0048533e, when pushed in little endian order, as suggested here, it is readable as '>sh\x00'.
Next part, pushed separately, is the contract address and contract version separated by space (0x20)
This part contains data necesary to reconstruct the script, like a length of timelock used by script or value of payment constrained by the covenant. Data contained here is up to each contract specification.
Exemplary Licho Last Will p2sh notification will have outputs
OP_RETURN, (4) '>sh\x00', (44) 'prvwmkrrzmjxu407w89kndgkfyx4me5qh5jtv2ez6l 1', (10) '30375 1181'
↳ 0,
qpycc7fgqvzt3wkyzpvseau9af3kc9ua2vgnfzd7lp 5,46
qzwwap47fjt9zaah65vuww94dwcg5r5f5gw3wmvujl 5,46
qr3w9wvcnnsvf82f08afa6yty78q78lf6c9getv0z6 5,46
qpc5zfjsakfk9l6uwp3k4hdnlcpv43ztfcpnpf6xp3 79,18
prvwmkrrzmjxu407w89kndgkfyx4me5qh5jtv2ez6l 100,