Mar 15 2017
- last edited on
May 26 2021
Hi, Dong Xie from Oxford, U.K. Got a quick question, is that possible to use C# as the scripting language for Etherum/Smart Contract?
Mar 15 2017 09:34 AMSolution
For Ethereum specifically, the big requirement is that your programs compile down to Ethereum Virtual Machine (EVM) opcodes. Theoretically there's no reason you couldn't write a C# compiler for the EVM, though you wouldn't have access to a lot of the standard libraries due to additional limitations of the system - a big one is that all code has to be nondeterministic, because if different nodes get different results, you will have a consensus failure.
If you're interested in using C# in a blockchain context, the NEthereum libraries work well for integrating traditional C# programs with an Ethereum deployment. In the future, you will also be able to use C# as the language for Cryptlet development, enabling you to perform off-chain computations in C# and writing blockchain transactions as a standardized data object.
Mar 15 2017 09:44 AM
I thought Ethereum is open source right? So that maybe we can just start to get C# in it, as early as possible.
Is there good paper/documentation regarding EVM/opcodes and their distribution model? From a programmer's perspective.
Mar 15 2017 09:59 AM - edited Mar 15 2017 10:03 AM
There's nothing a JS-inspired language can do that a C#-inpsired language can't - it's just a function of where existing smart contract languages have taken their inspiration. I think the Solidity devs wanted to target web developers for DApp development, so making something that looks like JS makes sense.
A good link to read over is the following: https://github.com/ethereum/wiki/wiki/Ethereum-Development-Tutorial . There's links to other smart contract development languages, including ones that have taken syntactic inspiration from Python and C. In addition, the "State Machine" section shows what development at the EVM assembly level looks like.
Ethereum is indeed open source, so there's no reason we couldn't develop a smart contract development language that's inspired by C#. Currently we don't have any plans to do so, but considering that many of our customers are most comfortable with C#, this may change in the future. If you'd like to get started, the best EVM opcode reference is in the yellow paper, appendix H: http://gavwood.com/paper.pdf . Make it open source, and we may leverage it in the future! :)