{"id":15091159,"url":"https://github.com/arrjunpradeep/ethereum-batch-processing-sdk","last_synced_at":"2026-01-04T21:47:01.994Z","repository":{"id":251327228,"uuid":"836900931","full_name":"ArrjunPradeep/ethereum-batch-processing-sdk","owner":"ArrjunPradeep","description":"A NestJS application designed for batch processing of blockchain transactions, including sending coins and tokens, and retrieving gas estimation data. Built using Clean Architecture principles for modularity and scalability. Features a well-defined structure with separate layers for application logic, business logic, and infrastructure concerns","archived":false,"fork":false,"pushed_at":"2024-08-03T09:09:23.000Z","size":331,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-28T20:49:29.954Z","etag":null,"topics":["clean-architecture","docker","docker-compose","docker-image","dockerhub","dockerhub-image","ethereum","ethers","etherscan","ethersjs","foundry","nestjs","openapi","postgresql","sepolia","swagger","typeorm","typescript"],"latest_commit_sha":null,"homepage":"","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/ArrjunPradeep.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":"2024-08-01T19:46:27.000Z","updated_at":"2024-10-19T04:35:47.000Z","dependencies_parsed_at":"2024-11-28T21:32:00.711Z","dependency_job_id":null,"html_url":"https://github.com/ArrjunPradeep/ethereum-batch-processing-sdk","commit_stats":{"total_commits":60,"total_committers":1,"mean_commits":60.0,"dds":0.0,"last_synced_commit":"b0f5b6aa955ee6a626daf94ea92d8718ef2abac8"},"previous_names":["arrjunpradeep/ethereum-batch-processing-sdk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArrjunPradeep%2Fethereum-batch-processing-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArrjunPradeep%2Fethereum-batch-processing-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArrjunPradeep%2Fethereum-batch-processing-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ArrjunPradeep%2Fethereum-batch-processing-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ArrjunPradeep","download_url":"https://codeload.github.com/ArrjunPradeep/ethereum-batch-processing-sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235834939,"owners_count":19052512,"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":["clean-architecture","docker","docker-compose","docker-image","dockerhub","dockerhub-image","ethereum","ethers","etherscan","ethersjs","foundry","nestjs","openapi","postgresql","sepolia","swagger","typeorm","typescript"],"created_at":"2024-09-25T10:36:01.163Z","updated_at":"2026-01-04T21:47:01.967Z","avatar_url":"https://github.com/ArrjunPradeep.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blockchain Transaction Service\n\n## Overview\n\nThe Blockchain Transaction Service is a `NestJS` application designed to facilitate batch processing of blockchain transactions. It supports sending coins and tokens, as well as retrieving gas estimation data for transactions. The service is built with a `clean architecture` approach, incorporating modules for separation of concerns and scalability.\n\n## Clean Architecture\n\nClean Architecture is a software design principle aimed at creating systems that are easy to maintain and scale. In this project, Clean Architecture principles are applied to achieve the following:\n\n- **Separation of Concerns**: Each layer of the application is responsible for a distinct part of the system, making it easier to manage and evolve the codebase.\n  - **Application Layer**: Contains API controllers and application modules, focusing on handling requests and responses.\n  - **Core Layer**: Encapsulates the core business logic and domain models, ensuring that the application's core functionality is independent of external systems.\n  - **Infrastructure Layer**: Manages interactions with external systems such as databases and blockchain services, allowing the core and application layers to remain unaffected by changes in infrastructure.\n\n- **Dependency Inversion**: Higher-level modules (such as core business logic) do not depend on lower-level modules (such as infrastructure). Instead, both depend on abstractions (interfaces), which allows for easier testing and modification.\n\n- **Modularity**: The project is organized into well-defined modules, each with a specific responsibility. This modularity enhances readability and maintainability.\n\n- **Scalability**: The structure allows for the easy addition of new features and integration of new technologies without disrupting existing functionality.\n\nFor more detailed information on Clean Architecture and its principles, refer to [Robert C. Martin's \"Clean Architecture\"](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html)\n\n\n## Features\n\n- **`Send Coins`**: Process batch transactions for sending coins.\n- **`Send Tokens`**: Handle batch transactions for sending tokens.\n- **`Gas Estimation`**: Retrieve gas estimation data for transaction processing.\n\n## Folder Descriptions\n\n### `application`\n\n- **Purpose**: Contains application-specific logic, including API controllers, application modules, and server setup.\n- **Subfolders**:\n  - `api/http-rest/controller`: Manages HTTP request handling, including request validation and documentation.\n    - `documentation/common`: Contains common documentation utilities like `HttpError.ts`.\n    - `documentation/transaction`: Contains API body definitions for transaction-related endpoints.\n  - `di`: Dependency injection modules that configure and manage dependencies for the application.\n    - `infrastructure.module.ts`: Configures infrastructure-related dependencies.\n    - `root.module.ts`: Entry point for dependency injection configuration.\n    - `transaction.module.ts`: Configures dependencies related to transaction use cases.\n  - `server.application.ts`: Entry point for the application server, where the application is initialized and started.\n\n### `core`\n\n- **Purpose**: Contains the core business logic and domain models of the application.\n- **Subfolders**:\n  - `common/usecase`: Defines common use cases used across the application.\n    - `Usecase.ts`: Base class or interface for use cases.\n  - `domain/transaction`: Contains transaction-related business logic and domain models.\n    - `di/TransactionDITokens.ts`: Dependency injection tokens for transaction-related services.\n    - `entity`: Defines domain entities related to transactions.\n      - `transaction.entity.ts`: Core transaction entity.\n      - `type/createTransactionEntityPayload.ts`: Type definitions for creating transaction entities.\n    - `port`: Defines ports (interfaces) for transaction persistence and use cases.\n      - `persistence/TransactionRepository.port.ts`: Interface for transaction repository.\n      - `usecase`: Interfaces for use cases related to transactions.\n        - `gasEstimator.port.ts`: Interface for gas estimation use cases.\n        - `sendCoin.port.ts`: Interface for sending coin use cases.\n        - `sendToken.port.ts`: Interface for sending token use cases.\n    - `usecase`: Contains implementations of use cases.\n      - `dto/TransactionUseCase.dto.ts`: Data transfer objects for transaction use cases.\n      - `gasEstimator.usecase.ts`: Implementation of the gas estimation use case.\n      - `sendCoin.usecase.ts`: Implementation of the send coin use case.\n      - `sendToken.usecase.ts`: Implementation of the send token use case.\n  - `service/transaction/usecase`: Contains service implementations for transaction-related use cases.\n    - `gasEstimator.service.ts`: Service for gas estimation.\n    - `sendCoin.service.ts`: Service for sending coins.\n    - `sendToken.service.ts`: Service for sending tokens.\n\n### `infrastructure`\n\n- **Purpose**: Contains the implementations for infrastructure concerns such as database access and external services.\n- **Subfolders**:\n  - `adapter/ethereum`: Contains the implementation of Ethereum-related services.\n    - `ethereumTransaction.module.ts`: Module configuration for Ethereum transaction services.\n    - `ethereumTransaction.service.ts`: Service for interacting with the Ethereum blockchain.\n  - `adapter/persistence/typeorm`: Contains TypeORM-related implementations.\n    - `entity/typeOrmTransaction.ts`: TypeORM entity for transactions.\n    - `repository/transaction/typeOrmTransactionRepository.ts`: Repository implementation for TypeORM transactions.\n    - `usecase/transaction`: Contains adapters that map between use case ports and infrastructure implementations.\n      - `gasEstimator.adapter.ts`: Adapter for gas estimation use cases.\n      - `sendCoin.adapter.ts`: Adapter for send coin use cases.\n      - `sendToken.adapter.ts`: Adapter for send token use cases.\n  - `config`: Contains configuration files for various parts of the application.\n    - `app.config.ts`: Application configuration settings.\n    - `blockchain.config.ts`: Configuration for blockchain-related settings.\n    - `database.config.ts`: Configuration for database settings.\n    - `index.ts`: Aggregates and exports configuration modules.\n\n### `main.ts`\n\n- **Purpose**: The main entry point of the application where the server is initialized and started.\n\n## Naming Conventions\n\n- **`application`**: Represents the application layer, including controllers, modules, and server configuration.\n- **`core`**: Contains the core business logic and domain models. This layer defines the use cases and domain entities.\n- **`infrastructure`**: Manages the interaction with external systems and databases, including implementation details for persistence and external services.\n\n## BatchTransfer Smart Contract\nThis project utilizes the BatchTransfer smart contract, which is responsible for handling batch transactions on the blockchain. The smart contract is implemented in a separate repository and is an integral part of this service.\n\n### Repository Link\nBatchTransfer Smart Contract: [BatchTransfer](https://github.com/ArrjunPradeep/batch-transfer-erc20-contract)\n\n### Integration\nThe BatchTransfer smart contract integrates with the Blockchain Transaction Service to facilitate efficient processing of multiple transactions in a single batch. For detailed information on how to use or deploy the BatchTransfer smart contract, refer to its dedicated repository.\n\n## Installation\n\n### Prerequisites\n\n- `Docker`\n\n### Setup\n\n1. **Pull the Image from `Docker Hub`**\n   ```bash\n   docker pull arrjunpradeep/sdk:latest\n   docker pull postgres:13.15-alpine\n   ```\n\n2. **Create a Network**\n   ```bash\n   docker network create my-network\n   ```\n\n3. **Ensure You Have the Required Environment Files**\n\n   Create an `env` folder in the root of your project with the following files:\n\n   * `app.env` : \n   ```bash\n   APP_HOST=0.0.0.0\n   APP_PORT=3369\n   API_SECRET_KEY=safle\n   ```\n\n   * `blockchain.env` : \n   ```bash\n   NODE_URL=XXXXX\n   PRIVATE_KEY=XXXXX\n   EXPLORER_API_KEY=XXXXX\n   CHAIN_ID=sepolia\n   BATCH_CONTRACT=XXXXX\n   ```\n\n   * `database.env` : \n   ```bash\n   POSTGRES_TYPE=postgres\n   POSTGRES_HOST=postgres_db\n   POSTGRES_PORT=5432\n   POSTGRES_DB=XXXXX\n   POSTGRES_USER=XXXXX\n   POSTGRES_PASSWORD=XXXXX\n   POSTGRES_SYNCHRONIZE=false\n   POSTGRES_AUTO_LOAD_ENTITIES=true\n   ```\n   \n\n4. **Run PostgreSQL Container**\n   ```bash\n   docker run -d --name postgres_db --network my-network --env-file ./env/database.env -p 5432:5432 postgres:13.15-alpine\n   ```\n\n5. **Run Application Container**\n   ```bash\n   docker run -d --name sdk --network my-network  --env-file ./env/app.env --env-file ./env/blockchain.env -p 3369:3369 arrjunpradeep/sdk:latest\n   ```\n\n6. **Check Container Logs**\n   ```bash\n   docker logs sdk\n   docker logs postgres_db\n   ```\n\n7. **Access API Documentation**\n\n   To test our SDK, go to http://localhost:3369/swagger for API documentation and testing\n\n   You need to provide the API_SECRET_KEY mentioned in `app.env` for accessing the endpoints through Swagger.\n\n   ![alt text](image.png)\n\n- ***Notes :***\n\n   *****Ensure your .env files (app.env, blockchain.env, and database.env) are correctly configured and located in the ./env directory. The PostgreSQL container should be up and running before the application container to avoid connectivity issues.*****","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrjunpradeep%2Fethereum-batch-processing-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farrjunpradeep%2Fethereum-batch-processing-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrjunpradeep%2Fethereum-batch-processing-sdk/lists"}