{"id":13652220,"url":"https://github.com/arrudagates/substate","last_synced_at":"2025-04-23T03:30:37.410Z","repository":{"id":46482307,"uuid":"415125375","full_name":"arrudagates/substate","owner":"arrudagates","description":"100% no-std/wasm compatible Substrate storage key generator","archived":false,"fork":false,"pushed_at":"2021-10-16T16:18:05.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-01-25T04:52:44.181Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arrudagates.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}},"created_at":"2021-10-08T20:58:33.000Z","updated_at":"2022-04-15T13:56:40.000Z","dependencies_parsed_at":"2022-07-19T22:04:02.208Z","dependency_job_id":null,"html_url":"https://github.com/arrudagates/substate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrudagates%2Fsubstate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrudagates%2Fsubstate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrudagates%2Fsubstate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arrudagates%2Fsubstate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arrudagates","download_url":"https://codeload.github.com/arrudagates/substate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250365230,"owners_count":21418651,"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":["hacktoberfest"],"created_at":"2024-08-02T02:00:57.240Z","updated_at":"2025-04-23T03:30:37.087Z","avatar_url":"https://github.com/arrudagates.png","language":"Rust","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"# Substate\n100% no-std/wasm compatible Substrate storage key generator\n\nA simple macro is all you need to generate keys, check usage below.\n\n```rust\n// Storage Value\nstorage_key!(\"Session\", \"Validators\");\n// -\u003e 0xcec5070d609dd3497f72bde07fc96ba088dcde934c658227ee1dfafcd6e16903\n\n// Storage Map\nstorage_key!(\n    \"Staking\",\n    \"ErasRewardPoints\",\n    (StorageHasher::Twox64Concat, 10)\n);\n// -\u003e 0x5f3e4907f716ac89b6347d15ececedca80cc6574281671b299c1727d7ac68cabef8763d79d01484e0c000000\n\n// Storage Double Map\nstorage_key!(\n    \"ImOnline\",\n    \"AuthoredBlocks\",\n    (StorageHasher::Twox64Concat, 68),\n    (StorageHasher::Twox64Concat, address_to_accountid(\"esqyGXvN7eezFoGtXAiLvXNnai2KFWkt7VfWwywHNBdwb8dUh\").unwrap().0)\n);\n// -\u003e 0x2b06af9719ac64d755623cda8ddd9b94b1c371ded9e9c565e89ba783c4d5f5f94e9f0caa17b4771b4b000000e669931fb1d70de1e63bad33d41d23e049d4f9efea39e4f44426b3f82104800ef6a9f29fbaa18667\n```\n\nAlso comes with a set of string to AccountId and AccountId to string functions in the utils module, because the implementation in sp_core requires std\n\n```rust\nlet (accountid: AccountId32, format: Ss58AddressFormat) = address_to_accountid(\"esqyGXvN7eezFoGtXAiLvXNnai2KFWkt7VfWwywHNBdwb8dUh\").unwrap();\n\nlet account: String = accountid_to_address(accountid, format);\n```\n\n## Credit\n\nThe helper functions used in this library were adapted from [Substrate](https://github.com/paritytech/substrate) and [substrate-api-client](https://github.com/scs/substrate-api-client) to work on a no-std/wasm environment and used inside the main macro \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrudagates%2Fsubstate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farrudagates%2Fsubstate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farrudagates%2Fsubstate/lists"}