{"id":21815758,"url":"https://github.com/bitcoin-com/cashaccounts","last_synced_at":"2025-04-14T00:53:46.121Z","repository":{"id":40941934,"uuid":"184497509","full_name":"Bitcoin-com/cashaccounts","owner":"Bitcoin-com","description":"Cash Accounts","archived":false,"fork":false,"pushed_at":"2023-07-12T00:20:14.000Z","size":466,"stargazers_count":3,"open_issues_count":20,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T14:55:25.000Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Bitcoin-com.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":"2019-05-02T00:04:09.000Z","updated_at":"2023-11-14T10:26:33.000Z","dependencies_parsed_at":"2024-11-27T19:15:13.430Z","dependency_job_id":null,"html_url":"https://github.com/Bitcoin-com/cashaccounts","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/Bitcoin-com%2Fcashaccounts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bitcoin-com%2Fcashaccounts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bitcoin-com%2Fcashaccounts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bitcoin-com%2Fcashaccounts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bitcoin-com","download_url":"https://codeload.github.com/Bitcoin-com/cashaccounts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804784,"owners_count":21164131,"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":"2024-11-27T15:22:39.423Z","updated_at":"2025-04-14T00:53:46.096Z","avatar_url":"https://github.com/Bitcoin-com.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cash Accounts javascript library\n\n## Human readable account names for Bitcoin Cash\n\nCashaccounts allow you to use aliases to send Bitcoin Cash and Tokens instead of\nhaving to type out or memorize things like\n`bitcoincash:qp3wjpa3tjlj042z2wv7hahsldgwhwy0rq9sywjpyy`. They look like\n`Jonathan#100`; The username followed by the number (based on block height\nregistration).\n\n## Installation\n\n```\n  npm i cashaccounts\n```\n\n## Usage\n\nThe library will default to using the cashaccounts.bchdata.cash lookup server, but if\nyou run your own you can pass in the url as the first parameter. Note,\nregistrations cost some satoshis to broadcast and the funds are subsidied by the\nnode running the lookup server. This library contains methods for a trusted\nsetup like the 3rd party cashaccount api, as well as methods for trustless\nsetups for more advanced users who do only want to rely on the data from their\nown node.\n\n```\n  const cashAccountClass = require('cashaccounts');\n  const cashAccounts = new cashAccountClass(url, nodeCredentials) // both optional\n```\n\nThe `url` defaults to `https://cashaccounts.bchdata.cash`. the `nodeCredentials`\nobject looks like\n\n```\n{\n  host: 'example.com', // or ip\n  username: 'admin',\n  password: 'password1',\n  port: 1234,\n  timeout: 3000\n}\n```\n\n### Trusted methods\n\n#### trustedRegistration(username, bchAddress, slpAddress)\n\nreturns\n\n```\n{\n  txid: \"0e436928cb4370be2f46258ace2c70e81e4cc67d88cb75805c…\",\n  hex: \"0100000001cd90df45fba8dc4940eb72eb349a67ea63f9e451…\"\n}\n```\n\n#### trustedLookup(handle) // jonathan#100\n\nreturns\n\n```\n{\n  \"identifier\": \"tokenAware#15874;\",\n  \"information\": {\n    \"emoji\": \"🐙\",\n    \"name\": \"tokenAware\",\n    \"number\": 15874,\n    \"collision\": {\n      \"hash\": \"2091441002\",\n      \"count\": 0,\n      \"length\": 0\n  },\n  \"payment\": [\n      {\n        \"address\": \"bitcoincash:qrry6f92p7x3q4np05xhv5krssdw0q0aaq3sq20mh4\",\n        \"type\": \"Key Hash\"\n      },\n      {\n        \"address\":\"simpleledger:qr932wdxkqdavp27y4pthxn7sf0awuwd7y2swnjm5m\",\n        \"type\":\"Key Hash\"\n      }\n    ]\n  }\n}\n```\n\nhandles can include the collision hash noted with a `.`.\n\nFor example;\n\ntrustedLookup(ectest#1106.9871360083)\n\n#### trustedBitdbLookup(handle) // jonathan#100\n\nreturns\n\n```\n{\n  \"identifier\": \"Jonathan#100;\",\n  \"information\": {\n    \"emoji\": \"☯\",\n    \"name\": \"Jonathan\",\n    \"number\": 100,\n    \"collision\": {\n    \"hash\": \"5876958390\",\n    \"count\": 0,\n    \"length\": 0\n  },\n  \"payment\": [\n      {\n        \"address\": \"bitcoincash:qr4aadjrpu73d2wxwkxkcrt6gqxgu6a7usxfm96fst\",\n        \"type\": \"Key Hash\"\n      }\n    ]\n  }\n}\n```\n\n#### accountLookupViaTxid(txid)\n\nreturns\n\n```\n{\n  \"blockhash\" : \"00000000000000000331f42d43f6a460e1bb634bd2e16a1fad9dbdf80beae100\",\n  \"blockheight\" : 581590,\n  \"data\" : \"01249a7741ea9f5106a9d25f156a348ee554688606\",\n  \"name\" : \"account1\",\n  \"opreturn\" : \"OP_RETURN 01010101 6163636f756e7431 01249a7741ea9f5106a9d25f156a348ee554688606  01dd4913aaef64d4e523fcb0034c41f85947590dc0\",\n  \"transactionhash\" : \"ca53a8c0f4af966a36ad9e5022c0d53f132caf4bbbafc4e0ebbc471bb4e261e5\"\n}\n```\n\n### Trustless methods\n\nrequires your own node via passing in the `nodeCredentials` object.\n\n#### trustlessLookup(handle) // jonathan#100\n\nreturns\n\n```\n{\n  \"identifier\": \"Jonathan#100;\",\n  \"information\": {\n    \"emoji\": \"☯\",\n    \"name\": \"Jonathan\",\n    \"number\": 100,\n    \"collision\": {\n    \"hash\": \"5876958390\",\n    \"count\": 0,\n    \"length\": 0\n  },\n  \"payment\": [\n      {\n        \"address\": \"bitcoincash:qr4aadjrpu73d2wxwkxkcrt6gqxgu6a7usxfm96fst\",\n        \"type\": \"Key Hash\"\n      }\n    ]\n  }\n}\n```\n\n### Utils\n\n#### splitHandle(handle)\n\nreturns an object with the username, number, and collision\n\n```\n{\n  username: 'jonathan',\n  number: '100',\n  collision: false\n}\n```\n\n#### isCashAccount(handle)\n\nreturns boolean\n\n## References\n\nOfficial Website [https://www.cashaccount.info](https://www.cashaccount.info/).\n\nLookup Server\n[https://gitlab.com/cash-accounts/lookup-server](https://gitlab.com/cash-accounts/lookup-server).\n\nYou can read the full spec\n[https://gitlab.com/cash-accounts/specification/blob/master/SPECIFICATION.md](https://gitlab.com/cash-accounts/specification/blob/master/SPECIFICATION.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoin-com%2Fcashaccounts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoin-com%2Fcashaccounts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoin-com%2Fcashaccounts/lists"}