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.
- Node.js (v14+ recommended)
- npm (comes with Node.js)
- A wallet with some test ETH on BASE Sepolia Testnet
- Clone this repository:
git clone https://github.com/JamesEBall/erc-7777-challenge-demo
cd erc-7777-challenge-demo
- Install dependencies:
npm install
- Create a
.env
file in the root directory:
touch .env
- 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:
- For RPC URL: Chainlist
- For wallet: Export your private key from MetaMask (without the '0x' prefix)
- Get test ETH from Base Sepolia Faucet
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
- Compile contracts:
npx hardhat compile
Remove old con
- Deploy single robot:
npx hardhat run scripts/deploy.js --network base-sepolia
- Run full challenge-response demo:
npx hardhat run scripts/robot-challenge-demo.js --network base-sepolia
-
Deploys two robot contracts:
- A "real" robot with authentic hardware credentials
- An "impostor" robot with copied metadata but different hardware keys
-
Demonstrates the challenge-response process:
- Generates a random challenge
- Both robots attempt to sign the challenge
- Verifies signatures to prove authenticity
-
Shows how hardware-based authentication can:
- Verify genuine robots
- Detect impostors even if they copy visible identifiers
This optional add-on demonstrates how the challenge-response system could work with actual robot hardware using an STM32 microcontroller simulation.
- Docker Desktop
- Install Docker Desktop:
# Using brew on macOS
brew install --cask docker
# Or download from Docker website
- Start Docker Desktop and verify installation:
docker --version
docker-compose --version
- Build the simulation environment:
docker-compose up -d
- Test challenge-response with simulated hardware:
npm run test:simulation
- View simulation logs:
docker-compose logs -f
MIT