gitlab.com/SiaPrime/SiaPrime@v1.4.1/modules/explorer.go (about) 1 package modules 2 3 import ( 4 "gitlab.com/SiaPrime/SiaPrime/types" 5 ) 6 7 const ( 8 // ExplorerDir is the name of the directory that is typically used for the 9 // explorer. 10 ExplorerDir = "explorer" 11 ) 12 13 type ( 14 // BlockFacts returns a bunch of statistics about the consensus set as they 15 // were at a specific block. 16 BlockFacts struct { 17 BlockID types.BlockID `json:"blockid"` 18 Difficulty types.Currency `json:"difficulty"` 19 EstimatedHashrate types.Currency `json:"estimatedhashrate"` 20 Height types.BlockHeight `json:"height"` 21 MaturityTimestamp types.Timestamp `json:"maturitytimestamp"` 22 Target types.Target `json:"target"` 23 TotalCoins types.Currency `json:"totalcoins"` 24 25 // Transaction type counts. 26 MinerPayoutCount uint64 `json:"minerpayoutcount"` 27 TransactionCount uint64 `json:"transactioncount"` 28 SiacoinInputCount uint64 `json:"siacoininputcount"` 29 SiacoinOutputCount uint64 `json:"siacoinoutputcount"` 30 FileContractCount uint64 `json:"filecontractcount"` 31 FileContractRevisionCount uint64 `json:"filecontractrevisioncount"` 32 StorageProofCount uint64 `json:"storageproofcount"` 33 SiafundInputCount uint64 `json:"siafundinputcount"` 34 SiafundOutputCount uint64 `json:"siafundoutputcount"` 35 MinerFeeCount uint64 `json:"minerfeecount"` 36 ArbitraryDataCount uint64 `json:"arbitrarydatacount"` 37 TransactionSignatureCount uint64 `json:"transactionsignaturecount"` 38 39 // Factoids about file contracts. 40 ActiveContractCost types.Currency `json:"activecontractcost"` 41 ActiveContractCount uint64 `json:"activecontractcount"` 42 ActiveContractSize types.Currency `json:"activecontractsize"` 43 TotalContractCost types.Currency `json:"totalcontractcost"` 44 TotalContractSize types.Currency `json:"totalcontractsize"` 45 TotalRevisionVolume types.Currency `json:"totalrevisionvolume"` 46 } 47 48 // Explorer tracks the blockchain and provides tools for gathering 49 // statistics and finding objects or patterns within the blockchain. 50 Explorer interface { 51 // Block returns the block that matches the input block id. The bool 52 // indicates whether the block appears in the blockchain. 53 Block(types.BlockID) (types.Block, types.BlockHeight, bool) 54 55 // BlockFacts returns a set of statistics about the blockchain as they 56 // appeared at a given block. 57 BlockFacts(types.BlockHeight) (BlockFacts, bool) 58 59 // LatestBlockFacts returns the block facts of the last block 60 // in the explorer's database. 61 LatestBlockFacts() BlockFacts 62 63 // Transaction returns the block that contains the input transaction 64 // id. The transaction itself is either the block (indicating the miner 65 // payouts are somehow involved), or it is a transaction inside of the 66 // block. The bool indicates whether the transaction is found in the 67 // consensus set. 68 Transaction(types.TransactionID) (types.Block, types.BlockHeight, bool) 69 70 // UnlockHash returns all of the transaction ids associated with the 71 // provided unlock hash. 72 UnlockHash(types.UnlockHash) []types.TransactionID 73 74 // SiacoinOutput will return the siacoin output associated with the 75 // input id. 76 SiacoinOutput(types.SiacoinOutputID) (types.SiacoinOutput, bool) 77 78 // SiacoinOutputID returns all of the transaction ids associated with 79 // the provided siacoin output id. 80 SiacoinOutputID(types.SiacoinOutputID) []types.TransactionID 81 82 // FileContractHistory returns the history associated with a file 83 // contract, which includes the file contract itself and all of the 84 // revisions that have been submitted to the blockchain. The first bool 85 // indicates whether the file contract exists, and the second bool 86 // indicates whether a storage proof was successfully submitted for the 87 // file contract. 88 FileContractHistory(types.FileContractID) (fc types.FileContract, fcrs []types.FileContractRevision, fcExists bool, storageProofExists bool) 89 90 // FileContractID returns all of the transaction ids associated with 91 // the provided file contract id. 92 FileContractID(types.FileContractID) []types.TransactionID 93 94 // SiafundOutput will return the siafund output associated with the 95 // input id. 96 SiafundOutput(types.SiafundOutputID) (types.SiafundOutput, bool) 97 98 // SiafundOutputID returns all of the transaction ids associated with 99 // the provided siafund output id. 100 SiafundOutputID(types.SiafundOutputID) []types.TransactionID 101 102 Close() error 103 } 104 )