Documentation ¶
Index ¶
- Constants
- Variables
- func BuildCoderFromBlock(b *Block) *coder.MainchainBlock
- func BuildCoderFromBytes(data []byte) (*coder.MainchainBlock, error)
- type Block
- func (b *Block) CalculateHash() (string, error)
- func (b *Block) CalculateHashBytes() ([]byte, error)
- func (b *Block) Deserialize(data []byte) error
- func (b *Block) DeserializeString(hexStr string) error
- func (b *Block) Equals(other merkletree.Content) (bool, error)
- func (b *Block) MarshalJSON() ([]byte, error)
- func (b *Block) Props() Props
- func (b *Block) Serialize() ([]byte, error)
- func (b *Block) SerializeString() (string, error)
- func (b *Block) SetHash() error
- func (b *Block) UnmarshalJSON(data []byte) error
- type MinerSig
- type Props
Constants ¶
View Source
const ImageHash = "0xc672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a"
ImageHash is the main chain identifier The main chain does not have an image (i.e. the image hash is nil). The hex encoded, sha2_256 hash of a nil bytes array is ImageHash https://play.golang.org/p/69Z8ot5uly5
Variables ¶
View Source
var ( // ErrNilBlock ... ErrNilBlock = errors.New("block is nil") // GenesisBlockHash ... GenesisBlockHash = "0x90770ba62574b68607ebd14a41dd2eb9df3c537df11b68647faea34a88315e49" // GenesisBlock ... GenesisBlock = Block{ // contains filtered or unexported fields } )
Functions ¶
func BuildCoderFromBlock ¶
func BuildCoderFromBlock(b *Block) *coder.MainchainBlock
BuildCoderFromBlock ...
func BuildCoderFromBytes ¶
func BuildCoderFromBytes(data []byte) (*coder.MainchainBlock, error)
BuildCoderFromBytes ...
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block ...
func (*Block) CalculateHashBytes ¶
CalculateHashBytes ...
func (*Block) DeserializeString ¶
DeserializeString ...
func (*Block) SerializeString ¶
SerializeString ...
type Props ¶
type Props struct { BlockHash *string `json:"blockHash,omitempty" rlp:"nil"` BlockNumber string `json:"blockNumber"` BlockTime string `json:"blockTime"` // unix timestamp ImageHash string `json:"imageHash"` StateBlocksMerkleHash string `json:"stateBlocksMerkleHash"` PrevBlockHash string `json:"prevBlockHash"` Nonce string `json:"nonce"` Difficulty string `json:"difficulty"` MinerAddress string `json:"minerAddress"` MinerSig *MinerSig `json:"minerSig,omitempty" rlp:"nil"` }
Props ...
func BuildBlockPropsFromBytes ¶
BuildBlockPropsFromBytes ...
func BuildBlockPropsFromCoder ¶
func BuildBlockPropsFromCoder(tmp *coder.MainchainBlock) (*Props, error)
BuildBlockPropsFromCoder ...
Click to show internal directories.
Click to hide internal directories.