This is a simple project where I deploy, read and write to eth contract on Rinkeby using golang
Go 99.91%Solidity 0.09%
go-eth-hello-world's Introduction
Overview
This is a simple project where I deploy, read and write to eth contract on Rinkeby using golang
Notes
To access solidity contract from golang
Get the contract source code in solidity
Generate the ABI ( application binary interface) using abigen
solc --abi Store.sol -o build
Convert the abi into an importable go file
abigen --abi=./build/Store.abi --pkg=store --out=Store.go
To Deploy solidity from golang
In order to deploy a smart contract from Go, we also need to compile the solidity smart contract to EVM bytecode. The EVM bytecode is what will be sent in the data field of the transaction. The bin file is required for generating the deploy methods on the Go contract file.
solc --bin Store.sol -o build
Now we compile the Go contract file which will include the deploy methods because we includes the bin file.
abigen --bin=./build/Store.bin --abi=./build/Store.abi --pkg=store --out=Store.go