Skip to content

JamesEBall/erc-7777-challenge-demo

Repository files navigation

Robot Challenge-Response Authentication Demo

This project demonstrates how to implement and test hardware-based challenge-response authentication for robots on the BASE network, based on ERC-7777. The demo shows how to distinguish between an authentic robot and an impostor using cryptographic signatures.

Prerequisites

  • Node.js (v14+ recommended)
  • npm (comes with Node.js)
  • A wallet with some test ETH on BASE Sepolia Testnet

Setup

  1. Clone this repository:
git clone https://github.com/JamesEBall/erc-7777-challenge-demo
cd erc-7777-challenge-demo
  1. Install dependencies:
npm install
  1. Create a .env file in the root directory:
touch .env
  1. Add the following to your .env file:
BASE_SEPOLIA_RPC_URL="https://sepolia.base.org"
PRIVATE_KEY="your-wallet-private-key-without-0x"

To get these values:

Project Structure

robot-demo/
├── contracts/
│   └── MockRobot.sol       # Robot identity contract
├── scripts/
│   ├── deploy.js           # Basic deployment script
│   └── robot-challenge-demo.js  # Challenge-response demo
├── hardhat.config.js       # Hardhat configuration
├── .env                    # Environment variables
└── README.md              # This file

Commands

  1. Compile contracts:
npx hardhat compile

Remove old con

  1. Deploy single robot:
npx hardhat run scripts/deploy.js --network base-sepolia
  1. Run full challenge-response demo:
npx hardhat run scripts/robot-challenge-demo.js --network base-sepolia

What the Demo Does

  1. Deploys two robot contracts:

    • A "real" robot with authentic hardware credentials
    • An "impostor" robot with copied metadata but different hardware keys
  2. Demonstrates the challenge-response process:

    • Generates a random challenge
    • Both robots attempt to sign the challenge
    • Verifies signatures to prove authenticity
  3. Shows how hardware-based authentication can:

    • Verify genuine robots
    • Detect impostors even if they copy visible identifiers

🔧 Add-on: STM32 Hardware Simulation

This optional add-on demonstrates how the challenge-response system could work with actual robot hardware using an STM32 microcontroller simulation.

Prerequisites for Hardware Simulation

  • Docker Desktop

Setting Up Hardware Simulation

  1. Install Docker Desktop:
# Using brew on macOS
brew install --cask docker

# Or download from Docker website
  1. Start Docker Desktop and verify installation:
docker --version
docker-compose --version
  1. Build the simulation environment:
docker-compose up -d

Running Hardware Tests

  1. Test challenge-response with simulated hardware:
npm run test:simulation
  1. View simulation logs:
docker-compose logs -f

Licence

MIT

About

Challenge-Response Demo for ERC-7777

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published