go-dapp-example

command module
v0.0.0-...-92dc355 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 15 Imported by: 0

README ยถ

Go-DApp-Example

DApp example of deploying and interacting with Solidity smart contract using Go.

๐Ÿ›  Built With

Go Badge Gin Badge Geth Badge Solidity Badge

โš™๏ธ Run Locally

Clone the project.

git clone https://github.com/tr1sm0s1n/go-dapp-example.git
cd go-dapp-example

Install abigen.

go install github.com/ethereum/go-ethereum/cmd/abigen@latest

Generate Go binding for contract.

abigen --bin lib/Cert.bin --abi lib/Cert.abi --pkg lib --type Cert --out lib/Cert.go

Run a blockchain simulation on port 8545 (both http & ws). Copy a valid private key (omit '0x') and paste it in .env.

PRIVATE_KEY=<private-key>

Deploy the contract.

go run ./cmd/deploy.go

Copy the contract address from the terminal and paste it in .env.

CONTRACT_ADDRESS=<contract-address>

Start the application.

go run .

Start the event listener (new terminal).

go run ./events/events.go

Issue a certificate (new terminal).

curl -X POST http://localhost:8080/issue -H "Content-Type: application/json" -d '{"id": "test-01", "name": "Shepard", "course": "ETH-GO", "grade": "A", "date": "22-11-23"}'

Fetch a certificate.

curl http://localhost:8080/fetch/test-01

Get event logs.

curl http://localhost:8080/events

๐Ÿ“œ License

Click here.

๐ŸŽ—๏ธ Contributing

Click here.

โš–๏ธ Code of Conduct

Click here.

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Directories ยถ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL