utils

package
v0.0.0-...-cf96749 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigIntToU256

func BigIntToU256(bigInt *big.Int) types.U256

BigIntToU256 converts a big.Int to a U256

func BytesToHex

func BytesToHex(bytes []byte) string

BytesToHex converts a byte slice to a hex string

func DecodeBlock

func DecodeBlock(data []byte) (*types.Block, error)

DecodeBlock decodes a block from JSON

func DecodeExtrinsic

func DecodeExtrinsic(data []byte) (*types.Extrinsic, error)

DecodeExtrinsic decodes an extrinsic from JSON

func EncodeBlock

func EncodeBlock(block *types.Block) ([]byte, error)

EncodeBlock encodes a block to JSON

func EncodeExtrinsic

func EncodeExtrinsic(ext *types.Extrinsic) ([]byte, error)

EncodeExtrinsic encodes an extrinsic to JSON

func GenerateKey

func GenerateKey() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

GenerateKey generates a new ECDSA key pair

func GetAccountAddressFromPrivateKey

func GetAccountAddressFromPrivateKey(privateKey *ecdsa.PrivateKey) common.Address

GetAccountAddressFromPrivateKey gets the account address from a private key

func GetAccountAddressFromPublicKey

func GetAccountAddressFromPublicKey(publicKey *ecdsa.PublicKey) common.Address

GetAccountAddressFromPublicKey gets the account address from a public key

func HexToBytes

func HexToBytes(hexString string) ([]byte, error)

HexToBytes converts a hex string to a byte slice

func SignMessage

func SignMessage(privateKey *ecdsa.PrivateKey, message []byte) ([]byte, error)

SignMessage signs a message with a private key

func U256ToBigInt

func U256ToBigInt(u256 types.U256) *big.Int

U256ToBigInt converts a U256 to a big.Int

func VerifySignature

func VerifySignature(publicKey *ecdsa.PublicKey, message []byte, signature []byte) bool

VerifySignature verifies a signature with a public key

Types

This section is empty.

Jump to

Keyboard shortcuts

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