interfaces

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSeed

func GetSeed(acc IAccount) int64

func WaitForRegUnreg

func WaitForRegUnreg(acc IAccount, isReg bool, timeout time.Duration) error

Types

type AccountType

type AccountType uint8
const (
	EthAccountType AccountType = iota
	NeoAccountType
)

type EthereumValues

type EthereumValues struct {
	WeiPerByte float64
	EthStake   float64
}

type IAccount

type IAccount interface {
	GetAccountType() AccountType
	BlockchainName() string
	Permission() common.UrlPermission

	EcdsaPrivateKey() *ecdsa.PrivateKey // follows Eth standard
	PrivateKeyBytes() []byte
	PrivateKeyString() string
	PublicKeyBytes() []byte
	EcdsaPublicKeyBytes() []byte // follows Eth standard
	PublicKeyString() string
	AddressBytes() []byte
	AddressString() string

	Sign(hash []byte) (sig []byte, err error)
	Verify(hash, signature, publicKey []byte) bool

	// true if the transaction was accepted by the blockchain
	IsTxAccepted(txId string) bool

	// For client side
	GetUserName() (string, error)
	RegisterUserName(string) error

	// For Storage Provider side
	// Checks if the storage provider is registered on the blockchain
	IsSpRegistered() bool
	RegisterSP(*RegistrationInfo) (txId string, err error)
	UnregisterSP() error
	GetUploadTxInfo(txId string) (info *UploadTxInfo, err error)
	GetEarnings() (int64, error)

	// Utilities
	// amount is in blockchain base (Wei/Gas)
	PrettyCurrency(amount int64) string
	// in blockchain base
	HundredthOfCent() int64
}

type NeoValues

type NeoValues struct {
	GasPerGigaByte float64
}

type RegistrationInfo

type RegistrationInfo struct {
	CountryA3        string
	PledgedGigaBytes float64
	Ethereum         EthereumValues
	Neo              NeoValues
	Version          int
}

type UploadTxInfo

type UploadTxInfo struct {
	TxId              string
	UserName          string
	PublicKey         []byte
	FileContainerType uint8
	Signature         []byte
	SPs               [][]byte
}

Info needed by the SP when it received an upload request

func (*UploadTxInfo) ToJsonString

func (u *UploadTxInfo) ToJsonString() string

Jump to

Keyboard shortcuts

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