{"id":22799982,"url":"https://github.com/tangle-network/gadget-protocol-template","last_synced_at":"2025-07-30T11:04:07.071Z","repository":{"id":234328795,"uuid":"788667964","full_name":"tangle-network/gadget-protocol-template","owner":"tangle-network","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-18T21:31:30.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-09T20:43:35.252Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tangle-network.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-04-18T21:19:29.000Z","updated_at":"2024-04-18T21:27:17.000Z","dependencies_parsed_at":"2024-04-18T22:30:15.717Z","dependency_job_id":"01f71549-eb9d-418e-a1bd-5d7c92665335","html_url":"https://github.com/tangle-network/gadget-protocol-template","commit_stats":null,"previous_names":["webb-tools/gadget-protocol-template","tangle-network/gadget-protocol-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/tangle-network/gadget-protocol-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fgadget-protocol-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fgadget-protocol-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fgadget-protocol-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fgadget-protocol-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tangle-network","download_url":"https://codeload.github.com/tangle-network/gadget-protocol-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tangle-network%2Fgadget-protocol-template/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267857632,"owners_count":24155912,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"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":[],"created_at":"2024-12-12T07:10:42.379Z","updated_at":"2025-07-30T11:04:06.973Z","avatar_url":"https://github.com/tangle-network.png","language":"Rust","readme":"# Gadget Protocol Template\n\nThis repository serves as a template to start hacking on a new distributed system, MPC protocol, or other offchain computation system using Tangle's gadget framework. This template contains a `StubProtocol` which simply sets up the boilerplate necessary for a new protocol. Please refer to the [gadget repo](https://github.com/webb-tools/gadget) for example protocols and more information on how to use the gadget framework, especially if you'd like to help improve the gadget framework.\n\n## Getting Started\n### Preqrequisits\nFirst install and configure `rustup`:\n\n```bash\n# Install\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n# Configure\nsource ~/.cargo/env\n```\n### Execution\n1. To build the project, run:\n```bash\nRUSTFLAGS=\"--cfg tokio_unstable\" cargo b -r\n```\n2. To test the project, run:\n```bash\nRUSTFLAGS=\"--cfg tokio_unstable\" cargo t -r\n```\n\n# Creating a new protocol\n\n#### Step 1: Add `gadget-common`, `async-trait`, `protocol-macros`, `tangle-primitives`, and `tokio` as a dependencies\n```toml\ngadget-common = { workspace = true }\nasync-trait = { workspace = true }\ntokio = { workspace = true }\ntangle-primitives = { workspace = true }\nprotocol-macros = { workspace = true }\n```\n\n#### Step 2: Create a struct representing the protocol as such:\n```rust\n#[protocol]\npub struct StubProtocol\u003c\n    B: Block,\n    BE: Backend\u003cB\u003e + 'static,\n    C: ClientWithApi\u003cB, BE\u003e,\n    N: Network,\n    KBE: KeystoreBackend,\n\u003e where\n        \u003cC as ProvideRuntimeApi\u003cB\u003e\u003e::Api: JobsApiForGadget\u003cB\u003e,\n{\n    pallet_tx: Arc\u003cdyn PalletSubmitter\u003e,\n    logger: DebugLogger,\n    client: C,\n    network: N,\n    account_id: AccountId,\n    key_store: ECDSAKeyStore\u003cKBE\u003e,\n    jobs_client: Arc\u003cMutex\u003cOption\u003cJobsClient\u003cB, BE, C\u003e\u003e\u003e\u003e,\n}\n```\n\n#### Step 2: Implement `FullProtocolConfig` for `StubProtocol`\n\n#### Step 3: Running the protocol\nAt the bottom of lib.rs, add the macro: `generate_setup_and_run_command!(StubProtocol, StubProtocol, ...)`. For real applications, you will want to add all the protocol configs you wish to run concurrently.\n\n#### Step 4: Testing the protocol:\nAfter generating the macro above, run this macro with appropriate `T`, `N`, and `K` values: `test_utils::generate_signing_and_keygen_tss_tests!(T, N, K, ThresholdSignatureRoleType::StubProtocol)`. Note: the `K` value is the number of expected protocols to run concurrently. It should match the number of items in the `generate_setup_and_run_command!` macro. \n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fgadget-protocol-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftangle-network%2Fgadget-protocol-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftangle-network%2Fgadget-protocol-template/lists"}