DEV Community

wiesiek karpinskoi
wiesiek karpinskoi

Posted on

I built DeFi contracts as portable, sealed .js files — no blockchain require

The problem I wanted to solve

Every DeFi tool I found required: a wallet, gas fees, a specific
blockchain, and trusting someone else's infrastructure.

I wanted something different — a contract you own completely.
One file, runs locally, no permissions needed.

What I built

AiDEFi forges self-contained DeFi contracts as single .js files.

node my-dex.aico.js call listPools
node my-dex.aico.js call swap ETH USDC 1.5 0
node my-wallet.aico.js call send 0xRecipient 100
Enter fullscreen mode Exit fullscreen mode

No blockchain. No gas. Runs anywhere Node.js runs.

The core concept: Freedom Computer Contract

Each generated file has three properties:

1. Cryptographic seal (SHA-256)
The file contains a SEAL field — a hash of its own source.
Any modification invalidates the seal. The network layer
verifies it on every write.

2. Local state
All data lives in .state.json on your machine.
You control the file, you control the data.

3. Zero external dependencies
One CJS bundle. Copy it to a USB drive, run it offline.

20 contract templates

TOKEN, VAULT, DEX, LOAN, STAKING, NFT, WALLET, CASINO,
FOREX, SYNTH, LEND, MULTISIG, ESCROW, ORACLE, and more.

The DEX supports up to 8 independent x*y=k pools per contract
plus flash loans. The WALLET generates a real secp256k1 EVM
keypair — works on Ethereum, Polygon, BSC, Arbitrum.

The Dream parser

This is the part I find most interesting. You describe what
you want in plain English:

"DEX with ETH/USDC and BTC/USDC pools, 0.3% fee, cyberpunk dashboard"

The parser extracts the spec and forges the contract.
No Solidity. No Yul. No bytecode.

HTML dashboards

Every contract gets a built-in HTML dashboard served at:

GET /contracts/:id/ui
Enter fullscreen mode Exit fullscreen mode

4 visual styles: cyberpunk, modern, minimal, retro.

Tech stack

  • Node.js CJS bundle (contracts)
  • Express 5 + PostgreSQL (API server)
  • React + Vite (frontend)
  • SHA-256 via Node built-in crypto

Try it

https://de-fi-powerhouse.replit.app/

Early access is $10 — I'm at the feedback stage and genuinely
want to know what breaks and what's confusing.

Happy to answer questions about the architecture in the comments.

Top comments (0)