Hacker News new | ask | show | jobs
by muneeb 1983 days ago
The smart contracts part comes with Clarity lang: https://clarity-lang.org/

Clarity contracts have direct visibility into Bitcoin state and can write logic against that.

1 comments

How useful is it to have a read-only glass window into Bitcoin that your smart contracts can look through?

The only practical application I can think of is atomic swaps, which can be accomplished any number of other, easier ways.

It means that Clarity smart contracts always have all the data they need to validate Bitcoin transactions. Unlike wBTC and friends, there's no need to copy header hashes from Bitcoin into the Stacks chain. By extension, this means there's no need to worry about catastrophic corner cases, such as the copied data being missing or invalid, the copied data not being mined in the canonical fork, or the copied data corresponding to a minority Bitcoin fork.
Interesting. If you don't mind, what's an example of a practical application where it would be useful to validate a bitcoin transaction without the ability for a smart contract to custody it?

Just asking because, again, the value proposition in practical terms is a little unclear to me.

Well, the intended use-case is to make it so the act of transferring BTC to a particular address will cause xBTC tokens to be minted in a Clarity contract by the principal that sent the transaction. From there, you can move the xBTC tokens around in Stacks.

This would be paired with a STX-collateralized service that would ultimately let you trade your xBTC back for BTC. The service would put STX up as collateral, which would be depleted if the service quality degrades. The Clarity contract for the collateral would track the service's xBTC to BTC transfers, and would allow the service to post the BTC transactions it sends as proof of good service quality (thereby staving off depletion).

Other ideas come to mind:

* Proof of (attempted) mining a STX block. A Blockstack app could use a Clarity contract to determine if a user was also a miner, and offer them in-app perks for helping to secure the network.

* Backwards-compatibility with BNS 1.0. Stacks 1.0 implemented a naming service (BNS) on Bitcoin, and Clarity's access to Bitcoin state can be leveraged to allow users to prove that they are OGs -- i.e. that they registered a BNS name before Stacks 2.0 went live (or did something specific with it, like updated it to have a particular owner or have a particular content hash).

* Proof of payment to a particular address. Many organizations, including open-source projects, take BTC for donations. A Clarity contract could be written to identify Stacks users who donated to a particular organization earlier.

* Proof of payment channel. You could demonstrate to a Clarity contract that you have opened a payment channel with a particular amount to a particular address, and post collateral that will be slashed if your payment channel closed before a particular Bitcoin block height.