{"id":27801337,"url":"https://github.com/ergoplatform/sigmastate-interpreter","last_synced_at":"2026-01-06T12:56:09.909Z","repository":{"id":21366538,"uuid":"81021157","full_name":"ergoplatform/sigmastate-interpreter","owner":"ergoplatform","description":"ErgoScript compiler and ErgoTree Interpreter implementation for Ergo blockchain","archived":false,"fork":false,"pushed_at":"2025-04-18T15:51:42.000Z","size":37628,"stargazers_count":65,"open_issues_count":136,"forks_count":42,"subscribers_count":11,"default_branch":"develop","last_synced_at":"2025-04-18T19:28:45.759Z","etag":null,"topics":["authentication-language","blockchain","compiler","ergoplatform","interpreter"],"latest_commit_sha":null,"homepage":"","language":"Scala","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/ergoplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2017-02-05T20:49:14.000Z","updated_at":"2025-04-11T17:30:18.000Z","dependencies_parsed_at":"2023-10-11T22:40:54.120Z","dependency_job_id":"f81d0727-c4ac-43c0-b86b-507d499e7e0d","html_url":"https://github.com/ergoplatform/sigmastate-interpreter","commit_stats":{"total_commits":4901,"total_committers":34,"mean_commits":"144.14705882352942","dds":0.5804937767802489,"last_synced_commit":"75f301a4b5986058a690ff77a82ae916843ede80"},"previous_names":["ergoplatform/sigmastate-interpreter"],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergoplatform%2Fsigmastate-interpreter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergoplatform%2Fsigmastate-interpreter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergoplatform%2Fsigmastate-interpreter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ergoplatform%2Fsigmastate-interpreter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ergoplatform","download_url":"https://codeload.github.com/ergoplatform/sigmastate-interpreter/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251825376,"owners_count":21649941,"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":["authentication-language","blockchain","compiler","ergoplatform","interpreter"],"created_at":"2025-05-01T05:01:06.270Z","updated_at":"2026-01-06T12:56:09.873Z","avatar_url":"https://github.com/ergoplatform.png","language":"Scala","funding_links":[],"categories":["🛠️ Development Tooling \u003ca id=\"development-tooling\"\u003e\u003c/a\u003e"],"sub_categories":["📜 Smart Contracts \u0026 ErgoScript \u003ca id=\"smart-contracts--ergoscript\"\u003e\u003c/a\u003e"],"readme":"[![CI](https://github.com/ScorexFoundation/sigmastate-interpreter/actions/workflows/ci.yml/badge.svg)](https://github.com/ScorexFoundation/sigmastate-interpreter/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/ScorexFoundation/sigmastate-interpreter/branch/develop/graph/badge.svg?token=HNu2ZEOoV6)](https://codecov.io/gh/ScorexFoundation/sigmastate-interpreter)\n\n# ErgoScript compiler and ErgoTree interpreter \n\nThis repository contains implementations of ErgoScript compiler and ErgoTree\nInterpreter for a family of Sigma-protocol based authentication languages (or simply\nSigma language).\n\nThis library is used internally in [Ergo\nNode](https://github.com/ergoplatform/ergo) and\n[ergo-wallet](https://github.com/ergoplatform/ergo/tree/master/ergo-wallet), the\npublic interfaces are subject to change.\n\nFor development of Ergo applications using JVM languages (Java/Scala/Kotlin/etc)\na better alternative is to use\n[Appkit](https://github.com/ergoplatform/ergo-appkit).\n\nThe library is cross-compiled to JS using Scala.js and the main abstractions can be used\nfrom JS directly by importing [NPM module](https://www.npmjs.com/package/sigmastate-js).\nSee [README](sigma-js/README.md) for details.\n\n## Sigma Language Background\n\nEvery coin in Bitcoin is protected by a program in the stack-based Script\nlanguage. An interpreter for the language is evaluating the program against a\ncontext (few variables containing information about a spending transaction and\nthe blockchain), producing a single boolean value as a result. While Bitcoin\nScript allows for some contracts to be programmed, its abilities are limited.\nAlso, to add new cryptographic primitives, for example, ring signatures, a\nhard-fork is required.\n\nGeneralizing the Bitcoin Script, ErgoScript compiler and ErgoTree interpreter\nimplement an _authentication language_ which allows to express coin spending\nconditions. The [ErgoScript\nCompiler](sigmastate/src/main/scala/sigmastate/lang/SigmaCompiler.scala#L48)\ncompiles the source code into\n[ErgoTree](sigmastate/src/main/scala/sigmastate/Values.scala#L990) byte code,\nwhich can be saved in UTXO coins to protect their spending (same as in Bitcoin).\n\nErgoTree, in turn, is a bytecode language and memory representation which can be\ndeterministically interpreted in the given _blockchain context_. \nErgoTree defines guarding proposition for a coin as a logic formula which\ncombines predicates over a context and cryptographic statements provable via\n[Σ-protocols](https://en.wikipedia.org/wiki/Proof_of_knowledge#Sigma_protocols)\nwith AND, OR, k-out-of-n connectives.\n\nAn _interacting party_ willing to spend the coin first constructs a\n[prover](sigmastate/src/main/scala/sigmastate/interpreter/ProverInterpreter.scala)\nwith a set of secrets it knows and then the prover is executed in two steps:\n\n- _Reduction_ - the prover uses the ErgoTree interpreter and deterministically\nreduces the ErgoTree proposition to a compound _cryptographic statement_(aka\nsigma proposition, Σ-protocol) by evaluating ErgoTree over known shared context\n(state of the blockchain system and a spending transaction). This step produces\na value of the [SigmaBoolean](sigmastate/src/main/scala/sigmastate/Values.scala)\ntype.\n\n- Signing - the prover is turning the obtained (and possibly\ncomplex) Σ-proposition into a signature with the help of a [Fiat-Shamir\ntransformation](https://en.wikipedia.org/wiki/Fiat-Shamir_heuristic). This step\nproduces a _proof_ that the party knows the secrets such that the knowledge can\nbe verified before the spending transaction is added to the blockchain.\n\nTo allow valid coin spending a\n[verifier](sigmastate/src/main/scala/sigmastate/interpreter/Interpreter.scala)\nis running the ErgoTree interpreter with the following three inputs:\n- a guarding proposition given by an ErgoTree \n- a blockchain _context_ of the transaction being verified\n- a _proof_ (aka transaction signature) generated by a _prover_ \n \nThe verifier is executed as part of transaction validation for each input and is\nexecuted in tree steps:\n\n- _Reduction_ - same as prover, the verifier uses the ErgoTree interpreter and\ndeterministically produces a value of the\n[SigmaBoolean](sigmastate/src/main/scala/sigmastate/Values.scala) type. \nHowever, this step must finish evaluation for any possible inputs within\nconcrete fixed time limit (aka maximum cost), which is checked by the interpreter.\n\n- Cost estimation - the verifier estimates the complexity of cryptographic Sigma\nproposition (based in the size and the concrete nodes of SigmaBoolean tree). The\nspending fails if the estimated cost exceeds the maximum limit.\n\n- Signature verification - the signature checker takes 1) the proof, 2) the\nSigmaBoolean (aka [sigma\nprotocol](https://en.wikipedia.org/wiki/Proof_of_knowledge#Sigma_protocols)\nproposition) and 3) the signed message (e.g. transaction bytes).\nThe checker than verifies the proof, which means it verifies that all the\nnecessary secrets has been known and used to construct the proof (i.e. sign the\ntransaction).\n\n## Getting Started \n\nThis library is\n[publishied](https://mvnrepository.com/artifact/org.scorexfoundation/sigma-state)\non Maven repository and can be added to the SBT configuration of Scala project.\n\n```scala\nlibraryDependencies += \"org.scorexfoundation\" %% \"sigma-state\" % \"5.0.14\"\n```\n\n## Repository Organization\n\n| sub-module  | description                                                                        |\n|-------------|------------------------------------------------------------------------------------|\n| core        | contains core classes of Sigma library                                             |\n| data        | contains classes for working with ErgoTree, addresses and all related serializers  |\n| docs        | Collection of documents                                                            |\n| interpreter | contains an implementation of ErgoTree Interpreter                                 |\n| sdk         | contains and implementation of transaction reduction and signing                   |\n| parsers     | contains an implementation of ErgoScript parsers using FastParse library           |\n| sc          | contains an implementation of ErgoScript compiler                                  |\n| sigma-js    | root directory of sigmastate-js JS module (see [package.json](sigma-js/README.md)) |\n\n## Contributing\n\nWe welcome contributions to this project! If you are interested in contributing, here are\na few ways to get started:\n\n**Report bugs:** If you have found a bug please open an issue on the issue tracker.\n\n**Fix bugs or implement features:** If you would like to fix a bug or implement a new\nfeature, please fork the repository and open a pull request with your changes. Please make\nsure to include a clear description of the changes you have made and why you think they\nshould be included in the project.\n\n**Improve documentation:** If you notice that the documentation could be improved, please\nfeel free to make changes and open a pull request.\n\n**Review pull requests:** If you would like to help review pull requests, please take a\nlook at the open pull requests and leave comments on any that you would like to review.\n\nBefore you start working on a contribution, please make sure to read the [contributing\nguidelines](CONTRIBUTING.md). These documents outline the expectations for contributions\nto this project.\n\nThank you for your interest in contributing to this project! Your help is always appreciated!\n\n\n\nPlease submit a pull request or create an issue to add a new cryptographic primitives or better implementations.\n\n\n## Acknowledgments\n\nWe thank JetBrains for [supporting](https://www.jetbrains.com/buy/opensource/) this project since 2021 by providing All Products Pack subscription.\n\n\u003cimg src=\"https://www.yourkit.com/images/yklogo.png\"/\u003e\n\nWe thank YourKit for support of open source projects with its full-featured Java Profiler.\nYourKit, LLC is the creator of \u003ca href=\"https://www.yourkit.com/java/profiler/\"\u003eYourKit Java Profiler\u003c/a\u003e\nand \u003ca href=\"https://www.yourkit.com/.net/profiler/\"\u003eYourKit .NET Profiler\u003c/a\u003e,\ninnovative and intelligent tools for profiling Java and .NET applications.\n\n## References\n\n- [Ergo Site](https://ergoplatform.org/en/)\n- [Ergo Sources](https://github.com/ergoplatform/ergo)\n- [Sigma-js](https://www.npmjs.com/package/sigmastate-js)\n- [Ergo Appkit](https://github.com/ergoplatform/ergo-appkit)\n- [Ergo Appkit Examples](https://github.com/aslesarenko/ergo-appkit-examples)\n- [ergo-android](https://github.com/aslesarenko/ergo-android)\n- [ergo-wallet-android](https://github.com/MrStahlfelge/ergo-wallet-android)\n- [ErgoTree Specification](https://ergoplatform.org/docs/ErgoTree.pdf)\n- [Ergo Documents](https://docs.ergoplatform.org/)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergoplatform%2Fsigmastate-interpreter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fergoplatform%2Fsigmastate-interpreter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fergoplatform%2Fsigmastate-interpreter/lists"}