I’m referring to this page https://nemtech.github.io/guides/transaction.html#guide-using-secret-lock-for-atomic-cross-chain-swap
Apart form the really bad grammar and some smaller mistakes, the whole thing is also unclear to me from a technical pov and I’m hoping someone can shed some light on this.
So Alice broadcasts TX1. After that the documentation states that Alice now tells Bob the secret, or he can get it from the broadcasted tx directly.
If Bob then already has the secret to unlock the funds, why does he even need to broadcast he TX2 ?
I’m guessing this is written in a confusing way and the actual secret needed to unlock the funds (I’m guessing this is what’s called the proof) is only revealed later, when Bob broadcasts TX2. It is however not at all explained how that happens. How does Alice get knowdlege of Bob’s proof and vice versa ?
From the rest of the documentation I was able to gather that the secret in the lock tx is actually the hashed proof i.e. the secret necessary to unlock the funds hashed. Unfortunately that doesn’t really help answering my question.
I also saw that when
Can someone clear this up ?
/edit:
Okay, I think I got it. It’s the same secret/proof for both Alice and Bob isn’t it ?
The process would then for example be:
Let’s say Alice chooses abc as “proof” and let’s also assume the hash of abc is bcd
Alice broadcasts the tx with the secret she chose
TX1:
secret=bcd
Bob brodcasts his tx with that same secret
TX2:
secret=bcd
Now, if Alice wants to redeem her funds she’s gonna need to reveal the original proof i.e. the secret before it’s hashed.
So she does:
TX3:
secret=bcd
proof=abc
Now Bob knows the value he needs to unlock his funds too and so he does:
TX4:
secret=bcd
proof=abc
If this explanation is correct, the usage of the words proof and secret are imho very misleading, because the secret isn’t actually secret, it’s the hash of the actual secret which is called proof.