Skip to content

tlapata/walletet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeFi RPC Interface (Hyperswarm + Hypercore)

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.


Features

Wallet Management

  • Generates a unique wallet for each user
  • Securely stores private keys
  • Uses Hypercore / Hyperbee for persistent storage

Transaction Module

Handles interactions with the DeFi protocol:

  • Read operations (protocol state)
  • Write operations (e.g., staking, transactions)

RPC Interface

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

Tech Stack

  • JavaScript (Node.js)
  • Hypercore
  • Hyperbee
  • Hyperswarm RPC
  • HyperDHT
  • EVM testnet

Project Structure

/db
  rpc-server/
  rpc-client/

wallet.js        # wallet generation & storage
protocol.js      # DeFi protocol interaction
server.js        # RPC server
client.js        # RPC client example

Setup

1. Install dependencies

npm install

Install HyperDHT globally:

npm install -g hyperdht

2. Start a bootstrap DHT node

hyperdht --bootstrap --host 127.0.0.1 --port 30001

This creates a local distributed hash table network used for RPC discovery.


3. Run the RPC server

node server.js

The server will output a public key, which clients use to connect.


4. Run the RPC client

Update the client with the server's public key and run:

node client.js

Example RPC Action

Example request payload:

{
  "user": "0xUserAddress",
  "amount": "25.6"
}

Example response:

{
  "tx": "0xTransactionHash"
}

Limitations / Future Improvements

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

Notes

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.

About

JavaScript backend for interacting with a DeFi protocol on an EVM testnet, featuring secure multi-user wallet management with Hypercore/Hyperbee and a Hyperswarm RPC interface for protocol reads, writes, and transaction history.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors