sol file put in ~/contracts/sol
File list
~/contracts/sol/Contracts.solRUN
docker run -v ~/contracts:/sources ethereum/solc:0.4.23 -o /sources --abi --bin /sources/sol/Contract.sol
File list
~/contracts/sol/Contracts.sol~/contracts/Contracts.abi
~/contracts/Contracts.bin
1. 0.4.23 check your contract version. This example is pragma solidity ^0.4.23;
2. sol name need be changeed. This example is Contract.sol
3. Permission denied just use root
RUN
docker run -v ~/contracts:/sources ethereum/client-go:alltools-v1.9.2 abigen --abi /sources/Contract.abi --pkg contracts --type Contract --out /sources/Contract.go --bin /sources/Contract.bin
File list
~/contracts/sol/Contracts.sol~/contracts/Contracts.abi
~/contracts/Contracts.bin
~/contracts/Contracts.go
1. Contract.abi Contract.go must change by solc output
2. pkg is go source code:package contracts
3. type is go source code:type Cert struct { }
4. bin is go source code:be add "var ContractBin = ..." and "func DeployContract(..."
Error:
docker run -v ~/contracts/sol:/sources ethereum/client-go:alltools-v1.9.2 abigen --sol /sources/Cert.sol --pkg contracts --out /sources/Cert.go
Fatal: Failed to build Solidity contract: exec: "solc": executable file not found in $PATH
Source:
https://solidity.readthedocs.io/en/develop/installing-solidity.html#docker
https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts#generating-the-bindings
https://hub.docker.com/r/ethereum/client-go
https://github.com/ethereum/go-ethereum/blob/master/cmd/abigen/main.go