{"id":19155056,"url":"https://github.com/rkdud007/xxfunc","last_synced_at":"2025-04-30T14:09:24.298Z","repository":{"id":253480324,"uuid":"843594772","full_name":"rkdud007/xxfunc","owner":"rkdud007","description":"Serverless function on Reth","archived":false,"fork":false,"pushed_at":"2024-08-22T22:35:28.000Z","size":12972,"stargazers_count":72,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T16:46:36.059Z","etag":null,"topics":["reth","serverless"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rkdud007.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":"2024-08-16T21:44:42.000Z","updated_at":"2025-03-09T22:41:45.000Z","dependencies_parsed_at":"2024-08-23T06:33:42.474Z","dependency_job_id":null,"html_url":"https://github.com/rkdud007/xxfunc","commit_stats":null,"previous_names":["rkdud007/xxfunc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkdud007%2Fxxfunc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkdud007%2Fxxfunc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkdud007%2Fxxfunc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rkdud007%2Fxxfunc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rkdud007","download_url":"https://codeload.github.com/rkdud007/xxfunc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251717021,"owners_count":21632223,"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":["reth","serverless"],"created_at":"2024-11-09T08:29:09.699Z","updated_at":"2025-04-30T14:09:24.270Z","avatar_url":"https://github.com/rkdud007.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xxfunc\n\n\u003e **Warning:** This codebase is experimental and not production ready 🚧\n\n`xxfunc` is serverless function support on reth using exex (execution hook).\nWe compile arbitrary code to `WASI` module and when exex hook is triggered, it will spawn a new wasm runtime and execute the code.\n\n## Motivation\n\nNot many people are able to run or manage their own node. However, many people want to run logic on top of the resource. This was the motivation behind the invention of [\"serverless functions\"](https://en.wikipedia.org/wiki/Serverless_computing). We wanted to provide the same ability for Ethereum full nodes.\n\n## Architecture\n\n- [`cargo-xxfunc`](./cargo-xxfunc/): cli tool to build, deploy, start serverless function.\n- [`exex`](./exex/): reth + scheduler binary. Use execution hook to listen event and scheduler scraps all active tasks and spawn runtimes\n- [`server`](./server/): public endpoint to submit function. interact with db.\n\n![](.github/arch.png)\n\n## Define serverless function\n\ncheck out [example](./examples/)\n\n```\n#![no_main]\n\n#[xxfunc::main]\nasync fn main(data: \u0026[u8]) {\n    println!(\"🦀 Hello, world from wasi!, exex notification data: {:?}\", data);\n}\n\n\n```\n\n## Demo\n\n![](.github/demo.gif)\n\nterminal 1 (server)\n\n```\nRUST_LOG=info cargo run -p xxfunc-server\n```\n\nterminal 2 (user)\n\nBuild arbitrary wasm module and deploy it to the server. And set state to started.\n\n```\ncargo xxfunc build\ncargo xxfunc deploy --url http://0.0.0.0:3000 --wasm-path ./wasm_output/output.wasm\ncargo xxfunc start --url http://0.0.0.0:3000 --module-name output.wasm\n```\n\nterminal 3 (reth + scheduler)\n\nRun reth with wasm run time scheduler. For testing purpose, we added script to send mock exex notification per every 10 seconds.\n\n```\nETHERSCAN_API_KEY={ETHERSCAN_API_KEY} cargo run -p xxfunc-exex -- node --debug.etherscan --chain holesky --http \n```\n\n## Build and Run wasm module\n\n- install `cargo-xxfunc` subcommand\n- build wasm module with `cargo xxfunc build`\n- run wasm module with runtime test\n\n```console\n./scripts/build_run_module.sh\n```\n\n## Support\n\n- [x] `cargo xxfunc` support `build`, `deploy`, `start` and `stop`\n- [x] #[xxfunc::main] support async main function\n- [x] db, server, exex, scheduler\n\n## TODO:\n\n- [ ] add status of functions in the module db. (eg started or stopped)\n- [ ] xxfunclib include a handle to the reth datadir and can be called from the main function\n- [ ] check WASIX / WasmEdge\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkdud007%2Fxxfunc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frkdud007%2Fxxfunc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frkdud007%2Fxxfunc/lists"}