Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
DEFAULT_BRIDGE_PORTAL_REF: main
# Guardian is an external (OpenZeppelin) repo released by tag; pin to a tested
# release rather than tracking a branch. Bump on each Guardian release.
DEFAULT_GUARDIAN_REF: v0.15.0
DEFAULT_GUARDIAN_REF: v0.17.0-rc.1
steps:
- name: Checkout docs site
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion docs/builder/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ faster quote-and-solve flow for test USDC. Both integrations are testnet-only.

## What does the gas fee model of Miden look like?

Miden does not yet have a fully implemented fee model, work in progress.
Miden v0.16 includes a transaction fee mechanism in which the account's authentication procedure creates a public `TX_FEE` note on fee-charging networks.
81 changes: 29 additions & 52 deletions docs/builder/get-started/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Before diving into account creation, it's essential to understand what makes Mid

- **Smart Contract Wallets**: Every account is a programmable smart contract that can hold assets and execute custom logic
- **Modular Design**: Accounts are composed of reusable components (authentication, wallet functionality, etc.)
- **Privacy Levels**: Choose between public or private storage modes
- **Privacy Levels**: Choose whether the full account state is public or privately held

Miden accounts differ from traditional blockchain addresses in fundamental ways.

Expand All @@ -27,7 +27,7 @@ Miden accounts differ from traditional blockchain addresses in fundamental ways.
- Each account has **storage slots** for custom data
- Accounts are composed of **modular components** for different functionalities

**Storage Modes:**
**Account-state visibility:**

- **Public**: All state visible onchain (transparent operations)
- **Private**: Only commitments onchain, full state held privately
Expand Down Expand Up @@ -89,17 +89,6 @@ pub enum AccountType {

Wallet, faucet, and custom-contract roles come from the account's components and creation options, not from the account ID.

**Storage Modes:**

```rust
pub enum StorageMode {
/// State stored onchain and publicly readable.
Public,
/// Only a commitment is onchain; full state is held privately by the owner.
Private,
}
```

</details>

## Set Up Development Environment
Expand Down Expand Up @@ -134,7 +123,7 @@ If you already created `miden-app` during [installation](./setup/installation#ty
```bash title=">_ Terminal"
npm create vite@latest miden-app -- --template vanilla-ts
cd miden-app
npm install @miden-sdk/miden-sdk@^0.15.0
npm install @miden-sdk/miden-sdk@^0.16.0
```

For each code example, save the TypeScript snippet as `src/demo.ts` (overwriting the previous one as you progress):
Expand Down Expand Up @@ -173,21 +162,20 @@ use miden_client::{
component::{AuthScheme, AuthSingleSig, BasicWallet},
AccountBuilder, AccountType,
},
auth::AuthSecretKey,
auth::{Approver, AuthSecretKey},
builder::ClientBuilder,
keystore::{FilesystemKeyStore, Keystore},
rpc::{Endpoint, GrpcClient},
rpc::Endpoint,
};
use miden_client_sqlite_store::ClientBuilderSqliteExt;
use rand::RngCore;
use rand::Rng;
use std::sync::Arc;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize RPC connection
let endpoint = Endpoint::testnet();
let timeout_ms = 10_000;
let rpc_client = Arc::new(GrpcClient::new(&endpoint, timeout_ms));

// Initialize keystore
let keystore_path = std::path::PathBuf::from("./keystore");
Expand All @@ -200,10 +188,9 @@ async fn main() -> anyhow::Result<()> {
// NOTE: The client is our entry point to the Miden network.
// All interactions with the network go through the client.
let mut client = ClientBuilder::new()
.rpc(rpc_client)
.grpc_client(&endpoint, Some(timeout_ms))
.sqlite_store(store_path)
.authenticator(keystore.clone())
.in_debug_mode(true.into())
.build()
.await?;

Expand All @@ -216,10 +203,10 @@ async fn main() -> anyhow::Result<()> {

let builder = AccountBuilder::new(init_seed)
.account_type(AccountType::Public)
.with_auth_component(AuthSingleSig::new(
.with_component(AuthSingleSig::new(Approver::new(
key_pair.public_key().to_commitment(),
AuthScheme::Falcon512Poseidon2,
))
)))
.with_component(BasicWallet);

let account = builder.build()?;
Expand All @@ -229,7 +216,7 @@ async fn main() -> anyhow::Result<()> {
keystore.add_key(&key_pair, account.id()).await?;

println!("Account ID: {}", account.id());
println!("No assets in Vault: {:?}", account.vault().is_empty());
println!("No Assets in Vault: {:?}", account.vault().is_empty());

Ok(())
}
Expand Down Expand Up @@ -275,29 +262,26 @@ Before we can work with tokens, we need a source of tokens. Let's create a fungi
use miden_client::{
account::{
component::{
AccessControl, AuthScheme, BurnPolicyConfig, FungibleFaucet, MintPolicyConfig,
PolicyRegistration, TokenName, TokenPolicyManager, TransferPolicy,
create_fungible_faucet,
AuthScheme, AuthSingleSig, BurnPolicy, FungibleFaucet, MintPolicy, TokenName,
TokenPolicyManager, TransferPolicy, create_singlesig_user_fungible_faucet,
},
AccountType,
},
asset::{AssetAmount, TokenSymbol},
auth::AuthSecretKey,
auth::{Approver, AuthSecretKey},
builder::ClientBuilder,
keystore::{FilesystemKeyStore, Keystore},
rpc::{Endpoint, GrpcClient},
rpc::Endpoint,
};
use miden_client_sqlite_store::ClientBuilderSqliteExt;
use miden_standards::AuthMethod;
use rand::RngCore;
use rand::Rng;
use std::sync::Arc;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize RPC connection
let endpoint = Endpoint::testnet();
let timeout_ms = 10_000;
let rpc_client = Arc::new(GrpcClient::new(&endpoint, timeout_ms));

// Initialize keystore
let keystore_path = std::path::PathBuf::from("./keystore");
Expand All @@ -310,10 +294,9 @@ async fn main() -> anyhow::Result<()> {
// NOTE: The client is our entry point to the Miden network.
// All interactions with the network go through the client.
let mut client = ClientBuilder::new()
.rpc(rpc_client)
.grpc_client(&endpoint, Some(timeout_ms))
.sqlite_store(store_path)
.authenticator(keystore.clone())
.in_debug_mode(true.into())
.build()
.await?;

Expand All @@ -338,23 +321,22 @@ async fn main() -> anyhow::Result<()> {
.decimals(decimals)
.max_supply(max_supply)
.build()?;
let policies = TokenPolicyManager::new()
.with_mint_policy(MintPolicyConfig::AllowAll, PolicyRegistration::Active)?
.with_burn_policy(BurnPolicyConfig::AllowAll, PolicyRegistration::Active)?
.with_send_policy(TransferPolicy::AllowAll, PolicyRegistration::Active)?
.with_receive_policy(TransferPolicy::AllowAll, PolicyRegistration::Active)?;
let faucet_account = create_fungible_faucet(
let policies = TokenPolicyManager::builder()
.active_mint_policy(MintPolicy::allow_all())
.active_burn_policy(BurnPolicy::allow_all())
.active_send_policy(TransferPolicy::allow_all())
.active_receive_policy(TransferPolicy::allow_all())
.build();
let auth = AuthSingleSig::new(Approver::new(
key_pair.public_key().to_commitment(),
AuthScheme::Falcon512Poseidon2,
));
let faucet_account = create_singlesig_user_fungible_faucet(
init_seed,
faucet,
AccountType::Public,
AuthMethod::SingleSig {
approver: (
key_pair.public_key().to_commitment(),
AuthScheme::Falcon512Poseidon2,
),
},
AccessControl::AuthControlled,
auth,
policies,
AccountType::Public,
)?;

client.add_account(&faucet_account, false).await?;
Expand Down Expand Up @@ -406,11 +388,6 @@ Faucet account ID: 0xde0ba31282f7522046d3d4af40722b
- **Public Accounts**: Account state is fully transparent and visible onchain
- **Private Accounts**: Only cryptographic commitments are stored onchain, with full state maintained privately

**Storage Modes:**

- **Public**: Account state is fully transparent and visible onchain
- **Private**: Only cryptographic commitments are stored onchain, with full state maintained privately

**Modular Components:**

- **BasicWallet**: Provides asset management functionality
Expand Down
2 changes: 1 addition & 1 deletion docs/builder/get-started/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Key concepts you'll encounter:
- **Accounts**: smart contracts that hold assets and execute code
- **Notes**: messages that exchange data and assets between accounts — also programmable
- **Assets**: tokens that can be fungible or non-fungible
- **Privacy**: every transaction, note, and account in Miden is private by default — only the involved parties can view asset amounts or transfer details
- **Privacy**: accounts and notes can be public or private. Private accounts keep their state offchain, while private notes hide their details behind commitments

## Getting started

Expand Down
Loading