{"id":24823071,"url":"https://github.com/arjun-r34/btc_utils","last_synced_at":"2025-03-25T22:22:55.876Z","repository":{"id":40813579,"uuid":"278571942","full_name":"ARJUN-R34/btc_utils","owner":"ARJUN-R34","description":"This is an SDK to generate a BECH32 BTC wallet (mainnet and testnet) and also perform transactions.","archived":false,"fork":false,"pushed_at":"2023-01-07T19:57:59.000Z","size":961,"stargazers_count":0,"open_issues_count":5,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T19:48:12.357Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ARJUN-R34.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}},"created_at":"2020-07-10T07:45:45.000Z","updated_at":"2022-10-30T16:37:43.000Z","dependencies_parsed_at":"2023-02-07T23:45:24.890Z","dependency_job_id":null,"html_url":"https://github.com/ARJUN-R34/btc_utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARJUN-R34%2Fbtc_utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARJUN-R34%2Fbtc_utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARJUN-R34%2Fbtc_utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ARJUN-R34%2Fbtc_utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ARJUN-R34","download_url":"https://codeload.github.com/ARJUN-R34/btc_utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245551266,"owners_count":20634000,"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":[],"created_at":"2025-01-30T19:46:51.796Z","updated_at":"2025-03-25T22:22:55.847Z","avatar_url":"https://github.com/ARJUN-R34.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitcoin Transaction\n\nThis package can be used to generate Bech32 Bitcoin wallets and also transact on the Bitcoin testnet.\n\n### Methods\n\n1. generateP2PKH()\n2. generateBECH32()\n3. signAndSendTransaction()\n4. generateTestAccounts()\n\n### Installation\n\nInstall this package using,\n```npm install --save btc-utils```\n\nImport this package using,\n```const bitcoin = require('btc-utils');```\n\n### Usage\n\n####  Generate P2PKH Wallet\n\n```const p2pkhWallet = bitcoin.generateP2PKH();```\n\n##### Response\n\n- ```privateKey``` - Private Key of the wallet.\n- ```publicKey``` - Public Key of the wallet.\n- ```address``` - Address of the wallet.\n\n#### Generate BECH32 Wallet\n\n```const bech32Wallet = bitcoin.generateBECH32();```\n\n##### Response\n\n- ```privateKey``` - Private Key of the wallet.\n- ```publicKey``` - Public Key of the wallet.\n- ```privateKeyWIF``` - Private key in WIF (Wallet Import Format).\n- ```address``` - Address of the wallet.\n\n#### Generate Bitcoin Test Wallet\n\n```const testWallet = bitcoin.generateTestAccounts();```\n\n##### Response\n\n- ```private``` - Private Key of the wallet.\n- ```public``` - Public Key of the wallet.\n- ```address``` - Address of the wallet.\n- ```wif``` - Private key in WIF (Wallet Import Format).\n\n#### Bitcoin Transaction (Testnet)\n\n```const btcTx = bitcoin.signAndSendTransaction({ fromAddress, toAddress, value, privateKeyWIF });```\n\n##### Parameters\n\n- ```fromAddress``` - Address of the wallet to send the transaction from (sender).\n- ```toAddress``` - Address of the wallet to send the transaction to (recepient).\n- ```value``` - Amount of Bitcoins (in satoshis).\n- ```privateKeyWIF``` - Private key of the sender in WIF (Wallet Import Format).\n\n#### Success Response\n\n```response: {transactionHash} - Transaction Hash of that particular transaction.```\n\n#### Error Response\n\n##### Insufficient balance\n\n```error: 'Insufficient funds.'```\n\n##### Incorrect private key\n\n```error: 'Incorrect private Key.'```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farjun-r34%2Fbtc_utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farjun-r34%2Fbtc_utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farjun-r34%2Fbtc_utils/lists"}