{"id":25804438,"url":"https://github.com/mahsumurebe/nestjs-bitcoin-rpc-client","last_synced_at":"2026-05-06T00:03:23.618Z","repository":{"id":63408287,"uuid":"564904666","full_name":"mahsumurebe/nestjs-bitcoin-rpc-client","owner":"mahsumurebe","description":"Bitcoin RPC Client Module for NestJS","archived":false,"fork":false,"pushed_at":"2022-11-26T21:34:55.000Z","size":85,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-19T21:36:22.475Z","etag":null,"topics":["bitcoin","bitcoin-rpc","jsonrpc","nestjs","nestjs-module"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-bitcoin-rpc-client","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mahsumurebe.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-11T19:29:12.000Z","updated_at":"2024-05-03T00:58:36.000Z","dependencies_parsed_at":"2023-01-22T09:00:43.321Z","dependency_job_id":null,"html_url":"https://github.com/mahsumurebe/nestjs-bitcoin-rpc-client","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mahsumurebe/nestjs-bitcoin-rpc-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fnestjs-bitcoin-rpc-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fnestjs-bitcoin-rpc-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fnestjs-bitcoin-rpc-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fnestjs-bitcoin-rpc-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mahsumurebe","download_url":"https://codeload.github.com/mahsumurebe/nestjs-bitcoin-rpc-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mahsumurebe%2Fnestjs-bitcoin-rpc-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bitcoin","bitcoin-rpc","jsonrpc","nestjs","nestjs-module"],"created_at":"2025-02-27T18:31:48.648Z","updated_at":"2026-05-06T00:03:23.602Z","avatar_url":"https://github.com/mahsumurebe.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitcoin RPC Client Module for NestJS\n\nBitcoin RPC Client Module for NestJS.\n\n## Installation\n\nFor installation, you can run the following command in the directory of your project.\n\n```shell script\nnpm install nestjs-bitcoin-rpc-client\n```  \n\n## Getting started with module\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { BitcoinRpcClientModule } from 'nestjs-bitcoin-rpc-client';\n\n@Module({\n  imports: [\n    BitcoinRpcClientModule.forRoot({\n      url: \"http://localhost:8332\"\n    }),\n  ],\n})\nexport class AppModule {\n}\n```\n\nOr with async module loading\n\n```typescript\nimport { Module } from '@nestjs/common';\nimport { ConfigModule, ConfigService } from '@nestjs/config';\nimport { BitcoinRpcClientModule } from 'nestjs-bitcoin-rpc-client';\n\n@Module({\n  imports: [\n    BitcoinRpcClientModule.forRootAsync({\n      imports: [ConfigModule],\n      inject: [ConfigService],\n      useFactory: (configService: ConfigService) =\u003e ({\n        url: configService.get('BITCOIN_RPC_URL'),\n      }),\n    }),\n  ],\n})\nexport class AppModule {\n}\n```\n\n### Configuration\n\nThe module configuration is as follows.\n\n| KEY     | DEFAULT   | DESCRIPTION  | Type              | Required |\n|---------|-----------|--------------|-------------------|----------|\n| url     | null      | RPC HTTP URL | object            | Yes      |\n| headers | null      | HTTP Headers | object            | No       |\n| timeout | 10_000    | Timeout      | number            | No       |\n\n### Using In Project\n\nThe way of use in controller and service is the same. Below is an example of usage within the service.\n\n#### Use RPCService\n\n```typescript\nimport { Inject, Injectable } from '@nestjs/common';\nimport { RPCService } from 'nestjs-bitcoin-rpc-client';\n\n@Injectable()\nexport class FooService {\n  @Inject() protected rpcService: RPCService;\n\n  async getNodeBlockCount(): Promise\u003c{ blockCount: number }\u003e {\n    const blockCount = await this.rpcService.blockchain.getBlockCount();\n    return {\n      blockCount,\n    }\n  }\n}\n```\n\n#### Use Directly Service\n\nYou can also inject RPC groups one by one, which are collected under RPCSService.\n\n```typescript\nimport { Inject, Injectable } from '@nestjs/common';\nimport { BlockchainRpcService } from 'nestjs-bitcoin-rpc-client';\n\n@Injectable()\nexport class FooService {\n  @Inject() protected blockchainRpcService: BlockchainRpcService;\n\n  async getNodeBlockCount(): Promise\u003c{ blockCount: number }\u003e {\n    const blockCount = await this.blockchainRpcService.getBlockCount();\n    return {\n      blockCount,\n    }\n  }\n}\n```\n\n#### Batch Request\n\nThis module supports batch requests. Batch requests must be made within the callback function sent to\n**RpcService.batch** method. The first parameter of the callback function contains the RpcService instance.\n\n```typescript\nimport { Inject, Injectable } from '@nestjs/common';\nimport { RPCService, TransactionInterface } from 'nestjs-bitcoin-rpc-client';\n\n@Injectable()\nexport class FooService {\n  @Inject() protected rpcService: RPCService;\n\n  async getTransactions(): Promise\u003cTransactionInterface[]\u003e {\n    const transactions = await this.rpcService\n      .batch((batchRpcService) =\u003e {\n        batchRpcService.wallet.getTransaction('0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098');\n        batchRpcService.wallet.getTransaction('9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5');\n        batchRpcService.wallet.getTransaction('foo');\n      })\n      .then((allResponse) =\u003e allResponse.map(response =\u003e {\n        if (response instanceof Error) {\n          // You can catch error\n          return response;\n        }\n        return response.result;\n      }));\n\n    console.log(transactions);\n    // [\n    //    {\n    //        \"addresses\": [\n    //            \"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"\n    //        ],\n    //        \"block_height\": -1,\n    //        \"block_index\": -1,\n    //        \"confirmations\": 0,\n    //        \"double_spend\": false,\n    //        \"fees\": 0,\n    //        \"hash\": \"0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098\",\n    //        \"inputs\": [\n    //            {\n    //                \"age\": 0,\n    //                \"output_index\": -1,\n    //                \"script\": \"04ffff001d0104\",\n    //                \"script_type\": \"empty\",\n    //                \"sequence\": 4294967295\n    //            }\n    //        ],\n    //        \"outputs\": [\n    //            {\n    //                \"addresses\": [\n    //                    \"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"\n    //                ],\n    //                \"script\": \"410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac\",\n    //                \"script_type\": \"pay-to-pubkey\",\n    //                \"value\": 5000000000\n    //            }\n    //        ],\n    //        \"preference\": \"low\",\n    //        \"received\": \"2022-11-26T21:23:50.591795236Z\",\n    //        \"relayed_by\": \"44.202.186.4\",\n    //        \"size\": 134,\n    //        \"total\": 5000000000,\n    //        \"ver\": 1,\n    //        \"vin_sz\": 1,\n    //        \"vout_sz\": 1,\n    //        \"vsize\": 134\n    //    },\n    //    {\n    //        \"addresses\": [\n    //            \"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"\n    //        ],\n    //        \"block_height\": -1,\n    //        \"block_index\": -1,\n    //        \"confirmations\": 0,\n    //        \"double_spend\": false,\n    //        \"fees\": 0,\n    //        \"hash\": \"0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098\",\n    //        \"inputs\": [\n    //            {\n    //                \"age\": 0,\n    //                \"output_index\": -1,\n    //                \"script\": \"04ffff001d0104\",\n    //                \"script_type\": \"empty\",\n    //                \"sequence\": 4294967295\n    //            }\n    //        ],\n    //        \"outputs\": [\n    //            {\n    //                \"addresses\": [\n    //                    \"12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX\"\n    //                ],\n    //                \"script\": \"410496b538e853519c726a2c91e61ec11600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781e62294721166bf621e73a82cbf2342c858eeac\",\n    //                \"script_type\": \"pay-to-pubkey\",\n    //                \"value\": 5000000000\n    //            }\n    //        ],\n    //        \"preference\": \"low\",\n    //        \"received\": \"2022-11-26T21:24:42.283438993Z\",\n    //        \"relayed_by\": \"54.85.182.93\",\n    //        \"size\": 134,\n    //        \"total\": 5000000000,\n    //        \"ver\": 1,\n    //        \"vin_sz\": 1,\n    //        \"vout_sz\": 1,\n    //        \"vsize\": 134\n    //    },\n    //    ServerErrorException(3, {\n    //      code: -8,\n    //      message: \"parameter 1 must be of length 64 (not 3, for 'foo')\",\n    //    })\n    // ]\n\n    return transactions;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahsumurebe%2Fnestjs-bitcoin-rpc-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmahsumurebe%2Fnestjs-bitcoin-rpc-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmahsumurebe%2Fnestjs-bitcoin-rpc-client/lists"}