{"id":18633755,"url":"https://github.com/allisterb/silver","last_synced_at":"2025-07-25T21:41:02.470Z","repository":{"id":41336737,"uuid":"444494031","full_name":"allisterb/Silver","owner":"allisterb","description":"Static analyzer and formal verifier for Stratis smart contracts","archived":false,"fork":false,"pushed_at":"2023-10-13T01:11:16.000Z","size":3132,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T08:28:36.788Z","etag":null,"topics":["blockchain","dotnet","formal-verification","smart-contracts","static-analysis","stratis"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/allisterb.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":"2022-01-04T16:44:32.000Z","updated_at":"2022-11-20T12:59:25.000Z","dependencies_parsed_at":"2023-01-19T06:01:12.028Z","dependency_job_id":null,"html_url":"https://github.com/allisterb/Silver","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisterb%2FSilver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisterb%2FSilver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisterb%2FSilver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allisterb%2FSilver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allisterb","download_url":"https://codeload.github.com/allisterb/Silver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223460570,"owners_count":17148760,"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":["blockchain","dotnet","formal-verification","smart-contracts","static-analysis","stratis"],"created_at":"2024-11-07T05:16:10.558Z","updated_at":"2024-11-07T05:16:11.051Z","avatar_url":"https://github.com/allisterb.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Silver\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://static.wikia.nocookie.net/zelda_gamepedia_en/images/5/5a/BotW_Silver_Shield_Model.png/revision/latest/scale-to-width-down/335?cb=20210118165032\u0026format=original\" /\u003e\n\u003c/p\u003e\n\n[![img](https://img.shields.io/nuget/v/Silver.CodeAnalysis?style=plastic)](https://www.nuget.org/packages/Silver.CodeAnalysis/)\n\n## About\n\nSilver is a [static analysis](https://en.wikipedia.org/wiki/Static_program_analysis) and [formal verification](https://en.wikipedia.org/wiki/Formal_verification) \ntool for Stratis smart contracts. Silver can analyze both C# source code using a Roslyn diagnostic analyzer and CIL code in a .NET bytecode assembly \nand can run both inside Visual Studio and on the command line.\n\n![type not allowed from namespace](https://dm2301files.storage.live.com/y4mtdREUkjcGF6gKDRZjHDPQ1s0NU53LLENRXrni2IXbOeNblTZ4z7xMATD2woY3RdyoZvto0VlnKjW80e6tUISj2YO2t4JifQJdj0tRIwK5YDt5XIuLSWo-fBbwl6iWcF7jQGuJ0zlhvk7_uYfoflzmJSp7E612_O6O5KREX3vWTYcEJHpGO4kYHC6r6309vJx?width=1424\u0026height=1015\u0026cropmode=none)\n\nSilver can [validate](https://github.com/allisterb/Silver/blob/master/src/Silver.CodeAnalysis.Cs/Silver.CodeAnalysis.Cs/Validator.cs) C# code using a Roslyn diagnostic analyzer according to the same [rules](https://github.com/stratisproject/StratisFullNode/blob/master/Documentation/Features/SmartContracts/Clr-execution-and-validation.md) for types and members used by the Stratis CLR VM for smart contracts. All the [validation policies](https://github.com/stratisproject/StratisFullNode/blob/master/src/Stratis.SmartContracts.CLR.Validation/DeterminismPolicy.cs) currently in use will be ported to the Roslyn analyzer.\n\nSilver can disassemble smart contract CIL code in a .NET bytecode assembly:\n\n![Silver disassembler](https://dm2301files.storage.live.com/y4mCr82EmE3ovpdLVj9Xihx2Oa1TeLDD3SEvnNTlvC2JRws1ka1X2G09KKVk1XfTxjai4AFZlWZjhrXNT0TYdVLF-ofmBqtmWmTX10YLKZcCO-lIXw6UvpOs1ikO6r_bEMHGxpx5h3CX8dkTqILCNYYz9Alp43dH5-q_aQu1rQfLkbZFWdT3i8k6h6lOv8ITjpS?width=1920\u0026height=945\u0026cropmode=none)\nand statically analyze it using the [Analysis.Net](https://github.com/edgardozoppi/analysis-net/tree/master) framework e.g. the following is a [call-graph](https://en.wikipedia.org/wiki/Call_graph) analysis of the methods in the [Address Mapper](https://github.com/stratisproject/CirrusSmartContracts/tree/master/Mainnet/AddressMapper) contract.\n\n![img](https://dm2301files.storage.live.com/y4mLu9yA4qSBuSATzoJqXQtKfaJCMsDx11duBmqvmt5ZDMgvXMJhvPVIurq9har4_VC2vza5GKYWXYhOReBYPW3g-xS1iDWmYiEjEqLfxzSZMzrfXTS51oDOEml0oT3Y_MuL8OLc8Bvm8VWVqToi37DxrXBTBiyfRwRU09k57lEK8riBf_OvJGxdiVNWwl-lH84?width=1916\u0026height=1023\u0026cropmode=none)\n\nSilver can [output graphs](https://github.com/allisterb/Silver/tree/master/src/Silver.Drawing) in different formats like PNG images:\n\n![img](https://dm2301files.storage.live.com/y4mRkO7wiNlaUapDiUxbW_hLwNXWrXOhhyE3fTSHLoelnaD3GIvKMRUv97clPiiyW__NfobAAzSNuNUT4Frk3sIluCe9uhcds2vA0z0nVMOYd2C6xz6cXcnBwo0g3YbYH-CC8SxLDdGRhZHGOUTdxuYmptpXMojwcJQc_fgGJPgfurMuqF3ATuTSO359j3o-39M?width=2000\u0026height=612\u0026cropmode=none)\nor in the DGML format which are natively supported in Visual Studio:\n\n![img](https://dm2301files.storage.live.com/y4mOhd7isx7dRXOsuYjaZk1o88mkSv7sjqVzuGyTdhGRa9mYHLB2ziQQXbkyE-pdv5I4zqgYFgoXOgvZY88YBAOvs7I41I77KB1lw_9rZ9-ZSxHBWOutiBUZDYMGLnmGmaZJYGv9azJD3I9v0GTARJIIysAD4UJqoFZrQURyXfmE0HZXI1kSZIOtHAy9-H7JtEz?width=1904\u0026height=946\u0026cropmode=none)\n\nSilver can formally verify smart contracts in C# using the Spec# compiler from Microsoft Research:\n\n![Silver verifier](https://dm2301files.storage.live.com/y4m1bPIN0-HBrPvmt-Aq62K-m3zlUQWs28zmJqtCsBRbLm4sTvK8sbR2Z1-9BEFh24LKD1WEJpn1g67tGJvP63bi6ng1VloHBFMnYXdTK6ceqrCPnM01t_CTFDEGvLkOJcodXkmpWJVcSZheLaJh-6X4oUVKBJ98dyQYdxh4hwoMK5vu1mtjBdRUPsXsfW0_78s?width=860\u0026height=475\u0026cropmode=none)\n\nSee the [wiki](https://github.com/allisterb/Silver/wiki) for more in-depth technical information and documentation.\n\n## Building\n\n### Requirements\n* [NET 6.0](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)\n* Mono (on *nix/MacOs)\n* libgdiplus (on *nix/MacOs, for graph drawing)\n\n### Known issues\nThe verifier is currently broken on non-Windows as the Spec# verifier depends on some Windows specific code in the compiler to write .PDB files which are needed to verify an assembly. Everything else should work cross-platform including the analyzers and compiler.\n\n### Steps\n1. Ensure requirements are installed\n2. Clone this git repo and submodules: `git clone https://github.com/allisterb/Silver.git --recurse-submodules`\n3. Run .`/build` or `build.cmd` in the root repo directory. Build should complete without errors.\n4. Run `./silver install` to download and install the external tools needed.\n5. Compile and analyze one of the example projects e.g. `./silver compile examples\\AddressMapper\\AddressMapper.csproj` and ` silver dis examples/AddressMapper/bin/Debug/netcoreapp2.1/AddressMapper.dll`\n6. On Windows you can verify one of the example projects e.g. ` silver verify examples\\SimpleVerifiableContracts\\SimpleVerifiableContracts.csproj` or ` silver compile examples\\SimpleVerifiableContracts\\SimpleVerifiableContracts.csproj --verify`\n\n### Usage\nSee `silver help` for the different commands and actions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallisterb%2Fsilver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallisterb%2Fsilver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallisterb%2Fsilver/lists"}