Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporal safety: cancel and punish timelocks, racing and finality thresholds #99

Open
zkao opened this issue Dec 11, 2021 · 0 comments
Open

Comments

@zkao
Copy link
Member

zkao commented Dec 11, 2021

This issue opens the discussion on the temporal safety parameter. The transaction RFC presents the framework used to establish the variables:

Guesstimates for mainnet:

cancel timelock: ~ 10 + racing threshold (gives 3 hours to complete the successfull path)
punish timelock: ~ 144 (gives 24 hours to refund before punishing)

racing threshold: ~ 20 bitcoin blocks, while placing transactions at the surface of the mempool (< 0.5 MvB mempool depth. At the time of writing, the parameters above translates to ~2 USD fees on miners fees for bitcoin), and the Buy transaction has ~ 3 hours to be mined, before cancel becoming valid.

cancel timelock ~ racing threshold
cancel timelock ~ 1/fee

finality thresholds: bitcoin lock >= 2 blocks and monero lock >= 10 blocks. That takes on average > 20 min to lock bitcoin, and add to that 20 min to lock monero. So on average swaps paying high fees take 40 min for Bob to receive his monero, and 20 min for Alice to receive her bitcoin.

Note that as soon as Alice buy transaction shows up on the mempool, Bob has access to the monero secret keys he needs. So if parameters aren't chosen correctly, even if the transaction never gets mined on the bitcoin blockchain, Bob will still get the monero, and might as well get his bitcoin back, if he cancels and refunds.

Nontheless, if cancel is set too high, Alice might watch for price volatility and decided to exercise the option to buy the bitcoin (free option problem is enhanced) if cancel is too low, Bob might try to race buy with cancel, and try to get both the bitcoin and monero.

free-option magnitude ~ cancel timelock

For saving on fees, cancel time lock should be larger. That is, Alice has 10 blocks after the Lock was mined to publish her buy transaction. After 10 blocks we assume cancel might race buy. Cancel becomes valid after Lock has 10 confirmations.

Real-time fees must be compatible with such times

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant