{"id":13818158,"url":"https://github.com/quilt/sheth","last_synced_at":"2025-05-13T10:32:00.475Z","repository":{"id":103802914,"uuid":"202064094","full_name":"quilt/sheth","owner":"quilt","description":"Execution environment for managing shard ether","archived":false,"fork":false,"pushed_at":"2020-04-16T21:50:30.000Z","size":276,"stargazers_count":24,"open_issues_count":15,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-08-05T07:01:30.124Z","etag":null,"topics":["ee","ethereum"],"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/quilt.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}},"created_at":"2019-08-13T04:26:52.000Z","updated_at":"2023-07-25T14:28:10.000Z","dependencies_parsed_at":"2023-10-20T22:43:47.138Z","dependency_job_id":null,"html_url":"https://github.com/quilt/sheth","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/quilt%2Fsheth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quilt%2Fsheth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quilt%2Fsheth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quilt%2Fsheth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quilt","download_url":"https://codeload.github.com/quilt/sheth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225206014,"owners_count":17438018,"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":["ee","ethereum"],"created_at":"2024-08-04T07:00:34.493Z","updated_at":"2024-11-18T16:12:00.027Z","avatar_url":"https://github.com/quilt.png","language":"Rust","funding_links":[],"categories":["Prototyping"],"sub_categories":["Execution Environments"],"readme":"# sheth\n\n![sheth test status](https://github.com/lightclient/sheth/workflows/sheth-test/badge.svg)\n![client test status](https://github.com/lightclient/sheth/workflows/client-test/badge.svg)\n![composer test status](https://github.com/lightclient/sheth/workflows/composer-test/badge.svg)\n[![Apache License](https://img.shields.io/badge/license-Apache--2.0-blue)](https://github.com/lightclient/sheth#license)\n\n`sheth` [ ˈshēth ] is an [execution\nenvironment](https://hackmd.io/UzysWse1Th240HELswKqVA?view#Execution-Environment-EE)\n(EE) for Ethereum 2.0 that facilitates the movement of ether within a shard and\nprovides mechanisms to move ether between a shard and the beacon chain.\n\n## Quick Start\n\nFirst, setup your environment:\n```console\nrustup target install wasm32-unknown-unknown\ncargo install chisel\nmake setup\n```\n\nThen simulate execution using [Scout](https://github.com/ewasm/scout):\n```console\nmake scout\n```\n\nOr run on your local architecture (useful for tracking down bugs):\n```console\nmake test\n```\n\n#### Recommended Reading\nThe design space for EEs is broad and builds on many different Ethereum 2.0\nrelated concepts. If you're lost, here are a few places to get started:\n\n* [Phase 2 Wiki](https://hackmd.io/UzysWse1Th240HELswKqVA)\n* [Phase 2 Proposal](https://notes.ethereum.org/w1Pn2iMmSTqCmVUTGV4T5A?view#Implementing-in-shard-ETH-transfers)\n* [Eth EE Proposal](https://ethresear.ch/t/eth-execution-environment-proposal/5507)\n\nPing me [@lightclients](https://twitter.com/lightclients) for any\nother questions / concerns.\n\n## Motivation\n* Understanding the developer experience regarding EEs could influence design\n  decisions of the protocol and EE runtime.\n* Efficiently authenticating and updating merkle multi-proofs is critical to the\n  success of stateless execution environments.\n* In order to develop strong tooling for EE development, it's important to\n  determine a lower bound for execution time and binary size to target. \n* Provide a framework on which others can develop and experiment.\n\n\n## Architecture\nAt a high level, `sheth` provides a single state transition function:\n\n```rust\npub fn main(pre_state: \u0026[u8; 32], data: \u0026[u8]) -\u003e [u8; 32];\n```\n\nThe main function essentially takes in the latest merkle root of the state as\n`pre_state` and some amount of `data`. It deserializes the data into the\ntransactions that will be executed and the merkle multi-proof which is used\nauthenticate the transactions. Due to some of the semantics of WebAssembly, it\nisn't quite this simple (see the [FFI interface](src/lib.rs)) -- but the general\nidea remains intact.\n\n`sheth`'s design is heavily influenced by Vitalik's sample EE in his [phase 2\nproposal](https://notes.ethereum.org/w1Pn2iMmSTqCmVUTGV4T5A?view#Implementing-in-shard-ETH-transfers).\n\n### State\nThe `state` can be thought of abstractly as an array `[Account, 2**256]`, where\nan account's index in the array is equal to `Sha256(account.pubkey)`. This is\nfar too large to fit into memory all at once, so operations are done on specific\nelements within a merkle multi-proof.\n\nThe sparse merkle tree for `sheth`'s `state` can be roughly visualized as\nfollows:\n\n```\nFL = first leaf node = 2**256\nLL = last leaf node = 2**257 - 1\n        \n              +---------- 1 ----------+             \n             /                         \\\n        +-- 2 --+                   +-- 3 --+       \n       /         \\                 /         \\\n     ...         ...             ...         ...   \n    /   \\       /   \\           /   \\       /   \\\n  FL+0 FL+1   FL+2 FL+3  ...  LL-3 LL-2   LL-1 LL-0 \n```\n\nEach leaf node is the root of the corresponding `account`. An `account`'s merkle\ntree structure is as follows:\n\n```\n              +--- account ---+\n             /                 \\\n      pubkey_root           sub_root    \n        /     \\              /    \\     \n  pk[0..32] pk[32..48]    nonce  value\n```\n\n### Merkle Multi-Proof \nA merkle multi-proof is a data structure which stores multiple branches proving\nvarious items within the `state`. For a formal definition, see the\n[specification](https://github.com/ethereum/eth2.0-specs/blob/dev/specs/light_client/merkle_proofs.md#merkle-multiproofs).\n\n#### Example\nImagine a merkle tree of this shape (e.g. an `account`):\n\n```\n     1\n   /   \\\n  2     3\n / \\   / \\\n4   5 6   7\n```\n\nIn order to prove `6` is included in the root at `1`, the nodes [2, 6, 7] would\nbe needed since `1` and `3` can be calculated from that set.\n\n```\n     1\n   /   \\\n [2]    3\n / \\   / \\\n4   5[6] [7]\n```\n\n## Roadmap\n- [x] Support intra-shard transfers\n- [ ] Consume beacon chain withdrawal receipts\n- [ ] Allow shard ether to be deposited to the beacon chain\n- [ ] Validate transaction signature against BLS pubkey\n- [x] Verify transaction nonce against account\n- [ ] Implement `merge` functionality for multiple packages\n- [ ] Minimize binary size\n- [ ] Minimize execution time\n- [ ] Minimize multi-proof size\n\n## License\nLicensed under Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquilt%2Fsheth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquilt%2Fsheth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquilt%2Fsheth/lists"}