github.com/johnathanhowell/sia@v0.5.1-beta.0.20160524050156-83dcc3d37c94/modules/explorer.go (about) 1 package modules 2 3 import ( 4 "github.com/NebulousLabs/Sia/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 // Transaction returns the block that contains the input transaction 60 // id. The transaction itself is either the block (indicating the miner 61 // payouts are somehow involved), or it is a transaction inside of the 62 // block. The bool indicates whether the transaction is found in the 63 // consensus set. 64 Transaction(types.TransactionID) (types.Block, types.BlockHeight, bool) 65 66 // UnlockHash returns all of the transaction ids associated with the 67 // provided unlock hash. 68 UnlockHash(types.UnlockHash) []types.TransactionID 69 70 // SiacoinOutput will return the siacoin output associated with the 71 // input id. 72 SiacoinOutput(types.SiacoinOutputID) (types.SiacoinOutput, bool) 73 74 // SiacoinOutputID returns all of the transaction ids associated with 75 // the provided siacoin output id. 76 SiacoinOutputID(types.SiacoinOutputID) []types.TransactionID 77 78 // FileContractHistory returns the history associated with a file 79 // contract, which includes the file contract itself and all of the 80 // revisions that have been submitted to the blockchain. The first bool 81 // indicates whether the file contract exists, and the second bool 82 // indicates whether a storage proof was successfully submitted for the 83 // file contract. 84 FileContractHistory(types.FileContractID) (fc types.FileContract, fcrs []types.FileContractRevision, fcExists bool, storageProofExists bool) 85 86 // FileContractID returns all of the transaction ids associated with 87 // the provided file contract id. 88 FileContractID(types.FileContractID) []types.TransactionID 89 90 // SiafundOutput will return the siafund output associated with the 91 // input id. 92 SiafundOutput(types.SiafundOutputID) (types.SiafundOutput, bool) 93 94 // SiafundOutputID returns all of the transaction ids associated with 95 // the provided siafund output id. 96 SiafundOutputID(types.SiafundOutputID) []types.TransactionID 97 98 Close() error 99 } 100 )