{"id":18369857,"url":"https://github.com/cawfree/react-native-helios","last_synced_at":"2025-04-06T18:32:35.814Z","repository":{"id":63390424,"uuid":"567504604","full_name":"cawfree/react-native-helios","owner":"cawfree","description":"⚛️ A fast, secure, and portable light client for Ethereum dApps.","archived":false,"fork":false,"pushed_at":"2023-05-16T15:43:57.000Z","size":1281,"stargazers_count":86,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-04T14:38:33.617Z","etag":null,"topics":["client","decentralized","ethereum","ethers","helios","json","light","mobile","network","portal","rpc","trustless"],"latest_commit_sha":null,"homepage":"https://twitter.com/cawfree","language":"TypeScript","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/cawfree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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-11-17T23:42:54.000Z","updated_at":"2025-03-22T16:41:10.000Z","dependencies_parsed_at":"2024-11-05T23:34:54.101Z","dependency_job_id":null,"html_url":"https://github.com/cawfree/react-native-helios","commit_stats":{"total_commits":158,"total_committers":2,"mean_commits":79.0,"dds":0.006329113924050667,"last_synced_commit":"98dd652e57ecfc358c029d5c5fd0608d42c0b01a"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-helios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-helios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-helios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cawfree%2Freact-native-helios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cawfree","download_url":"https://codeload.github.com/cawfree/react-native-helios/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247531349,"owners_count":20953937,"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":["client","decentralized","ethereum","ethers","helios","json","light","mobile","network","portal","rpc","trustless"],"created_at":"2024-11-05T23:32:42.001Z","updated_at":"2025-04-06T18:32:34.073Z","avatar_url":"https://github.com/cawfree.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-helios\n\n\u003e ⚠️ Currently `react-native-helios` only supports execution on iOS, MacOS, Android and Expo.\n\nThroughout the majority of [__Ethereum__](https://ethereum.org/en/)'s history, frontend applications have been forced to rely upon centralized interfaces like [__Infura__](https://www.infura.io/) to access the decentralized network. This is because to act as a meaningful participant to the network, such as an entity capable of submitting transactions or maintaining a verifiable history the network state, the protocol's current design [__demands high device specifications__](https://youtu.be/0stc9jnQLXA?t=136) that are insurmountable for even top-end mobile devices.\n\nThis reliance on third party infrastructure typically aided the delivery of ethereum frontend applications, but is subject to the pitfalls of all centralized systems; susceptibility to downtime and subservience to censorship and monetization.\n\n## Introducing [`helios`](https://github.com/a16z/helios)! 👋\n\n[__Helios__](https://github.com/a16z/helios) is an innovative new [__light client__](https://ethereum.org/en/developers/docs/nodes-and-clients/) for Ethereum which is minimal enough to run on mobile devices or even from within [__React Native__](https://reactnative.dev) applications.\n\nThe key property enabled by `helios`, compared to traditional light clients, is the level of trustlessness.\n\nWhere contemporary light clients merely _defer_ responsibility to a more powerful node, [`helios`](https://github.com/a16z/helios) is capable of maintaining the state of the decentralized network autonomously by _inferring_ the validity of the chain header by assessing the validity of the proof sequence that constitutes the canonical chain.\n\nMuch like the proposed design of the [__Portal Network__](https://www.ethportal.net/), [`helios`](https://github.com/a16z/helios) need only trust a potentially untrustworthy block header proof provider just _once_ in order to quickly synchronize with canonical Ethereum chain, verify it's validity, and transact as an independent network participant.\n\n[__❯ Learn more__](https://a16zcrypto.com/building-helios-ethereum-light-client/)\n\n## `react-native-helios` ⚛️\n\n[`react-native-helios`](https://github.com/cawfree) is a [__React Native__](https://reactnative.dev) wrapper for [`helios`](https://github.com/a16z/helios):\n\n```sh\nyarn add react-native-helios\n```\n\nTo instantiate a trustless [__JSON-RPC__](https://ethereum.org/en/developers/docs/apis/json-rpc/#:~:text=JSON%2DRPC%20is%20a%20stateless,many%20various%20message%20passing%20environments.), we merely need to call the `start()` method:\n\n```typescript\nimport { start, StartParams } from 'react-native-helios';\n\nconst params: StartParams = {\n  untrusted_rpc_url:\n    'https://eth-mainnet.g.alchemy.com/v2/\u003cyour-alchemy-key\u003e', // source of initial proofs\n  consensus_rpc_url: 'https://www.lightclientdata.org',\n};\n\nconst { shutdown } = await start(params);\n\nconsole.log(\"Ready!\");\n\n// ...\n\nawait shutdown();\n```\n\nThis will establish a JSON-RPC on your device running at `http://127.0.0.1:8485`, which can then be interacted like usual using [`ethers`](https://github.com/ethers-io/ethers.js/):\n\n```typescript\nimport { Platform } from 'react-native';\nimport { ethers } from 'ethers';\nimport { getHeliosProvider } from 'react-native-helios';\n\nconst provider = getHeliosProvider(params);\n\nconst [blockNumber, balance] = await Promise.all([\n  provider.getBlockNumber(),\n  provider.getBalance('cawfree.eth'),\n]);\n\nconsole.log(\n  `Block number is: ${blockNumber} and balance is ${ethers.utils.formatEther(\n    balance\n  )}Ξ!`\n);\n```\n\nYou can also define a weak subjectivity `checkpoint` using the `checkpoint` parameter of `StartParams`. If you're unsure of a value to use, you can use: `fallbackCheckpoint(network: Network)`:\n\n```typescript\nimport { fallbackCheckpoint, start } from 'react-native-helios';\n\nconst params: StartParams = {...};\nconst checkpoint = await fallbackCheckpoint(params);\n\nawait start({ ...params, checkpoint: fallbackCheckpoint });\n```\n\n\u003e **Warning**\n\u003e\n\u003e If a `checkpoint` is not manually specified, the `fallbackCheckpoint` will be used. Please be aware of the [__potential dangers__](https://github.com/a16z/helios#using-helios-as-a-library) in the implicit trust assumptions of doing so.\n\n## Building from source 🏗\n\n\u003e __Note__ Currently, [`react-native-helios`](https://github.com/cawfree/react-native-helios) may only be compiled on Apple Silicon.\n\n1. Make sure you've installed [`rustup`](https://www.rust-lang.org/tools/install):\n\n```shell\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\n2. Clone and build [`react-native-helios`](https://github.com/cawfree/react-native-helios):\n\n```shell\ngit clone https://github.com/cawfree/react-native-helios\ncd react-native-helios\nyarn ; yarn heliosup\n```\n\n\u003e For iOS, we leverage [`swift-bridge`](https://github.com/chinedufn/swift-bridge) and [`cargo-lipo`](https://github.com/TimNN/cargo-lipo) to automatically generate a [__Swift__](https://developer.apple.com/swift/)-compatible [__Native Module__](https://reactnative.dev/docs/native-modules-intro) which bridges into the original [__Rust__](https://www.rust-lang.org/) client. To support the `arm64` architecture for both simulated and physical iOS devices, the target-specific static libraries are repackaged into an [`XCFramework`](https://medium.com/trueengineering/xcode-and-xcframeworks-new-format-of-packing-frameworks-ca15db2381d3).\n\u003e\n\u003e For Android, we use [`flapigen`](https://github.com/Dushistov/flapigen-rs) and [`rifgen`](https://docs.rs/rifgen/latest/rifgen/) to synthesize a runtime-compatible interface. Currently, only the build architectures `arm64_v8a` and `x86_64` are supported.\n\u003e\n\n3. Finally, run the [__Example Project__](./example).\n\n## Building with [Expo](https://expo.dev/) 📲\n\n1. You can install to your project using `npx expo install react-native-helios`.\n2. Next, you'll need to add the Helios plugin to your Expo config (`app.json`, `app.config.json` or `app.config.js`):\n\n```diff\n{\n  \"expo\": {\n    \"name\": \"my-app\",\n+   \"plugins\": [\n+     \"react-native-helios\"\n+   ]\n  }\n}\n```\n3. Once that's done, use `npx expo prebuild` to generate Expo-friendly native binaries.\n4. Finally, run `eas build` to build a new binary, or use `yarn ios` or `yarn android` to start running.\n\n\u003e Note:\n\u003e To run `eas build`, you'll need to `npm install --global expo-cli eas-cli`.\n\n## License ✌️\n[__MIT__](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawfree%2Freact-native-helios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcawfree%2Freact-native-helios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcawfree%2Freact-native-helios/lists"}