Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Log = logger.NewLogger("provide-chainpoint", getLogLevel(), true)
Log global
Functions ¶
func ImmortalizeHashes ¶
ImmortalizeHashes places an array of hashes (represented as *[]byte at this point) on a buffered channel managed by a chainpoint daemon instance. In architecture.svg, this method represents the "hash subject" entrypoint and a typical use-case is upon receipt of a blockheader.
The provideID is typically-- i.e., when this method is called by the initial Provide platform implementation-- the unique identifier of a network on the Provide platform. Other implementations can define their own business rules for what provideID actually represents at runtime, but it will be used to create a hash with each of the given hashes.
func RunChainpointDaemon ¶
RunChainpointDaemon initializes and starts a new chainpoint daemon and aggregates hashes on a buffered channel until the channel is full or a configured timeout expires, at which point the entire buffer is flushed by way of provide.SubmitHashes.
Upon successful flushing of the buffer the related in-flight NATS messages are ACK'd. Upon timeout of an in-flight NATS message (i.e., a message delivered using the chainpoint.hash subject), the message will be attempted for redelivery. There is not currently a dead-letter strategy associated with chainpoint daemons (i.e., messages will be retried forever unless removed from the NATS streaming broker). A dead-letter queue will be considered but needs additional discussion.
This method returns an error if there is already a chainpoint usage daemon running in the parent golang process (chainpoint daemon is currently singleton-per-process).
Types ¶
type Node ¶
type Node struct {
PublicURI string `json:"public_uri"`
}
Node represents a chainpoint node
type ProofBody ¶
type ProofBody struct {
Anchors []interface{} `json:"anchors_complete"`
HashIDNode string `json:"hash_id_node"`
Proof interface{} `json:"proof"`
}
ProofBody
func GetProofs ¶
func GetProofs(proofHandles []ProofHandle) ([]ProofBody, error)
GetProofs function accepts a list of Proof Handles and will retrieve their corresponding Chainpoint Proofs. This function includes the subtle optimization of grouping Proof Handles by Chainpoint Node PublicURI's and will issue one HTTP GET request with an embedded header value consisting of a comma-delimited string of hashIdNode values dictating which Proofs need to be resolved and returned to the requestor.
type ProofHandle ¶
type ProofHandle struct {
Hash string `json:"hash"`
HashIDNode string `json:"hashIdNode"`
URI string `json:"URI"`
}
ProofHandle
func SubmitHashes ¶
func SubmitHashes(hashes [][]byte, nodes *NodeList) ([]ProofHandle, error)
SubmitHashes will submit a list of hashes to every Chainpoint Node provided to it via the function's second argument `nodes` of type `NodeList`. Submitting to multiple Chainpoint Nodes to achieve your required level of redundancy is advised. Only a single Chainpoint Proof is required to attest the existence of your data.
type VerifiedProofs ¶
type VerifiedProofs []struct {
ProofIndex int `json:"proof_index"`
Hash string `json:"hash"`
HashIDNode string `json:"hash_id_node"`
HashSubmittedNodeAt time.Time `json:"hash_submitted_node_at"`
HashIDCore string `json:"hash_id_core"`
HashSubmittedCoreAt time.Time `json:"hash_submitted_core_at"`
Anchors []struct {
Branch string `json:"branch"`
Type string `json:"type"`
Valid bool `json:"valid"`
} `json:"anchors"`
Status string `json:"status"`
}
VerifiedProofs as returned by chainpoint
func VerifyProofs ¶
func VerifyProofs(proofs []string) (VerifiedProofs, error)
VerifyProofs accepts a list of base64 encode strings that will be submitted to any Chainpoint Node for verification. The verification process will perform the required cryptorgraphic operations for both `cal` and `btc` branches to verify the integrity of the Chainpoint Proof(s) that have been submitted.