og_interface

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const (
	FlagAddressNone byte = iota
	FlagAddress20
)
View Source
const (
	FlagHashNone byte = iota
	FlagHash32
)
View Source
const (
	Address20Length = 20
)
View Source
const CryptoTypeECDSA = CryptoType(cryptopb.KeyType_ECDSA)
View Source
const CryptoTypeEd25519 = CryptoType(cryptopb.KeyType_Ed25519)
View Source
const CryptoTypeRSA = CryptoType(cryptopb.KeyType_RSA)
View Source
const CryptoTypeSecp256k1 = CryptoType(cryptopb.KeyType_Secp256k1)
View Source
const (
	Hash32Length = 32
)

Variables

This section is empty.

Functions

func BytesCmp

func BytesCmp(a FixLengthBytes, b FixLengthBytes) int

func MarshalAddress

func MarshalAddress(addr Address) ([]byte, error)

func MarshalHash

func MarshalHash(hash Hash) ([]byte, error)

Types

type AccountHolder

type AccountHolder interface {
	ProvidePrivateKey(createIfMissing bool) ([]byte, error)
}

type Address

type Address interface {
	FixLengthBytes
	AddressKey() AddressKey
	AddressString() string // just for type safety between Address and Hash
	AddressShortString() string

	marshaller.IMarshaller
}

func AddressFromAddressKey

func AddressFromAddressKey(key AddressKey) (Address, error)

func AddressFromHex

func AddressFromHex(s string) (Address, error)

func UnmarshalAddress

func UnmarshalAddress(b []byte) (Address, []byte, error)

type Address20

type Address20 struct {
	// contains filtered or unexported fields
}

func BigToAddress20

func BigToAddress20(v *big.Int) *Address20

func BytesToAddress20

func BytesToAddress20(b []byte) *Address20

func CreateAddress20

func CreateAddress20(b Address20, nonce uint64) Address20

CreateAddress creates an address20 given the bytes and the nonce

func CreateAddress20_2

func CreateAddress20_2(b Address20, salt Hash32, inithash []byte) Address20

CreateAddress2 creates an address20 given the address bytes, initial contract code hash and a salt.

func HexToAddress20

func HexToAddress20(hex string) (*Address20, error)

func RandomAddress20

func RandomAddress20() *Address20

func (*Address20) AddressKey

func (a *Address20) AddressKey() AddressKey

func (*Address20) AddressShortString

func (a *Address20) AddressShortString() string

func (*Address20) AddressString

func (a *Address20) AddressString() string

func (*Address20) Big added in v0.0.9

func (a *Address20) Big() *big.Int

func (*Address20) Bytes

func (a *Address20) Bytes() []byte

func (*Address20) Cmp

func (a *Address20) Cmp(another FixLengthBytes) int

func (*Address20) FromBytes

func (a *Address20) FromBytes(b []byte)

func (*Address20) FromHex

func (a *Address20) FromHex(s string) (err error)

func (*Address20) FromHexNoError

func (a *Address20) FromHexNoError(s string)

func (*Address20) Hex

func (a *Address20) Hex() string

func (*Address20) Length

func (a *Address20) Length() int

func (*Address20) MarshalMsg

func (a *Address20) MarshalMsg() ([]byte, error)

func (*Address20) MsgSize

func (a *Address20) MsgSize() int

func (*Address20) UnmarshalMsg

func (a *Address20) UnmarshalMsg(b []byte) ([]byte, error)

type AddressConverter

type AddressConverter interface {
	AddressFromAccount(account *OgLedgerAccount) (addr Address, err error)
}

type AddressKey

type AddressKey string

func (AddressKey) Bytes

func (k AddressKey) Bytes() []byte

type BlockContent

type BlockContent interface {
	GetType() BlockContentType
	String() string
	FromString(string)
	GetHash() Hash
	GetHeight() int64
}

type BlockContentType

type BlockContentType int
const (
	BlockContentTypeInt BlockContentType = iota
)

type BlsConsensusAccount

type BlsConsensusAccount struct {
	// contains filtered or unexported fields
}

func (BlsConsensusAccount) Id

func (b BlsConsensusAccount) Id() string

type CommitteeMemberStore

type CommitteeMemberStore struct {
	PeerIndex       int
	MemberId        string
	TransportPeerId string
	PublicKey       string
}

type CommitteeStore

type CommitteeStore struct {
	Version int
	Peers   []CommitteeMemberStore
}

type CryptoType

type CryptoType int

type FixLengthBytes

type FixLengthBytes interface {
	Length() int
	FromBytes(b []byte)
	FromHex(s string) error
	FromHexNoError(s string)
	Bytes() []byte
	Hex() string
	Cmp(FixLengthBytes) int
}

type Genesis

type Genesis struct {
	//RootSequencerHash og_interface.Hash
	FirstCommittee *consensus_interface.Committee
}

type GenesisStore

type GenesisStore struct {
	//RootSequencerHash string
	FirstCommittee CommitteeStore
}

type Hash

type Hash interface {
	FixLengthBytes
	HashKey() HashKey
	HashString() string
	HashShortString() string

	marshaller.IMarshaller
}

func BigToHash

func BigToHash(b *big.Int, hashFlag byte) Hash

func UnmarshalHash

func UnmarshalHash(b []byte) (Hash, []byte, error)

type Hash32

type Hash32 [Hash32Length]byte

func BigToHash32

func BigToHash32(v *big.Int) *Hash32

func BytesToHash32

func BytesToHash32(b []byte) *Hash32

func HexToHash32

func HexToHash32(hex string) (*Hash32, error)

func RandomHash32

func RandomHash32() *Hash32

func (*Hash32) Bytes

func (a *Hash32) Bytes() []byte

func (*Hash32) Cmp

func (a *Hash32) Cmp(another FixLengthBytes) int

func (*Hash32) FromBytes

func (a *Hash32) FromBytes(b []byte)

func (*Hash32) FromHex

func (a *Hash32) FromHex(s string) (err error)

func (*Hash32) FromHexNoError

func (a *Hash32) FromHexNoError(s string)

func (*Hash32) HashKey

func (a *Hash32) HashKey() HashKey

func (*Hash32) HashShortString

func (a *Hash32) HashShortString() string

func (*Hash32) HashString

func (a *Hash32) HashString() string

func (*Hash32) Hex

func (a *Hash32) Hex() string

func (*Hash32) Length

func (a *Hash32) Length() int

func (*Hash32) MarshalMsg

func (a *Hash32) MarshalMsg() ([]byte, error)

func (*Hash32) MsgSize

func (a *Hash32) MsgSize() int

func (*Hash32) UnmarshalMsg

func (a *Hash32) UnmarshalMsg(data []byte) ([]byte, error)

type HashKey

type HashKey string

func (HashKey) Bytes

func (k HashKey) Bytes() []byte

type Ledger

type Ledger interface {
	CurrentHeight() int64
	CurrentCommittee() *consensus_interface.Committee
	GetBlock(height int64) BlockContent
	ConfirmBlock(block BlockContent)
	GetResource(request ResourceRequest) Resource
}

type LedgerAccountProvider

type LedgerAccountProvider interface {
	ProvideAccount() (*OgLedgerAccount, error)
	Generate() (account *OgLedgerAccount, err error)
	Load() (account *OgLedgerAccount, err error)
	Save() (err error)
}

type LedgerSigner

type LedgerSigner interface {
	Sign(msg []byte, account OgLedgerAccount) []byte
}

type NewHeightDetectedEvent

type NewHeightDetectedEvent struct {
	Height int64
	PeerId string
}

type NewHeightDetectedEventSubscriber

type NewHeightDetectedEventSubscriber interface {
	Name() string
	NewHeightDetectedEventChannel() chan *NewHeightDetectedEvent
}

type NodeInfoProvider

type NodeInfoProvider interface {
	CurrentHeight() int64
	GetNetworkId() string
}

type OgLedgerAccount

type OgLedgerAccount struct {
	PublicKey  crypto.PubKey
	PrivateKey crypto.PrivKey
	Address    Address
}

OgLedgerAccount represents a full account of a user.

type OgSequencer

type OgSequencer struct {
}

type OgTx

type OgTx struct {
	Hash        Hash
	ParentsHash []Hash
	MineNonce   uint64
	From        Address
	To          Address
	Value       string // bigint
	TokenId     int32
	PublicKey   []byte
	Data        []byte
	Signature   []byte
}

type PeerJoinedEvent

type PeerJoinedEvent struct {
	PeerId string
}

type PeerJoinedEventSubscriber

type PeerJoinedEventSubscriber interface {
	EventChannelPeerJoined() chan *PeerJoinedEvent
}

type PeerLeftEvent

type PeerLeftEvent struct {
	PeerId string
}

type PeerLeftEventSubscriber

type PeerLeftEventSubscriber interface {
	EventChannelPeerLeft() chan *PeerLeftEvent
}

type PrivateGenerator

type PrivateGenerator interface {
	GeneratePair(typ int) (privKey crypto.PrivKey, pubKey crypto.PubKey, err error)
}

type Syncer

type Syncer interface {
}

type Unknown

type Unknown interface {
	GetType() UnknownType
	GetValue() interface{}
}

Unknown represents a resource that needs to be synced from others

type UnknownHash

type UnknownHash struct {
	// contains filtered or unexported fields
}

func (UnknownHash) GetType

func (u UnknownHash) GetType() UnknownType

func (UnknownHash) GetValue

func (u UnknownHash) GetValue() interface{}

type UnknownHeight

type UnknownHeight struct {
	// contains filtered or unexported fields
}

func (UnknownHeight) GetType

func (u UnknownHeight) GetType() UnknownType

func (UnknownHeight) GetValue

func (u UnknownHeight) GetValue() interface{}

type UnknownManager

type UnknownManager interface {
}

type UnknownType

type UnknownType int
const (
	UnknownTypeHeight UnknownType = iota
	UnknownTypeHash
)

Jump to

Keyboard shortcuts

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