Crypto that works for real businesses.
Near-zero fees. Real-time inventory. No complexity.
CoCo is a Substrate-based blockchain protocol purpose-built for real businesses. It creates a programmable economic layer where merchants can issue tokens, track inventory, manage digital rights, and accept payments — all without understanding blockchain. The system hides behind familiar tools: a barcode scanner, a dashboard, a POS terminal.
Any organization can issue custom programmable tokens — loyalty points, employee compensation, asset-backed credits, or micro-finance instruments — that can be exchanged across a unified ecosystem with near-zero fees (0% internal, 0.25% external vs. 2-5% card networks). The protocol extends this with a Product Rights Management (PRM) system: physical products are tokenized as NFTs carrying DRM flags that enable pay-as-you-go, lease-to-own, subscriptions, and microtransaction-based feature unlocks.
Barcode scanning, real-time inventory analysis, and POS integration provide the physical-world bridge. The goal is not to build a crypto platform — it's to build a better payment and inventory system that happens to run on a blockchain.
| Capability | CoCo | Traditional |
|---|---|---|
| Payment Fees (retail) | 0.25% | Visa/MC 2-5% |
| B2B / Supplier Payment | 0% internal | 2-3% card or $25 wire |
| Settlement Time | 6 seconds | 1-3 business days |
| Chargebacks | None | Costly & frequent |
| Programmable Tokens | Custom sub-tokens + smart contracts | Siloed loyalty programs |
| DRM Enforcement | On-chain lock/unlock/repossess | No enforcement mechanism |
| Micro-finance | PAYG, lease-to-own, subscriptions, rentals | Credit cards (2-3% fees) |
| Supply Chain + Inventory | Real-time, on-chain, auto-reorder from suppliers | Siloed, no cross-org data |
| Inter-Ecosystem Trade | 0% between any CoCo tokens | Visa/Mastercard 2-3% |
| Merchant Complexity | Scan barcode → done | Terminal contract, PCI audit, chargeback risk |
| Processor | Fee on $20 | Settlement |
|---|---|---|
| ★ CoCo | $0.05 | 6 seconds |
| Visa / Mastercard | $0.50 – $0.90 | 1-2 days |
| MercadoPago QR | $0.30 – $0.40 | Next day |
| MercadoPago Card | $0.80 – $1.00 | Next day |
| PayPal | $1.19 | Instant (holds apply) |
| Stripe | $0.88 | 1-2 days |
| Method | Fee on $1,000 | Settlement |
|---|---|---|
| ★ CoCo (internal) | $0.00 | 6 seconds |
| ★ CoCo (border crossing) | $2.50 | 6 seconds |
| Wire Transfer | $25 – $50 flat | 1-3 days |
| Corporate Credit Card | $20 – $30 (2-3%) | 1-2 days |
| Paper Check | $5 – $10 + float | 5-10 days |
| ACH / SEPA | ~$0.50 | 2-3 days |
0.25% border fee is still 10-24x cheaper than any card processor. Internal ecosystem movement is 0%. The only thing cheaper is cash — and cash doesn't give you inventory analytics, DRM enforcement, automated supplier ordering, or yield-bearing savings.
┌─────────────────────────────────────────────────────────────────────┐
│ CoCo Blockchain (Substrate) │
│ │
│ ┌────────────────────────────────────────────────────────────┐ │
│ │ Runtime (FRAME) — 3 Layers │ │
│ │ │ │
│ │ LAYER 1: ECONOMIC ✦ BRIDGE │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │
│ │ │pallet- │ │pallet- │ │pallet- │ │pallet- │ │ │
│ │ │assets │ │kyc │ │rewards │ │bridge 🆕 │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────────┘ │ │
│ │ │ │
│ │ LAYER 2: PRODUCT RIGHTS MANAGEMENT │ │
│ │ ┌──────────────────┐ ┌────────────┐ ┌──────────────────┐ │ │
│ │ │pallet-product-nft│ │pallet-drm │ │pallet- │ │ │
│ │ │★ (digital twins) │ │(enforce) │ │microfinance │ │ │
│ │ └──────────────────┘ └────────────┘ └──────────────────┘ │ │
│ │ │ │
│ │ LAYER 3: PHYSICAL BRIDGE ✦ REALTIME INVENTORY │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ │ │
│ │ │barcode │ │inventory │ │POS │ │ │
│ │ │scanner │ │analysis │ │terminal │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ │ │
│ │ │ │
│ │ System: ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────┐ │ │
│ │ │balances │ │timestamp │ │sudo │ │grandpa│ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────┘ │ │
│ └────────────────────────────────────────────────────────────┘ │
│ Consensus: Aura (6s blocks) + Grandpa (fast finality) │
└────────────────────────────────────────────────────────────────────┘
↕
┌─────────────────────────┼──────────────────────────┐
│ │ │
│ ┌──────────▼──────────┐ │
│ │ Node.js Server │ │
│ │ (REST API + WS) │ │
│ └──────────┬──────────┘ │
│ │ │
│ ┌─────────────────┐ ┌───────────────────────┐ │
│ │ Web Apps │ │ Mobile Apps │ │
│ │ /login │ │ Android Scanner │ │
│ │ /admin │ │ (Kotlin + ML Kit) │ │
│ │ /dashboard │ └───────────────────────┘ │
│ │ /marketplace │ │
│ │ /onboarding │ │
│ └─────────────────┘ │
└──────────────────────────────────────────────────┘
/home/nate/gemini/coco/ ├── coco-substrate/ ★ Primary — Substrate blockchain │ ├── node/ Node binary (CLI, RPC, chain spec) │ ├── runtime/ All pallets configured │ ├── pallets/ 11 custom pallets + pallet-contracts │ │ ├── product-nft/ ★ Core — product NFT + DRM (v0.5) │ │ ├── kyc/ KYC provider network │ │ ├── rewards/ Yield distribution + staking │ │ └── ... (7 more) │ ├── contracts/ Example ink! smart contracts (PAYG, Lease, Escrow) │ ├── scripts/ Build & run utilities │ └── docs/ Technical documentation ├── barcode/ Scanner app + POS server │ ├── app/ Android app (Kotlin) │ └── Server/ Node.js backend (Express, SQLite) └── website/ Public website and documentation
The core pallet managing the full lifecycle of physical products as digital twins (NFTs). 17 extrinsics (0-16) + 8 DRM extrinsics (17-24), 14 storage maps, 26 events, 43 error codes.
| # | Extrinsic | Call Index | Access | Description |
|---|---|---|---|---|
| 0 | register_company | 0 | KYC user | Register a brand/company |
| 1 | deactivate_company | 1 | Owner | Deactivate own company |
| 2 | activate_company | 2 | Owner | Reactivate company |
| 3 | mint_product | 3 | Company | Mint 1 product with GTIN+serial |
| 4 | batch_mint_products | 4 | Company | Mint up to 1000 units |
| 5 | transfer | 5 | Owner | Transfer custody + location |
| 6 | sell_to_consumer | 6 | Owner | Retail sale + warranty |
| 7 | authenticate_product | 7 | Mfr | Mark authentic on-chain |
| 8 | recall_product | 8 | Mfr | Recall product, block sale |
| 9 | resolve_recall | 9 | Mfr | Close recall, EndOfLife |
| 10 | register_product | 10 | Owner | Add to consumer portfolio |
| 11 | submit_warranty_claim | 11 | Owner | File a warranty claim |
| 12 | resolve_warranty_claim | 12 | Mfr | Approve/deny claim |
| 13 | list_for_sale | 13 | Owner | List on marketplace |
| 14 | buy_listing | 14 | Any | Purchase listed product |
| 15 | cancel_listing | 15 | Seller | Remove listing |
| 16 | set_fee_config | 16 | Root | Set fee rates & treasury collector |
| Name | Key | Value | Query |
|---|---|---|---|
| Companies | AccountId | CompanyInfo | Option |
| CompanyCount | — | u32 | Value |
| NextProductId | — | u128 | Value |
| Products | u128 | ProductNFT | Option |
| ProductLookup | (GTIN, Serial) | u128 | — |
| Authentications | u128 | AuthenticationRecord | Option |
| RecalledProducts | u128 | RecallInfo | Option |
| ConsumerPortfolio | AccountId | BoundedVec<u128> | Value |
| WarrantyClaimCount | — | u32 | Value |
| WarrantyClaims | (u128, u32) | WarrantyClaim | Option |
| MarketListings | u128 | MarketListing | Option |
| FeeConfig | — | FeeConfiguration | Value |
| ProductDRM 🆕 | u128 | DRMStatus | Option |
ProductNFT {
product_id: u128,
gtin: BoundedString, // GTIN-14 (GS1 standard)
serial_number: BoundedString, // Unit-level serial
batch_id: BoundedString,
name: BoundedString,
category: ProductCategory,
manufacturer: AccountId,
manufactured_at: BlockNumber,
current_owner: AccountId,
status: ProductStatus, // InProduction → ... → Sold/EndOfLife
custody_chain: BoundedVec<CustodyRecord>,
sale_price: Option<Balance>,
warranty: Option<WarrantyInfo>,
drm: Option<DRMStatus>, // 🆕 v0.5: DRM config, state, features
}
DRMStatus { // 🆕 v0.5
drm_config: DRMConfig { drm_enabled, enforcement_type, ... },
drm_state: DRMState, // Unlocked | Licensed | FeatureLocked | FullyLocked | Repossessed | Burned
features: BoundedVec<FeatureLock>,
enforcement_history: BoundedVec<EnforcementRecord>,
}
ProductStatus enum:
InProduction | InTransit | AtDistributor | InStore |
Sold | ListedForResale | Recalled | ReportedStolen | EndOfLife
RecallInfo {
recalled_by: AccountId,
recalled_at: BlockNumber,
reason: BoundedString,
action: RecallAction, // Return | Dispose | Replace | Refund
is_resolved: bool,
resolved_at: Option<BlockNumber>,
}
MarketListing {
seller: AccountId,
price: Balance,
listed_at: BlockNumber,
royalty_percent: Option<u8>, // Brand royalty on resale
}
Product Rights Management system. Enables lock/unlock, feature-level gating, repossession, and emergency override on product NFTs. DRM config is set by the manufacturer at product level with consumer consent.
| # | Extrinsic | Access | Description |
|---|---|---|---|
| 17 | set_drm_config | Manufacturer | Enable DRM on a product, set enforcement type |
| 18 | lock_product | Financing Entity | Lock product (missed payment, default) |
| 19 | unlock_product | Financing Entity | Restore product access on payment |
| 20 | unlock_feature | Any | Microtransaction: unlock single feature for N blocks |
| 21 | lock_feature | Financing Entity | Lock a specific feature |
| 22 | repossess_product | Manufacturer | Transfer ownership back on final default |
| 23 | burn_drm | Owner | Permanently remove DRM (full ownership achieved) |
| 24 | emergency_drm_override | Emergency Auth | Temporary unlock for safety/medical emergencies |
Unlocked → Licensed → FeatureLocked → FullyLocked → Repossessed → Burned
↑ | | | |
└──────────┴────────────┴───────────────┴─────────────┘
(payment restores access)
| Name | Key | Value | Query |
|---|---|---|---|
| ProductDRM | u128 (product_id) | DRMStatus {config, state, features, history} | Option |
| Model | Example | DRM Flow |
|---|---|---|
| Pay-as-you-go | Heated seats: $0.50/24h | FeatureLocked → unlock_feature(payment) → Timed unlock → Locked on expiry |
| Lease-to-own | Smartphone: $30/mo × 24 | Licensed → Each payment → ownership% → Full payment → Burned |
| Subscription | Premium audio: $10/mo | Licensed → Missed payment → FeatureLocked → Payment → Unlocked |
| Micro-loan | $200 loan on $500 phone | FullyLocked → Repayment → Unlocked → Default → Repossessed |
ProductNFT {
...
drm: Option<DRMStatus>, // NEW: DRM config, state, features
}
Manages KYC provider network and user address approvals. Used as a gate for company registration and staking.
| Extrinsic | Access | Description |
|---|---|---|
| add_kyc_provider | Root | Register a KYC provider |
| remove_kyc_provider | Root | Remove a KYC provider |
| activate_provider | Root | Reactivate suspended provider |
| deactivate_provider | Root | Suspend a provider |
| approve_address | Provider | KYC-approve a user |
| revoke_approval | Provider | Revoke KYC approval |
is_kyc_approved(address) — Check if address is KYC'd and activeget_kyc_approval(address) — Get approval details (expiry, provider)is_kyc_provider(account) — Check if account is a KYC providerget_all_approved_addresses() — List all active KYC addressesApartment lease agreements with DRM-enforced access control. An apartment is a ProductNFT with DRM — on-time payment unlocks the door, late payment locks it. Security deposits held in escrow, released on completion or dispute.
| # | Extrinsic | Access | Description |
|---|---|---|---|
| 0 | create_agreement | Landlord | Set terms: rent, deposit, grace period, late fee |
| 1 | accept_agreement | Tenant | Pay deposit + first month → status Active |
| 2 | pay_rent | Tenant | Monthly payment. Restores DRM unlock if late. |
| 3 | trigger_late | Anyone | After grace period. Locks DRM on property. |
| 4 | serve_notice | Landlord | Start eviction process. |
| 5 | vacate | Tenant/Landlord | End tenancy. Status → Terminated. |
| 6 | release_deposit | Tenant/Landlord | Release security deposit. |
Pending → Active → Late → EvictionProcess → Terminated → Completed
↑ ↓ (pay rent) ↓
└─────────┘ release_deposit
Cross-chain bridge for Solana, USDC, and USDT interoperability. Wrapped tokens on CoCo backed 1:1 by locked tokens on source chains. Relayer-based verification with replay protection.
| # | Extrinsic | Access | Description |
|---|---|---|---|
| 0 | register_asset | Root | Register bridged token (USDC/USDT/SOL) |
| 1 | deactivate_asset | Root | Stop new deposits |
| 2 | deposit | Relayer | Complete deposit (mint wrapped tokens) |
| 3 | withdraw | Any | Initiate withdrawal (burn wrapped tokens) |
| 4 | complete_withdrawal | Relayer | Confirm unlock on source chain |
| 5 | add_relayer | Root | Authorize relayer |
| 6 | remove_relayer | Root | Remove relayer |
| 7 | set_paused | Root | Emergency stop |
Solana → CoCo: User locks tokens on Solana
→ Relayer detects event
→ Calls bridge.deposit() on CoCo
→ Wrapped tokens minted to recipient
CoCo → Solana: User calls bridge.withdraw() on CoCo
→ Wrapped tokens burned
→ Relayer detects WithdrawalInitiated event
→ Calls unlock_tokens() on Solana program
→ User receives native tokens on Solana
| Asset | Solana Address | CoCo ID | Decimals |
|---|---|---|---|
| USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v | 0 | 6 |
| USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB | 1 | 6 |
| SOL (w) | So11111111111111111111111111111111111111112 | 2 | 9 |
docs/SOLANA_BRIDGE_SPEC.mdscripts/bridge-relayer.jsTreasury-managed yield distribution to KYC-approved stakers. Implements the CoCo-K staking model where real-world asset yield (USDC from T-bills) is distributed proportionally.
| Extrinsic | Access | Description |
|---|---|---|
| set_treasury_manager | Root | Appoint treasury manager |
| remove_treasury_manager | Root | Remove treasury manager |
| activate_manager | Root | Reactivate manager |
| deactivate_manager | Root | Suspend manager |
| distribute_rewards | Manager | Distribute yield to KYC stakers |
| claim_rewards | Staker | Claim pending rewards |
| stake | KYC user | Stake CoCo-K tokens |
| unstake | Staker | Unstake tokens |
| set_distribution_schedule | Root | Configure interval/minimum |
Off-Chain Treasury (T-bills)
↓ Interest earned
Convert to USDC
↓ Bridge to CoCo chain
Treasury Manager calls distribute_rewards()
↓ Proportional to stake
KYC-Approved Stakers → Pending Rewards
↓ claim_rewards()
Withdrawn to staker's wallet
Wasm-based smart contracts via pallet-contracts. Deploy ink! contracts that call into the CoCo runtime via a custom chain extension. Contract deployment uses COCO for gas metering and storage deposits.
Contracts can query on-chain state through the CoCoExtension without paying cross-contract call fees:
| ID | Function | Input | Output | Description |
|---|---|---|---|---|
| 1 | is_kyc_approved | AccountId | bool | Check if an address is KYC-approved |
| 2 | get_product_owner | u128 (product_id) | Option<AccountId> | Get current owner of a product NFT |
| 3 | is_product_authentic | u128 (product_id) | bool | Check manufacturer authentication status |
| 4 | get_product_status | u128 (product_id) | Option<u8> | Get product lifecycle status enum |
| 5 | is_drm_enabled | u128 (product_id) | bool | Check if DRM is active on a product |
| Contract | Source | Description |
|---|---|---|
| PAYG | contracts/payg/ | Pay-as-you-go: purchase time blocks, vendor withdraws, KYC-gated access |
| Lease | contracts/lease/ | Lease-to-own: fixed installments, ownership transfer on full payment |
| Escrow | contracts/escrow/ | Time-locked escrow with mediator resolution, 10 COCO stake |
# Install ink! toolchain cargo install cargo-contract # Build a contract cd coco-substrate/contracts/payg cargo contract build # Upload via Polkadot.js → Developer → Contracts # Instantiate with constructor args # Call via extrinsic or UI
| Parameter | Value |
|---|---|
| Deposit per storage item | 1 COCO |
| Deposit per byte | 0.01 COCO |
| Max code length | 128 KB |
| Call stack depth | 5 frames |
| Max delegate actions | 2 |
is_kyc_approved before granting product access. No KYC check is needed for deployment — any user can deploy, but the contract logic enforces KYC where required.
The Node.js server at barcode/Server/ provides REST API endpoints for both the POS system and blockchain operations.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login | Username + password → JWT token |
| POST | /api/auth/register | Create new user (admin required) |
| GET | /api/auth/me | Get current user from token |
| POST | /api/auth/change-password | Change password |
| POST | /api/auth/logout | Logout (stateless, logs event) |
| GET | /api/items | List inventory items |
| POST | /api/items | Add inventory item |
| GET | /api/transactions | List POS transactions |
| Endpoint | Blockchain Call | Key Parameters |
|---|---|---|
| /kyc | kyc.approveAddress | address |
| /register | productNft.registerCompany | name, seed |
| /asset | assets.create + setMetadata | assetId, name, symbol, seed |
| /mint | productNft.mintProduct | gtin, serialNumber, batchId, name, category, seed |
| /mint-batch | productNft.batchMintProducts | gtin, batchId, name, category, quantity, seed |
| /transfer | productNft.transfer | productId, toAddress, newStatus, lat, lng, desc, action, seed |
| /sale | productNft.sellToConsumer | productId, consumerAddress, price, warrantyDuration, lat, lng, desc, seed |
| /authenticate | productNft.authenticateProduct | productId, seed |
| /recall | productNft.recallProduct | productId, reason, action, seed |
| /resolve-recall | productNft.resolveRecall | productId, seed |
| /register-product | productNft.registerProduct | productId, seed |
| /warranty-claim | productNft.submitWarrantyClaim | productId, description, seed |
| /resolve-claim | productNft.resolveWarrantyClaim | productId, claimIndex, resolution, seed |
| /list-for-sale | productNft.listForSale | productId, price, royaltyPercent, seed |
| /buy-listing | productNft.buyListing | productId, lat, lng, desc, seed |
| /cancel-listing | productNft.cancelListing | productId, seed |
| /set-drm 🆕 | productNft.setDrmConfig | productId, enforcementType, paymentTokenId, seed |
| /lock 🆕 | productNft.lockProduct | productId, reason, seed |
| /unlock 🆕 | productNft.unlockProduct | productId, seed |
| /unlock-feature 🆕 | productNft.unlockFeature | productId, featureId, durationBlocks, seed |
| /lock-feature 🆕 | productNft.lockFeature | productId, featureId, seed |
| /repossess 🆕 | productNft.repossessProduct | productId, seed |
| /burn-drm 🆕 | productNft.burnDrm | productId, seed |
| /emergency-override 🆕 | productNft.emergencyDrmOverride | productId, seed |
| Endpoint | Blockchain Call | Access |
|---|---|---|
| /api/bridge/register-asset | bridge.registerAsset | Root |
| /api/bridge/deactivate-asset | bridge.deactivateAsset | Root |
| /api/bridge/deposit | bridge.deposit | Relayer |
| /api/bridge/withdraw | bridge.withdraw | Any |
| /api/bridge/complete-withdrawal | bridge.completeWithdrawal | Relayer |
| /api/bridge/add-relayer | bridge.addRelayer | Root |
| /api/bridge/remove-relayer | bridge.removeRelayer | Root |
| /api/bridge/set-paused | bridge.setPaused | Root |
Note: "seed" is the private key seed phrase for signing transactions. In production, this would use a wallet connection (Polkadot.js extension, mobile wallet) rather than raw seed input.
| Route | File | Description |
|---|---|---|
| /login | login.html | Login/Register page 🆕 |
| /admin | admin.html | POS Admin Dashboard |
| /dashboard | company-dashboard.html | Company Dashboard |
| /marketplace | marketplace.html | P2P Marketplace |
| /onboarding | onboarding.html | Company Onboarding |
// The Polkadot.js API client handles: getApi() — Connect to ws://127.0.0.1:9944 sendTransaction() — Sign + submit + wait for inclusion + decode errors getAlice() — Get dev sudo key for KYC approval
Login/Register page with JWT-based authentication for POS and admin access.
Features:
Username/password sign in · Admin-only registration · Token-based session management · Auto-redirect on expiry
Full-featured admin panel for companies to manage their CoCo operations.
Features:
Product inventory with search/filter · Single & batch minting · Supply chain transfers · Retail sales · Recall management · Warranty claim resolution · Product authentication · Company settings
Browse and buy verified products listed for resale on the CoCo network.
Features:
Browse listings · Search & filter by category · View product details (authenticity, warranty) · Buy with wallet · List your own products · Cancel listings · Optional brand royalty on resale
6-step onboarding flow for new companies: KYC → Register → Asset → Mint → Transfer → Sale
Guide for integrating the Android barcode scanner app with the CoCo blockchain (wallet management, on-chain queries, transaction signing).
Command-line tool for common operations: build, run node, test, check, start server, reset chain data, generate spec, build Docker.
./coco-substrate/scripts/admin.sh build ./coco-substrate/scripts/admin.sh run ./coco-substrate/scripts/admin.sh test nft
Every product on CoCo has a scannable QR code linking its physical form to its on-chain digital twin. The standard is defined in docs/QR_CODE_STANDARD.md.
coco://product/{chain_id}/{product_id}?gtin={gtin}&serial={serial}&sig={signature}
coco://product/0/0x00000000000000000000000000000001?gtin=00012345678905&serial=LV-2024-001234
| Type | Use | Signature |
|---|---|---|
| Static QR | Printed on packaging, permanent | No (lookup only) |
| Dynamic QR | App-generated at POS/transfer | ECDSA signature from owner |
GS1 Digital Link: https://id.gs1.org/01/00012345678905/21/LV-2024-001234 CoCo Equivalent: coco://product/0/0x01?gtin=00012345678905&serial=LV-2024-001234
UPC-A, UPC-E, EAN-13, EAN-8, Code 128, Code 39, Code 93, QR, Data Matrix, PDF417, Aztec, ITF, Codabar
User scans QR code → App extracts product_id from URI → Queries chain: Products(product_id) → Displays: authenticity, status, custody chain, warranty → If for sale: show purchase option → If owned by user: show manage options (list, claim warranty)
beta_instructions.md. This section covers building, configuring, and running the CoCo node.
| Component | Development | Testnet Validator |
|---|---|---|
| CPU | 2 vCPU | 4 vCPU |
| RAM | 4 GB | 8 GB |
| Storage | 20 GB | 100 GB SSD |
| OS | Linux / macOS / WSL2 | Ubuntu 22.04+ |
# Rust toolchain curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh rustup target add wasm32-unknown-unknown # System dependencies (Ubuntu) apt install build-essential pkg-config libssl-dev clang # Node.js 18+ (for server/relayer) curl -fsSL https://deb.nodesource.com/setup_18.x | bash - apt install nodejs # Verify rustc --version # ≥ 1.77 node --version # ≥ 18
cd coco-substrate # Release build (recommended — 30-60 min) ./scripts/build.sh # Or manually: cargo build --release -p coco-substrate # Binary at: ./target/release/coco-node ./target/release/coco-node --version
# Quick start ./scripts/run-dev.sh # Or manual: ./target/release/coco-node --dev --tmp # Connect: ws://127.0.0.1:9944 # Connect: https://polkadot.js.org/apps → Development → Local Node
# 1. Generate chain spec ./target/release/coco-node build-spec --chain local --raw > testnet-spec.json # 2. Generate validator keys ./target/release/coco-node key generate --scheme sr25519 --output-type json > aura-key.json ./target/release/coco-node key generate --scheme ed25519 --output-type json > grandpa-key.json # 3. Insert keys ./target/release/coco-node key insert \ --base-path /opt/coco/data/validator \ --chain testnet-spec.json \ --scheme sr25519 --key-type aura --suri "<seed>" ./target/release/coco-node key insert \ --base-path /opt/coco/data/validator \ --chain testnet-spec.json \ --scheme ed25519 --key-type gran --suri "<seed>" # 4. Start validator ./target/release/coco-node \ --chain testnet-spec.json \ --base-path /opt/coco/data/validator \ --name "My Validator" --validator \ --rpc-methods Safe --rpc-external --ws-external \ --prometheus-external # Ports: 30333 (P2P), 9933 (RPC), 9944 (WS), 9615 (metrics) # See beta_instructions.md for multi-validator testnet setup
# Start Node.js server (POS + blockchain proxy) cd barcode/Server npm install cp .env.example .env # Edit SUBSTRATE_URL npm start # http://localhost:3000 # Web apps: # /admin — POS dashboard # /dashboard — Company inventory # /marketplace — P2P product listings # /onboarding — Company setup wizard # /login — Authentication
# Linux CLI wallet cd barcode/linux-wallet npm install ./wallet.js new # Create wallet ./wallet.js balance # Check balances ./wallet.js send <addr> <amt> # Send COCO # Android wallet # Build: cd barcode && ./gradlew assembleDebug # APK: app/build/outputs/apk/debug/app-debug.apk
# Environment
export COCO_WS_URL=ws://127.0.0.1:9944
export COCO_RELAYER_SEED=//RelayerRelayer
# Start relayer
node scripts/bridge-relayer.js
# Register bridged assets (as root)
curl -X POST http://localhost:3000/api/bridge/register-asset \
-H "Content-Type: application/json" \
-d '{
"sourceChain":"Solana",
"sourceTokenAddress":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"name":"USD Coin","symbol":"USDC","decimals":6,
"seed":"//Alice"
}'
cd coco-substrate # Quick build (recommended) ./scripts/build.sh # Or manually: cargo build --release -p coco-substrate-runtime cargo build --release -p coco-substrate # Binary: ./target/release/coco-node
./scripts/run-dev.sh # or: ./target/release/coco-node --dev # RPC: ws://127.0.0.1:9944 | http://127.0.0.1:9933 # Connect: https://polkadot.js.org/apps → Development → Local Node
# Product NFT pallet (36 tests) cargo test -p pallet-product-nft # All pallets cargo test -p pallet-kyc cargo test -p pallet-rewards
cd barcode/Server npm install cp .env.example .env # Edit SUBSTRATE_URL if needed npm start # http://localhost:3000 # Open: http://localhost:3000/onboarding.html
cd barcode ./gradlew assembleDebug # APK: app/build/outputs/apk/debug/app-debug.apk
cargo test -p pallet-product-nft -p pallet-micro-finance -p pallet-bridge → 75 passed, 0 failed.
The company onboarding process is a 6-step flow documented in ONBOARDING.md and implemented in the website at /onboarding.html.
| Step | Blockchain Action | Who |
|---|---|---|
| 1. KYC Approval | kyc.approveAddress | Provider (Alice in demo) |
| 2. Register Company | productNft.registerCompany | KYC-approved user |
| 3. Create Asset | assets.create + setMetadata | Company |
| 4. Mint Products | productNft.mintProduct / batchMintProducts | Company |
| 5. Supply Chain Transfer | productNft.transfer | Current owner |
| 6. Retail Sale | productNft.sellToConsumer | Retailer |
| Action | Blockchain Call | When |
|---|---|---|
| Register product | productNft.registerProduct | After purchase |
| Authenticate product | productNft.authenticateProduct | Manufacturer only |
| Submit warranty claim | productNft.submitWarrantyClaim | Within warranty period |
| List for resale | productNft.listForSale | Owner wants to sell |
| Buy from marketplace | productNft.buyListing | Any user |
| Cancel listing | productNft.cancelListing | Original seller |
| Parameter | Value | Notes |
|---|---|---|
| Block Time | 6 seconds | Aura slot duration |
| Finality | ~12-18 seconds | Grandpa 2/3+ confirmation |
| Native Token | COCO | 12 decimal places |
| Total Supply | 1,000,000,000 | Pre-mined at genesis |
| Existential Deposit | 500 plancks | Minimum balance |
| Max Validators | 32 | Aura authorities |
| Max KYC Providers | 100 | Configurable |
| Max Stakers | 100,000 | CoCo-K stakers |
set_fee_config (sudo). Default rates shown below.
| Transaction | Fee | Recipient | Status |
|---|---|---|---|
| Supply chain transfer | 0% | Free | Live |
| Product minting | 0.1% (configurable) | Treasury | Live |
| Retail sale | 0.25% (configurable) | Treasury | Live |
| P2P resale | 0.25% (configurable) | Treasury | Live |
| COCO transfer | Network fee | Validators | Live |
| Sub-token swap (same brand) | 0% | Free | Planned |
| Sub-token to COCO | 0.25% | Treasury | Planned |
// Fee configuration (stored on-chain):
struct FeeConfiguration {
fee_collector: AccountId, // Treasury address
sale_fee_rate: Permill, // 0.25% default
resale_fee_rate: Permill, // 0.25% default
mint_fee_rate: Permill, // 0.1% default
}
// Example: Retail sale of 1000 COCO product
// Sale price: 1000 COCO
// Fee (0.25%): 2.5 COCO → transferred to TreasuryAccount
// Seller receives: 997.5 COCO (net)
Fees are automatically deducted during sell_to_consumer and buy_listing extrinsics via the charge_fee helper. The treasury account is set to Alice in dev mode and should be changed to a multi-sig treasury for production.
| Name | Role | COCO |
|---|---|---|
| Alice | Sudo / Validator | 1,000,000 |
| Bob | Validator / KYC Provider | 1,000,000 |
| Charlie | User / Staker | 1,000,000 |
| Dave | User | 1,000,000 |
| Eve | User | 1,000,000 |
Done New Pending Planned
/dashboard/marketplacescripts/admin.sh with 9 commandsdocs/SCANNER_INTEGRATION.md| Metric | Target |
|---|---|
| Brands onboarded | 50 |
| Products tokenized | 500M |
| Active consumers | 10M |
| Resale volume | $100M |
| Microtransaction volume | $10M |
| DRM-enabled products | 100K |
| Network revenue | $90M |