REST API for isolated Hardhat sessions: compile, deploy & interact with Solidity contracts
2.1K
Containerized REST API for spinning up isolated Hardhat development sessions, compiling Solidity contracts, and deploying/interacting with them — no local Hardhat setup required.
.sol files as plain text via HTTPhardhat compile inside the session sandboxdocker run -d -p 3000:3000 -p 8545-8600:8545-8600 meivan/socosi:latest
| Endpoint | Method | Description |
|---|---|---|
/api/start | POST | Start a new session (returns sessionId + RPC URL) |
/api/close/:sessionId | POST | Manually close a session |
/api/upload/:sessionId | POST | Upload a .sol contract |
/api/compile/:sessionId | POST | Compile contracts in the session |
/api/artifact/:sessionId/:fileName/:contractName | GET | Get compiled ABI/bytecode |
/api/deploy/:sessionId/:fileName/:contractName | POST | Deploy a contract |
/api/execute/:sessionId/:fileName/:contractName/:address | POST | Call contract methods (batch supported) |
/api/debug | GET | Inspect active sessions and port usage |
# 1. Start a session
curl -X POST http://localhost:3000/api/start
# 2. Upload a contract
curl -X POST http://localhost:3000/api/upload/<sessionId> \
-H "Content-Type: application/json" \
-d '{"fileName": "Counter.sol", "content": "..."}'
# 3. Compile
curl -X POST http://localhost:3000/api/compile/<sessionId>
# 4. Deploy
curl -X POST http://localhost:3000/api/deploy/<sessionId>/Counter/Counter \
-H "Content-Type: application/json" \
-d '{"args": []}'
# 5. Execute methods
curl -X POST http://localhost:3000/api/execute/<sessionId>/Counter/Counter/<address> \
-H "Content-Type: application/json" \
-d '{"calls": [{"method": "increment", "args": []}]}'
Content type
Image
Digest
sha256:16b2d3daa…
Size
91.2 MB
Last updated
3 months ago
docker pull meivan/socosi