{"id":22829163,"url":"https://github.com/strict-types/stenc","last_synced_at":"2025-04-23T16:24:50.899Z","repository":{"id":165233630,"uuid":"392093013","full_name":"strict-types/stenc","owner":"strict-types","description":"Strict encoding compiler. Strict encoding is a format used by client-side-validation, RGB smart contracts, AluVM, Internet2 APIs and in languages ParselTongue and Contractum.","archived":false,"fork":false,"pushed_at":"2021-08-03T16:33:57.000Z","size":10,"stargazers_count":3,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T16:24:38.784Z","etag":null,"topics":["aluvm","client-side-validation","compiler","contractum","encoding","parsel","strict-encoding"],"latest_commit_sha":null,"homepage":"https://strict-encoding.lnp-bp.org","language":"Rust","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/strict-types.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["dr-orlovsky"]}},"created_at":"2021-08-02T21:00:55.000Z","updated_at":"2023-01-28T02:19:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0ab96af-9b46-4db8-93ea-c7f0a78c285d","html_url":"https://github.com/strict-types/stenc","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/strict-types%2Fstenc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strict-types%2Fstenc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strict-types%2Fstenc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/strict-types%2Fstenc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/strict-types","download_url":"https://codeload.github.com/strict-types/stenc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250468807,"owners_count":21435542,"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":["aluvm","client-side-validation","compiler","contractum","encoding","parsel","strict-encoding"],"created_at":"2024-12-12T19:13:39.342Z","updated_at":"2025-04-23T16:24:50.894Z","avatar_url":"https://github.com/strict-types.png","language":"Rust","funding_links":["https://github.com/sponsors/dr-orlovsky"],"categories":[],"sub_categories":[],"readme":"# Strict encoding schema\n\nStrict encoding schema is a **library** for handling binary [strict encoding] \nrules and a **compiler** from a human-readable data structure representation, \nwritten on a [Parsel] language, used by [AluVM] (or its subset [Contractum] used\nin RGB smart contracts) into a binary format.\n\nExample of strict encoding schema declaration in Parsel/Contractum:\n```parsel\ndatapkg BP\n\nalias Hash256 :: U8^32\nalias Sha256 :: Hash256\nalias Sha256d :: Hash256\nalias Sha256t :: Hash256\nalias Ripemd160 :: U8^20\n\nalias BlockId :: Sha256d\nalias Txid :: Sha256d\n\nalias Amount :: U64\n\ndata OutPoint :: Txid, vout U16\n\ndata ScriptPubkey :: U8^..10_000\ndata StackByteStr :: U8^..520\ndata Witness :: StackByteStr^..1_000\ndata SigScript :: StackByteStr^..1_000\n\ndata TxOut :: Amount, \n              ScriptPubkey\ndata TxIn :: OutPoint, \n             nSeq U16, \n             SigScript, \n             Witness?\n\ndata Transaction :: ver U8, \n                    inputs TxIn*,\n                    outputs TxOut*,\n                    lockTime U32\n```\n\nStrict encoding schema library and compiler also covers *`StenPath`* - a \nstandard for addressing specific fields and entries of strict-encoded data \ninside container (you may compare StenPath to XPath for XML) and its binary\nencoding which is used in `STEN` AluVM ISA extensions.\n\nFor instance, StenPath expression `$1[5].$3[1][0]` applied to `Transaction`\ndata structure defined above it will return first byte of second\nitem in witness stack of the second transaction input. In binary form StenPath\ncan be read like `FF 01 00  FE 05 00  FF 03 00  FE 01 00  FE 00 00`.\n\nExample of how this encoding can be used together with `STEN` ISA in \n[AluVM assembly]:\n\n```aluasm\n.ISA  ALU, BP, STEN\n\n.MAIN\n                    ;; Load transaciton with ID to s16[1]\n                    bpltx   0xbdb657fe4633d4612e4096eb2cb9f575233cb007ae3a17245d80dad76afb33b9, s16[1]\n                    ;; Define lookup path\n                    put     0xFF0100_FE0500_FF0300_FE0100_FF0000, s16[3]\n\n                    ;; Parses data from s16[1] according to ses-encoding found in s16[2]\n                    ;; at data path encoded at s16[3] to register u8[1]\n                    parse   s16[1], s16[2], s16[3], u8[1]\n```\n\n[strict encoding]: https://strict-encoding.lnp-bp.org\n[AluVM]: https://www.aluvm.org\n[ParselTongue]: https://parsel-lang.org\n[Contractum]: https://github.com/rgb-org/contractum-lang\n[AluVM assembly]: https://github.com/pandoracore/aluasm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrict-types%2Fstenc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstrict-types%2Fstenc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstrict-types%2Fstenc/lists"}