Add Miden Standards builder docs#298
Conversation
PhilippGackstatter
left a comment
There was a problem hiding this comment.
Looked at the first two files and left some comments.
| |-----------|------------|-------------| | ||
| | `BasicWallet` | Holding assets, receiving assets from standard notes, and moving assets into output notes. | `miden_standards::account::wallets` | | ||
| | `FungibleFaucet` | Minting, sending, receiving, and burning fungible assets from faucet accounts. | `miden_standards::account::faucets` | | ||
| | `AuthSingleSig` | Authenticating transactions with one supported signature scheme. | `miden_standards::account::auth` | |
There was a problem hiding this comment.
| | `AuthSingleSig` | Authenticating transactions with one supported signature scheme. | `miden_standards::account::auth` | | |
| | `AuthSingleSig` | Single-signature authentication of transactions. | `miden_standards::account::auth` | |
This component supports various signature schemes.
| | `AuthSingleSigAcl` | Single-signature authentication with an access-control list. | `miden_standards::account::auth` | | ||
| | `AuthMultisig` / `AuthMultisigSmart` | Threshold or policy-aware multisig authentication. | `miden_standards::account::auth` | | ||
| | `AuthGuardedMultisig` | Multisig guarded by a guardian configuration. | `miden_standards::account::auth` | | ||
| | `AuthNetworkAccount` | Authentication for network-account flows. | `miden_standards::account::auth` | |
There was a problem hiding this comment.
| | `AuthNetworkAccount` | Authentication for network-account flows. | `miden_standards::account::auth` | | |
| | `AuthNetworkAccount` | Authentication through note allowlists for network accounts. | `miden_standards::account::auth` | |
| | `AuthMultisig` / `AuthMultisigSmart` | Threshold or policy-aware multisig authentication. | `miden_standards::account::auth` | | ||
| | `AuthGuardedMultisig` | Multisig guarded by a guardian configuration. | `miden_standards::account::auth` | | ||
| | `AuthNetworkAccount` | Authentication for network-account flows. | `miden_standards::account::auth` | | ||
| | `Ownable2Step` | Ownership transfer with an explicit accept step. | `miden_standards::account::access` | |
There was a problem hiding this comment.
| | `Ownable2Step` | Ownership transfer with an explicit accept step. | `miden_standards::account::access` | | |
| | `Ownable2Step` | Access control for account owners. | `miden_standards::account::access` | |
Not sure what framing is best, but I think the primary purpose of the component is more about defining what account owner means, and the transfer of ownership is secondary.
| | `AuthGuardedMultisig` | Multisig guarded by a guardian configuration. | `miden_standards::account::auth` | | ||
| | `AuthNetworkAccount` | Authentication for network-account flows. | `miden_standards::account::auth` | | ||
| | `Ownable2Step` | Ownership transfer with an explicit accept step. | `miden_standards::account::access` | | ||
| | `RoleBasedAccessControl` | Role-based authorization for standard policy management. | `miden_standards::account::access` | |
There was a problem hiding this comment.
| | `RoleBasedAccessControl` | Role-based authorization for standard policy management. | `miden_standards::account::access` | | |
| | `RoleBasedAccessControl` | Role-based authorization for token policy management. | `miden_standards::account::access` | |
Fits better with TokenPolicyManager.
|
|
||
| Use these components from Rust when you build accounts with the SDK, or import the underlying MASM modules when you are writing lower-level account code. The same standards surface is what note scripts and transaction scripts rely on when they call account procedures. | ||
|
|
||
| ## Common components |
There was a problem hiding this comment.
Do we want to list everything here or just "common" ones?
In any case, TokenPolicyManager would also be useful to mention, and probably the BasicBlocklist and BasicAllowlist. These are not in 0.14.x (as the PR description suggests), iirc, but neither is Authority which is already listed.
|
|
||
| - [Standard notes](./standard-notes) - which account interfaces each standard note expects | ||
| - [Faucets and policies](./faucets-and-policies) - using faucet and mint policy components | ||
| - [`miden-standards` account source](https://github.com/0xMiden/protocol/tree/next/crates/miden-standards/src/account) - current implementation |
There was a problem hiding this comment.
Should this link to the corresponding release, for which these docs are built? This would at least prevent confusion, and in the worst case prevent looking at the wrong source and building something that's broken because of it.
I think this might be a more general doc problem, namely that we're linking to next in many cases, but as mentioned above, this seems very problematic. Would be useful to somehow inject the $CURRENT_VERSION of the docs into such links or otherwise check in CI that github.com links point to $CURRENT_VERSION.
|
|
||
| # Faucets and Policies | ||
|
|
||
| In Miden, a token issuer is an account. A fungible faucet account can mint and burn the fungible asset identified by that faucet's account ID. The standard faucet components give builders a reusable way to create token issuers without hand-writing the entire faucet interface. |
There was a problem hiding this comment.
Heads-up: This is going to be outdated in 0.15 (see also 0xMiden/protocol#2956). The account type no longer decides what type of asset can be issued, instead this is decided at the asset level (AssetComposition).
| | MASM component | `miden::standards::faucets::fungible` | | ||
| | Account type | `FungibleFaucet` account | | ||
|
|
||
| Public storage is typical for shared token faucets because clients can discover faucet state and metadata. Private storage is possible, but it changes who can observe the faucet's state. |
There was a problem hiding this comment.
Nit: Replace "storage" with "state", since for a public account, everything is public, not just storage (in particular also the account's asset vault and code).
| | Symbol | Short token symbol. | | ||
| | Decimals | Display precision for client UX. | | ||
| | Max supply | Upper bound enforced by the faucet component. | | ||
| | Metadata | Optional display fields such as token name, description, logo URI, and external link. | |
There was a problem hiding this comment.
Nit: TokenName is mandatory.
| Write a custom faucet component when: | ||
|
|
||
| - Minting depends on application state, proofs, allowlists, or rate limits. | ||
| - Supply policy is more complex than a fixed max supply and a standard authority check. | ||
| - You need custom public methods beyond the standard faucet interface. | ||
|
|
There was a problem hiding this comment.
- The
TokenPolicyManagerallows for custom policies to check minting, burning and transfers. Users should be nudged to first check if implementing such a custom policy satisfies their use case. Only if that's not the case, should they resort to writing their own faucet. - Somewhat agree with the 2nd point, though a complex supply policy could also be handled in a
CUSTOM_MINTnote that is the only note allowed by the faucet to mint assets. This would move the logic outside the faucet and wouldn't require a custom faucet. - 3rd point reads a bit ambiguous: If users only need additional public methods, extending the faucet account with additional procedures may be a fine solution and wouldn't require a custom faucet per se. But if they need customized versions of the faucets' procedures, then, yes, they would have to write it themselves.
Summary
Closes #287.
Validation
git diff --checkcurlprotocolorigin/next(01077765)protocol@nextclone:cargo test -p miden-standards --test docs_examplesprotocol@v0.14.6clone:cargo test -p miden-standards --test docs_examplesnpm run buildin a fresh Docker copy after reproducing the deploy-docs vendor aggregation stepmiden/docsathttps://homelab.tail477b3c.ts.net:9000/Notes: the production-shaped build succeeds, but Docusaurus still reports pre-existing broken links/anchors from ingested/versioned docs unrelated to these Standards pages.