ethutil

package module
v0.0.0-...-8f19054 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: MIT Imports: 10 Imported by: 2

README


logo


go-ethutil

Ethereum utility functions for Go.

License Build Status Go Report Card GoDoc

Documentation

https://godoc.org/github.com/miguelmota/go-ethutil

Install

go get -u github.com/miguelmota/go-ethutil

Getting started

package main

import (
	"fmt"
	"log"

	"github.com/miguelmota/go-ethutil"
)

func main() {
	wei := ethutil.ToWei(0.02, 18)
	fmt.Println(wei) // 20000000000000000
}

Examples

Check out the ./example directory and documentation.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcGasCost

func CalcGasCost(gasLimit uint64, gasPrice *big.Int) *big.Int

CalcGasCost calculate gas cost given gas limit (units) and gas price (wei)

func IsValidAddress

func IsValidAddress(iaddress interface{}) bool

IsValidAddress validate hex address

func IsZeroAddress

func IsZeroAddress(iaddress interface{}) bool

IsZeroAddress validate if it's a 0 address

func LogTopicHash

func LogTopicHash(fnsig string) common.Hash

LogTopicHash generates the log topic hash given the event function declaration signature

func PublicKeyBytesToAddress

func PublicKeyBytesToAddress(publicKey []byte) common.Address

PublicKeyBytesToAddress returns the public address derived from a public key

func SigRSV

func SigRSV(isig interface{}) ([32]byte, [32]byte, uint8)

SigRSV signatures R S V returned as arrays

func ToDecimal

func ToDecimal(ivalue interface{}, decimals int) decimal.Decimal

ToDecimal wei to decimals

func ToWei

func ToWei(iamount interface{}, decimals int) *big.Int

ToWei decimals to wei

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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