Documentation ¶
Index ¶
- func ByteToFloat64(bytes []byte) float64
- func BytesToHash(b []byte) common.Hash
- func GetNodeFromLeaf(ln uint64) uint64
- func HashToF64(x common.Hash) float64
- func IsPowerOfTwo(n uint64) bool
- func MapVerify(proof []byte, txHash common.Hash) error
- func NextPowerOfTwo(n uint64) uint64
- func ProofInfoToBytes(info *ProofInfo) ([]byte, error)
- func RlpHash(x interface{}) (h common.Hash)
- func SortAndRemoveRepeatForBlocks(slc []uint64) []uint64
- func Uint64ToBytes(i uint64) []byte
- type ChainAdapter
- type ChainHeaderProof
- type ChainInfoProof
- type ChainProofs
- type MapProofs
- type MapTransaction
- type Mmr
- func (m *Mmr) Copy() *Mmr
- func (m *Mmr) CreateNewProof(right_difficulty *big.Int) (*ProofInfo, []uint64, []uint64)
- func (m *Mmr) GenerateProof(proofHeight, EndHeight uint64) *ProofInfo
- func (m *Mmr) GenerateProof2(proofHeight, EndHeight uint64) *ProofInfo
- func (m *Mmr) GetRoot2() common.Hash
- func (m *Mmr) Pop2() *Node
- func (m *Mmr) Push(newElem *Node)
- type Node
- type NodeList
- type NodeSet
- func (db *NodeSet) DataSize() int
- func (db *NodeSet) Delete(key []byte) error
- func (db *NodeSet) Get(key []byte) ([]byte, error)
- func (db *NodeSet) Has(key []byte) (bool, error)
- func (db *NodeSet) KeyCount() int
- func (db *NodeSet) NodeList() NodeList
- func (db *NodeSet) Put(key []byte, value []byte) error
- func (db *NodeSet) Store(target ethdb.KeyValueWriter)
- type ProofBlock
- type ProofBlocks
- type ProofElem
- type ProofElems
- type ProofInfo
- type ProofRes
- type ReceiptProof
- type VerifyElem
- type VerifyElems
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteToFloat64 ¶
func BytesToHash ¶
func GetNodeFromLeaf ¶
func HashToF64 ¶
extract bits from the hash value to generate an f64 value this is used for extracting randomness from hash values https://news.ycombinator.com/item?id=9207874 http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/ARTICLES/dSFMT.pdf
func IsPowerOfTwo ¶
func NextPowerOfTwo ¶
func ProofInfoToBytes ¶
func SortAndRemoveRepeatForBlocks ¶
////////////////////////////////////////////////////////////////
func Uint64ToBytes ¶
Types ¶
type ChainAdapter ¶
type ChainAdapter struct { Genesis common.Hash ConfirmBlock *types.Header ProofHeader *types.Header Latest []*types.Header }
func (*ChainAdapter) Copy ¶
func (o *ChainAdapter) Copy() *ChainAdapter
func (*ChainAdapter) GenesisCheck ¶
func (o *ChainAdapter) GenesisCheck(head *types.Header) error
type ChainHeaderProof ¶
type ChainHeaderProof struct { Proof *ProofInfo // the leatest blockchain and an proof of existence Header []*types.Header Right *big.Int }
func (*ChainHeaderProof) Data ¶
func (b *ChainHeaderProof) Data() ([]byte, error)
type ChainInfoProof ¶
type ChainProofs ¶
type ChainProofs struct { Remote *ChainAdapter `json:"remote" rlp:"nil"` HeaderProof *ChainHeaderProof InfoProof *ChainInfoProof }
func NewChainProofs ¶
func NewChainProofs() *ChainProofs
func (*ChainProofs) Data ¶
func (cps *ChainProofs) Data() ([]byte, error)
func (*ChainProofs) Verify ¶
func (cps *ChainProofs) Verify() error
type MapProofs ¶
type MapProofs struct { ChainProof *ChainProofs ReceiptProof *ReceiptProof End *big.Int Header *types.Header Result bool TxHash common.Hash }
newBlockData is the network packet for the block propagation message.
type MapTransaction ¶
type MapTransaction struct { SimpUlvpP *MapProofs Tx *types.Transaction }
UlvpTransaction is the network packet for the block propagation message.
type Mmr ¶
type Mmr struct {
// contains filtered or unexported fields
}
func (*Mmr) CreateNewProof ¶
func (*Mmr) GenerateProof ¶
func (*Mmr) GenerateProof2 ¶
type NodeList ¶
NodeList stores an ordered list of trie nodes. It implements mosdb.KeyValueWriter.
func (NodeList) Store ¶
func (n NodeList) Store(db ethdb.KeyValueWriter)
Store writes the contents of the list to the given database
type NodeSet ¶
type NodeSet struct {
// contains filtered or unexported fields
}
NodeSet stores a set of trie nodes. It implements trie.Database and can also act as a cache for another trie.Database.
func (*NodeSet) Store ¶
func (db *NodeSet) Store(target ethdb.KeyValueWriter)
Store writes the contents of the set to the given database
type ProofBlock ¶
func SortAndRemoveRepeatForProofBlocks ¶
func SortAndRemoveRepeatForProofBlocks(slc []*ProofBlock) []*ProofBlock
func VerifyRequiredBlocks ¶
func VerifyRequiredBlocks(info *ProofInfo, right_difficulty *big.Int) ([]*ProofBlock, error)
func VerifyRequiredBlocks2 ¶
func VerifyRequiredBlocks2(info *ProofInfo) ([]*ProofBlock, error)
type ProofBlocks ¶
type ProofBlocks []*ProofBlock
func (ProofBlocks) Len ¶
func (a ProofBlocks) Len() int
func (ProofBlocks) Less ¶
func (a ProofBlocks) Less(i, j int) bool
func (ProofBlocks) Swap ¶
func (a ProofBlocks) Swap(i, j int)
type ProofElem ¶
type ProofElems ¶
type ProofElems []*ProofElem
type ProofInfo ¶
type ProofInfo struct { RootHash common.Hash RootDifficulty *big.Int LeafNumber uint64 Elems []*ProofElem Checked []uint64 }
func ProofInfoFromBytes ¶
func (*ProofInfo) VerifyProof ¶
func (p *ProofInfo) VerifyProof(blocks []*ProofBlock) bool
func (*ProofInfo) VerifyProof2 ¶
func (p *ProofInfo) VerifyProof2(blocks []*ProofBlock) bool
type ReceiptProof ¶
type VerifyElem ¶
type VerifyElems ¶
type VerifyElems []*VerifyElem