microchain

package
v0.0.0-...-45a46c7 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2019 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	MicroPayHashPrefix            = "\x19Ethereum Signed Message:\n32"
	DBKeyMicChainUserVersion      = "%s_DBKey_MicChain_User_Data_Version_%s"
	DBKeyMicChainMinerVersion     = "%s_DBKey_MicChain_Miner_Data_Version_%s"
	DBKeyUserData                 = "%s_DBKey_Local_User_Data_%s_%s"
	DBKeyLocalReceipt             = "%s_DBKey_Local_Receipt_Data_%s_%s"
	DBKeyLocalMinerAccount        = "%s_DBKey_Local_Miner_Account_%s_%s"
	BlockChainVersionSyncInterval = time.Second * 13
)
View Source
const (
	ReceiptSyncTypeUser = iota
	ReceiptSyncTypeMiner
)

Variables

This section is empty.

Functions

func RKey

func RKey(micSys, from, to common.Address) []byte

func UserKey

func UserKey(micSys, from, to common.Address) []byte

Types

type BroadCast

type BroadCast struct {
	sync.RWMutex

	NewRcpChan chan *Receipt
	// contains filtered or unexported fields
}

func (*BroadCast) Wait

func (bc *BroadCast) Wait(sig chan struct{})

type CreditAuthor

type CreditAuthor struct {
	Contract  common.Address `json:"contract"`
	TokenAddr common.Address `json:"token"`
}

func (*CreditAuthor) Verify

func (ca *CreditAuthor) Verify(conf *com.EthereumConfig) bool

type MicChain

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

func NewWorker

func NewWorker(auth string) *MicChain

func (*MicChain) Syncing

func (mc *MicChain) Syncing(sig chan struct{})

func (*MicChain) WaitRcpReader

func (mc *MicChain) WaitRcpReader(sig chan struct{})

func (*MicChain) WaitTxInput

func (mc *MicChain) WaitTxInput(sig chan struct{})

type MicroTX

type MicroTX struct {
	Sig  []byte `json:"signature"`
	Hash []byte `json:"hash"`
	*TxData
}

func (*MicroTX) AbiHash

func (mt *MicroTX) AbiHash() ([]byte, error)

func (*MicroTX) FillAbiSign

func (mt *MicroTX) FillAbiSign(w account.Wallet) error

func (*MicroTX) String

func (mt *MicroTX) String() string

func (*MicroTX) UAKey

func (mt *MicroTX) UAKey() []byte

func (*MicroTX) VerifyTx

func (mt *MicroTX) VerifyTx() bool

type MinerAccManager

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

type MinerReceipt

type MinerReceipt struct {
	Sig          []byte
	*MinerTxData `json:"MinerTxData"`
}

func (*MinerReceipt) String

func (syn *MinerReceipt) String() string

func (*MinerReceipt) Verify

func (syn *MinerReceipt) Verify() bool

type MinerTxData

type MinerTxData struct {
	PackMined    *big.Int       `json:"mined"`
	LastMicNonce int64          `json:"lastNonce"`
	EthData      *eth.MinerData `json:"EthData"`
}

func (*MinerTxData) String

func (mtd *MinerTxData) String() string

type Receipt

type Receipt struct {
	Sig      []byte `json:"sig"`
	*MicroTX `json:"tx"`
}

func (*Receipt) RKey

func (r *Receipt) RKey(micSys common.Address) []byte

func (*Receipt) String

func (r *Receipt) String() string

func (*Receipt) Verify

func (r *Receipt) Verify() bool

type ReceiptSync

type ReceiptSync struct {
	Typ int
	MR  *MinerReceipt
	URQ *UserReceiptQuery
}

type TxData

type TxData struct {
	Epoch int64      `json:"CN"`
	Nonce int64      `json:"nonce"`
	Time  time.Time  `json:"time"`
	Miner account.ID `json:"minerID"`

	From   common.Address `json:"from"`
	To     common.Address `json:"to"`
	Amount *big.Int       `json:"amount"`
	Credit *big.Int       `json:"credit"`
	Author *CreditAuthor  `json:"author"`
}

type UserAccManager

type UserAccManager struct {
	UALock map[string]sync.RWMutex
	// contains filtered or unexported fields
}

type UserAccount

type UserAccount struct {
	UserAddr      common.Address `json:"user"`
	PoolAddr      common.Address `json:"pool"`
	Nonce         int64          `json:"nonce"`
	TokenBalance  *big.Int       `json:"balance"`
	PacketBalance *big.Int       `json:"reminder"`
	Expire        time.Time      `json:"expire"`

	Epoch      int64    `json:"epoch"`
	Credit     *big.Int `json:"credit"`
	MicroNonce int64    `json:"microNonce"`
}

func (*UserAccount) String

func (ua *UserAccount) String() string

func (*UserAccount) UKey

func (ua *UserAccount) UKey(micSys common.Address) []byte

type UserReceiptQuery

type UserReceiptQuery struct {
	UserAddr common.Address
	PoolAddr common.Address
}

func (*UserReceiptQuery) String

func (urq *UserReceiptQuery) String() string

type VersionManager

type VersionManager struct {
	UserDataVer  int64 `json:"udv"`
	PoolDataVer  int64 `json:"pdv"`
	MinerDataVer int64 `json:"mdv"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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