app

package
v0.0.0-...-cb5b683 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2021 License: Unlicense Imports: 13 Imported by: 4

Documentation

Index

Constants

View Source
const TIMEINTERVALBETWEENCHECKS = int64(60 * 60) //one hour interval between checks

Variables

View Source
var CalcTemplate *template.Template //HTML template to use
View Source
var CurrentDifficulty float32 //current difficulty of the Bitcoin network
View Source
var CurrentExchangeRate float32 //current USD exchange rate (24h average updated about once an hour from bitcoin charts)
View Source
var LastCheckTime int64 //last time the current data was checked

Functions

func MainLoop

func MainLoop(path, command, coin string)

Types

type BlockchainStatus

type BlockchainStatus struct {
	Blocks    int `json:"blocks"`
	Txs       int `json:"txs"`
	Addresses int `json:"addresses"`
}

type Calculations

type Calculations struct {
	//basic variables
	Difficulty       float32
	HashRate         float32
	ExchangeRate     float32
	BitcoinsPerBlock float32

	RigCost          float32
	PowerConsumption float32
	PowerCost        float32

	//their string representation to be displayed in HTML (HTML has problems parsing big and small numbers, displying them in scientific notation [f.e. 1e9])
	DifficultyStr       string
	HashRateStr         string
	ExchangeRateStr     string
	BitcoinsPerBlockStr string

	RigCostStr          string
	PowerConsumptionStr string
	PowerCostStr        string

	//variable to indicate whether or not to display results
	DisplayResults bool

	//reward strings to be displayed in HTML. Don`t need to keep dat in float32, since it won't be used anymore
	//Rewards in Bitcoins
	HourlyRewardBC  string
	DailyRewardBC   string
	WeeklyRewardBC  string
	MonthlyRewardBC string
	AnnualRewardBC  string

	//Rewards in Dollars
	HourlyRewardD  string
	DailyRewardD   string
	WeeklyRewardD  string
	MonthlyRewardD string
	AnnualRewardD  string

	//how long does it take to generate a block
	TimeToGenerateABlock   string
	BlocksGeneratedPerYear string

	//results that take power cost into consideration
	MiningCost       string
	HourlyNetProfit  string
	DailyNetProfit   string
	WeeklyNetProfit  string
	MonthlyNetProfit string
	AnnualNetProfit  string
	BreakEvenTime    string
}

the structure to store the data for calculation and displaying

var DefaultCalc Calculations //default data to display to the user

type ExplorerJDBs

type ExplorerJDBs struct {
	// contains filtered or unexported fields
}

func InitExplorerJDBs

func InitExplorerJDBs(jdbServers map[string]string, command, coin string) *ExplorerJDBs

func (*ExplorerJDBs) GetAddr

func (ej *ExplorerJDBs) GetAddr(coin, id string) map[string]interface{}

func (*ExplorerJDBs) GetBlock

func (ej *ExplorerJDBs) GetBlock(coin, id string) map[string]interface{}

func (*ExplorerJDBs) GetBlockShort

func (ej *ExplorerJDBs) GetBlockShort(coin, blockhash string) map[string]interface{}

func (*ExplorerJDBs) GetBlocks

func (ej *ExplorerJDBs) GetBlocks(coin string, per, page int) (blocks []map[string]interface{})

func (*ExplorerJDBs) GetExplorer

func (ej *ExplorerJDBs) GetExplorer(coin string) *BlockchainStatus

func (*ExplorerJDBs) GetInfo

func (ej *ExplorerJDBs) GetInfo(coin string) map[string]interface{}

func (*ExplorerJDBs) GetLastBlock

func (ej *ExplorerJDBs) GetLastBlock(coin string) int

func (*ExplorerJDBs) GetMemPool

func (ej *ExplorerJDBs) GetMemPool(coin string) []string

func (*ExplorerJDBs) GetMiningInfo

func (ej *ExplorerJDBs) GetMiningInfo(coin string) map[string]interface{}

func (*ExplorerJDBs) GetNetworkInfo

func (ej *ExplorerJDBs) GetNetworkInfo(coin string) map[string]interface{}

func (*ExplorerJDBs) GetPeers

func (ej *ExplorerJDBs) GetPeers(coin string) []interface{}

func (*ExplorerJDBs) GetStatus

func (ej *ExplorerJDBs) GetStatus(coin string) (*BlockchainStatus, error)

func (*ExplorerJDBs) GetTx

func (ej *ExplorerJDBs) GetTx(coin, id string) map[string]interface{}

func (*ExplorerJDBs) WriteExplorer

func (eq *ExplorerJDBs) WriteExplorer(coin string) *BlockchainStatus

type JORMexplorer

type JORMexplorer struct {
	Coin     string
	BitNodes nodes.BitNodes
	Status   *BlockchainStatus
	ExJDBs   *ExplorerJDBs

	WWW *http.Server
	// contains filtered or unexported fields
}

func NewJORMexplorer

func NewJORMexplorer(path, command, coin string) *JORMexplorer

func (*JORMexplorer) ExploreCoin

func (e *JORMexplorer) ExploreCoin()

GetExplorer updates the data from blockchain of a coin in the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL