This guide provides detailed instructions on how to run a Docker image to simulate the enclave, as well as the necessary steps to install additional dependencies and set up the environment.
- Install the Docker image to simulate the enclave:
docker run -it -v $(pwd):/myapp -p 8080:8080 ghcr.io/edgelesssys/ego-dev
- Install Ethereum and Solc:
-
This link contains detailed instructions on how to install Ethereum. Summarizing:
apt-get install software-properties-common add-apt-repository -y ppa:ethereum/ethereum apt-get update apt-get install ethereum
-
Install
solc
to compile Solidity contracts.apt-get update apt-get install -y software-properties-common add-apt-repository -y ppa:ethereum/ethereum apt-get update apt-get install -y solc
-
Next install
abigen
:
go install github.com/ethereum/go-ethereum/cmd/abigen@latest
- Add in your PATH:
export PATH=$PATH:$(go env GOPATH)/bin`
-
Follow these steps if you want to execute the Dockerfile from the terminal:
-
Make sure you have Docker installed on your system. If you haven't installed it yet, you can follow the official instructions to Install Docker.
-
Ensure you are in the directory of your project that contains the Dockerfile.
-
Use the
docker build
command to build the Docker image from the Dockerfile. You can assign a name to the image using the-t
option. For example, if you want to name the imagemyimage
, the command would be similar to this:docker build -t myimage .
Make sure to include the dot
.
at the end of the command to indicate the current directory as the build context. -
Once the image is built, you can run the Docker container using the
docker run
command. For example:docker run -it myimage
Replace
myimage
with the name you gave to the image during the build phase. -
Save container
docker commit my_container my_new_image:latest
By following these commands, you should be able to build and run the Docker container using the provided Dockerfile. Make sure you have sufficient privileges to execute Docker commands; you may need to use sudo
if you are not a root user or do not have adequate permissions.
-
Create the smart contract in Solidity:
- Write your smart contract in Solidity and save it in a
.sol
file.
- Write your smart contract in Solidity and save it in a
-
Convert it with
abigen
andsolc
into a.go
file:- Use the
abigen
andsolc
tools to convert the Solidity file into a Go file. Make sure you have Go dependencies installed.
- Use the
-
Perform the following operations:
go mod init
go mod tidy
go get github.com/ethereum/go-ethereum
go get all
These steps will install the necessary dependencies to run and test your Ethereum contract within the Go environment.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.