stacks-network / sbtc-developer-release

sBTC primitives, signer components, helper tools
https://sbtc.tech
MIT License
1.98k stars 23 forks source link

[sBTC DR 0.2] commit reveal #198

Open FriendsFerdinand opened 1 year ago

FriendsFerdinand commented 1 year ago

This issue is meant to track progress towards the commit-reveal implementation. This is to list some of the dependencies as well as to keep track of PRs related to this.

Dependencies for commit-reveal to be implemented in the Developer Release:

### Dependencies
- [x] ecc library on Clarity with uint256 number types
- [x] commit-reveal Clarity contract to confirm the existence of a Bitcoin commit-reveal transaction on Stacks
- [ ] adding the `commit-reveal` event in the Romeo runner meant to be triggered when a commit-reveal transaction is confirmed on Bitcoin through the Clarity smart contract
setzeus commented 1 year ago

Doing some maintenance here, double-checking @FriendsFerdinand you're working off of @MarvinJanssen generalized commit-reveal WIP / draft? Or rolling your own?

FriendsFerdinand commented 1 year ago

@setzeus I'll be using his generalized commit-reveal actually.

@AshtonStephens Also, I would like to note that the biggest obstacle here is the ecc library on Clarity. It's not a blocker, but there are just a few unknowns that keep popping up as I keep making progress.

AshtonStephens commented 1 year ago

@AshtonStephens Also, I would like to note that the biggest obstacle here is the ecc library on Clarity. It's not a blocker, but there are just a few unknowns that keep popping up as I keep making progress.

Can you elaborate? I don't understand what the obstacle is but we can probably work with the library owners to make it less of an obstacle.

FriendsFerdinand commented 1 year ago

@AshtonStephens I am writing this Clarity library that we'll have to add to use commit-reveal https://github.com/FriendsFerdinand/clarity-tapscript/blob/main/contracts/uint256-lib.clar

What I mean by obstacle is that it's the task with the most unknowns.

MarvinJanssen commented 1 year ago

@FriendsFerdinand if there are any preliminary findings for clarity-commit-reveal, please post them here: https://github.com/MarvinJanssen/clarity-commit-reveal/issues/1.

I will start adding tests soon.

I'm still wondering whether we need a full ecc library and uint256. A lot can be done by acting on byte arrays. (It is how we do things in the Ryder SE code.)

FriendsFerdinand commented 1 year ago

@MarvinJanssen I'm sure there's space for optimization using bit/byte array manipulation. I'm aiming for a PoC right now, that would be a next step and not necessarily a nice-to-have at this point. It's getting expensive.

FriendsFerdinand commented 1 year ago

Opened a PR for clarity-commit-reveal https://github.com/MarvinJanssen/clarity-commit-reveal/pull/2