types

package
v0.0.0-...-1bcd00c Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggState

type AggState struct {
	ProofID  string `json:"proof_id"`
	Hash     string `json:"hash"`
	AggID    string `json:"agg_id"`
	AggState string `json:"agg_state"`
	AggRoot  string `json:"agg_root"`
}

AggState : agg state for proof gen

type Aggregation

type Aggregation struct {
	AggID     string     `json:"agg_id"`
	AggRoot   string     `json:"agg_root"`
	AggStates []AggState `json:"agg_states"`
}

Aggregation : An object containing all the relevant data for an aggregation event

type AnchorBtcAggState

type AnchorBtcAggState struct {
	CalId             string `json:"cal_id"`
	AnchorBtcAggId    string `json:"anchor_btc_agg_id"`
	AnchorBtcAggState string `json:"anchor_btc_agg_state"`
}

type AnchorBtcHeadState

type AnchorBtcHeadState struct {
	BtcTxId       string `json:"btctx_id"`
	BtcHeadHeight int64  `json:"btchead_height"`
	BtcHeadState  string `json:"btchead_state"`
}

type AnchorBtcTxState

type AnchorBtcTxState struct {
	AnchorBtcAggId string `json:"anchor_btc_agg_id"`
	BtcTxId        string `json:"btctx_id"`
	BtcTxState     string `json:"btctx_state"`
}

type AnchorConfig

type AnchorConfig struct {
	ChainId          string
	DBType           string
	BitcoinNetwork   string
	ElectionMode     string
	RabbitmqURI      string
	TendermintConfig TendermintConfig
	LightningConfig  lightning.LnClient
	PostgresURI      string
	RedisURI         string
	APIURI           string
	EthConfig        EthConfig
	ECPrivateKey     ecdsa.PrivateKey
	DoNodeManagement bool
	DoNodeAudit      bool
	DoPrivateNetwork bool
	PrivateNodeIPs   []string
	PrivateCoreIPs   []string
	CIDRBlockList    []string
	IPBlockList      []string
	DoCal            bool
	DoAnchor         bool
	AnchorInterval   int
	Logger           *log.Logger
	FilePV           privval.FilePV
	AnchorTimeout    int
	AnchorReward     int
	StakePerCore     int64
	FeeInterval      int64
	FeeMultiplier    float64
	HashPrice        int
	UseAllowlist     bool
	GatewayAllowlist []string
	CoreURI          string
	CoreName         string
	AnalyticsID      string
}

AnchorConfig represents values to configure all connections within the ABCI anchor app

type AnchorObj

type AnchorObj struct {
	AnchorID string   `json:"anchor_id"`
	Uris     []string `json:"uris"`
}

AnchorObj : Utilized by the proof spec to represent an anchoring proof step

type AnchorOpsState

type AnchorOpsState struct {
	Ops    []ProofLineItem `json:"ops"`
	Anchor AnchorObj       `json:"anchor"`
}

AnchorOpsState : Part of the RMQ message for btc anchoring post-confirmation

type AnchorRange

type AnchorRange struct {
	AnchorBtcAggRoot string `json:"anchor_btc_agg_root"`
	CalBlockHeight   int64  `json:"cal_block_height"`
	BtcBlockHeight   int64  `json:"btc_block_height"`
	BeginCalTxInt    int64  `json:"begin_cal_int"`
	EndCalTxInt      int64  `json:"end_cal_int"`
	AmLeader         bool   `json:"am_leader"`
}

AnchorRange : To store anchor state to compensate for failed anchors

type AnchorState

type AnchorState struct {
	ID                string                     `json:"tendermint_id"`
	TxInt             int64                      `json:"tx_int"`
	Height            int64                      `json:"height"`
	AmValidator       bool                       `json:"validator"`
	AppHash           []byte                     `json:"app_hash"`
	BeginCalTxInt     int64                      `json:"begin_cal_int"`
	EndCalTxInt       int64                      `json:"end_cal_int"`
	LatestCalTxInt    int64                      `json:"latest_cal_int"`
	CurrentCalInts    int64                      `json:"current_cal_ints"`
	LatestBtcaTx      []byte                     `json:"latest_btca"`
	LatestBtcaTxInt   int64                      `json:"latest_btca_int"`
	LatestBtcaHeight  int64                      `json:"latest_btca_height"`
	LatestBtcTx       string                     `json:"latest_btc"`
	LatestBtcAggRoot  string                     `json:"latest_btc_root"`
	LatestBtccTx      []byte                     `json:"latest_btcc"`
	LatestBtccTxInt   int64                      `json:"latest_btcc_int"`
	LatestBtccHeight  int64                      `json:"latest_btcc_height"`
	LatestErrRoot     string                     `json:"latest_btce"`
	LastElectedCoreID string                     `json:"last_elected_core_id"`
	LastAnchorCoreID  string                     `json:"last_anchor_core_id"`
	LastErrorCoreID   string                     `json:"last_error_core_id"`
	BtcHeight         int64                      `json:"btc_height"`
	TxValidation      map[string]TxValidation    `json:"tx_validation"`
	CoreKeys          map[string]ecdsa.PublicKey `json:"-"`
	LnUris            map[string]LnIdentity      `json:"lightning_identities"`
	IDMap             map[string]string          `json:"-"`
	Validators        []*types3.Validator        `json:"-"`
	TMState           coretypes.ResultStatus     `json:"-"`
	TMNetInfo         coretypes.ResultNetInfo    `json:"-"`
	LNState           lnrpc2.GetInfoResponse     `json:"-"`
	ChainSynced       bool
	JWKStaked         bool
	LnStakePrice      int64 `json:"total_stake_price"`
	LnStakePerVal     int64 `json:"validator_stake_price"`
	LatestNistRecord  string
	LatestTimeRecord  string
	LatestBtcFee      int64
	LastBtcFeeHeight  int64
	Migrations        map[int]string `json:"migrations"`
}

AnchorState holds Tendermint/ABCI application state. Persisted by ABCI app

type BtcA

type BtcA struct {
	AnchorBtcAggRoot string `json:"anchor_btc_agg_root"`
	BtcTxID          string `json:"btctx_id"`
}

BtcA struct will be included in the BTC-A tx data field

type BtcAgg

type BtcAgg struct {
	AnchorBtcAggID   string         `json:"anchor_btc_agg_id"`
	AnchorBtcAggRoot string         `json:"anchor_btc_agg_root"`
	ProofData        []BtcProofData `json:"proofData"`
}

BtcAgg : An object containing BTC anchoring aggregation data

type BtcMonMsg

type BtcMonMsg struct {
	BtcTxID       string    `json:"btctx_id"`
	BtcHeadHeight int64     `json:"btchead_height"`
	BtcHeadRoot   string    `json:"btchead_root"`
	Path          []JSProof `json:"path"`
}

BtcMonMsg : An RMQ message sent by the monitoring service to confirm a BTC transaction has occurred

type BtcMsgObj

type BtcMsgObj struct {
	BtcTxID   string `json:"tx_id"`
	BtcTxBody string `json:"tx_body"`
}

BtcTxMsg : An RMQ message object from btc-tx to btc-mon service

type BtcProofData

type BtcProofData struct {
	CalID string          `json:"cal_id"`
	Proof []ProofLineItem `json:"proof"`
}

BtcProofData : An individual proof object within a Btc aggregation set

type BtcTxMsg

type BtcTxMsg struct {
	AnchorBtcAggID   string `json:"anchor_btc_agg_id"`
	AnchorBtcAggRoot string `json:"anchor_btc_agg_root"`
	BtcTxID          string `json:"btctx_id"`
	BtcTxBody        string `json:"btctx_body"`
	BtcTxHeight      int64  `json:"btctx_height"`
	CalBlockHeight   int64  `json:"cal_block_height"`
	BeginCalTxInt    int64  `json:"begin_cal_int"`
	EndCalTxInt      int64  `json:"end_cal_int"`
}

BtcTxMsg : A RMQ message object

type BtcTxProofState

type BtcTxProofState struct {
	AnchorBtcAggID string   `json:"anchor_btc_agg_id"`
	BtcTxID        string   `json:"btctx_id"`
	BtcTxState     OpsState `json:"btctx_state"`
}

BtcTxProofState : An RMQ message object bound for proofstate service

type BtccStateObj

type BtccStateObj struct {
	BtcTxID       string         `json:"btctx_id"`
	BtcHeadHeight int64          `json:"btchead_height"`
	BtcHeadState  AnchorOpsState `json:"btchead_state"`
}

BtccStateObj : An RMQ message object issued to generate proofs after BTCC confirmation

type CalAgg

type CalAgg struct {
	CalRoot   string         `json:"cal_root"`
	ProofData []CalProofData `json:"proofData"`
}

CalAgg : An RMQ message representing an intermediate aggregation object to be fed into the Cal anchor tree

type CalProofData

type CalProofData struct {
	AggID string          `json:"agg_id"`
	Proof []ProofLineItem `json:"proof"`
}

CalProofData : Represents a step in a cal proof

type CalState

type CalState struct {
	CalID     string         `json:"cal_id"`
	Anchor    AnchorObj      `json:"anchor"`
	ProofData []CalProofData `json:"proofData"`
}

CalState : An RMQ message confirming a CAL anchor, sent to the proof service to generate/store the proof

type CalStateObject

type CalStateObject struct {
	AggID    string `json:"agg_id"`
	CalId    string `json:"cal_id"`
	CalState string `json:"cal_state"`
}

CalState : cal state for proof gen

type Core

type Core struct {
	EthAddr     string
	CoreId      sql.NullString
	PublicIP    sql.NullString
	BlockNumber sql.NullInt64
}

Core : Used to represent Core info to and from postgres

type CoreAPIStatus

type CoreAPIStatus struct {
	Version          string `json:"version"`
	Time             string `json:"time"`
	BaseURI          string `json:"base_uri"`
	Jwk              Jwk    `json:"jwk"`
	Network          string `json:"network"`
	IdentityPubkey   string `json:"identity_pubkey"`
	LightningAddress string `json:"lightning_address"`
	LightningBalance struct {
		TotalBalance       string `json:"total_balance"`
		ConfirmedBalance   string `json:"confirmed_balance"`
		UnconfirmedBalance string `json:"unconfirmed_balance"`
	} `json:"lightning_balance"`
	PublicKey           string                  `json:"public_key"`
	Uris                []string                `json:"uris"`
	Alias               string                  `json:"alias"`
	HashPriceSatoshis   int                     `json:"hash_price_satoshis"`
	TotalStakePrice     int64                   `json:"total_stake_price"`
	ValidatorStakePrice int64                   `json:"validator_stake_price"`
	ActiveChannelsCount int                     `json:"num_channels_count"`
	NodeInfo            p2p.DefaultNodeInfo     `json:"node_info"`
	SyncInfo            coretypes.SyncInfo      `json:"sync_info"`
	ValidatorInfo       coretypes.ValidatorInfo `json:"validator_info"`
}

CoreAPIStatus : status from Core's api service. Includes pubkey

type EcdsaSignature

type EcdsaSignature struct {
	R, S *big.Int
}

EcdsaSignature : Allows for unmarshalling an ecdsa signature

type EthConfig

type EthConfig struct {
	EthereumURL          string
	EthPrivateKey        string
	TokenContractAddr    string
	RegistryContractAddr string
}

EthConfig holds contract addresses and eth node URI

type HashItem

type HashItem struct {
	ProofID string `json:"proof_id"`
	Hash    string `json:"hash"`
}

HashItem : An object contains the Core ID and value for a hash

type JSProof

type JSProof struct {
	Left  string `json:"left,omitempty"`
	Right string `json:"right,omitempty"`
}

JSProof : Used to unmarshall the Javascript MerkleTools proofs. The library generates a different proof structure than the go version.

type Jwk

type Jwk struct {
	Kty string `json:"kty"`
	Kid string `json:"kid"`
	Crv string `json:"crv"`
	X   string `json:"x"`
	Y   string `json:"y"`
}

Jwk : holds key info for validating node requests

type LnIdentity

type LnIdentity struct {
	Peer            string `json:"peer"`
	RequiredChanAmt int64  `json:"required_satoshis"`
}

type OpsState

type OpsState struct {
	Ops []ProofLineItem `json:"ops"`
}

OpsState : An RMQ message generated as part of the monitoring proof object

type ProofData

type ProofData struct {
	ProofID string          `json:"proof_id"`
	Hash    string          `json:"hash"`
	Proof   []ProofLineItem `json:"proof"`
}

ProofData : The proof data for a given hash within an aggregation

type ProofLineItem

type ProofLineItem struct {
	Left  string `json:"l,omitempty"`
	Right string `json:"r,omitempty"`
	Op    string `json:"op,omitempty"`
}

ProofLineItem : A step in a Chainpoint proof

type ProofState

type ProofState struct {
	ProofID string `json:"proof_id"`
	Proof   string `json:"proof"`
}

type RateLimit

type RateLimit struct {
	AllowedRate int64
	PerBlocks   int64
	LastCheck   int64
	Bucket      float32
}

Uses simple token bucket method

type TendermintConfig

type TendermintConfig struct {
	TMServer string
	TMPort   string
	Config   *cfg.Config
	Logger   log.Logger
	FilePV   privval.FilePV
	NodeKey  *p2p.NodeKey
}

TendermintConfig holds connection info for RPC

type Tx

type Tx struct {
	TxType  string `json:"type"`
	Data    string `json:"data"`
	Version int64  `json:"version"`
	Time    int64  `json:"time"`
	CoreID  string `json:"core_id"`
	Meta    string `json:"meta,omitempty"`
	Sig     string `json:"sig,omitempty"`
}

Tx holds custom transaction data and metadata for the Chainpoint Calendar

type TxID

type TxID struct {
	TxID             string `json:"tx_id"`
	BlockHeight      int64  `json:"block_height"`
	AnchorBtcAggRoot string `json:"anchor_btc_agg_root"`
}

TxID : RMQ message dispatched to initiate monitoring

type TxTm

type TxTm struct {
	Hash []byte
	Data []byte
}

TxTm holds result of submitting a CAL transaction (needed in order to get Hash)

type TxValidation

type TxValidation struct {
	LastJWKTxHeight int64
	JWKAllowedRate  RateLimit
	JWKSubmissions  int64

	LastCalTxHeight       int64
	CalAllowedRate        RateLimit
	CalValidationSuccess  int64
	CalValidationFailures int64

	LastBtcaTxHeight int64 // for anchoring Cores
	ConfirmedAnchors int64
	FailedAnchors    int64
	BtcaAllowedRate  RateLimit

	LastBtccTxHeight int64 // for Cores submitting confirmations, not anchoring Cores
	BtccAllowedRate  RateLimit

	LastNISTTxHeight int64 // last "good", non-stale nist record
	NISTAllowedRate  RateLimit

	LastFeeTxHeight       int64
	FeeAllowedRate        RateLimit
	FeeValidationFailures int64

	UnAuthValSubmissions int64
}

Holds state for validating Transactions

Jump to

Keyboard shortcuts

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