Skip to content

Conversation

obycode
Copy link
Contributor

@obycode obycode commented Aug 14, 2025

The Clarity smart contract language powers decentralized applications across a
wide range of domains. Over years of real-world use, developers have encountered
several pain points when interacting with other, sometimes untrusted, contracts.
Securely calling unknown contracts unlocks powerful use cases, but demands
careful safeguards.

This SIP addresses common feedback and requests from builders in the ecosystem.
It proposes new Clarity features to make it easier for developers to write
secure and composable smart contracts. Specifically, it proposes:

  1. A new Clarity function to fetch the hash of a contract's code body. This
    enables on-chain contract code validation, for example allowing contract A to
    validate that contract B follows a specific template and is therefore safe to
    interact with. This is especially useful for enabling bridges and
    marketplaces to safely and trustlessly support a dynamic set of assets.
  2. A new set of Clarity functions to allow a contract to set post-conditions
    to protect its assets.
    These allow a contract to safely call arbitrary
    external contracts (e.g. passed in as traits) while ensuring that if the
    executed code moves assets beyond those specified, the changes will be rolled
    back.
  3. A new Clarity function to convert simple values into string-ascii
    values.
    This function will enable developers to easily convert values like
    bools and principals into their ASCII string representations,
    facilitating the generation of string-based messages for interacting with
    cross-chain protocols.

Note

Additional feature added 👇

  1. A new Clarity keyword to get the timestamp of the current block. This
    keyword will allow developers to easily access the timestamp of the block
    currently being processed, enabling time-based logic and features in their
    smart contracts. This is especially important for DeFi applications.

Without a `with-stacking`, the body may not stack the STX of the
`asset-owner`.
Allowances are now passed in as an argument to the expression, similar
to the way `let` works.
@obycode obycode marked this pull request as ready for review August 18, 2025 15:26
Using `u0` for an error code might be confusing, so start at `u1`.
@Hero-Gamer
Copy link
Contributor

We all agreed offline that SIP would be assigned to number: SIP-033

…st SIP_TEMPLATE

We are creating a SIP_TEMPLATE.md for all SIP authors to follow so sections ordering and stylistically can be consistent.

I added Governance CAB to the Consideration to get their CAB sign off as well.
@Rapha-btc
Copy link

Thank you for adding secp256r1 support to SIP-033. This allows Stacks developers to build applications with native passkey integration, unlocking use cases like 2FA for VCs in multisig setups, embedded mints on X with Touch ID purchases, and instant wallet creation with Face ID in seconds. All secured by the user's device secure enclave without third parties.

@wileyj
Copy link
Contributor

wileyj commented Oct 8, 2025

@obycode now that sip number is assigned, can you rename the folder to sip-033 from sip-clarity4 ?

@obycode
Copy link
Contributor Author

obycode commented Oct 8, 2025

@obycode now that sip number is assigned, can you rename the folder to sip-033 from sip-clarity4 ?

Done ✅

@whoabuddy whoabuddy changed the title Clarity 4: high-demand new builtins SIP-033: Clarity 4: high-demand new builtins Oct 16, 2025
@Rapha-btc
Copy link

I'm looking for examples of contract-hash? usage to verify DEX templates before they can self-register for token transfers. This would enforce royalties when users sell tokens to DEX contracts by creating an auto-allowlist of compliant exchanges that implement a required royalty-collecting function. My first implementation is at https://github.com/Rapha-btc/pizza-square/blob/main/contracts/pizza-faktory.clar copy @obycode

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

Successfully merging this pull request may close these issues.