examples

package module
v0.0.0-...-6c18b30 Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: GPL-3.0 Imports: 0 Imported by: 0

README

Echo server example

Example of listening Ethereum events in Golang

Run

go run cmd/pongWatcher/main.go --raw-url=wss://ropsten.eth.6120.eu/ws --address=0x85EAb3977d0C1a6F22Fd0a3e37090a234551D2E0

go run

Generate wrapper

From base directory: go generate

Dependencies

For wrapper generation: abigen go get github.com/ethereum/go-ethereum/cmd/abigen

Example code

	c, err := ethclient.Dial(opts.RawURL)
[...]
	ppf, err := examples.NewPingPongFilterer(addr, c)
[...]
	sub, err := ppf.WatchPong(&bind.WatchOpts{nil, nil}, sink)
[...]
	for e := range sink {
		log.Printf("PingPongPong: %+v", e)
	}

Donation

BTC: 1MYiMU3GfsgEP4EYHHonG9Fy6DkA1JC3B5

ETH: 0xc8f8371BDd6FB64388F0D65F43A0040926Ee38be

BCC: bitcoincash:qphs9n0apf553jgwawgrx24wfrnutjse45av6k5h8x

Documentation

Overview

This file is only here for the go generate function

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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