{"id":33588101,"url":"https://github.com/hummusonrails/fortune-generator","last_synced_at":"2026-05-11T10:33:24.866Z","repository":{"id":278903379,"uuid":"934619568","full_name":"hummusonrails/fortune-generator","owner":"hummusonrails","description":"Fortune Generator powered by Arbitrum","archived":false,"fork":false,"pushed_at":"2025-02-18T06:09:42.000Z","size":622,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-01T11:16:39.060Z","etag":null,"topics":["arbitrum","arbitrum-stylus","dapp","react"],"latest_commit_sha":null,"homepage":"","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/hummusonrails.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":"2025-02-18T06:09:24.000Z","updated_at":"2025-02-18T06:10:35.000Z","dependencies_parsed_at":"2025-02-22T12:49:36.448Z","dependency_job_id":"bad3d469-c397-4bfd-a16f-bf9ddbcd2df9","html_url":"https://github.com/hummusonrails/fortune-generator","commit_stats":null,"previous_names":["hummusonrails/fortune-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hummusonrails/fortune-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hummusonrails%2Ffortune-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hummusonrails%2Ffortune-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hummusonrails%2Ffortune-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hummusonrails%2Ffortune-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hummusonrails","download_url":"https://codeload.github.com/hummusonrails/fortune-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hummusonrails%2Ffortune-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32890673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["arbitrum","arbitrum-stylus","dapp","react"],"created_at":"2025-11-29T11:04:44.757Z","updated_at":"2026-05-11T10:33:24.854Z","avatar_url":"https://github.com/hummusonrails.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fortune Generator on Arbitrum\n\nThis is an example of building a full-stack dApp on Arbitrum using [Arbitrum Stylus](https://docs.arbitrum.io/stylus/reference/overview) to write the smart contract in Rust and [ethers.js](https://docs.ethers.io) to interact with the contract from the React + Vite frontend.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./readme-images/app-screenshot-1.png\" width=\"50%\"\u003e\n\u003c/p\u003e\n\nThe dApp consists of a smart contract that stores a reference to a fortune string and allows users to set and get the fortune, and a frontend that allows users to interact with the contract by fetching a random fortune.\n\n## Getting Started\n\n### Prerequisites\n\nYou need to have the following installed locally:\n\n- [Rust toolchain](https://www.rust-lang.org/tools/install)\n- [cargo stylus](https://github.com/OffchainLabs/cargo-stylus)\n- [npm](https://www.npmjs.com/get-npm)\n- [Docker](https://www.docker.com/products/docker-desktop)\n- [Foundry CLI](https://getfoundry.sh/)\n- [Nitro Devnode](https://docs.arbitrum.io/run-arbitrum-node/run-nitro-dev-node)\n\n### Running the dApp\n\n#### Smart Contract + Devnode\n\nThe frontend is currently written to interact with the smart contract deployed on Nitro devnode, which is a locally run Arbitrum testnet that comes with a pre-funded wallet address available for testing and experimentation. In order to deploy and interact with the smart contract you need to have the Nitro devnode running.\n\nFollow the instructions in the [Nitro Devnode documentation](https://docs.arbitrum.io/run-arbitrum-node/run-nitro-dev-node) to start the Nitro devnode.\n\nOnce the devnode is up and running continue with the following steps:\n\n1. Deploy the contract\n\nYou will be using the pre-funded wallet address to deploy the contract and can simply copy and paste the following command to do so, assuming you have already installed `cargo stylus`:\n\n```bash\ncargo stylus deploy \\\n  --endpoint='http://localhost:8547' \\\n  --private-key=\"0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659\"\n```\n\nMake sure to copy and store the address of the contract deployed on the devnode as you will add it shortly to the frontend. The output from the above command will return something like this:\n\n```bash\ndeployed code at address: 0x33f54de59419570a9442e788f5dd5cf635b3c7ac\n```\n\nThe address `0x33f54de59419570a9442e788f5dd5cf635b3c7ac` is the address of the deployed contract in this example.\n\n2. Generate fortune references on chain\n\nNow that your contract is deployed, you need to create some references stored on chain to fortune strings that the frontend will fetch when a user clicks the \"Get Fortune\" button. You can do this by running the following command, make sure you have the [Foundry CLI](https://getfoundry.sh/) installed:\n\n```bash\ncast send --rpc-url 'http://localhost:8547' \\\n  --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 \\\n  [deployed-contract-address] \"mintFortune(uint32)\" 45\n```\n\nReplace `[deployed-contract-address]` with the address of the contract you deployed in the previous step, also removing the square brackets. This command will generate a fortune reference at index 45. \n\nRun this command several times changing the index to generate more fortune references.\n\nWhen you are done you can check to see how many fortune references have been generated by running the following command:\n\n```bash\ncast call --rpc-url 'http://localhost:8547' \\\n  [deployed-contract-address] \"totalMintedValue()\"\n```\n\nRemember to replace `[deployed-contract-address]` with the address of the contract you deployed in the previous step.\n\n#### Frontend\n\nNow that the contract is deployed and you have generated some fortune references on chain, you can run the frontend to interact with the contract.\n\n1. Start the frontend dev server\n\nNavigate to the `fortune-frontend` directory and run the following commands:\n\n```bash\nnpm install\nnpm run dev\n```\n\nThis will install the dependencies and start the frontend dev server. You can now navigate to `http://localhost:5173` in your browser to interact with the dApp.\n\n2. Add the contract address to the frontend\n\nYou are not quite done yet, you need to add the address of the deployed contract to the frontend. Open the `fortune-frontend/src/App.tsx` file and replace the value of the `contractAddress` with the address of the contract you deployed on the Nitro devnode.\n\n```typescript\nconst contractAddress = 'your-contract-address';\n```\n\nThe frontend will automatically update itself when you save the file, you do not need to restart the server.\n\n3. Interact with the dApp\n\nYou can now interact with the dApp by clicking the \"Generate Fortune\" button to fetch a random fortune from the contract. The fortune will be displayed on the screen.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhummusonrails%2Ffortune-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhummusonrails%2Ffortune-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhummusonrails%2Ffortune-generator/lists"}