This project implements a multi-user backend interface for interacting with a DeFi protocol on an EVM testnet. The system provides wallet management, transaction handling, and a distributed RPC interface using the Hyper ecosystem.
The project is written entirely in JavaScript and does not include a UI, as interaction is performed through Hyperswarm RPC.
- Generates a unique wallet for each user
- Securely stores private keys
- Uses Hypercore / Hyperbee for persistent storage
Handles interactions with the DeFi protocol:
- Read operations (protocol state)
- Write operations (e.g., staking, transactions)
Users interact with the system via Hyperswarm RPC instead of REST APIs.
Supported RPC actions:
- Execute protocol transactions
- Retrieve user transaction history
- Query protocol state
- JavaScript (Node.js)
- Hypercore
- Hyperbee
- Hyperswarm RPC
- HyperDHT
- EVM testnet
/db
rpc-server/
rpc-client/
wallet.js # wallet generation & storage
protocol.js # DeFi protocol interaction
server.js # RPC server
client.js # RPC client example
npm install
Install HyperDHT globally:
npm install -g hyperdht
hyperdht --bootstrap --host 127.0.0.1 --port 30001
This creates a local distributed hash table network used for RPC discovery.
node server.js
The server will output a public key, which clients use to connect.
Update the client with the server's public key and run:
node client.js
Example request payload:
{
"user": "0xUserAddress",
"amount": "25.6"
}Example response:
{
"tx": "0xTransactionHash"
}Due to time constraints (8 hour limit), the implementation may not include:
- Full transaction history indexing
- Advanced key encryption / key management
- Robust error handling
- Complete DeFi protocol coverage
- Production-ready security and validation
- Automated testing
With more time, these could be addressed by:
- adding encrypted wallet storage
- implementing indexing for faster queries
- adding retries and transaction monitoring
- integrating multiple DeFi actions
This project demonstrates how Hypercore-based infrastructure and Hyperswarm RPC can replace traditional client-server APIs for interacting with blockchain protocols in a distributed environment.