This guide will help you test the system in under 5 minutes using just commands.
# Install just (if not already installed)
cargo install just
# Or on macOS:
# brew install just
# Install Rust (if not already installed)
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThis command downloads all required binaries (polkadot, polkadot-omni-node, zombienet) and builds the project:
cd /Users/naren/DevBox/scalable-web3-storage-dev/web3-storage
just setupWhat it does:
- ✅ Downloads polkadot binaries (polkadot, workers) to
.bin/ - ✅ Downloads polkadot-omni-node to
.bin/ - ✅ Downloads zombienet to
.bin/ - ✅ Downloads chain-spec-builder to
.bin/ - ✅ Builds the entire project in release mode
Expected output:
Downloading binaries...
All binaries downloaded to .bin/
Building project...
Finished `release` profile [optimized]
Setup complete! Run 'just start-chain' and 'just start-provider' to start the local network.
Terminal 1: Start Blockchain Network
just start-chainTerminal 2: Start Provider Node
Once blockchain is ready:
export PROVIDER_ID=5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
export CHAIN_RPC=ws://127.0.0.1:2222
cargo run --release -p storage-provider-nodeTerminal 3: Check Services
# Check blockchain
bash scripts/check-chain.sh
# Check provider health
just health
# Or:
curl http://localhost:3333/healthExpected output:
{
"status": "ok",
"provider": "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
}just demoThe quick test will fail at the upload step because:
- ❌ Bucket doesn't exist on-chain
- ❌ Provider not registered on-chain
- ❌ No storage agreement between bucket and provider
This is expected - these require on-chain transactions.
For a full end-to-end test, you need to:
Open in browser: https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:2222
Step 1a: Register Provider (Basic Info)
- Go to Developer > Extrinsics
- Select account: ALICE
- Select pallet: storageProvider
- Select extrinsic: registerProvider
- Fill in parameters:
multiaddr:/ip4/127.0.0.1/tcp/3333(Polkadot.js will encode it)publicKey:0xd43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d(Alice's public key)stake:1000000000000000(1000 tokens - minimum required stake)
- Submit transaction
Step 1b: Configure Provider Settings (Optional but Recommended)
- Same account: ALICE
- Select extrinsic: updateProviderSettings
- Fill in settings:
minDuration:100(minimum blocks)maxDuration:1000(maximum blocks)pricePerByte:1000000(price per byte per block)acceptingPrimary:truereplicaSyncPrice:Some(5000000)orNoneacceptingExtensions:truemaxCapacity:10737418240(10 GB - or 0 for unlimited)
- Submit transaction
Capacity Notes:
maxCapacitydeclares maximum storage capacity (in bytes)- Provider's stake must cover capacity:
stake >= maxCapacity × MinStakePerByte maxCapacity = 0means unlimited (backward compatible)- See Storage Marketplace Design for details
- Go to Developer > Extrinsics
- Account: ALICE
- Extrinsic: storageProvider.createBucket
- Parameters:
minProviders:1
- Submit
- Account: ALICE
- Extrinsic: storageProvider.requestPrimaryAgreement
- Parameters:
bucketId:0provider: ALICE (5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY)maxBytes:1073741824(1 GB)duration:500(blocks)maxPayment:600000000000000000(maximum payment willing to pay - with 10% buffer)
- Submit
Payment Calculation:
payment = price_per_byte × max_bytes × duration
payment = 1,000,000 × 1,073,741,824 × 500
payment = 536,870,912,000,000,000
The maxPayment must be ≥ calculated payment. Using 600000000000000000 gives ~12% buffer.
- Account: ALICE (acting as provider)
- Extrinsic: storageProvider.acceptAgreement
- Parameters:
bucketId:0
- Submit
just demoThis time all tests should pass! ✅
I can create a script that automates steps 1-4 using the Substrate CLI, but it requires:
- Installing
subxt-cli - Generating chain metadata
- Creating signed transactions programmatically
Would you like me to create this automated setup script?
For comprehensive testing including:
- Multiple providers
- Replica synchronization
- Challenge/slashing mechanism
- Performance benchmarks
See: Manual Testing Guide
| Component | Address | Purpose |
|---|---|---|
| Relay Chain | ws://127.0.0.1:9900 | Validator network |
| Parachain | ws://127.0.0.1:2222 | Storage pallet chain |
| Provider HTTP | http://127.0.0.1:3333 | Data upload/download |
| Block Explorer | https://polkadot.js.org/apps/?rpc=ws://127.0.0.1:2222 | UI for chain interaction |
- Ensure zombienet is running in Terminal 1
- Wait 30-60 seconds after starting
- Run
bash scripts/check-chain.shto verify
- Ensure provider is running in Terminal 2
- Check no other process is using port 3333
- Verify
CHAIN_RPCenvironment variable is set
- Minimum stake required: 1000 tokens
- Use:
1000000000000000(not100000000000) - The runtime uses 12 decimals: 1 token = 1,000,000,000,000
- Check Alice's balance in Accounts tab (should have millions on local testnet)
- Complete steps 1-4 in Polkadot.js UI first
- Verify agreement exists: Developer > Chain State > storageProvider.agreements(0, ALICE)
- Make sure you called
updateProviderSettingsafter registration - Check
acceptingPrimaryis set totruein provider settings
- You're missing the
maxPaymentparameter or set it too low - Calculate required payment:
price_per_byte × max_bytes × duration - Example:
1,000,000 × 1,073,741,824 × 500 = 536,870,912,000,000,000 - Set
maxPaymentwith 10-20% buffer:600000000000000000 - See "Create Storage Agreement" section for details
Instead of manually selecting providers, use the DiscoveryClient to find matching providers automatically:
use storage_client::{DiscoveryClient, StorageRequirements};
let mut client = DiscoveryClient::with_defaults()?;
client.connect().await?;
// Find providers matching your requirements
let requirements = StorageRequirements {
bytes_needed: 10 * 1024 * 1024 * 1024, // 10 GB
min_duration: 500,
max_price_per_byte: 2_000_000,
primary_only: true,
};
let providers = client.find_providers(requirements, 5).await?;
for provider in &providers {
println!("Provider: {} (score: {}, available: {:?} bytes)",
provider.account,
provider.match_score,
provider.available_capacity
);
}See Storage Marketplace Design for details on the matching algorithm.
Once the basic test passes:
- ✅ Upload works
- ✅ Download works
- ✅ Data integrity verified
Try:
- Adding more providers
- Creating more buckets
- Testing challenges
- Benchmarking performance
- Using the Discovery Client for automatic provider selection
- Setting up automatic checkpoints with
CheckpointManager