SOLVED

Re: Welcome to the Blockchain AMA!

%3CLINGO-SUB%20id%3D%22lingo-sub-53443%22%20slang%3D%22en-US%22%3ERe%3A%20Welcome%20to%20the%20Blockchain%20AMA!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-53443%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20Dong%20Xie%20from%20Oxford%2C%20U.K.%20Got%20a%20quick%20question%2C%20is%20that%20possible%20to%20use%20C%23%20as%20the%20scripting%20language%20for%20Etherum%2FSmart%20Contract%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-53509%22%20slang%3D%22en-US%22%3ERe%3A%20Welcome%20to%20the%20Blockchain%20AMA!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-53509%22%20slang%3D%22en-US%22%3E%3CP%3EThere's%20nothing%20a%20JS-inspired%20language%20can%20do%20that%20a%20C%23-inpsired%20language%20can't%20-%20it's%20just%20a%20function%20of%20where%20existing%20smart%20contract%20languages%20have%20taken%20their%20inspiration.%20I%20think%20the%20Solidity%20devs%20wanted%20to%20target%20web%20developers%20for%20DApp%20development%2C%20so%20making%20something%20that%20looks%20like%20JS%20makes%20sense.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20good%20link%20to%20read%20over%20is%20the%20following%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fethereum%2Fwiki%2Fwiki%2FEthereum-Development-Tutorial%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2Fethereum%2Fwiki%2Fwiki%2FEthereum-Development-Tutorial%3C%2FA%3E%20.%20There's%20links%20to%20other%20smart%20contract%20development%20languages%2C%20including%20ones%20that%20have%20taken%20syntactic%20inspiration%20from%20Python%20and%20C.%20In%20addition%2C%20the%20%22State%20Machine%22%20section%20shows%26nbsp%3Bwhat%20development%20at%20the%20EVM%20assembly%20level%20looks%20like.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEthereum%20is%20indeed%20open%20source%2C%20so%20there's%20no%20reason%20we%20couldn't%20develop%20a%20smart%20contract%20development%20language%20that's%20inspired%20by%20C%23.%20Currently%20we%20don't%20have%20any%20plans%20to%20do%20so%2C%20but%20considering%20that%20many%20of%20our%20customers%20are%20most%20comfortable%20with%20C%23%2C%20this%20may%20change%20in%20the%20future.%20If%20you'd%20like%20to%20get%20started%2C%20the%20best%20EVM%20opcode%20reference%20is%20in%20the%20yellow%20paper%2C%20appendix%20H%3A%20%3CA%20href%3D%22http%3A%2F%2Fgavwood.com%2Fpaper.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttp%3A%2F%2Fgavwood.com%2Fpaper.pdf%3C%2FA%3E%20.%20Make%20it%20open%20source%2C%20and%20we%20may%20leverage%20it%20in%20the%20future!%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-53487%22%20slang%3D%22en-US%22%3ERe%3A%20Welcome%20to%20the%20Blockchain%20AMA!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-53487%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20for%20the%20great%20answer.%20Although%20I'm%20not%20very%20clear%20why%20a%20JavaScript%20like%20language%20would%20do%20yet%20C%23%20can't%3F%20Since%20C%23%20is%20my%20first%20language%2C%20I%20would%20prefer%20it%20to%20be%20where%20I%20should%20be%20coding.%20Defintely%20not%20going%20to%20learn%20another%20JS%20like%20nightmare.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20thought%20Ethereum%20is%20open%20source%20right%3F%20So%20that%20maybe%20we%20can%20just%20start%20to%20get%20C%23%20in%20it%2C%20as%20early%20as%20possible.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20good%20paper%2Fdocumentation%20regarding%20EVM%2Fopcodes%20and%20their%20distribution%20model%3F%20From%20a%20programmer's%20perspective.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-53467%22%20slang%3D%22en-US%22%3ERe%3A%20Welcome%20to%20the%20Blockchain%20AMA!%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-53467%22%20slang%3D%22en-US%22%3E%3CP%3EFor%20Ethereum%20specifically%2C%20the%20big%20requirement%20is%20that%20your%20programs%20compile%20down%20to%20Ethereum%20Virtual%20Machine%20(EVM)%20opcodes.%20Theoretically%20there's%20no%20reason%20you%20couldn't%20write%20a%20C%23%20compiler%20for%20the%20EVM%2C%20though%20you%20wouldn't%20have%20access%20to%20a%20lot%20of%20the%20standard%20libraries%20due%20to%20additional%20limitations%20of%20the%20system%20-%20a%20big%20one%20is%20that%20all%20code%20has%20to%20be%20nondeterministic%2C%20because%20if%20different%20nodes%20get%20different%20results%2C%20you%20will%20have%20a%20consensus%20failure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERight%20now%20the%20major%20scripting%20language%20for%20Ethereum%20smart%20contracts%20is%20Solidity%2C%20which%20is%20syntactically%20similar%20to%20Javascript.%20Research%20is%20ongoing%20into%20other%20languages%20that%20target%20the%20EVM.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you're%20interested%20in%20using%20C%23%20in%20a%20blockchain%20context%2C%20the%20NEthereum%20libraries%20work%20well%20for%20integrating%20traditional%20C%23%20programs%20with%20an%20Ethereum%20deployment.%20In%20the%20future%2C%20you%20will%20also%20be%20able%20to%20use%20C%23%20as%20the%20language%20for%20Cryptlet%20development%2C%20enabling%20you%20to%20perform%20off-chain%20computations%20in%20C%23%20and%20writing%20blockchain%20transactions%20as%20a%20standardized%20data%20object.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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 (New 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! :)