{"id":35241313,"url":"https://github.com/mr-zwets/bchn-api-wrapper","last_synced_at":"2026-01-24T16:26:12.066Z","repository":{"id":258954537,"uuid":"875262109","full_name":"mr-zwets/bchn-api-wrapper","owner":"mr-zwets","description":"a Typescript wrapper for interacting with the Bitcoin Cash Node (BCHN) API","archived":false,"fork":false,"pushed_at":"2025-12-19T21:38:51.000Z","size":133,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T10:36:01.535Z","etag":null,"topics":["bitcoin-cash","bitcoin-cash-node","bitcoincash","bitcoind"],"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/mr-zwets.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-19T14:15:11.000Z","updated_at":"2025-12-19T21:38:54.000Z","dependencies_parsed_at":"2025-08-19T12:08:43.198Z","dependency_job_id":"59e7c295-eef4-4636-b80f-79ddffd15ac2","html_url":"https://github.com/mr-zwets/bchn-api-wrapper","commit_stats":null,"previous_names":["mr-zwets/bchn-api-wrapper"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/mr-zwets/bchn-api-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-zwets%2Fbchn-api-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-zwets%2Fbchn-api-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-zwets%2Fbchn-api-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-zwets%2Fbchn-api-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mr-zwets","download_url":"https://codeload.github.com/mr-zwets/bchn-api-wrapper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mr-zwets%2Fbchn-api-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28731232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T10:24:43.181Z","status":"ssl_error","status_checked_at":"2026-01-24T10:24:36.112Z","response_time":89,"last_error":"SSL_read: 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-cash","bitcoin-cash-node","bitcoincash","bitcoind"],"created_at":"2025-12-30T05:03:16.489Z","updated_at":"2026-01-24T16:26:12.058Z","avatar_url":"https://github.com/mr-zwets.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BCHN-API-Wrapper\n\nThis library is a Typescript wrapper for interacting with the Bitcoin Cash Node (BCHN) RPC and REST interfaces.\n\n## Compatibility\n\nRPC and REST interface types compatible with **BCHN v29.0.0**.\n\n## Features\n\nThe library is a simple wrapper for using the BCHN REST and RPC-endpoints in a type-safe way.\n\nThe library is designed to be easy to use and get started with.\n\nThe library has good documentation, automated tests and zero dependencies.\n\n## Details\n\nThe `BchnRestClient` uses a class with unique methods for each of the endpoints.\n\nThe `BchnRpcClient` uses a request function which uses generics to type arguments and responses.\n\nThe **REST API** is ideal for **read-only** access to general blockchain information such as transactions, blocks, and UTXO data. In contrast, the **RPC API** allows for **full interaction** with the Bitcoin Cash node, including managing the built-in wallet, sending transactions, performing mining operations, and issuing control commands like pruning or stopping the node. While the REST API provides 11 endpoints, the RPC API offers a much broader set of 136 commands.\n\n## Configuration\n\nTo use the RPC and REST APIs on your BCHN node, you need to enable them in your node's configuration file.\n\n\u003cdetails\u003e\n  \u003csummary\u003eBCHN Configuration\u003c/summary\u003e\n  In the BCHN '.conf' file add the following settings:\n\n  ```bash\n    server=1\n    rest=1\n    txindex=1\n    rpcuser=rpcuser\n    rpcpassword=rpcpassword\n    rpcallowip=127.0.0.1\n    rpcport=8332\n  ```\n\n  To learn more about the `.conf` settings, see the [BCHN documentation](https://docs.bitcoincashnode.org/doc/bitcoin-conf/).\n\u003c/details\u003e\n\nNote that the REST-endpoints can be made public, but the RPC-endpoints should never be made public. If you want to use the RPC-endpoints of your own node remotely, you need a secure connection using SSL/TLS to encrypt your communication and protect your credentials and data from being exposed. Additionally, ensure you have strong, unique RPC credentials (username and password) set in your node's configuration file.\n\n## Install\n\nInstall the BCHN-API-Wrapper from NPM with:\n\n```bash\npnpm install @mr-zwets/bchn-api-wrapper\n```\n\n## REST usage\n\nThe `BchnRestClient` is a wrapper over the 11 BCHN REST-endpoints. For the list of the BCHN REST-endpoints see the [REST documentation](https://docs.bitcoincashnode.org/doc/REST-interface/).\n\nThe `RestClientConfig` object accepts optional parameters for `logger` \u0026 `timeoutMs`\n\n### REST example\n\n```ts\nimport { BchnRestClient, RestClientConfig } from 'bchn-api-wrapper'\n\n// Create the RestClientConfig\nconst clientOptions: RestClientConfig = {\n  url: \"http://localhost:8332\",\n}\n// Instantiate the REST client to query your BCHN node\nconst restClient = new BchnRestClient(clientOptions)\n\n// Get the latest blockhash\nconst chainInfo = await restClient.getChainInfo()\nconst latestBlockHash = chainInfo.bestblockhash\nconsole.log(`The latest blockhash is ${latestBlockHash}`)\n\n// Get block info with includeTxDetails flag\nconst fullBlockInfo = await restClient.getBlock(latestBlockHash, true)\nconsole.log(JSON.stringify(fullBlockInfo))\n```\n\n## RPC usage\n\nThe `BchnRpcClient` is a thin type-wrapper over the actual RPC endpoints, with request interfaces for each endpoint. For a complete list of all BCHN RPC-endpoints see the [RPC documentation](https://docs.bitcoincashnode.org/doc/json-rpc/).\n\nThe `RpcClientConfig` object accepts optional parameters for `logger`, `timeoutMs`, `retryDelayMs` \u0026 `maxRetries`\n\nThe library does not currently support making batched RPC requests.\n\n### RPC example\n\n```ts\nimport { BchnRpcClient, RpcClientConfig, GetBestBlockHash, GetBlockVerbosity1 } from 'bchn-api-wrapper'\n\n// Create the RpcClientConfig\nconst clientOptions: RpcClientConfig = {\n  url: \"http://localhost:8332\",\n  rpcUser: \"rpcUser\",\n  rpcPassword: \"rpcPassword\"\n}\n// Instantiate the RPC client to query your BCHN node\nconst rpcClient = new BchnRpcClient(clientOptions)\n\n// Get the latest blockhash\nconst latestBlockHash = await rpcClient.request\u003cGetBestBlockHash\u003e(\"getbestblockhash\")\nconsole.log(`The latest blockhash is ${latestBlockHash}`)\n\n// Get verbosity1 info about the latest block contents\nconst fullBlockInfo = await rpcClient.request\u003cGetBlockVerbosity1\u003e(\"getblock\", latestBlockHash, 1)\nconsole.log(JSON.stringify(fullBlockInfo))\n```\n\n### Run Tests\n\nThe library has automated tests using vitest, run the testing suite with:\n\n```bash\npnpm run test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-zwets%2Fbchn-api-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-zwets%2Fbchn-api-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-zwets%2Fbchn-api-wrapper/lists"}