A Node.js application with Express.js framework and ethers.js for Ethereum interactions.
- Express.js web server
- JSON API endpoints
- Health check endpoint
- Environment variable support
- Ethers.js integration for Ethereum blockchain interactions
- EIP-712 typed data signing support
- Node.js (version 14 or higher)
- npm
- Clone the repository or navigate to the project directory
- Install dependencies:
npm install
Start the development server:
npm startOr run directly with Node:
node index.jsThe application will be available at http://localhost:3000
GET /- Welcome messageGET /health- Health check endpointPOST /ethereum/wallet- Create a new Ethereum walletPOST /ethereum/sign-typed-data- Sign EIP-712 typed dataPOST /ethereum/execute-contract- Execute smart contract with EIP-712 signaturePOST /ethereum/prepare-record-transaction- Prepare transaction data for MetaMaskPOST /ethereum/deploy-contract- Deploy smart contractPOST /ethereum/swap-tokens- Execute token swapPOST /ethereum/prepare-swap-tokens- Prepare swap transaction dataPOST /ethereum/prepare-provide-funds- Prepare funds transaction dataGET /ethereum/get-trades- Get all stored tradesGET /ethereum/trade-count- Get trade countGET /ethereum/trades-by-hash- Get trade by hash
POST /circle/wallet-sets- Create a new wallet setGET /circle/wallet-sets- Get all wallet setsGET /circle/wallet-sets/:walletSetId- Get specific wallet set by ID
npm start- Start the applicationnpm test- Run tests (to be implemented)npm run dev- Start in development mode with nodemon
Create a .env file in the root directory with the following variables:
PORT- Server port (default: 3000)CIRCLE_API_KEY- Circle API key for wallet operations (required for Circle endpoints)CIRCLE_ENTITY_SECRET- Circle entity secret for wallet set creation (required for Circle endpoints)ETHEREUM_RPC_URL- Ethereum RPC URL (default: http://localhost:8545)
See config.example.env for an example configuration file.
- express - Web framework
- ethers - Ethereum library for interacting with the blockchain
- @circle-fin/developer-controlled-wallets - Circle Developer Controlled Wallets SDK
- dotenv - Environment variable loader
eip712/
├── index.js # Main application file
├── package.json # Project configuration
├── README.md # Project documentation
└── .gitignore # Git ignore file
This project includes ethers.js for:
- Creating and managing Ethereum wallets
- Signing EIP-712 typed data
- Interacting with smart contracts
- Sending transactions
- Reading blockchain data