{"id":20811204,"url":"https://github.com/andromedatechnology/ethereum-observer-api","last_synced_at":"2026-05-08T05:47:41.049Z","repository":{"id":249782215,"uuid":"417030209","full_name":"AndromedaTechnology/ethereum-observer-api","owner":"AndromedaTechnology","description":" 🔭 Simple block and transaction tracker for Ethereum network. ","archived":false,"fork":false,"pushed_at":"2022-12-13T02:54:18.000Z","size":283,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-18T14:46:01.286Z","etag":null,"topics":["ethereum","hardhat","solidity","typescript"],"latest_commit_sha":null,"homepage":"https://andromeda.technology","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AndromedaTechnology.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-14T07:23:54.000Z","updated_at":"2022-12-14T23:53:19.000Z","dependencies_parsed_at":"2024-07-23T10:39:58.387Z","dependency_job_id":null,"html_url":"https://github.com/AndromedaTechnology/ethereum-observer-api","commit_stats":null,"previous_names":["andromedatechnology/ethereum-observer-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndromedaTechnology%2Fethereum-observer-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndromedaTechnology%2Fethereum-observer-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndromedaTechnology%2Fethereum-observer-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndromedaTechnology%2Fethereum-observer-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndromedaTechnology","download_url":"https://codeload.github.com/AndromedaTechnology/ethereum-observer-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243158972,"owners_count":20245669,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","hardhat","solidity","typescript"],"created_at":"2024-11-17T20:37:49.953Z","updated_at":"2025-12-26T05:04:26.614Z","avatar_url":"https://github.com/AndromedaTechnology.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eEthereum Observer API\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://ethereum-observer-api.andromeda.technology\"\u003e\u003cimg src=\"./storage/static/hero.jpg\"  alt=\"Ethereum Observer API\" /\u003e\u003c/a\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://ethereum-observer-api.andromeda.technology\"\u003eSimple tracker for Ethereum Network\u003c/a\u003e\n  \u003cbr /\u003e\n  \u003ca href=\"https://ethereum-observer-api.andromeda.technology\"\u003ehttps://ethereum-observer-api.andromeda.technology\u003c/a\u003e\n\u003c/p\u003e\n\nSimple `block and transaction tracker` for [Ethereum network](https://ethereum.org).\n\nUses a `Smart Contract` to save a short summary for each day (**check the [Smart Contract repository](https://github.com/AndromedaTechnology/ethereum-observer-contract-hardhat)**).\n\nUse it as a `scalable boilerplate for communication with the Ethereum network` and/or a learning resource.\n\n## 1. Technology\n\n- [TypeScript](https://www.typescriptlang.org/),\n- [Koa.js](https://koajs.com/),\n- Database: [MongoDB](https://www.mongodb.com/): [Mongoose](https://mongoosejs.com/),\n- Config: [Dotenv](https://www.npmjs.com/package/dotenv), [Joi](https://joi.dev/),\n- Testing: [Jest](https://jestjs.io/): SuperTest, MongoDBMemoryServer,\n- [Docker](https://www.docker.com/): MongoDB, Redis.\n\n**Blockchain**\n\n- Ethereum,\n- Smart Contract: [Solidity](https://docs.soliditylang.org/),\n  - only this app can write to the Contract,\n  - anyone can read it's state.\n\n**Communication with the Ethereum Network**\n\n- Using [ethers.js](https://docs.ethers.io/v5/) for calls to Ethereum network,\n- Subscribing to [events](https://docs.ethers.io/v5/api/providers/provider/#Provider--events),\n  - Event: `block`: new block is mined.\n\n## 2. Usage\n\n1. Clone the repo,\n2. Duplicate `.env.example` files in [`./`,`/docker/`] to `.env`; modify as needed,\n3. Have `Docker` [installed](https://www.docker.com/get-started), run the containers and your app (check the instructions below),\n4. Add modules (routes, controllers, services, tests) to `/src`,\n5. List newly added modules (features) here (Readme.md) and in your POSTMAN collection.\n\n### 2.1. Starting/stopping the observer\n\nObserved data will be saved to the local database, and later - to a Smart Contract, as a daily summary.\n\n- Start: `POST [API_PREFIX]/network`\n- Stop: `DELETE [API_PREFIX]/network`\n\n`[API_PREFIX]` is defined in `.env`; defaults to `/api` .\n\n_Note: Use the Postman Collection linked below._\n\n## 3. Features\n\n1. Watches for [block](https://ethereum.org/en/developers/docs/blocks/) creation, stores it in the local DB,\n2. For every created block: pulls all [transactions](https://ethereum.org/en/developers/docs/transactions/) and stores them in the local DB,\n3. For every day that passes: storing [`totalBlockAmount`,`totalGasAmount`] in a simple Smart Contract, using [Solidity](https://docs.soliditylang.org/).\n\nModules\n\n1. Network: start/stop network observation, calling Summary.sync on block creation,\n2. Block: CRUD,\n3. Summary: Calculation, Syncing with the Ethereum Network,\n\nAll API routes are prefixed by `API_PREFIX` (defined in`.env`) (default: `/api`).\n\n## 4. Setup\n\n**Docker**\n\nDocker provides isolated `MongoDB` and `Redis` for your project.\n\n```\ncd ./docker\n\n# Duplicate example env file, modify as needed\ncp .env.example .env\n\ndocker-compose up -d\n```\n\n**Application**\n\n```\n# Return from `docker` to root dir\n# cd ..\n\n# Duplicate example env file, modify if needed\ncp .env.example .env\n\n# Install packages\nnpm i\n\n# Run\nnpm run dev\n```\n\n## 5. Tests\n\nUsing `Jest` Testing Framework.\n\nJest uses `SuperTest` and `MongoDBMemoryServer`.\n\n```\nnpm run test\n```\n\n## 6. Postman\n\n[Postman Documentation](https://documenter.getpostman.com/view/97483/UUy7aPBG)\n\nPre-set environment variables:\n\n- `host`\n- `admin_password`\n\nDynamic environment variables,\nautomatically set in tests:\n\n- `access_token`\n\n## 7. Admin Routes\n\nRoutes can be protected with `jwtCheck` middleware,\nrequiring admin rights.\n\nRequests going to these routes require `Authorization: Bearer {access_token}` header.\n\n**List of protected, i.e. Admin Routes**\n\n1. Message[Create,Update,Delete],\n2. [Add your protected routes here]\n\n**Getting access_token for the Admin user**\n\n- Request endpoint: `POST /auth/token`,\n- Pass your password in the request body: `{ password: ADMIN_PASSWORD }`,\n- Response will return created `token`.\n\nNote: Postman collection will automatically set `access_token` environment variable,\nso you can immediately call admin routes, without copy-pasting it or setting the env variable manually.\n\n**Getting the ADMIN_PASSWORD**\n\n- Your `ADMIN_PASSWORD` is defined in `.env` file.\n- It defaults to `secret`.\n\n## 8. Deployment\n\nIf you use MongoDB Atlas: Uncomment and fill `DB_URI` in `.env`.\n\n## 9. Social\n\nAndromeda\n\n- [Medium](https://medium.com/andromeda-technology)\n- [Twitter](https://twitter.com/andromeda_node)\n\n## 10. Rest\n\nHero image source: [EthereumPrice.org](https://ethereumprice.org).\n\n## 11. Related\n\n[🔭 Ethereum Observer - Smart Contract - Hardhat, TypeScript](https://github.com/AndromedaTechnology/ethereum-observer-contract-hardhat)\n\n- Simple `Ethereum Smart Contract` that stores a `Daily Summary` of **[Ethereum Observer API](https://github.com/AndromedaTechnology/ethereum-observer-api)**,\n- TypeScript,\n- Hardhat,\n- Solidity,\n- Ethers.js,\n- Waffle.\n\n[🚀 FireStarter API - Progressive Startup API Boilerplate](https://github.com/AndromedaTechnology/firestarter-api)\n\n- Easy to extend, Progressive and Scalable API boilerplate to power your startup,\n- TypeScript,\n- Koa.js,\n- MongoDB,\n- Jest,\n- Docker.\n\n[🏄 Habitus - Journal, Habit, Emotion tracker](https://github.com/AndromedaTechnology/habitus)\n\n- State-of-the-art tracker for emotions, habits and thoughts,\n- Healthiest version of you,\n- Gamified,\n- Anonymous and open source.\n\n## 12. Contribute\n\nCheck [Self-Aware Software Artisan](http://selfawaresoftwareartisan.com) before contributing.\n\n\u003cbr/\u003e\n\u003ch5 align=\"center\"\u003e\n  \u003ca href=\"https://startedincroatia.com\"\u003eStarted in Europe, Croatia 🇭🇷\u003c/a\u003e\n\u003c/h5\u003e\n\u003ch3 align=\"center\"\u003e\n  Crafted with ❤️ \u003cbr /\u003e\n  by contributors around the 🌍 World and \u003ca href=\"https://andromeda.technology/\"\u003e🌌 Andromeda\u003c/a\u003e.\n\u003c/h3\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandromedatechnology%2Fethereum-observer-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandromedatechnology%2Fethereum-observer-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandromedatechnology%2Fethereum-observer-api/lists"}