I assume this is also the case with Boltz.exchange and probably every service like this?
0 sats \ 1 reply \ @duvel 10 Aug
I see that boltz.exchange is non-custodial, but how does that work? If users are in control of their money, how can dishonest users be prevented from scamming you?
reply
Boltz only supports trading between cryptocurrencies and networks that support a feature called atomic swaps. They are a bit difficult to wrap your head around at first when your only experience with bitcoin wallets is that they have buttons labeled Send and Receive, but in fact bitcoin can be sent "conditionally."
This means it is possible to send bitcoin to a special kind of address called a "script address" which does not "directly" belong to any wallet, but is controlled by a script, i.e. a little bit of code. And before sending money to this "script address" you can inspect it to see what it will do. For Boltz, they prepare a script address (you can examine it here on their github) where one of two things happens: 1. you, the sender, can take the money from this script address if you wait for about an hour (you cannot take the money before an hour due to something called a "timelock" which is a bit like postdating a check) or 2. your counterparty, the recipient, can take the money from this script address without waiting, but only if their transaction includes an extra piece of data -- sometimes called a "preimage" or a "secret" -- whose cryptographic hash is committed to in the script address.
The goal of this script address is to ensure that your counterparty has to disclose a secret if they want to take the money, and if they don't do it within an hour, you can take your money back. Typically you would only send money to this address if that secret is useful to you. E.g. if you are trading bitcoin for ethereum, which also supports script addresses, you could set up a similar script address where you can take the money from the ethereum address if you publish the secret, otherwise your counterparty gets his money back after a timelock.
Once you set up both contracts, your counterparty can send $100 worth of ethereum (for example) into the script address on ethereum, and then you can send $100 worth of bitcoin into the script address on bitcoin. That gives your counterparty 1 hour to take the money but only if he publishes the secret. If he does, you can use it to take the money from the ethereum address, thus completing the swap. If he does not, you get your money back on bitcoin (after an hour), and he gets his money back on ethereum (usually the second blockchain requires a slightly longer wait period, to avoid something called a "race condition"), thus canceling the swap.
That is how boltz prevents dishonest parties from cheating. If you want a visual explanation, I go into more detail in this video:
reply