{"id":19373437,"url":"https://github.com/neo-project/neo-devpack-dotnet","last_synced_at":"2026-01-28T09:11:32.790Z","repository":{"id":37548320,"uuid":"77516089","full_name":"neo-project/neo-devpack-dotnet","owner":"neo-project","description":"NEO Development Pack","archived":false,"fork":false,"pushed_at":"2025-05-15T06:06:47.000Z","size":6734,"stargazers_count":81,"open_issues_count":40,"forks_count":105,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-05-15T07:22:34.751Z","etag":null,"topics":["neo"],"latest_commit_sha":null,"homepage":"","language":"C#","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/neo-project.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-12-28T08:23:09.000Z","updated_at":"2025-05-12T11:24:25.000Z","dependencies_parsed_at":"2023-10-11T12:55:08.252Z","dependency_job_id":"b32a70fb-ae92-4c61-8b4b-018d9daf4edb","html_url":"https://github.com/neo-project/neo-devpack-dotnet","commit_stats":{"total_commits":396,"total_committers":27,"mean_commits":"14.666666666666666","dds":0.702020202020202,"last_synced_commit":"c5e7b023272e5d01b3b6d460c307833ec117e570"},"previous_names":["antshares/antshares.smartcontract.framework"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo-project%2Fneo-devpack-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo-project%2Fneo-devpack-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo-project%2Fneo-devpack-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo-project%2Fneo-devpack-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neo-project","download_url":"https://codeload.github.com/neo-project/neo-devpack-dotnet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254293788,"owners_count":22046784,"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":["neo"],"created_at":"2024-11-10T08:28:20.469Z","updated_at":"2026-01-28T09:11:32.784Z","avatar_url":"https://github.com/neo-project.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NEO DevPack for .NET\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://neo.org/\"\u003e\n    \u003cimg src=\"https://neo3.azureedge.net/images/logo%20files-dark.svg\" width=\"250px\" alt=\"neo-logo\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href='https://coveralls.io/github/neo-project/neo-devpack-dotnet'\u003e\n    \u003cimg src='https://coveralls.io/repos/github/neo-project/neo-devpack-dotnet/badge.svg' alt='Coverage Status' /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/neo-project/neo-devpack-dotnet/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.nuget.org/packages/Neo.SmartContract.Framework\"\u003e\n    \u003cimg src=\"https://img.shields.io/nuget/v/Neo.SmartContract.Framework.svg\" alt=\"NuGet Version\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.nuget.org/packages/Neo.SmartContract.Framework\"\u003e\n    \u003cimg src=\"https://img.shields.io/nuget/dt/Neo.SmartContract.Framework.svg\" alt=\"NuGet Downloads\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/rvZFQ5382k\"\u003e\n    \u003cimg src=\"https://img.shields.io/discord/382937847893590016?logo=discord\" alt=\"Discord\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://twitter.com/neo_blockchain\"\u003e\n    \u003cimg src=\"https://img.shields.io/twitter/follow/neo_blockchain?style=social\" alt=\"Twitter Follow\"\u003e\n  \u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/.NET-10.0-512BD4\" alt=\".NET Version\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/C%23-14-512BD4?logo=csharp\u0026logoColor=white\" alt=\"C# 14 Support\"\u003e\n\u003c/p\u003e\n\n## Overview\n\nNEO DevPack for .NET is a comprehensive suite of development tools for building smart contracts and decentralized applications (dApps) on the NEO blockchain platform using .NET. This toolkit enables developers to write, compile, test, and deploy smart contracts using C# and other .NET languages.\n\n## Components\n\nThe NEO DevPack for .NET consists of several key components:\n\n### Neo.SmartContract.Framework\n\nThe framework provides the necessary libraries and APIs for writing NEO smart contracts in C#. It includes:\n\n- Base classes and interfaces for smart contract development\n- NEO blockchain API wrappers\n- Standard contract templates (NEP-17, NEP-11, etc.)\n- Utilities for common blockchain operations\n\n### Neo.Compiler.CSharp\n\nA specialized compiler that translates C# code into NEO Virtual Machine (NeoVM) bytecode. Features include:\n\n- Full C# language support for smart contract development\n- Optimization for gas efficiency\n- Debug information generation\n- Source code generation for contract testing\n- Contract interface generation\n\n### Neo.SmartContract.Testing\n\nA testing framework for NEO smart contracts that allows:\n\n- Unit testing of contracts without deployment\n- Storage simulation\n- Mock native contracts\n- Blockchain state simulation\n- Gas consumption tracking\n- Code coverage analysis\n\n### Neo.Disassembler.CSharp\n\nA tool for disassembling NeoVM bytecode back to readable C# code.\n\n### Neo.SmartContract.Analyzer\n\nCode analyzers and linting tools to help write secure and efficient contracts.\n\n### Neo.SmartContract.Template\n\nProject templates for creating new NEO smart contracts with the proper structure and configurations.\n\n## Getting Started\n\n### Prerequisites\n\n- [.NET SDK](https://dotnet.microsoft.com/download) 10.0 or later\n- [Visual Studio](https://visualstudio.microsoft.com/) or [Visual Studio Code](https://code.visualstudio.com/) (optional but recommended)\n\n### Installation\n\nClone the repository with submodules:\n\n```shell\ngit clone --recurse-submodules https://github.com/neo-project/neo-devpack-dotnet.git\ncd neo-devpack-dotnet\n```\n\n### Build\n\n```shell\ndotnet build\n```\n\n### Run Tests\n\n```shell\ndotnet test\n```\n\n## Usage\n\n### Creating a New Smart Contract\n\n1. Create a new class library project targeting .NET 10.0 or later\n2. Add a reference to the Neo.SmartContract.Framework package\n3. Create a class that inherits from `SmartContract`\n4. Implement your contract logic\n5. Compile using the Neo.Compiler.CSharp\n\nExample:\n\n```csharp\nusing Neo.SmartContract.Framework;\nusing Neo.SmartContract.Framework.Attributes;\nusing Neo.SmartContract.Framework.Services;\n\npublic class HelloWorldContract : SmartContract\n{\n    [Safe]\n    public static string SayHello(string name)\n    {\n        return $\"Hello, {name}!\";\n    }\n}\n```\n\n### Compiling a Smart Contract\n\nThe NEO C# compiler (nccs) translates your C# smart contract into NeoVM bytecode, which can then be deployed to the NEO blockchain. There are several ways to compile your contract:\n\n#### Basic Compilation\n\n```shell\ndotnet run --project src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj -- path/to/your/contract.csproj\n```\n\nThis command will compile your contract and generate the following files in the `bin/sc` directory of your project:\n- `YourContract.nef`: The compiled bytecode file that is deployed to the blockchain\n- `YourContract.manifest.json`: Contract manifest containing metadata and ABI information\n\n#### Compilation Options\n\nYou can customize the compilation process with various options:\n\n```shell\n# For bash/zsh (macOS/Linux)\ndotnet run --project src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj -- \\\n    path/to/your/contract.csproj \\\n    -o output/directory \\\n    --base-name MyContract \\\n    --debug \\\n    --assembly \\\n    --optimize=All \\\n    --generate-interface\n\n# For Windows Command Prompt\ndotnet run --project src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj -- ^\n    path/to/your/contract.csproj ^\n    -o output/directory ^\n    --base-name MyContract ^\n    --debug ^\n    --assembly ^\n    --optimize=All ^\n    --generate-interface\n```\n\n#### Working with Single Files or Directories\n\nThe compiler can also process individual `.cs` files or entire directories:\n\n```shell\n# Compile a single file\ndotnet run --project src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj -- path/to/Contract.cs\n\n# Compile all contracts in a directory\ndotnet run --project src/Neo.Compiler.CSharp/Neo.Compiler.CSharp.csproj -- path/to/contract/directory\n```\n\n#### Compiler Command Reference\n\nThe NEO C# compiler supports the following options:\n\n| Option | Description |\n|--------|-------------|\n| `-o, --output` | Specifies the output directory for compiled files |\n| `--base-name` | Specifies the base name of the output files (overrides contract name) |\n| `--debug` | Generates debug information (default is `Extended`) |\n| `--assembly` | Generates a readable assembly (.asm) file |\n| `--generate-artifacts` | Generates additional artifacts for contract interaction (Source, Library, or All) |\n| `--generate-interface` | Generates a C# interface file for the contract (useful for type-safe interaction) |\n| `--security-analysis` | Performs security analysis on the compiled contract |\n| `--optimize` | Specifies the optimization level (None, Basic, All, Experimental) |\n| `--no-inline` | Disables method inlining during compilation |\n| `--nullable` | Sets the nullable context options (Disable, Enable, Annotations, Warnings) |\n| `--checked` | Enables overflow checking for arithmetic operations |\n| `--address-version` | Sets the address version for script hash calculations |\n\n### Testing a Smart Contract\n\nThe NEO DevPack includes a comprehensive testing framework specifically designed for smart contracts. Here's how to create unit tests for your contracts:\n\n```csharp\nusing Neo.SmartContract.Testing;\nusing Neo.SmartContract.Testing.TestingStandards;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Example.SmartContract.MyContract.UnitTests\n{\n    [TestClass]\n    public class MyContractTests : TestBase\u003cArtifactMyContract\u003e\n    {\n        [TestInitialize]\n        public void TestSetup()\n        {\n            // Compile and generate testing artifacts\n            var (nef, manifest) = TestCleanup.EnsureArtifactsUpToDateInternal();\n\n            // Setup the test base with the compiled contract\n            TestBaseSetup(nef, manifest);\n        }\n\n        [TestMethod]\n        public void TestMethod()\n        {\n            // Access contract properties and methods through the Contract property\n            var result = Contract.MyMethod(\"parameter\");\n            Assert.AreEqual(\"Expected result\", result);\n\n            // Test storage changes after operations\n            var storedValue = Storage.Get(Contract.Hash, \"myKey\");\n            Assert.AreEqual(\"Expected storage value\", storedValue);\n\n            // Verify emitted events\n            var notifications = Notifications;\n            Assert.AreEqual(1, notifications.Count);\n            Assert.AreEqual(\"ExpectedEvent\", notifications[0].EventName);\n        }\n    }\n}\n```\n\n#### Key Testing Features\n\n1. **TestBase\u003cT\u003e Class**: Provides a base class for contract testing with access to the contract, storage, and notifications.\n\n2. **Automatic Artifact Generation**: The testing framework automatically compiles your contracts and generates testing artifacts.\n\n3. **Direct Contract Interaction**: Access contract properties and methods directly through the strongly-typed `Contract` property.\n\n4. **Storage Simulation**: Test persistent storage operations without deploying to a blockchain.\n\n5. **Event Verification**: Validate that your contract emits the expected events.\n\n6. **Gas Consumption Analysis**: Track and analyze GAS costs of operations:\n\n```csharp\n[TestMethod]\npublic void TestGasConsumption()\n{\n    // Record initial gas\n    var initialGas = Engine.GasConsumed;\n\n    // Execute contract operation\n    Contract.ExpensiveOperation();\n\n    // Check gas consumption\n    var gasUsed = Engine.GasConsumed - initialGas;\n    Console.WriteLine($\"Gas used: {gasUsed}\");\n    Assert.IsTrue(gasUsed \u003c 100_000_000, \"Operation used too much gas\");\n}\n```\n\n#### Setting Up the Test Project\n\n1. Create a new test project for your contract\n2. Add references to the Neo.SmartContract.Testing package and your contract project\n3. Create a test class that inherits from TestBase\u003cT\u003e\n4. Implement the TestSetup method to compile and initialize the contract\n5. Write test methods for each contract feature or scenario\n\n## Examples\n\nThe repository includes various example contracts that demonstrate different features and capabilities in the `examples` directory:\n\n| Example | Description |\n|---------|-------------|\n| [HelloWorld](examples/Example.SmartContract.HelloWorld/) | Basic contract example |\n| [NEP-17](examples/Example.SmartContract.NEP17/) | Token standard implementation |\n| [NEP-11](examples/Example.SmartContract.NFT/) | NFT standard implementation |\n| [Storage](examples/Example.SmartContract.Storage/) | Persistent storage example |\n| [Events](examples/Example.SmartContract.Event/) | Event notification example |\n| [Contract Calls](examples/Example.SmartContract.ContractCall/) | Inter-contract calls |\n| [Exception](examples/Example.SmartContract.Exception/) | Error handling examples |\n| [ZKP](examples/Example.SmartContract.ZKP/) | Zero-knowledge proof implementation examples |\n| [Inscription](examples/Example.SmartContract.Inscription/) | Blockchain inscription examples |\n| [Oracle](examples/Example.SmartContract.Oracle/) | Oracle service interaction examples |\n| [Modifier](examples/Example.SmartContract.Modifier/) | Method modifier usage examples |\n| [Transfer](examples/Example.SmartContract.Transfer/) | Asset transfer examples |\n| [SampleRoyaltyNEP11Token](examples/Example.SmartContract.SampleRoyaltyNEP11Token/) | NFT with royalty feature implementation |\n\nEach example comes with corresponding unit tests that demonstrate how to properly test the contract functionality.\n\n## Documentation\n\nFor detailed documentation on NEO smart contract development with .NET:\n\n- [NEO Official Documentation](https://docs.neo.org/)\n- [NEO Smart Contract Development Guide](https://docs.neo.org/docs/en-us/develop/write/basics.html)\n\n## Contributing\n\nContributions are welcome! Please follow these steps:\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/your-feature`)\n3. Commit your changes (`git commit -am 'Add your feature'`)\n4. Push to the branch (`git push origin feature/your-feature`)\n5. Create a new Pull Request\n\nPlease ensure that your code follows the existing coding style and includes appropriate tests and documentation.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [NEO Project](https://neo.org/)\n- [NEO Community](https://neo.org/community)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo-project%2Fneo-devpack-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo-project%2Fneo-devpack-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo-project%2Fneo-devpack-dotnet/lists"}