HTTP API на NestJS, которое проксирует запросы к узлам EVM и Cosmos.
Требования: Node 18.20.4, npm, git.
git clone https://github.com/Romanafanasyev/blockchain-gateway.git
cd blockchain-gateway
npm install
cp .env.example .env
npm run start:devSwagger: http://localhost:3000/docs
Health:
curl http://localhost:3000/health-
GET /evm/block/:height
Вход: height целое число >= 0
Выход: height, hash, parentHash, gasLimit, gasUsed, size -
GET /evm/transactions/:hash
Вход: 0x + 64 hex
Выход: hash, to, from, value, input, maxFeePerGas, maxPriorityFeePerGas, gasPrice -
GET /cosmos/block/:height
Вход: height целое число >= 0
Выход: height, time, hash, proposedAddress -
GET /cosmos/transactions/:hash
Вход: 64 hex без 0x Выход: hash, height, time, gasUsed, gasWanted, fee, sender
EVM:
curl http://localhost:3000/evm/block/175136924
curl http://localhost:3000/evm/transactions/0x1b14ec07580efe24d4c040481164be74656294ce276639c88b02d9d46e824120Cosmos:
curl http://localhost:3000/cosmos/block/175140829
curl http://localhost:3000/cosmos/transactions/137004447D9D62246A396371C32B85B2C2B299DB7B156408D7A2E33A5C9E8BF7/
README.md
.env.example
package.json
tsconfig*.json
nest-cli.json
/src
main.ts - bootstrap, ValidationPipe, Swagger
app.module.ts - сборка модулей
/common
common.module.ts - общие провайдеры
logger/ - winston + ротация, http-лог
filters/ - формат ошибок
pipes/ - PositiveInt, Evm/Cosmos hash
utils/ - evm hex utils
/evm
evm.controller.ts - /evm/* + swagger
evm.service.ts - маппинг, 1 rpc на блок
evm.rpc.service.ts - JSON-RPC клиент
types/ - rpc/view типы, константы
/cosmos
cosmos.controller.ts - /cosmos/* + swagger
cosmos.service.ts - маппинг
cosmos.rpc.service.ts - /block (+fallback /commit), tx REST
types/ - rpc типы
/health
health.controller.ts - /health
/test
unit/ - pipes, evm, cosmos
e2e/ - health, evm, cosmos
npm run test
npm run test:e2e- Ethereum JSON-RPC: https://ethereum.github.io/execution-apis/api-documentation/
- Cosmos SDK: https://docs.cosmos.network/
- SEI RPC: https://sei-m.rpc.n0ok.net:443