Documentation ¶
Index ¶
- func Coinbase(in *tx.Input) bool
- type Address
- type BlockResp
- type Cluster
- type Clusters
- type ClustersResp
- type Config
- type Dgraph
- func (d *Dgraph) AddParent(pos, parent uint32) error
- func (d *Dgraph) AddRank(pos, rank uint32) error
- func (d *Dgraph) BulkMakeSet(address string, size, parentPos, rankPos uint32) error
- func (d *Dgraph) Delete(UID string) (err error)
- func (d *Dgraph) Empty() (err error)
- func (d *Dgraph) GetBlockFromHash(hash string) (blk block.Block, err error)
- func (d *Dgraph) GetBlockFromHeight(height int32) (blk block.Block, err error)
- func (d *Dgraph) GetBlockFromHeightRange(height int32, first int) (blks []block.Block, err error)
- func (d *Dgraph) GetBlockTxOutputsFromHash(hash string) (uids map[string][]string, err error)
- func (d *Dgraph) GetBlockTxOutputsFromRange(height int32, first int) (uids map[string]map[string][]string, err error)
- func (d *Dgraph) GetClusterHeight() (int32, error)
- func (d *Dgraph) GetClusterUID() (string, error)
- func (d *Dgraph) GetClusters() (Clusters, error)
- func (d *Dgraph) GetFirstOccurenceHeight(address string) (height int32, err error)
- func (d *Dgraph) GetFollowingTx(hash string, vout uint32) (transaction tx.Tx, err error)
- func (d *Dgraph) GetLastBlockHeight() (height int32, err error)
- func (d *Dgraph) GetOccurences(address string) (occurences []string, err error)
- func (d *Dgraph) GetParent(pos uint32) (Parent, error)
- func (d *Dgraph) GetRank(pos uint32) (Rank, error)
- func (d *Dgraph) GetSetUID(set uint32) (string, error)
- func (d *Dgraph) GetSpentTxOutput(hash string, vout uint32) (output tx.Output, err error)
- func (d *Dgraph) GetStoredBlocks() (blks []block.Block, err error)
- func (d *Dgraph) GetStoredTxs() (transactions []string, err error)
- func (d *Dgraph) GetTx(hash string) (transaction tx.Tx, err error)
- func (d *Dgraph) GetTxBlock(hash string) (blk block.Block, err error)
- func (d *Dgraph) GetTxBlockHeight(hash string) (height int32, err error)
- func (d *Dgraph) GetTxOutputs(hash string) (outputs []tx.Output, err error)
- func (d *Dgraph) GetTxUID(hash string) (uid string, err error)
- func (d *Dgraph) GetUtxoSet() (UtxoSet, error)
- func (d *Dgraph) GetUtxoSetByHash(hash string) (Utxo, error)
- func (d *Dgraph) GetUtxoSetUID() (string, error)
- func (d *Dgraph) IsSpent(tx string, index uint32) bool
- func (d *Dgraph) LastBlock() (blk block.Block, err error)
- func (d *Dgraph) NewClusters() error
- func (d *Dgraph) NewSet(address string, cluster uint32) error
- func (d *Dgraph) NewUtxo(txid string, outputs []tx.Output) error
- func (d *Dgraph) NewUtxoSet() error
- func (d *Dgraph) RemoveLastBlock() (err error)
- func (d *Dgraph) RemoveStxo(txid string, index uint32) error
- func (d *Dgraph) Setup() error
- func (d *Dgraph) Store(v interface{}) (err error)
- func (d *Dgraph) StoreBatch(v interface{}) (err error)
- func (d *Dgraph) StoreBlock(v interface{}) (err error)
- func (d *Dgraph) StoreCoinbase() error
- func (d *Dgraph) UpdateClusterHeight(height int32) error
- func (d *Dgraph) UpdateParent(pos, parent uint32) error
- func (d *Dgraph) UpdateRank(pos, rank uint32) error
- func (d *Dgraph) UpdateSet(address string, cluster uint32) error
- func (d *Dgraph) UpdateSize(size uint32) error
- type OutputsResp
- type Parent
- type Queue
- type Rank
- type TxResp
- type Utxo
- type UtxoResp
- type UtxoSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cluster ¶
type Cluster struct { UID string `json:"uid,omitempty"` Addresses []Address `json:"addresses,omitempty"` Cluster uint32 `json:"cluster,omitempty"` }
Cluster set of addresses related to the same entity
type Clusters ¶
type Clusters struct { UID string `json:"uid,omitempty"` Size uint32 `json:"size,omitempty"` Height int32 `json:"height,omitempty"` Parents []Parent `json:"parents,omitempty"` Ranks []Rank `json:"ranks,omitempty"` Set []Cluster `json:"set,omitempty"` }
Clusters represents the set of clusters
type ClustersResp ¶
type ClustersResp struct {
C []struct{ Clusters }
}
ClustersResp basic structure to unmarshall cluster query
type Dgraph ¶
type Dgraph struct { *dgo.Dgraph // contains filtered or unexported fields }
Dgraph wrapper of dgraph client
func (*Dgraph) BulkMakeSet ¶
BulkMakeSet take together single update operations and update clusters with a single request
func (*Dgraph) GetBlockFromHash ¶
GetBlockFromHash returns the hash of the block retrieving it based on its height
func (*Dgraph) GetBlockFromHeight ¶
GetBlockFromHeight returns the hash of the block retrieving it based on its height
func (*Dgraph) GetBlockFromHeightRange ¶
GetBlockFromHeightRange returns the hash of the block retrieving it based on its height
func (*Dgraph) GetBlockTxOutputsFromHash ¶
GetBlockTxOutputsFromHash retrieves the list of outputs uid of all block's transactions
func (*Dgraph) GetBlockTxOutputsFromRange ¶
func (d *Dgraph) GetBlockTxOutputsFromRange(height int32, first int) (uids map[string]map[string][]string, err error)
GetBlockTxOutputsFromRange retrieves the list of outputs uid of all block's transactions in the block range
func (*Dgraph) GetClusterHeight ¶
GetClusterHeight returns the UID of the cluster
func (*Dgraph) GetClusterUID ¶
GetClusterUID returns the UID of the cluster
func (*Dgraph) GetClusters ¶
GetClusters returns the set of all clusters stored in dgraph
func (*Dgraph) GetFirstOccurenceHeight ¶
GetFirstOccurenceHeight returns the height of the block in which the address appeared for the first time
func (*Dgraph) GetFollowingTx ¶
GetFollowingTx returns the transaction spending the output (vout) of the transaction passed as input to the function TODO: rememeber orderasc fetches no more than 1000 elements
func (*Dgraph) GetLastBlockHeight ¶
GetLastBlockHeight returns the height of the last block synced by Bitgodine
func (*Dgraph) GetOccurences ¶
GetOccurences returns an array containing the transactions where the address appears in the blockchain
func (*Dgraph) GetSpentTxOutput ¶
GetSpentTxOutput returns the output spent (the vout) of the corresponding tx
func (*Dgraph) GetStoredBlocks ¶
GetStoredBlocks returns an array containing all blocks stored on dgraph
func (*Dgraph) GetStoredTxs ¶
GetStoredTxs returns all the stored transactions hashes
func (*Dgraph) GetTx ¶
GetTx returns the node from the query queried TODO: orderasc on inputs, outputs, check whether they can have more than 1000 elments (1000 dgraph limit fetch)
func (*Dgraph) GetTxBlock ¶
GetTxBlock returns the block containing the transaction
func (*Dgraph) GetTxBlockHeight ¶
GetTxBlockHeight returns the height of the block based on its hash
func (*Dgraph) GetTxOutputs ¶
GetTxOutputs returns the outputs of the queried tx by hash TODO: rememeber orderasc fetches no more than 1000 elements
func (*Dgraph) GetUtxoSet ¶
GetUtxoSet returns the set of all utxos stored in dgraph
func (*Dgraph) GetUtxoSetByHash ¶
GetUtxoSetByHash returns the UID of the specified set of addresses
func (*Dgraph) GetUtxoSetUID ¶
GetUtxoSetUID returns the UID of the cluster
func (*Dgraph) IsSpent ¶
IsSpent returns true if exists a transaction that takes as input to the new tx the output corresponding to the index passed to the function
func (*Dgraph) NewClusters ¶
NewClusters stores the basic struct to manage the cluster sets
func (*Dgraph) NewSet ¶
NewSet creates a new set in the cluster. A set is composed by at least an addres, that is why address is passed as argument
func (*Dgraph) NewUtxoSet ¶
NewUtxoSet stores the basic struct to manage the utxo sets
func (*Dgraph) RemoveLastBlock ¶
RemoveLastBlock deletes the last block stored in the db
func (*Dgraph) RemoveStxo ¶
RemoveStxo remove a spent transaction output from the utxos set
func (*Dgraph) StoreBatch ¶
StoreBatch loads a queue untill a threshold to perform a bulk insertion on dgraph
func (*Dgraph) StoreBlock ¶
StoreBlock returns the hash of the block retrieving it based on its height
func (*Dgraph) StoreCoinbase ¶
StoreCoinbase prepare coinbase output to be used as input for coinbase transactions
func (*Dgraph) UpdateClusterHeight ¶
UpdateClusterHeight updates the size of the cluster
func (*Dgraph) UpdateParent ¶
UpdateParent updates the parent tag in parent node based on passed position
func (*Dgraph) UpdateRank ¶
UpdateRank updates the parent tag in parent node based on passed position
func (*Dgraph) UpdateSize ¶
UpdateSize updates the size of the cluster
type OutputsResp ¶
OutputsResp represent the resp from a dgraph query returning an array of output nodes
type Parent ¶
type Parent struct { UID string `json:"uid,omitempty"` Pos uint32 `json:"pos"` Parent uint32 `json:"parent"` }
Parent persist the parent tag and its position
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue data structure used as broker to load insertion queue
type Rank ¶
type Rank struct { UID string `json:"uid,omitempty"` Pos uint32 `json:"pos"` Rank uint32 `json:"rank"` }
Rank persist rank and its position
type Utxo ¶
type Utxo struct { UID string `json:"uid,omitempty"` TxID string `json:"txid,omitempty"` Utxo []tx.Output `json:"utxo"` // TODO: this could just be a refernce, e.g. the UID of the parsed output node }
Utxo tracks utxos