crypto

package
v0.0.0-...-24d451d Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const AddressHexLength = 2 * AddressLength
View Source
const AddressLength = binary.Word160Length

Variables

View Source
var ZeroAddress = BVMAddress{}

Functions

func GetChainName

func GetChainName(chainID string) string

func GetMainChainID

func GetMainChainID(chainID string) string

func Nonce

func Nonce(caller BVMAddress, nonce []byte) []byte

func SequenceNonce

func SequenceNonce(address BVMAddress, sequence uint64) []byte

Obtain a nearly unique nonce based on a montonic account sequence number

func ToAddr

func ToAddr(address BVMAddress) crypto.Address

Types

type BVMAddress

type BVMAddress binary.Word160

func AddressFromBytes

func AddressFromBytes(bs []byte) (address BVMAddress, err error)

Returns an address consisting of the first 20 bytes of bs, return an error if the bs does not have length exactly 20 but will still return either: the bytes in bs padded on the right or the first 20 bytes of bs truncated in any case.

func AddressFromHexString

func AddressFromHexString(str string) (BVMAddress, error)

func AddressFromWord256

func AddressFromWord256(addr binary.Word256) BVMAddress

func MaybeAddressFromBytes

func MaybeAddressFromBytes(bs []byte) (*BVMAddress, error)

Returns a pointer to an BVMAddress that is nil iff len(bs) == 0 otherwise does the same as AddressFromBytes

func MustAddressFromBytes

func MustAddressFromBytes(addr []byte) BVMAddress

func MustAddressFromHexString

func MustAddressFromHexString(str string) BVMAddress

func NewContractAddress

func NewContractAddress(caller BVMAddress, nonce []byte) (newAddr BVMAddress)

func NewContractAddress2

func NewContractAddress2(caller BVMAddress, salt [binary.Word256Length]byte, initcode []byte) (newAddr BVMAddress)

func ToBVM

func ToBVM(address crypto.Address) BVMAddress

func (BVMAddress) Bytes

func (address BVMAddress) Bytes() []byte

Copy address and return a slice onto the copy

func (*BVMAddress) Equal

func (address *BVMAddress) Equal(b BVMAddress) bool

func (*BVMAddress) Marshal

func (address *BVMAddress) Marshal() ([]byte, error)

Gogo proto support

func (BVMAddress) MarshalJSON

func (address BVMAddress) MarshalJSON() ([]byte, error)

func (BVMAddress) MarshalText

func (address BVMAddress) MarshalText() ([]byte, error)

func (*BVMAddress) MarshalTo

func (address *BVMAddress) MarshalTo(data []byte) (int, error)

func (*BVMAddress) Size

func (address *BVMAddress) Size() int

func (BVMAddress) String

func (address BVMAddress) String() string

func (*BVMAddress) Unmarshal

func (address *BVMAddress) Unmarshal(data []byte) error

func (*BVMAddress) UnmarshalJSON

func (address *BVMAddress) UnmarshalJSON(data []byte) error

func (*BVMAddress) UnmarshalText

func (address *BVMAddress) UnmarshalText(text []byte) error

func (BVMAddress) Word256

func (address BVMAddress) Word256() binary.Word256

type BVMAddresses

type BVMAddresses []BVMAddress

func (BVMAddresses) Len

func (as BVMAddresses) Len() int

func (BVMAddresses) Less

func (as BVMAddresses) Less(i, j int) bool

func (BVMAddresses) Swap

func (as BVMAddresses) Swap(i, j int)

type CurveType

type CurveType uint32
const (
	CurveTypeUnset CurveType = iota
	CurveTypeEd25519
	CurveTypeSecp256k1
)

func (CurveType) ABCIType

func (k CurveType) ABCIType() string

func (CurveType) Byte

func (k CurveType) Byte() byte

Get this CurveType's 8 bit identifier as a byte

func (CurveType) String

func (k CurveType) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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