A simple smart contract demonstration deployed on Arbitrum Sepolia testnet.
This project contains a simple smart contract that is deployed on the Arbitrum Sepolia testnet.
See the various deployments on https://sepolia.arbiscan.io/ Creator Wallet Address: 0xdb4Bf427b1546c462EF83620e2d2AaF8c781c5eB
- 0xd4fe0aDEf0a62398b629Da0620E079F0D487bBd2
- 0x7675DA30Bcc226DFC4bbCE43bCAA441C88934d73
- 0x82b7896234Dcc5A4256657D1A9efa5879D8e5Ff6
View contracts at (https://sepolia.arbiscan.io/address/0x82b7896234Dcc5A4256657D1A9efa5879D8e5Ff6)[https://sepolia.arbiscan.io/address/0x82b7896234Dcc5A4256657D1A9efa5879D8e5Ff6]
- 0x86475277CE05B5E217E695FA585468219905F864
- HelloWorld smart contract with message storage and update functionality
- Deployment scripts for Arbitrum Sepolia
- Update scripts to modify the message in the deployed contract
- Balance checking utility
- Node.js v18.20.4 (recommended, managed via nvm)
- npm or yarn
- An Ethereum wallet with some Arbitrum Sepolia testnet ETH
- Clone this repository
- Install dependencies:
npm install
- Create a
.env
file based on.env.example
with your own API URL and private key:Note: Never commit your actualAPI_URL = "YOUR_ALCHEMY_API_URL" PRIVATE_KEY = "YOUR_WALLET_PRIVATE_KEY"
.env
file to version control!
./run-hardhat.sh run scripts/deploy.js --network arbitrumSepolia
./update-contract.sh <CONTRACT_ADDRESS> "Your new message"
./run-hardhat.sh run scripts/check-balance.js --network arbitrumSepolia
Users are able to sign up and authenticate with MetaMask on Arbitrum Sepolia. The project includes:
AuthenticatedHelloWorld.sol
extends the original HelloWorld contract with:
- User registration with usernames
- MetaMask signature-based authentication
- Nonce system to prevent replay attacks
- Events for tracking authentication activities
scripts/deploy-authenticated.js
: Hardhat deployment script for the new contractdeploy-authenticated.sh
: Bash script to easily deploy the contract to Arbitrum Sepolia
See the /web
directory for a complete web application with funcctionality to:
- Connect with MetaMask
- Register with a username
- Authenticate using cryptographic signatures
- Update and view the contract message
- Transaction history tracking
The web/README.md
file has instructions to spin up local instance of webui for interacting with authentication smart contract
-
Deploy the Contract
./deploy-authenticated.sh
This will deploy the AuthenticatedHelloWorld contract to Arbitrum Sepolia and provide you with the contract address.
-
Update the Web App
./update-web-contract-address.sh YOUR_CONTRACT_ADDRESS
This will update the web application with your deployed contract address.
-
Serve the Web Application
cd web npm install npm start
Then open http://localhost:3000 in your browser to interact with your contract.
-
Authenticate with MetaMask
- Connect your MetaMask wallet to the application
- Register with a username
- Authenticate by signing a message with your wallet
- Update the contract message and perform other actions
This implementation provides a secure, blockchain-based authentication system that leverages the cryptographic capabilities of MetaMask without requiring users to share their private keys or pay for gas on every login (only registration and initial authentication require gas).
- Always use a dedicated development wallet with minimal funds for testing
- Never use your main wallet's private key in development environments
- Keep your
.env
file secure and never commit it to version control