{"id":19537444,"url":"https://github.com/margelo/react-native-bignumber","last_synced_at":"2025-05-15T09:06:22.870Z","repository":{"id":39253847,"uuid":"465639568","full_name":"margelo/react-native-bignumber","owner":"margelo","description":"🔢 The fastest Big Number library for React Native","archived":false,"fork":false,"pushed_at":"2025-02-26T21:17:53.000Z","size":1659,"stargazers_count":358,"open_issues_count":17,"forks_count":16,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-08T12:15:07.403Z","etag":null,"topics":["app","big","bignumber","crypto","cryptography","jsi","library","math","native","number","react","react-native","wallet"],"latest_commit_sha":null,"homepage":"https://margelo.com","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/margelo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2022-03-03T08:52:46.000Z","updated_at":"2025-05-02T17:44:50.000Z","dependencies_parsed_at":"2025-02-19T14:00:55.849Z","dependency_job_id":"66a10488-7986-43fb-a3b8-4d77d20bf10e","html_url":"https://github.com/margelo/react-native-bignumber","commit_stats":{"total_commits":135,"total_committers":4,"mean_commits":33.75,"dds":0.4740740740740741,"last_synced_commit":"56873d9930f47379233edd183eec4454c6d97db3"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-bignumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-bignumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-bignumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/margelo%2Freact-native-bignumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/margelo","download_url":"https://codeload.github.com/margelo/react-native-bignumber/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043263,"owners_count":22004913,"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":["app","big","bignumber","crypto","cryptography","jsi","library","math","native","number","react","react-native","wallet"],"created_at":"2024-11-11T02:27:57.770Z","updated_at":"2025-05-15T09:06:22.864Z","avatar_url":"https://github.com/margelo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://margelo.com\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"./img/banner-dark.png\" /\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"./img/banner-light.png\" /\u003e\n    \u003cimg alt=\"react-native-bignumber\" src=\"./img/banner-light.png\" /\u003e\n  \u003c/picture\u003e\n\u003c/a\u003e\n\n# 🔢 react-native-bignumber\n\nThe fastest Big Number library for React Native.\n\n* 🏎️ Up to 300x faster than all other solutions\n* ⚡️ Lightning fast implementation with pure C++ and JSI\n* 🧪 Well tested in JS and C++ (OpenSSL)\n* 💰 Made for crypto apps and Wallets\n* 🤌 Up to 5x smaller in JS-bundle size\n* 🔢 Store numbers as big as your Phone's RAM can store\n* 🔁 Easy drop-in replacement for [BN.js](https://github.com/indutny/bn.js/)\n\n## Installation\n\n\u003ch3\u003e\n  React Native  \u003ca href=\"#\"\u003e\u003cimg src=\"./img/react-native.png\" height=\"15\" /\u003e\u003c/a\u003e\n\u003c/h3\u003e\n\n```sh\nyarn add react-native-bignumber\ncd ios \u0026\u0026 pod install\n```\n\n\u003ch3\u003e\n  Expo  \u003ca href=\"#\"\u003e\u003cimg src=\"./img/expo.png\" height=\"12\" /\u003e\u003c/a\u003e\n\u003c/h3\u003e\n\n```sh\nexpo install react-native-bignumber\nexpo prebuild\n```\n\n## Usage\n\n### ..as a normal library\n\nThe exposed `BN` class is used to create new BigNumber instances from strings (binary, hex, decimal), ArrayBuffers, Buffers, numbers, or other BigNumber instances.\n\n```ts\nimport { BN } from 'react-native-bignumber'\n\nconst a = new BN(3274556)\nconst b = new BN(9856712)\nconst c = a.mul(b) // 32.276.355.419.872\n```\n\nRefer to [BN.js' documentation](https://github.com/indutny/bn.js/#instructions) for a full API reference and usage guide.\n\nFor example, this is how you calculate large Fibonacci numbers:\n\n```ts\nfunction fibonacci(n: number): BN {\n  let prev = new BN(0)\n  let prevPrev = new BN(1)\n  let number = new BN(1)\n\n  for (let i = 1; i \u003c n; i++) {\n    prevPrev = prev\n    prev = number\n    number = prevPrev.add(prev)\n  }\n\n  return number\n}\n\nconst f = fibonacci(50) // 12.586.269.025\n```\n\n### ..as a drop-in replacement\n\nSince popular libraries like [ethers.js](https://github.com/ethers-io/ethers.js/) or [elliptic](https://github.com/indutny/elliptic) use [BN.js](https://github.com/indutny/bn.js/) under the hood, react-native-bignumber exposes exactly the same API as [BN.js](https://github.com/indutny/bn.js/) so it can be used as a drop-in replacement and promises much greater speed at common crypto operations.\n\nIn your `babel.config.js`, add a module resolver to replace `bn.js` with `react-native-bignumber`:\n\n```diff\n+const path = require('path');\n\nmodule.exports = {\n  presets: ['module:metro-react-native-babel-preset'],\n  plugins: [\n+   [\n+     'module-resolver',\n+     {\n+       alias: {\n+         'bn.js': 'react-native-bignumber',\n+       },\n+     },\n+   ],\n    ...\n  ],\n};\n```\n\nNow, all imports for `bn.js` will be resolved as `react-native-bignumber` instead.\n\nIn the Exodus app, this single line change reduced app launch time by **4 seconds**! 🚀\n\n## Community Discord\n\n[Join the Margelo Community Discord](https://discord.gg/6CSHz2qAvA) to chat about react-native-bignumber or other Margelo libraries.\n\n## Sponsors\n\n\u003ca href=\"https://exodus.com\"\u003e\n  \u003cimg align=\"right\" src=\"img/exodus.svg\" height=\"65\" alt=\"Exodus\" /\u003e\n\u003c/a\u003e\n\nThis library is supported by [**Exodus**](https://exodus.com).\nSend, receive, and exchange Bitcoin and 160+ cryptocurrencies with ease on the world's leading Desktop, Mobile and Hardware crypto wallets: [exodus.com](https://www.exodus.com/)\n\n## Adopting at scale\n\nreact-native-bignumber was built at Margelo, an elite app development agency. For enterprise support or other business inquiries, contact us at \u003ca href=\"mailto:hello@margelo.io?subject=Adopting react-native-bignumber at scale\"\u003ehello@margelo.io\u003c/a\u003e!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmargelo%2Freact-native-bignumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmargelo%2Freact-native-bignumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmargelo%2Freact-native-bignumber/lists"}