Skip to content

(code-body-of? principal) to fetch the code body of a specific contract #6320

@wileyj

Description

@wileyj

duplicated from clarity-lang/reference#88

I suggest the introduction of a new function code-body-of? that returns the code body of the specified contract principal. The function will unlock various new use-cases and will allow other contracts to prove contracts are designed in a specific way. It would replace aspects of the clarity-stacks library.

Signature: (code-body-of? principal)
Return type: (response string-ascii uint)

Return values:

  • (ok "code body string") on success.
  • (err u0) if the principal is not a contract principal.
  • (err u1) if the specified contract does not exist.
  • (err u2) if the code body does not fit in the string-ascii.

The function would provide the minimum necessary to make it possible to prove code bodies, and can be combined with existing functions such as sha256. It would also be made more useful if Clarity 4 offers more string manipulation and conversion functions. (Suggested in different issues in this repo.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Status: 🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions