{"id":25703413,"url":"https://github.com/dashpay/dashd-rpc","last_synced_at":"2025-04-30T06:46:06.335Z","repository":{"id":37789806,"uuid":"95724582","full_name":"dashpay/dashd-rpc","owner":"dashpay","description":"Dash Client Library to connect to Dash Core (dashd) via RPC","archived":false,"fork":false,"pushed_at":"2024-07-09T10:52:50.000Z","size":355,"stargazers_count":16,"open_issues_count":6,"forks_count":67,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-30T06:45:41.376Z","etag":null,"topics":["backend","dapi","platform"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/dashpay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2017-06-29T01:02:26.000Z","updated_at":"2024-07-09T10:52:24.000Z","dependencies_parsed_at":"2024-06-18T18:22:29.637Z","dependency_job_id":null,"html_url":"https://github.com/dashpay/dashd-rpc","commit_stats":null,"previous_names":["dashevo/dashd-rpc","dashevo/bitcoind-rpc-dash"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fdashd-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fdashd-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fdashd-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dashpay%2Fdashd-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dashpay","download_url":"https://codeload.github.com/dashpay/dashd-rpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658195,"owners_count":21622819,"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":["backend","dapi","platform"],"created_at":"2025-02-25T05:29:19.438Z","updated_at":"2025-04-30T06:46:06.304Z","avatar_url":"https://github.com/dashpay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dashd-rpc\n\n[![Build Status](https://github.com/dashevo/dashd-rpc/actions/workflows/test.yml/badge.svg)](https://github.com/dashevo/dashd-rpc/actions/workflows/test.yml)\n[![NPM Package](https://img.shields.io/npm/v/@dashevo/dashd-rpc.svg)](https://www.npmjs.org/package/@dashevo/dashd-rpc)\n\nDash Client Library to connect to Dash Core (dashd) via RPC\n\n## Install\n\ndashd-rpc runs on [node](http://nodejs.org/), and can be installed via [npm](https://npmjs.org/):\n\n```bash\nnpm install @dashevo/dashd-rpc\n```\n\n## Usage\n\n### RpcClient\n\nConfig parameters : \n\n\t- protocol : (string - optional) - (default: 'https') - Set the protocol to be used. Either `http` or `https`.\n\t- user : (string - optional) - (default: 'user') - Set the user credential.\n\t- pass : (string - optional) - (default: 'pass') - Set the password credential.\n\t- host : (string - optional) - (default: '127.0.0.1') - The host you want to connect with.\n\t- port : (integer - optional) - (default: 9998) - Set the port on which perform the RPC command.\n\nPromise vs callback based\n\n  - `require('@dashevo/dashd-rpc/promise')` to have promises returned\n  - `require('@dashevo/dashd-rpc')` to have callback functions returned\n\t\n### Examples\n\nConfig:\n\n```javascript\nvar config = {\n    protocol: 'http',\n    user: 'dash',\n    pass: 'local321',\n    host: '127.0.0.1',\n    port: 19998\n};\n```\n\nPromise based:\n\n```javascript\nvar RpcClient = require('@dashevo/dashd-rpc/promise');\nvar rpc = new RpcClient(config);\n\nrpc.getRawMemPool()\n    .then(ret =\u003e {\n        return Promise.all(ret.result.map(r =\u003e rpc.getRawTransaction(r)))\n    })\n    .then(rawTxs =\u003e {\n        rawTxs.forEach(rawTx =\u003e {\n            console.log(`RawTX: ${rawTx.result}`);\n        })\n    })\n    .catch(err =\u003e {\n        console.log(err)\n    })\n```\n\nCallback based (legacy):\n\n```javascript\nvar run = function() {\n  var bitcore = require('@dashevo/dashcore-lib');\n  var RpcClient = require('@dashevo/dashd-rpc');\n  var rpc = new RpcClient(config);\n\n  var txids = [];\n\n  function showNewTransactions() {\n    rpc.getRawMemPool(function (err, ret) {\n      if (err) {\n        console.error(err);\n        return setTimeout(showNewTransactions, 10000);\n      }\n\n      function batchCall() {\n        ret.result.forEach(function (txid) {\n          if (txids.indexOf(txid) === -1) {\n            rpc.getRawTransaction(txid);\n          }\n        });\n      }\n\n      rpc.batch(batchCall, function(err, rawtxs) {\n        if (err) {\n          console.error(err);\n          return setTimeout(showNewTransactions, 10000);\n        }\n\n        rawtxs.map(function (rawtx) {\n          var tx = new bitcore.Transaction(rawtx.result);\n          console.log('\\n\\n\\n' + tx.id + ':', tx.toObject());\n        });\n\n        txids = ret.result;\n        setTimeout(showNewTransactions, 2500);\n      });\n    });\n  }\n\n  showNewTransactions();\n};\n```\n\n### Help\n\nYou can dynamically access to the help of each method by doing\n\n```\nconst RpcClient = require('@dashevo/dashd-rpc');\nvar client = new RPCclient({\n    protocol:'http',\n    user: 'dash',\n    pass: 'local321', \n    host: '127.0.0.1', \n    port: 19998,\n    timeout: 1000\n});\n\nvar cb = function (err, data) {\n    console.log(data)\n};\n\n// Get full help\nclient.help(cb);\n\n// Get help of specific method\nclient.help('getinfo',cb);\n```\n\n## Contributing\n\nFeel free to dive in! [Open an issue](https://github.com/dashevo/dash-std-template/issues/new) or submit PRs.\n\n## License\n\n[MIT](LICENSE) \u0026copy; Dash Core Group, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashpay%2Fdashd-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdashpay%2Fdashd-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdashpay%2Fdashd-rpc/lists"}