ethutils

package module
v0.0.0-...-218c2b5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

README

ethutils

The collection of ethereum utils.

Quick Start

package main

import (
	"fmt"

	"github.com/TheStarBoys/ethutils"
	"github.com/ethereum/go-ethereum/crypto"
)

func main() {
	priv, err := crypto.HexToECDSA("9a01f5c57e377e0239e6036b7b2d700454b760b2dab51390f1eeb2f64fe98b68")
	if err != nil {
		panic(err)
	}

	rawText := "hello"
	sig, err := ethutils.PersonalSign([]byte(rawText), priv)
	if err != nil {
		panic(err)
	}

	fmt.Println("got sig:", sig.Hex())

	gotAddr, err := ethutils.EcRecover([]byte(rawText), sig)
	if err != nil {
		panic(err)
	}

	fmt.Println("got addr:", gotAddr.Hex())
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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