{"id":13600826,"url":"https://github.com/dawsbot/satoshi-bitcoin","last_synced_at":"2025-05-16T06:31:29.076Z","repository":{"id":35282233,"uuid":"39543116","full_name":"dawsbot/satoshi-bitcoin","owner":"dawsbot","description":"Convert precisely between Satoshi and Bitcoin","archived":false,"fork":false,"pushed_at":"2024-05-20T05:48:30.000Z","size":111,"stargazers_count":42,"open_issues_count":1,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-11-07T03:42:19.401Z","etag":null,"topics":["bitcoin","crypto","satoshi"],"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/dawsbot.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":"2015-07-23T03:13:14.000Z","updated_at":"2024-03-05T13:54:25.000Z","dependencies_parsed_at":"2023-02-12T08:15:39.007Z","dependency_job_id":"792604d1-a900-4074-9a72-1cb002680e08","html_url":"https://github.com/dawsbot/satoshi-bitcoin","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fsatoshi-bitcoin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fsatoshi-bitcoin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fsatoshi-bitcoin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dawsbot%2Fsatoshi-bitcoin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dawsbot","download_url":"https://codeload.github.com/dawsbot/satoshi-bitcoin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225411493,"owners_count":17470246,"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":["bitcoin","crypto","satoshi"],"created_at":"2024-08-01T18:00:49.446Z","updated_at":"2024-11-19T19:18:01.721Z","avatar_url":"https://github.com/dawsbot.png","language":"JavaScript","funding_links":[],"categories":["BTC"],"sub_categories":["Libraries"],"readme":"# satoshi-bitcoin\n\n![](https://badgen.net/bundlephobia/min/satoshi-bitcoin)\n[![🧪 npm test](https://github.com/dawsbot/satoshi-bitcoin/actions/workflows/test.yml/badge.svg)](https://github.com/dawsbot/satoshi-bitcoin/actions/workflows/test.yml)\n[![npm version](https://badge.fury.io/js/satoshi-bitcoin.svg)](http://badge.fury.io/js/satoshi-bitcoin)\n\n\u003e npm module to convert between Satoshi and Bitcoin \u003cb\u003ewith lightweight precision\u003c/b\u003e.\n\n\u003cbr\u003e\n\n## The Problem\n\n![The problem](http://i.imgur.com/H1Ck3bF.png)\n\n\u003cbr\u003e\n\n## Install\n\n```bash\nnpm install --save satoshi-bitcoin\n\n# OR\n\nyarn add satoshi-bitcoin\n```\n\n\u003cbr\u003e\n\n## Usage\n\n#### Node.js\n\n```js\nvar sb = require(\"satoshi-bitcoin\");\n\nsb.toSatoshi(1);\n//=\u003e100000000\n\nsb.toBitcoin(100000000);\n//=\u003e1\n```\n\n\u003cbr\u003e\n\n#### Web\n\n```html\n\u003c!-- package injected as \"sb\" --\u003e\n\u003cscript src=\"https://rawgit.com/dawsonbotsford/satoshi-bitcoin/master/index.bundle.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  console.log(\"One Satoshi equals \" + sb.toBitcoin(1) + \" Bitcoin\");\n\u003c/script\u003e\n```\n\n\u003cbr\u003e\n\nOr download it with `npm install --save satoshi-bitcoin` and reference it as:\n\n```html\n\u003cscript src=\"node_modules/satoshi-bitcoin/index.bundle.js\"\u003e\u003c/script\u003e\n```\n\n\u003cbr\u003e\n\n### Error Handling\n\n```javascript\ntry {\n  sb.toSatoshi(false); //Throws TypeError\n} catch (err) {\n  console.log(err);\n}\n```\n\n\u003cbr\u003e\n\n## API\n\n`sb.toSatoshi(number || string)`\n`sb.toBitcoin(number || string)`\n\n[Read more on the Wiki](https://github.com/dawsonbotsford/satoshi-bitcoin/blob/master/wiki/index.md)\n\n\u003cbr\u003e\n\n## FAQ\n\n- What is a Satoshi?\n\n  - Satoshi is to Bitcoin as pennies are to the dollar. Except that there are 100,000,000 Satoshi in one Bitcoin.\n\n- Why do I need a module when I can just divide or multiply by 100,000,000?\n  - [See here](http://repl.it/zlF/4) - Floating point errors are a problem. So `satoshi-bitcoin` uses a tiny bignum library (big.js) to ensure accurate conversions!\n\n\u003cbr\u003e\n\n## Tests\n\n```bash\nnpm test\n```\n\n\u003cbr\u003e\n\n## License\n\nMIT © [Dawson Botsford](https://dawsbot.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawsbot%2Fsatoshi-bitcoin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdawsbot%2Fsatoshi-bitcoin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdawsbot%2Fsatoshi-bitcoin/lists"}