Documentation ¶
Index ¶
- Constants
- Variables
- func BlockProposalPubKey(proposal *BlockProposal) ([]byte, error)
- func DeriveSha(list DerivableList) common.Hash
- func ProofProposalPubKey(proposal *ProofProposal) ([]byte, error)
- func Sender(tx *Transaction) (common.Address, error)
- func SenderFlipKey(fk *PublicFlipKey) (common.Address, error)
- func SenderFlipKeysPackage(fk *PrivateFlipKeysPackage) (common.Address, error)
- func SenderPubKey(tx *Transaction) ([]byte, error)
- type ActivityMonitor
- type AddrActivity
- type Answer
- type Answers
- type AuthorResults
- type BadAuthorReason
- type Block
- func (b *Block) FromBytes(data []byte) error
- func (b *Block) Hash() common.Hash
- func (b *Block) Hash128() common.Hash128
- func (b *Block) Height() uint64
- func (b *Block) IdentityRoot() common.Hash
- func (b *Block) IsEmpty() bool
- func (b *Block) IsValid() bool
- func (b *Block) Root() common.Hash
- func (b *Block) Seed() Seed
- func (b *Block) ToBytes() ([]byte, error)
- type BlockBundle
- type BlockCert
- type BlockCertSignature
- type BlockFlag
- type BlockProposal
- type Body
- type BurntCoins
- type Candidate
- type DerivableList
- type EmptyBlockHeader
- type Flip
- type FlipToReward
- type FullBlockCert
- type Grade
- type Header
- func (h *Header) Coinbase() common.Address
- func (h *Header) FeePerGas() *big.Int
- func (h *Header) Flags() BlockFlag
- func (h *Header) FromBytes(data []byte) error
- func (h *Header) FromProto(protoHeader *models.ProtoBlockHeader) *Header
- func (h *Header) Hash() common.Hash
- func (h *Header) Height() uint64
- func (h *Header) IdentityRoot() common.Hash
- func (h *Header) IpfsHash() []byte
- func (h *Header) IsValid() bool
- func (h *Header) OfflineAddr() *common.Address
- func (h *Header) ParentHash() common.Hash
- func (h *Header) Root() common.Hash
- func (h *Header) Seed() Seed
- func (h *Header) Time() int64
- func (h *Header) ToBytes() ([]byte, error)
- func (h *Header) ToProto() *models.ProtoBlockHeader
- type InviterValidationResult
- type Network
- type PrivateFlipKeysPackage
- type ProofProposal
- type ProposedHeader
- type PublicFlipKey
- type SavedEvent
- type SavedTransaction
- type Seed
- type SuccessfulInvite
- type Transaction
- func (tx *Transaction) AmountOrZero() *big.Int
- func (tx *Transaction) FromBytes(data []byte) error
- func (tx *Transaction) FromProto(protoTx *models.ProtoTransaction) *Transaction
- func (tx *Transaction) Hash() common.Hash
- func (tx *Transaction) Hash128() common.Hash128
- func (tx *Transaction) MaxFeeOrZero() *big.Int
- func (tx *Transaction) Size() int
- func (tx *Transaction) TipsOrZero() *big.Int
- func (tx *Transaction) ToBytes() ([]byte, error)
- func (tx *Transaction) ToProto() *models.ProtoTransaction
- func (tx *Transaction) ToSignatureBytes() ([]byte, error)
- type TransactionIndex
- type Transactions
- type TxEvent
- type TxReceipt
- type TxReceiptIndex
- type TxReceipts
- type TxType
- type ValidationResult
- type ValidationResults
- type Vote
- type VoteHeader
Constants ¶
View Source
const ( SendTx uint16 = 0x0 ActivationTx uint16 = 0x1 InviteTx uint16 = 0x2 KillTx uint16 = 0x3 SubmitFlipTx uint16 = 0x4 SubmitAnswersHashTx uint16 = 0x5 SubmitShortAnswersTx uint16 = 0x6 SubmitLongAnswersTx uint16 = 0x7 EvidenceTx uint16 = 0x8 OnlineStatusTx uint16 = 0x9 KillInviteeTx uint16 = 0xA ChangeGodAddressTx uint16 = 0xB BurnTx uint16 = 0xC ChangeProfileTx uint16 = 0xD DeleteFlipTx uint16 = 0xE DeployContract uint16 = 0xF CallContract uint16 = 0x10 TerminateContract uint16 = 0x11 )
View Source
const ( ReductionOne = 253 ReductionTwo = 254 Final = 255 MaxBlockGas = 3000 * 1024 )
Variables ¶
View Source
var CeremonialTxs map[uint16]struct{}
Functions ¶
func BlockProposalPubKey ¶ added in v0.21.0
func BlockProposalPubKey(proposal *BlockProposal) ([]byte, error)
func DeriveSha ¶
func DeriveSha(list DerivableList) common.Hash
func ProofProposalPubKey ¶ added in v0.21.0
func ProofProposalPubKey(proposal *ProofProposal) ([]byte, error)
func Sender ¶
func Sender(tx *Transaction) (common.Address, error)
Sender may cache the address, allowing it to be used regardless of signing method.
func SenderFlipKey ¶
func SenderFlipKey(fk *PublicFlipKey) (common.Address, error)
Sender may cache the address, allowing it to be used regardless of signing method.
func SenderFlipKeysPackage ¶
func SenderFlipKeysPackage(fk *PrivateFlipKeysPackage) (common.Address, error)
Sender may cache the address, allowing it to be used regardless of signing method.
func SenderPubKey ¶
func SenderPubKey(tx *Transaction) ([]byte, error)
Sender may cache the address, allowing it to be used regardless of signing method.
Types ¶
type ActivityMonitor ¶
type ActivityMonitor struct { UpdateDt time.Time Data []*AddrActivity }
func (*ActivityMonitor) FromBytes ¶ added in v0.21.0
func (s *ActivityMonitor) FromBytes(data []byte) error
func (*ActivityMonitor) ToBytes ¶ added in v0.21.0
func (s *ActivityMonitor) ToBytes() ([]byte, error)
type AuthorResults ¶
type BadAuthorReason ¶
type BadAuthorReason = byte
const ( NoQualifiedFlipsBadAuthor BadAuthorReason = 0 QualifiedByNoneBadAuthor BadAuthorReason = 1 WrongWordsBadAuthor BadAuthorReason = 2 )
type Block ¶
func (*Block) IdentityRoot ¶
type BlockBundle ¶
type BlockCert ¶
type BlockCert struct { Round uint64 Step uint8 VotedHash common.Hash Signatures []*BlockCertSignature }
func (*BlockCert) FromProto ¶ added in v0.21.0
func (s *BlockCert) FromProto(protoObj *models.ProtoBlockCert) *BlockCert
func (*BlockCert) ToProto ¶ added in v0.21.0
func (s *BlockCert) ToProto() *models.ProtoBlockCert
type BlockCertSignature ¶
type BlockProposal ¶
type BlockProposal struct { *Block Signature []byte Proof []byte // contains filtered or unexported fields }
func (*BlockProposal) FromBytes ¶ added in v0.21.0
func (p *BlockProposal) FromBytes(data []byte) error
func (*BlockProposal) IsValid ¶
func (p *BlockProposal) IsValid() bool
func (*BlockProposal) ToBytes ¶ added in v0.21.0
func (p *BlockProposal) ToBytes() ([]byte, error)
func (*BlockProposal) ToSignatureBytes ¶ added in v0.21.0
func (p *BlockProposal) ToSignatureBytes() ([]byte, error)
type Body ¶
type Body struct {
Transactions []*Transaction `rlp:"nil"`
}
func (*Body) FromProto ¶ added in v0.21.0
func (b *Body) FromProto(protoBody *models.ProtoBlockBody) *Body
func (*Body) ToProto ¶ added in v0.21.0
func (b *Body) ToProto() *models.ProtoBlockBody
type BurntCoins ¶
func (*BurntCoins) FromBytes ¶ added in v0.21.0
func (s *BurntCoins) FromBytes(data []byte) error
func (*BurntCoins) ToBytes ¶ added in v0.21.0
func (s *BurntCoins) ToBytes() ([]byte, error)
type DerivableList ¶
type EmptyBlockHeader ¶
type EmptyBlockHeader struct { ParentHash common.Hash Height uint64 Root common.Hash IdentityRoot common.Hash BlockSeed Seed Time int64 Flags BlockFlag }
func (*EmptyBlockHeader) Hash ¶
func (h *EmptyBlockHeader) Hash() common.Hash
func (*EmptyBlockHeader) ToProto ¶ added in v0.21.0
func (h *EmptyBlockHeader) ToProto() *models.ProtoBlockHeader_Empty
type Flip ¶
type Flip struct { Tx *Transaction PublicPart []byte PrivatePart []byte // contains filtered or unexported fields }
type FlipToReward ¶ added in v0.22.0
type FullBlockCert ¶
type FullBlockCert struct {
Votes []*Vote
}
func (*FullBlockCert) Compress ¶
func (s *FullBlockCert) Compress() *BlockCert
type Header ¶
type Header struct { EmptyBlockHeader *EmptyBlockHeader `rlp:"nil"` ProposedHeader *ProposedHeader `rlp:"nil"` }
func (*Header) FromProto ¶ added in v0.21.0
func (h *Header) FromProto(protoHeader *models.ProtoBlockHeader) *Header
func (*Header) IdentityRoot ¶
func (*Header) OfflineAddr ¶
func (*Header) ParentHash ¶
func (*Header) ToProto ¶ added in v0.21.0
func (h *Header) ToProto() *models.ProtoBlockHeader
type InviterValidationResult ¶ added in v0.20.0
type InviterValidationResult struct { SuccessfulInvites []*SuccessfulInvite SavedInvites uint8 NewIdentityState uint8 PayInvitationReward bool }
type PrivateFlipKeysPackage ¶
type PrivateFlipKeysPackage struct { Data []byte Epoch uint16 Signature []byte // contains filtered or unexported fields }
func SignFlipKeysPackage ¶
func SignFlipKeysPackage(fk *PrivateFlipKeysPackage, prv *ecdsa.PrivateKey) (*PrivateFlipKeysPackage, error)
SignFlipKey returns flip key signed with given private key
func (*PrivateFlipKeysPackage) FromBytes ¶ added in v0.21.0
func (k *PrivateFlipKeysPackage) FromBytes(data []byte) error
func (*PrivateFlipKeysPackage) Hash128 ¶
func (k *PrivateFlipKeysPackage) Hash128() common.Hash128
func (*PrivateFlipKeysPackage) ToBytes ¶ added in v0.21.0
func (k *PrivateFlipKeysPackage) ToBytes() ([]byte, error)
func (*PrivateFlipKeysPackage) ToSignatureBytes ¶ added in v0.21.0
func (k *PrivateFlipKeysPackage) ToSignatureBytes() ([]byte, error)
type ProofProposal ¶ added in v0.21.0
type ProofProposal struct { Proof []byte Round uint64 Signature []byte // contains filtered or unexported fields }
func (*ProofProposal) FromBytes ¶ added in v0.21.0
func (p *ProofProposal) FromBytes(data []byte) error
func (*ProofProposal) Hash128 ¶ added in v0.21.0
func (p *ProofProposal) Hash128() common.Hash128
func (*ProofProposal) ToBytes ¶ added in v0.21.0
func (p *ProofProposal) ToBytes() ([]byte, error)
func (*ProofProposal) ToSignatureBytes ¶ added in v0.21.0
func (p *ProofProposal) ToSignatureBytes() ([]byte, error)
type ProposedHeader ¶
type ProposedHeader struct { ParentHash common.Hash Height uint64 Time int64 TxHash common.Hash // hash of tx hashes ProposerPubKey []byte Root common.Hash // root of state tree IdentityRoot common.Hash // root of approved identities tree Flags BlockFlag IpfsHash []byte // ipfs hash of block body OfflineAddr *common.Address `rlp:"nil"` TxBloom []byte BlockSeed Seed FeePerGas *big.Int Upgrade uint32 SeedProof []byte TxReceiptsCid []byte }
func (*ProposedHeader) Hash ¶
func (h *ProposedHeader) Hash() common.Hash
func (*ProposedHeader) ToProto ¶ added in v0.21.0
func (h *ProposedHeader) ToProto() *models.ProtoBlockHeader_Proposed
type PublicFlipKey ¶
type PublicFlipKey struct { Key []byte Signature []byte Epoch uint16 // contains filtered or unexported fields }
func SignFlipKey ¶
func SignFlipKey(fk *PublicFlipKey, prv *ecdsa.PrivateKey) (*PublicFlipKey, error)
SignFlipKey returns flip key signed with given private key
func (*PublicFlipKey) FromBytes ¶ added in v0.21.0
func (k *PublicFlipKey) FromBytes(data []byte) error
func (*PublicFlipKey) Hash ¶
func (k *PublicFlipKey) Hash() common.Hash
func (*PublicFlipKey) ToBytes ¶ added in v0.21.0
func (k *PublicFlipKey) ToBytes() ([]byte, error)
func (*PublicFlipKey) ToSignatureBytes ¶ added in v0.21.0
func (k *PublicFlipKey) ToSignatureBytes() ([]byte, error)
type SavedEvent ¶ added in v0.22.0
func (*SavedEvent) FromBytes ¶ added in v0.22.0
func (i *SavedEvent) FromBytes(data []byte) error
func (*SavedEvent) ToBytes ¶ added in v0.22.0
func (i *SavedEvent) ToBytes() ([]byte, error)
type SavedTransaction ¶
type SavedTransaction struct { Tx *Transaction FeePerGas *big.Int BlockHash common.Hash Timestamp int64 }
func (*SavedTransaction) FromBytes ¶ added in v0.21.0
func (s *SavedTransaction) FromBytes(data []byte) error
func (*SavedTransaction) ToBytes ¶ added in v0.21.0
func (s *SavedTransaction) ToBytes() ([]byte, error)
type SuccessfulInvite ¶
type Transaction ¶
type Transaction struct { AccountNonce uint32 Epoch uint16 Type TxType To *common.Address `rlp:"nil"` Amount *big.Int `json:"value"` MaxFee *big.Int Tips *big.Int Payload []byte `rlp:"nil" json:"input"` Signature []byte UseRlp bool `rlp:"-"` // contains filtered or unexported fields }
func SignTx ¶
func SignTx(tx *Transaction, prv *ecdsa.PrivateKey) (*Transaction, error)
SignTx returns transaction signed with given private key
func (*Transaction) AmountOrZero ¶
func (tx *Transaction) AmountOrZero() *big.Int
func (*Transaction) FromBytes ¶ added in v0.21.0
func (tx *Transaction) FromBytes(data []byte) error
func (*Transaction) FromProto ¶ added in v0.21.0
func (tx *Transaction) FromProto(protoTx *models.ProtoTransaction) *Transaction
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() common.Hash
func (*Transaction) Hash128 ¶ added in v0.21.0
func (tx *Transaction) Hash128() common.Hash128
func (*Transaction) MaxFeeOrZero ¶
func (tx *Transaction) MaxFeeOrZero() *big.Int
func (*Transaction) Size ¶
func (tx *Transaction) Size() int
func (*Transaction) TipsOrZero ¶
func (tx *Transaction) TipsOrZero() *big.Int
func (*Transaction) ToBytes ¶ added in v0.21.0
func (tx *Transaction) ToBytes() ([]byte, error)
func (*Transaction) ToProto ¶ added in v0.21.0
func (tx *Transaction) ToProto() *models.ProtoTransaction
func (*Transaction) ToSignatureBytes ¶ added in v0.21.0
func (tx *Transaction) ToSignatureBytes() ([]byte, error)
type TransactionIndex ¶
func (*TransactionIndex) FromBytes ¶ added in v0.21.0
func (i *TransactionIndex) FromBytes(data []byte) error
func (*TransactionIndex) ToBytes ¶ added in v0.21.0
func (i *TransactionIndex) ToBytes() ([]byte, error)
type Transactions ¶
type Transactions []*Transaction
Transactions is a Transaction slice type for basic sorting.
func (Transactions) GetBytes ¶ added in v0.21.0
func (s Transactions) GetBytes(i int) []byte
func (Transactions) Swap ¶
func (s Transactions) Swap(i, j int)
Swap swaps the i'th and the j'th element in s.
type TxReceipt ¶ added in v0.22.0
type TxReceipt struct { ContractAddress common.Address Success bool GasUsed uint64 GasCost *big.Int From common.Address TxHash common.Hash Error error Events []*TxEvent }
func (*TxReceipt) FromProto ¶ added in v0.22.0
func (r *TxReceipt) FromProto(protoObj *models.ProtoTxReceipts_ProtoTxReceipt)
func (*TxReceipt) ToProto ¶ added in v0.22.0
func (r *TxReceipt) ToProto() *models.ProtoTxReceipts_ProtoTxReceipt
type TxReceiptIndex ¶ added in v0.22.0
func (*TxReceiptIndex) FromBytes ¶ added in v0.22.0
func (i *TxReceiptIndex) FromBytes(data []byte) error
func (*TxReceiptIndex) ToBytes ¶ added in v0.22.0
func (i *TxReceiptIndex) ToBytes() ([]byte, error)
type TxReceipts ¶ added in v0.22.0
type TxReceipts []*TxReceipt
func (TxReceipts) FromBytes ¶ added in v0.22.0
func (txrs TxReceipts) FromBytes(data []byte) TxReceipts
func (TxReceipts) FromProto ¶ added in v0.22.0
func (txrs TxReceipts) FromProto(protoObj *models.ProtoTxReceipts) TxReceipts
func (TxReceipts) ToBytes ¶ added in v0.22.0
func (txrs TxReceipts) ToBytes() ([]byte, error)
type ValidationResult ¶
type ValidationResult struct { FlipsToReward []*FlipToReward Missed bool NewIdentityState uint8 }
type ValidationResults ¶ added in v0.20.0
type ValidationResults struct { BadAuthors map[common.Address]BadAuthorReason GoodAuthors map[common.Address]*ValidationResult AuthorResults map[common.Address]*AuthorResults GoodInviters map[common.Address]*InviterValidationResult ReportersToRewardByFlip map[int]map[common.Address]*Candidate }
type Vote ¶
type Vote struct { Header *VoteHeader Signature []byte // contains filtered or unexported fields }
func (*Vote) ToSignatureBytes ¶ added in v0.21.0
Click to show internal directories.
Click to hide internal directories.