The First Token Smart Contract Executing in Native C# / .NET on Stratis


A graphic about Stratis

Note: Hundreds of you have been messaging me that X other platform has smart contracts in C#. I can say with certainty that Stratis is the first to be executing C# natively. Other platforms (e.g. NEO) may be compiling C# syntax to custom machine code but we’re definitely the first to be executing actual .NET code on the Common Language Runtime, .NET’s virtual machine. (I should know, I previously built EthSharp which compiled C# for the EVM!)

Over 12 months ago, slightly frustrated with the “young” state of solidity and Ethereum smart contract development environments, I started craving bringing my favourite development environment (C# / .NET / Visual Studio) to blockchain development. Over the course of a couple of months I made progress on a project called EthSharp(see it on github). It was starting to functionally generate EVM bytecode from C# syntax but I ultimately discontinued it because I felt that compiling to a non-native bytecode negates the possibility of leveraging an established framework’s ecosystem and may carry a range of security risks. Note to self: Write an article about this!

The smart contracts team at Stratis has since been building something much more exciting, a blockchain with the ability to execute .NET code on-chain. Smart contract platforms so far have generally introduced or repackaged a custom virtual machine like the EVM, whilst we’ve gone for a very different approach :)

The protocol isn’t in production yet — it’s scheduled to be live by the end of the year. You can find out more about the stacked roadmap here.

However, what’s cool right now is that we have a first draft of a functional token contract (think ERC-20) written completely in C#, and executing on-chain. Thanks to Rowan de Haas for putting this one together. Find the most up-to-date source in our node repository on github, or for now just marvel at this little preview:

We’re expecting to formalise the standard in the coming weeks, so yes it will have a catchy little name like “SRC-3” soon too.

I’m hoping there is someone else out there as excited about this as I am. If I find time I’d love to go into the pros and cons of our smart contract execution approach.

In the meantime, catch me on Twitter: @codingupastorm

Or join us on Discord! Find me in the #smart_contracts channel.