SOLVED

Re: Welcome to the Blockchain AMA!

Copper Contributor

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?

3 Replies
best response confirmed by Dong Xie (Copper Contributor)
Solution

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.

 

Right now the major scripting language for Ethereum smart contracts is Solidity, which is syntactically similar to Javascript. Research is ongoing into other languages that target the EVM.

 

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.

Thanks for the great answer. Although I'm not very clear why a JavaScript like language would do yet C# can't? Since C# is my first language, I would prefer it to be where I should be coding. Defintely not going to learn another JS like nightmare.

 

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.

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! :)

1 best response

Accepted Solutions
best response confirmed by Dong Xie (Copper Contributor)
Solution

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.

 

Right now the major scripting language for Ethereum smart contracts is Solidity, which is syntactically similar to Javascript. Research is ongoing into other languages that target the EVM.

 

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.

View solution in original post