anchor

package
v6.4.2-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnchorRecord

type AnchorRecord struct {
	AnchorRecordVer int    // version 1 places signature content in the field, version 2 uses external IDs for signature
	DBHeight        uint32 `json:",omitempty"` // Factom Directory Block Height - the unique number associated with this DBlock
	KeyMR           string `json:",omitempty"` // key merkle root of the directory block

	DBHeightMax uint32 `json:",omitempty"` // The highest directory block height included in this anchor window
	DBHeightMin uint32 `json:",omitempty"` // The lowest directory block height included in this anchor window
	WindowMR    string `json:",omitempty"` // Merkle root of all directory block KeyMRs from DBHeightMin to DBHeightMax

	RecordHeight uint32 // Likely to be deprecated soon. This is the future DBlock height a confirmation of anchoring event X is

	Bitcoin  *BitcoinStruct  `json:",omitempty"`
	Ethereum *EthereumStruct `json:",omitempty"`
}

AnchorRecord is used to construct the anchor chain. The Factom Protocol writes an anchor into a parent blockchain (Bitcoin or Ethereum) approximately every 10 minutes. The accumulated entries from the previous 10 minutes are organized into a Directory Block (DBlock). The information from the directory block is stored in the AnchorRecord.

func UnmarshalAnchorRecord

func UnmarshalAnchorRecord(data []byte) (*AnchorRecord, error)

UnmarshalAnchorRecord unmarshals a json format input into a new AnchorRecord

func UnmarshalAndValidateAnchorEntryAnyVersion

func UnmarshalAndValidateAnchorEntryAnyVersion(entry interfaces.IEBEntry, publicKeys []interfaces.Verifier) (*AnchorRecord, bool, error)

UnmarshalAndValidateAnchorEntryAnyVersion unmarshals json data and verifies with either internal or external signatures against public keys

func UnmarshalAndValidateAnchorRecord

func UnmarshalAndValidateAnchorRecord(data []byte, publicKeys []interfaces.Verifier) (*AnchorRecord, bool, error)

UnmarshalAndValidateAnchorRecord unmarshals signed json data and verifies signature with public keys for AnchorRecord v1

func UnmarshalAndValidateAnchorRecordV2

func UnmarshalAndValidateAnchorRecordV2(data []byte, extIDs [][]byte, publicKeys []interfaces.Verifier) (*AnchorRecord, bool, error)

UnmarshalAndValidateAnchorRecordV2 unmarshals json data and verifies external signature with public keys using AnchorRecord v2

func (*AnchorRecord) IsSame

func (ar *AnchorRecord) IsSame(ar2 *AnchorRecord) bool

IsSame returns true iff all the fields of ar==ar2

func (*AnchorRecord) JSONByte

func (ar *AnchorRecord) JSONByte() ([]byte, error)

JSONByte returns a []byte of the AnchorRecord encoded in Json

func (*AnchorRecord) JSONString

func (ar *AnchorRecord) JSONString() (string, error)

JSONString returns a string of the AnchorRecord encoded in Json

func (*AnchorRecord) Marshal

func (ar *AnchorRecord) Marshal() (rval []byte, err error)

Marshal marshals the AnchorRecord into json format

func (*AnchorRecord) MarshalAndSign

func (ar *AnchorRecord) MarshalAndSign(priv interfaces.Signer) ([]byte, error)

MarshalAndSign marshals the AnchorRecord into json and signs it with the input Signer, returning concatenated data of (data,signature)

func (*AnchorRecord) MarshalAndSignV2

func (ar *AnchorRecord) MarshalAndSignV2(priv interfaces.Signer) ([]byte, []byte, error)

MarshalAndSignV2 marshals the AnchorRecord into json and signs, returning separate anchor and signature data

func (*AnchorRecord) String

func (ar *AnchorRecord) String() string

String returns a string of AnchorRecord encoded in Json

func (*AnchorRecord) Unmarshal

func (ar *AnchorRecord) Unmarshal(data []byte) error

Unmarshal unmarshals json format input into this AnchorRecord

type BitcoinStruct

type BitcoinStruct struct {
	Address     string //"1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1",
	TXID        string //"9b0fc92260312ce44e74ef369f5c66bbb85848f2eddd5a7a1cde251e54ccfdd5", BTC Hash - in reverse byte order
	BlockHeight int32  //345678,
	BlockHash   string //"00000000000000000cc14eacfc7057300aea87bed6fee904fd8e1c1f3dc008d4", BTC Hash - in reverse byte order
	Offset      int32  //87
}

BitcoinStruct contains relevant data for a Bitcoin transaction

func (*BitcoinStruct) IsSame

func (bc *BitcoinStruct) IsSame(bc2 *BitcoinStruct) bool

IsSame returns true iff all fields of BitcoinStructs bc==bc2

type EthereumStruct

type EthereumStruct struct {
	ContractAddress string // Address of the Ethereum anchor contract
	TxID            string // Transaction ID of this particular anchor
	BlockHeight     int64  // Ethereum block height that this anchor was included in
	BlockHash       string // Hash of the Ethereum block that this anchor was included in
	TxIndex         int64  // Where the anchor tx is located within that block
}

EthereumStruct contains relevant data for an Ethereum transaction

func (*EthereumStruct) IsSame

func (es *EthereumStruct) IsSame(es2 *EthereumStruct) bool

IsSame returns true iff all fields of EthereumStructs es==es2

Jump to

Keyboard shortcuts

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