2

Hi guys I'm new to smart contracts, and I'm experimenting with Ethereum. I would like to use golang in my developments so:

  1. Are there frameworks for developing smart contracts with Ethereum using go?

  2. If there aren't frameworks what alternative can I use with golang and Ethereum?

Thank for your answers.

2

You can theoretically write smart contracts in any language you like, but you'd also need to write a compiler to create bytecode that the EVM was able to understand.

In the past there was a Go-like/C-like language called Mutan, which is now deprecated.

I don't believe anyone has written a compiler for pure Go, and the following thread makes some suggestions why using Go for writing smart contracts isn't easily achieved: What is the merit of creating new smart contract languages like Solidity instead of using other languages?

For a list of the languages that can be used for writing smart contracts, have a read of What are the contract languages?

0
  1. The best way to write Smart Contracts as of the moment is to use Solidity. You may use Golang in writing your dapps that would interface with your smart contracts.
  2. There frameworks for writing Dapps using Golang but again the smart contract itself needs to be written in Solidity. Checkout Perigord for this framework. You may also want to check https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts for learning how to use Golang in binding with your smart contracts.
0

This is something that may become possible in future. There are efforts to port Ethereum to support WASM, and indeed it's already supported by Parity on their Kovan testnet. This would make it possible to write contracts in any language with a WASM back-end, including Golang.

However, it won't be supported on mainnet until the Constantinople hard fork at the earliest (and it may not make the cut, and the hard fork date has not been confirmed yet).

But perhaps more importantly, even if you could write contracts in Go today, this wouldn't eliminate the need to learn new things. Writing contracts is very different to almost any coding you've done before (it's more like writing code for an OS kernel than a web app). Learning Solidity (or Vyper, or Bamboo, etc.) is the easy bit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.