Documentation ¶
Index ¶
- Constants
- Variables
- func MakeValSetChangeTx(pubkey types.PubKey, power int64) []byte
- func ValidateValidatorTx(val string) (err error, id string, pubkey []byte, power int64, blockHeight int64)
- type AnchorApplication
- func (app *AnchorApplication) AnchorCalendar(height int64) (int, error)
- func (app *AnchorApplication) BeaconMonitor()
- func (app *AnchorApplication) BeginBlock(req types2.RequestBeginBlock) types2.ResponseBeginBlock
- func (app *AnchorApplication) CalDataHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) CalHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) CheckTx(rawTx types2.RequestCheckTx) types2.ResponseCheckTx
- func (app *AnchorApplication) CheckVoteChangeStake()
- func (app *AnchorApplication) CheckVoteValidator()
- func (app *AnchorApplication) Commit() types2.ResponseCommit
- func (app *AnchorApplication) DeliverTx(tx types2.RequestDeliverTx) types2.ResponseDeliverTx
- func (app *AnchorApplication) EndBlock(req types2.RequestEndBlock) types2.ResponseEndBlock
- func (app *AnchorApplication) FeeMonitor()
- func (app *AnchorApplication) GatewaysHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) GenerateCalBatch(aggStates []types.AggState, calStates []types.CalStateObject) error
- func (app *AnchorApplication) HashHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) HomeHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) Info(req types2.RequestInfo) (resInfo types2.ResponseInfo)
- func (app *AnchorApplication) InitChain(req types2.RequestInitChain) types2.ResponseInitChain
- func (app *AnchorApplication) LoadIdentity() error
- func (app *AnchorApplication) LogError(err error) error
- func (app *AnchorApplication) PeerHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) ProofHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) Query(reqQuery types2.RequestQuery) (resQuery types2.ResponseQuery)
- func (app *AnchorApplication) SaveIdentity(tx types.Tx) error
- func (app *AnchorApplication) SendIdentity() error
- func (app *AnchorApplication) SetIdentity(tx types.Tx) (types.Jwk, error)
- func (app *AnchorApplication) SetOption(req types2.RequestSetOption) (res types2.ResponseSetOption)
- func (app *AnchorApplication) SetStake()
- func (app *AnchorApplication) StakeIdentity()
- func (app *AnchorApplication) StartAnchoring()
- func (app *AnchorApplication) StatusHandler(w http.ResponseWriter, r *http.Request)
- func (app *AnchorApplication) SyncMonitor()
- func (app *AnchorApplication) VerifyIdentity(tx types.Tx) bool
- type Hash
- type HashResponse
- type ProcessingHints
Constants ¶
const STATIC_FEE_AMT = 0 // 60k amounts to 240 sat/vbyte
const SUCCESSFUL_ANCHOR_CRITERIA = 100
const (
ValidatorSetChangePrefix string = "val:"
)
constant prefix for a validator transaction
Variables ¶
var ( ProtocolVersion version.Protocol = 0x1 GossipTxs = []string{"NIST"} )
variables for protocol version and main db state key
Functions ¶
func MakeValSetChangeTx ¶
MakeValSetChangeTx : TODO: describe this
Types ¶
type AnchorApplication ¶
type AnchorApplication struct { types2.BaseApplication // validator set ValUpdates []types2.ValidatorUpdate PendingValidator string PendingChangeStake int64 NodeRewardSignatures []string CoreRewardSignatures []string Db dbm.DB Anchor anchor.AnchorEngine ChainpointDb database.ChainpointDatabase Cache *level.KVStore LnClient *lightning.LightningClient ID string JWK types.Jwk Analytics *analytics2.UniversalAnalytics ULIDGenerator *threadsafe_ulid.ThreadSafeUlid // contains filtered or unexported fields }
AnchorApplication : AnchorState and config variables for the abci app
func NewAnchorApplication ¶
func NewAnchorApplication(config types.AnchorConfig) *AnchorApplication
NewAnchorApplication is ABCI app constructor
func (*AnchorApplication) AnchorCalendar ¶
func (app *AnchorApplication) AnchorCalendar(height int64) (int, error)
AnchorCalendar : Aggregate submitted hashes into a calendar transaction
func (*AnchorApplication) BeaconMonitor ¶
func (app *AnchorApplication) BeaconMonitor()
BeaconMonitor : elects a leader to poll DRAND. Called every minute by ABCI.commit
func (*AnchorApplication) BeginBlock ¶
func (app *AnchorApplication) BeginBlock(req types2.RequestBeginBlock) types2.ResponseBeginBlock
BeginBlock : Handler that runs at the beginning of every block
func (*AnchorApplication) CalDataHandler ¶
func (app *AnchorApplication) CalDataHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) CalHandler ¶
func (app *AnchorApplication) CalHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) CheckTx ¶
func (app *AnchorApplication) CheckTx(rawTx types2.RequestCheckTx) types2.ResponseCheckTx
CheckTx : Pre-gossip validation
func (*AnchorApplication) CheckVoteChangeStake ¶
func (app *AnchorApplication) CheckVoteChangeStake()
func (*AnchorApplication) CheckVoteValidator ¶
func (app *AnchorApplication) CheckVoteValidator()
func (*AnchorApplication) Commit ¶
func (app *AnchorApplication) Commit() types2.ResponseCommit
Commit is called at the end of every block to finalize and save chain state
func (*AnchorApplication) DeliverTx ¶
func (app *AnchorApplication) DeliverTx(tx types2.RequestDeliverTx) types2.ResponseDeliverTx
DeliverTx : tx is url encoded json
func (*AnchorApplication) EndBlock ¶
func (app *AnchorApplication) EndBlock(req types2.RequestEndBlock) types2.ResponseEndBlock
EndBlock : Handler that runs at the end of every block, validators can be updated here
func (*AnchorApplication) FeeMonitor ¶
func (app *AnchorApplication) FeeMonitor()
FeeMonitor : elects a leader to poll and gossip Fee. Called every n minutes by ABCI.commit
func (*AnchorApplication) GatewaysHandler ¶
func (app *AnchorApplication) GatewaysHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) GenerateCalBatch ¶
func (app *AnchorApplication) GenerateCalBatch(aggStates []types.AggState, calStates []types.CalStateObject) error
func (*AnchorApplication) HashHandler ¶
func (app *AnchorApplication) HashHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) HomeHandler ¶
func (app *AnchorApplication) HomeHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) Info ¶
func (app *AnchorApplication) Info(req types2.RequestInfo) (resInfo types2.ResponseInfo)
Info : Return the state of the current application in JSON
func (*AnchorApplication) InitChain ¶
func (app *AnchorApplication) InitChain(req types2.RequestInitChain) types2.ResponseInitChain
InitChain : Save the validators in the merkle tree
func (*AnchorApplication) LoadIdentity ¶
func (app *AnchorApplication) LoadIdentity() error
LoadIdentity : load public keys derived from JWTs from redis
func (*AnchorApplication) LogError ¶
func (app *AnchorApplication) LogError(err error) error
func (*AnchorApplication) PeerHandler ¶
func (app *AnchorApplication) PeerHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) ProofHandler ¶
func (app *AnchorApplication) ProofHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) Query ¶
func (app *AnchorApplication) Query(reqQuery types2.RequestQuery) (resQuery types2.ResponseQuery)
Query : Custom ABCI query method.
func (*AnchorApplication) SaveIdentity ¶
func (app *AnchorApplication) SaveIdentity(tx types.Tx) error
SaveIdentity : save the JWK value retrieved, and list ourselves as staked if we sent it
func (*AnchorApplication) SendIdentity ¶
func (app *AnchorApplication) SendIdentity() error
func (*AnchorApplication) SetIdentity ¶
func (*AnchorApplication) SetOption ¶
func (app *AnchorApplication) SetOption(req types2.RequestSetOption) (res types2.ResponseSetOption)
SetOption : Method for runtime data transfer between other apps and ABCI
func (*AnchorApplication) SetStake ¶
func (app *AnchorApplication) SetStake()
func (*AnchorApplication) StakeIdentity ¶
func (app *AnchorApplication) StakeIdentity()
StakeIdentity : updates active ECDSA public keys from all accessible peers Also ensures api is online
func (*AnchorApplication) StartAnchoring ¶
func (app *AnchorApplication) StartAnchoring()
StartAnchoring: StartAnchoring calendar and btc blockchains
func (*AnchorApplication) StatusHandler ¶
func (app *AnchorApplication) StatusHandler(w http.ResponseWriter, r *http.Request)
func (*AnchorApplication) SyncMonitor ¶
func (app *AnchorApplication) SyncMonitor()
SyncMonitor : turns off anchoring if we're not synced. Not cron scheduled since we need it to start immediately.
func (*AnchorApplication) VerifyIdentity ¶
func (app *AnchorApplication) VerifyIdentity(tx types.Tx) bool
VerifyIdentity : Verify that a channel exists only if we're a validator and the chain is synced
type HashResponse ¶
type HashResponse struct { Hash string `json:"hash"` ProofId string `json:"proof_id"` HashReceived string `json:"hash_received"` ProcessingHints ProcessingHints `json:"processing_hints"` }