Demo & On-Chain Data

This section explains how the live demo works, what data is stored on the Casper blockchain, and how to verify transactions yourself on the block explorer.

How the Demo Works

The demo showcases a complete B2B invoice escrow workflow running on Casper 2.0 testnet. When you interact with the demo, you're executing real blockchain transactions.

Architecture Overview

Demo Wallet
Pre-funded testnet account for demo transactions
Next.js Backend
API routes handle transaction signing & submission
Casper Testnet
Smart contract deployed, state stored on-chain
User ActionAPI Signs TXSubmit to CasperOn-Chain Execution

Demo Account Configuration

The demo uses a pre-funded testnet account to pay for gas and escrow funding. This allows judges and testers to experience the full workflow without needing their own testnet CSPR.

Demo Account
Public Key: 0203ff8cba4d2a6019845d95ade52b110eea6dda8fa28180f234c5def1f2872d7393
This account serves as both issuer and payer in the demo for simplicity. In production, these would be separate accounts controlled by different parties.

What Gets Stored On-Chain

Every escrow creates a smart contract instance on Casper with the following data stored in the contract's Named Keys:

KeyTypeDescription
stateU8Current escrow state (0=Draft, 1=Accepted, 2=Funded, 3=Released, 4=Cancelled)
issuerAccountHashAddress of the party receiving payment
payerAccountHashAddress of the party making payment
amountU512Required escrow amount in motes (1 CSPR = 10^9 motes)
descriptionStringInvoice description stored on-chain
balanceU512Current balance held in escrow
escrow_purseURefPurse holding the escrowed funds

State Transitions

Each state transition is recorded as a blockchain transaction (deploy):

Deploy Contract (call)
├── Args: amount (U64), description (String)
├── Creates: escrow_package, escrow_contract
├── Initial state: Draft (0)
└── Gas: ~10 CSPR

accept()
├── Caller: must be payer
├── Validates: state == Draft
├── Updates: state → Accepted (1)
└── Gas: ~2.5 CSPR

fund()
├── Args: amount (U512), source (URef)
├── Caller: must be payer
├── Validates: state == Accepted, amount >= required
├── Transfers: CSPR from source purse to escrow_purse
├── Updates: state → Funded (2), balance = amount
└── Gas: ~2.5 CSPR

release()
├── Caller: must be payer
├── Validates: state == Funded
├── Transfers: balance from escrow_purse to issuer
├── Updates: state → Released (3), balance = 0
└── Gas: ~2.5 CSPR

Verifying On-Chain

Every transaction can be verified on the Casper block explorer:

  1. Copy the deploy hash shown after any action in the demo
  2. Go to testnet.cspr.live
  3. Search for the deploy hash
  4. View execution results, gas used, and state changes
Successfully Deployed Contract
The escrow smart contract has been deployed to Casper testnet. Deploy hash: 86d45c8a...e9de22

Try It Yourself

Ready to see the infrastructure in action? The live demo lets you:

1. Create Invoice

Deploy a new escrow contract with description and amount

2. Accept Terms

Payer reviews and accepts the escrow terms

3. Fund Escrow

Deposit CSPR into the escrow contract

4. Release Payment

Transfer funds to issuer and complete the escrow

Technical Details

For developers who want to understand the implementation:

  • Smart Contract: Native Rust contract using casper-contract 5.x and casper-types 6.x
  • Entry Points: accept, fund, release, cancel, get_state, get_balance
  • SDK: casper-js-sdk 5.0.7 for transaction building and submission
  • Key Derivation: BIP39/BIP44 with Casper coin type (506)

Check the Smart Contract and Integration sections for full technical documentation.