In this tutorial you'll build a simple "Hello Token" component that:
Creates a new token when instantiated.
Gives out free tokens to anyone who asks.
By the end, you'll understand blueprints, components, resources, vaults, and buckets—the core concepts of Scrypto development.
Time | ~10 minutes |
Prerequisites | Terminal access, 2GB disk space |
Network | None (local only) |
1. Install the Toolchain (5 minutes)
Run the installer for your platform:
curl -fsSL https://raw.githubusercontent.com/radixdlt/radixdlt-scrypto/main/scrypto-install-scripts/install-scrypto.sh | bashInvoke-RestMethod 'https://raw.githubusercontent.com/radixdlt/radixdlt-scrypto/main/scrypto-install-scripts/install-scrypto-windows.ps1' | Invoke-ExpressionWhat's being installed?
Verify the installation:
scrypto --version
resim --version2. Create a Package (1 minute)
scrypto new-package hello_token
cd hello_tokenThis creates:
hello_token/
├── src/
│ └── lib.rs # Your blueprint code
├── tests/
│ └── lib.rs # Tests
└── Cargo.toml # Rust configuration
3. Understand the Code (2 minutes)
Open src/lib.rs. The template contains a complete working blueprint:
use scrypto::prelude::*;
#[blueprint]
mod hello_token {
struct HelloToken {
sample_vault: Vault,
}
impl HelloToken {
// Creates a new HelloToken component
pub fn instantiate() -> Global<HelloToken> {
// Create 1000 tokens
let my_bucket: Bucket = ResourceBuilder::new_fungible(OwnerRole::None)
.metadata(metadata! {
init {
"name" => "HelloToken", locked;
"symbol" => "HT", locked;
}
})
.mint_initial_supply(1000)
.into();
// Store them in a vault and create the component
Self {
sample_vault: Vault::with_bucket(my_bucket),
}
.instantiate()
.prepare_to_globalize(OwnerRole::None)
.globalize()
}
// Gives 1 token to whoever calls this
pub fn free_token(&mut self) -> Bucket {
self.sample_vault.take(1)
}
}
}Key concepts in this code:
Concept | What it means |
|---|---|
| Marks this module as a Radix blueprint (deployable template) |
| Permanent storage for tokens inside a component |
| Temporary container for moving tokens around |
| Creates new token types |
| Physically removes 1 token from the vault |
| A component with an address others can call |
4. Build and Run (2 minutes)
Build the package
scrypto buildYou should see "Compiling..." and then success.
Start the simulator
resim resetCreate a test account
resim new-accountSave the Account component address that's displayed (starts with account_sim).
Deploy your blueprint
resim publish .Save the Package address (starts with package_sim).
Instantiate a component
resim call-function <PACKAGE_ADDRESS> HelloToken instantiateReplace <PACKAGE_ADDRESS> with your actual package address.
Save the Component address (starts with component_sim).
5. Interact With Your Component (1 minute)
Get a free token
resim call-method <COMPONENT_ADDRESS> free_tokenCheck your balance
resim show <ACCOUNT_ADDRESS>You should see 1 HelloToken in your account!
Get another token
resim call-method <COMPONENT_ADDRESS> free_token
resim show <ACCOUNT_ADDRESS>Now you have 2 HelloToken.
What Just Happened?
You just:
Created a token type – HelloToken (HT) now exists as a resource definition.
Instantiated a component – A "vending machine" holding 1000 tokens.
Called a method –
free_tokenremoved a token from the vault and sent it to you.Received real assets – The tokens are now in your account's vault.
This is asset-oriented programming: tokens are physical things that move between vaults, not numbers in a database.
What's different from EVM?
Try This: Add a Price
Modify the free_token method to require payment:
pub fn buy_token(&mut self, mut payment: Bucket) -> (Bucket, Bucket) {
// Take 10 XRD as payment
let price = payment.take(dec!("10"));
// In a real component, you'd store this payment
// For now, we just drop it (burn it)
// Return the token AND the change
(self.sample_vault.take(1), payment)
}Rebuild with scrypto build and try it out.
Next Steps
🚀 Deploy to Stokenet
Take your component live on the test network
🎓 Scrypto Fundamentals
Deep dive into resources, authorization, and testing
Quick Reference
# Build your package
scrypto build
# Reset simulator state
resim reset
# Create account
resim new-account
# Deploy package
resim publish .
# Call a function (creates something new)
resim call-function <package> <blueprint> <function> [args...]
# Call a method (on existing component)
resim call-method <component> <method> [args...]
# Inspect account contents
resim show <account>
# See transaction history
resim show-ledgerConnect your wallet to join the discussion.

