Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import (
- "os"
- "fmt"
- "strconv"
- "math/rand"
- "math"
- "flag"
- )
- var block = 0//block count ( for genesis block = 0 )
- //var percent = 0.00000011946
- var pi = float64(3.1415926535897932384626433832795)
- var coef = float64(0.43429448190325182765112891891661)
- var year = 262980
- var percent_year = 0.0314159
- var percent_day_multi = math.Pow(1+percent_year, float64(1.0/365.0))
- var percent = (percent_day_multi - 1) / 720.0
- var Coin = int64(1000000)
- var Cent = int64(10000)
- var mplus, wMplus, sMplus float64
- var wDiff = float64(1.0)
- var sDiff = 0.0001
- var supply = 0.0//moneysupply
- var fees = 0.0
- var wHour = 29//PoW blocks' rate per 1 hour
- var shour = 1// PoS blocks' rate per 1 hour
- func main() {
- flag.Parse()
- wReward := 0.0
- fl, _ := strconv.ParseInt(flag.Arg(0), 10, 8)
- //years to mine in blocks
- eot := year * int(fl) + 2
- // fmt.Println(eot)
- // os.Exit(0)
- rnd := rand.New(rand.NewSource(7998884776666255876))
- for {
- if block < 10000000 {
- wReward = 10.0 + coef * math.Log(wDiff)
- // fmt.Println("PoW bounty: ", wReward, "wDiff=", wDiff)
- if block > 10 { wDiff = (1.005 * wDiff + rnd.Float64() * 111111.0 + 1.0) / 2 }
- if wDiff > 64000.0 { wDiff = 63999.0 }
- block++
- }
- // if block >= 1000000 { wReward = 0.0 }
- txFees := rnd.Float64() / 1.35
- if txFees > 0.66 { txFees = 0.02 }
- coinAge := rnd.Int63n(89970) + 30 //pseudorandom coin_age in days
- sReward := float64((33 * coinAge) / 12053) * 0.01
- // fmt.Println("PoS: ", sReward, "Fees=", txFees)
- // sRewardAndFees := sReward + txFees
- block++
- // fmt.Println("")
- supply = supply + wReward + sReward
- fees = fees + txFees
- if (block % year) == 0 {
- fmt.Println("moneysupply: ", strconv.FormatFloat(supply, 'f' , -1, 64), " at block #", block)
- fmt.Println("tx_fees =", fees)
- fmt.Println("PoW bounty: ", wReward, "wDiff=", wDiff)
- fmt.Println("PoS: ", sReward, "Fees=", txFees)
- fmt.Println("==========================================================")
- }
- if block > eot { break }
- }
- os.Exit(0)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement