gitlab.com/SiaPrime/SiaPrime@v1.4.1/types/constants.go (about)

     1  package types
     2  
     3  // constants.go contains the Sia constants. Depending on which build tags are
     4  // used, the constants will be initialized to different values.
     5  //
     6  // CONTRIBUTE: We don't have way to check that the non-test constants are all
     7  // sane, plus we have no coverage for them.
     8  
     9  import (
    10  	"math"
    11  	"math/big"
    12  	"time"
    13  
    14  	"gitlab.com/SiaPrime/SiaPrime/build"
    15  )
    16  
    17  var (
    18  	// ASICHardforkHeight is the height at which the hardfork targeting
    19  	// selected ASICs was activated.
    20  	ASICHardforkHeight BlockHeight
    21  
    22  	// ASICHardforkTotalTarget is the initial target after the ASIC hardfork.
    23  	// The actual target at ASICHardforkHeight is replaced with this value in
    24  	// order to prevent intolerably slow block times post-fork.
    25  	ASICHardforkTotalTarget Target
    26  
    27  	// ASICHardforkTotalTime is the initial total time after the ASIC
    28  	// hardfork. The actual total time at ASICHardforkHeight is replaced with
    29  	// this value in order to prevent intolerably slow block times post-fork.
    30  	ASICHardforkTotalTime int64
    31  
    32  	// ASICHardforkFactor is the factor by which the hashrate of targeted
    33  	// ASICs will be reduced.
    34  	ASICHardforkFactor = uint64(1)
    35  
    36  	// ASICHardforkReplayProtectionPrefix is a byte that prefixes
    37  	// SiacoinInputs and SiafundInputs when calculating SigHashes to protect
    38  	// against replay attacks.
    39  	ASICHardforkReplayProtectionPrefix = []byte(nil)
    40  
    41  	// BlockFrequency is the desired number of seconds that
    42  	// should elapse, on average, between successive Blocks.
    43  	BlockFrequency BlockHeight
    44  	// BlockSizeLimit is the maximum size of a binary-encoded Block
    45  	// that is permitted by the consensus rules.
    46  	BlockSizeLimit = uint64(2e6)
    47  	// BlocksPerHour is the number of blocks expected to be mined per hour.
    48  	BlocksPerHour = uint64(6)
    49  	// BlocksPerDay is the number of blocks expected to be mined per day.
    50  	BlocksPerDay = 24 * BlocksPerHour
    51  	// BlocksPerWeek is the number of blocks expected to be mined per week.
    52  	BlocksPerWeek = 7 * BlocksPerDay
    53  	// BlocksPerMonth is the number of blocks expected to be mined per month.
    54  	BlocksPerMonth = 30 * BlocksPerDay
    55  	// BlocksPerYear is the number of blocks expected to be mined per year.
    56  	BlocksPerYear = 365 * BlocksPerDay
    57  	// BurnAddressBlockHeight is the height at which the dev fund will be burnt
    58  	// instead of being claimed by the dev fund. Setting this value to 0 will
    59  	// prevent the dev fund from being burnt at any height.
    60  	BurnAddressBlockHeight = BlockHeight(105000)
    61  	// BurnAddressUnlockHash is the unlock hash for where to send coins to burn.
    62  	BurnAddressUnlockHash = UnlockHashFromAddrStr("000000000000000000000000000000000000000000000000000000000000000089eb0d6a8a69")
    63  	// DevFundEnabled is a boolean that when set to true will enable the ability to
    64  	// configure a dev fund
    65  	DevFundEnabled = true
    66  	// DevFundInitialBlockHeight is the height at which the dev fund became mandatory
    67  	DevFundInitialBlockHeight = BlockHeight(1)
    68  	// DevFundDecayStartBlockHeight is the height at which the DevFundInitialPercentage
    69  	// begins to linearly decay to the DevFundFinalPercentage
    70  	DevFundDecayStartBlockHeight = BlockHeight(30000)
    71  	// DevFundDecayEndBlockHeight is the height at which the DevFundInitialPercentage
    72  	// has fully decayed to the DevFundFinalPercentage
    73  	DevFundDecayEndBlockHeight = BlockHeight(105000)
    74  	// DevFundInitialPercentage is the initial percentage of the block reward that is
    75  	// sent to the DevFundUnlockHash before any dev fund percentage decay happens
    76  	DevFundInitialPercentage = uint64(20)
    77  	// DevFundFinalPercentage is the final percentage of the block reward that is sent
    78  	//  to the DevFundUnlockHash after the dev fund percentage is fully decayed
    79  	DevFundFinalPercentage = uint64(10)
    80  	// DevFundUnlockHash is the unlock hash for the dev fund subsidy
    81  	// Do not set this to the Zero address as doing so will cause the test that
    82  	// verifies that a dev fee is set to fail
    83  	DevFundUnlockHash = UnlockHashFromAddrStr("aefe0af2713c112ba4d10dee7753726e5c4de3f237ea455151342615c95d0e797d7a8cce7b05")
    84  
    85  	// EndOfTime is value to be used when a date in the future is needed for
    86  	// validation
    87  	EndOfTime = time.Unix(0, math.MaxInt64)
    88  
    89  	// ExtremeFutureThreshold is a temporal limit beyond which Blocks are
    90  	// discarded by the consensus rules. When incoming Blocks are processed, their
    91  	// Timestamp is allowed to exceed the processor's current time by a small amount.
    92  	// But if the Timestamp is further into the future than ExtremeFutureThreshold,
    93  	// the Block is immediately discarded.
    94  	ExtremeFutureThreshold Timestamp
    95  	// FutureThreshold is a temporal limit beyond which Blocks are
    96  	// discarded by the consensus rules. When incoming Blocks are processed, their
    97  	// Timestamp is allowed to exceed the processor's current time by no more than
    98  	// FutureThreshold. If the excess duration is larger than FutureThreshold, but
    99  	// smaller than ExtremeFutureThreshold, the Block may be held in memory until
   100  	// the Block's Timestamp exceeds the current time by less than FutureThreshold.
   101  	FutureThreshold Timestamp
   102  	// GenesisBlock is the first block of the block chain
   103  	GenesisBlock Block
   104  
   105  	// GenesisID is used in many places. Calculating it once saves lots of
   106  	// redundant computation.
   107  	GenesisID BlockID
   108  
   109  	// GenesisAirdropAllocation is the output creating the initial coins allocated
   110  	// for the airdrop at network launch
   111  	GenesisAirdropAllocation []SiacoinOutput
   112  	// GenesisSiafundAllocation is the set of SiafundOutputs created in the Genesis
   113  	// block.
   114  	GenesisSiafundAllocation []SiafundOutput
   115  	// ForkedGenesisSiafundAllocation is the set of SiafundOutputs created in the Genesis
   116  	// block.
   117  	ForkedGenesisSiafundAllocation []SiafundOutput
   118  	// GenesisTimestamp is the timestamp when genesis block was mined
   119  	GenesisTimestamp Timestamp
   120  	// InitialCoinbase is the coinbase reward of the Genesis block.
   121  	InitialCoinbase = uint64(300e3)
   122  	// AirdropCommunityValue is the total amount of coins the community members will split
   123  	// from the genesis block airdrop.
   124  	AirdropCommunityValue = NewCurrency64(10000000000).Mul(SiacoinPrecision)
   125  	// AirdropPoolValue is the total amount of coins the pools get
   126  	// airdrop so that they can pay out miners in the first 144 blocks
   127  	AirdropPoolValue = NewCurrency64(51840000).Mul(SiacoinPrecision)
   128  	// AirdropNebulousLabsValue is a gift to the NebulousLabs Team to acknowledge all their
   129  	// effort and hard work. THANK YOU!
   130  	AirdropNebulousLabsValue = NewCurrency64(300000000).Mul(SiacoinPrecision)
   131  	// AirdropSiaPrimeValue is the total amount of coins SiaPrime gets to help bootstrap
   132  	// expenses
   133  	AirdropSiaPrimeValue = NewCurrency64(200000000).Mul(SiacoinPrecision)
   134  	// MaturityDelay specifies the number of blocks that a maturity-required output
   135  	// is required to be on hold before it can be spent on the blockchain.
   136  	// Outputs are maturity-required if they are highly likely to be altered or
   137  	// invalidated in the event of a small reorg. One example is the block reward,
   138  	// as a small reorg may invalidate the block reward. Another example is a siafund
   139  	// payout, as a tiny reorg may change the value of the payout, and thus invalidate
   140  	// any transactions spending the payout. File contract payouts also are subject to
   141  	// a maturity delay.
   142  	MaturityDelay BlockHeight
   143  	// MaxTargetAdjustmentDown restrict how much the block difficulty is allowed to
   144  	// change in a single step, which is important to limit the effect of difficulty
   145  	// raising and lowering attacks.
   146  	MaxTargetAdjustmentDown *big.Rat
   147  	// MaxTargetAdjustmentUp restrict how much the block difficulty is allowed to
   148  	// change in a single step, which is important to limit the effect of difficulty
   149  	// raising and lowering attacks.
   150  	MaxTargetAdjustmentUp *big.Rat
   151  	// MedianTimestampWindow tells us how many blocks to look back when calculating
   152  	// the median timestamp over the previous n blocks. The timestamp of a block is
   153  	// not allowed to be less than or equal to the median timestamp of the previous n
   154  	// blocks, where for Sia this number is typically 11.
   155  	MedianTimestampWindow = uint64(11)
   156  	// MinimumCoinbase is the minimum coinbase reward for a block.
   157  	// The coinbase decreases in each block after the Genesis block,
   158  	// but it will not decrease past MinimumCoinbase.
   159  	MinimumCoinbase uint64
   160  
   161  	// Oak hardfork constants. Oak is the name of the difficulty algorithm for
   162  	// Sia following a hardfork at block 135e3.
   163  
   164  	// OakDecayDenom is the denominator for how much the total timestamp is decayed
   165  	// each step.
   166  	OakDecayDenom int64
   167  	// OakDecayNum is the numerator for how much the total timestamp is decayed each
   168  	// step.
   169  	OakDecayNum int64
   170  	// OakHardforkBlock is the height at which the hardfork to switch to the oak
   171  	// difficulty adjustment algorithm is triggered.
   172  	OakHardforkBlock BlockHeight
   173  	// OakHardforkFixBlock is the height at which the hardfork to switch from the broken
   174  	// oak difficulty adjustment algorithm to the fixed oak difficulty adjustment
   175  	// algorithm is triggered.
   176  	OakHardforkFixBlock BlockHeight
   177  	// OakHardforkTxnSizeLimit is the maximum size allowed for a transaction, a change
   178  	// which I believe was implemented simultaneously with the oak hardfork.
   179  	OakHardforkTxnSizeLimit = uint64(64e3) // 64 KB
   180  	// OakMaxBlockShift is the maximum number of seconds that the oak algorithm will shift
   181  	// the difficulty.
   182  	OakMaxBlockShift int64
   183  	// OakMaxDrop is the drop is the maximum amount that the difficulty will drop each block.
   184  	OakMaxDrop *big.Rat
   185  	// OakMaxRise is the maximum amount that the difficulty will rise each block.
   186  	OakMaxRise *big.Rat
   187  
   188  	// RootDepth is the cumulative target of all blocks. The root depth is essentially
   189  	// the maximum possible target, there have been no blocks yet, so there is no
   190  	// cumulated difficulty yet.
   191  	RootDepth = Target{255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
   192  	// RootTarget is the target for the genesis block - basically how much work needs
   193  	// to be done in order to mine the first block. The difficulty adjustment algorithm
   194  	// takes over from there.
   195  	RootTarget Target
   196  	// SiacoinPrecision is the number of base units in a siacoin. The Sia network has a very
   197  	// large number of base units. We call 10^24 of these a siacoin.
   198  	//
   199  	// The base unit for Bitcoin is called a satoshi. We call 10^8 satoshis a bitcoin,
   200  	// even though the code itself only ever works with satoshis.
   201  	SiacoinPrecision = NewCurrency(new(big.Int).Exp(big.NewInt(10), big.NewInt(24), nil))
   202  	// SiafundCount is the total number of Siafunds in existence.
   203  	SiafundCount = NewCurrency64(10000)
   204  	// SiafundPortion is the percentage of siacoins that is taxed from FileContracts.
   205  	SiafundPortion = big.NewRat(39, 1000)
   206  	// TargetWindow is the number of blocks to look backwards when determining how much
   207  	// time has passed vs. how many blocks have been created. It's only used in the old,
   208  	// broken difficulty adjustment algorithm.
   209  	TargetWindow BlockHeight
   210  )
   211  
   212  var (
   213  	// TaxHardforkHeight is the height at which the tax hardfork occurred.
   214  	TaxHardforkHeight = build.Select(build.Var{
   215  		Dev:      BlockHeight(10),
   216  		Standard: BlockHeight(21e3),
   217  		Testing:  BlockHeight(10),
   218  	}).(BlockHeight)
   219  )
   220  
   221  // scanAddress scans a types.UnlockHash from a string.
   222  func scanAddress(addrStr string) (addr UnlockHash, err error) {
   223  	err = addr.LoadString(addrStr)
   224  	if err != nil {
   225  		return UnlockHash{}, err
   226  	}
   227  	return addr, nil
   228  }
   229  
   230  // UnlockHashFromAddrStr convert string address to UnlockHash
   231  func UnlockHashFromAddrStr(addrStr string) (addr UnlockHash) {
   232  	dest, err := scanAddress(addrStr)
   233  	if err != nil {
   234  		return UnlockHash{}
   235  	}
   236  	return dest
   237  }
   238  
   239  // init checks which build constant is in place and initializes the variables
   240  // accordingly.
   241  func init() {
   242  	if build.Release == "dev" {
   243  		// 'dev' settings are for small developer testnets, usually on the same
   244  		// computer. Settings are slow enough that a small team of developers
   245  		// can coordinate their actions over a the developer testnets, but fast
   246  		// enough that there isn't much time wasted on waiting for things to
   247  		// happen.
   248  		ASICHardforkHeight = math.MaxInt64
   249  		ASICHardforkTotalTarget = Target{0, 0, 0, 8}
   250  		ASICHardforkTotalTime = 800
   251  
   252  		BlockFrequency = 12                      // 12 seconds: slow enough for developers to see ~each block, fast enough that blocks don't waste time.
   253  		MaturityDelay = 10                       // 60 seconds before a delayed output matures.
   254  		GenesisTimestamp = Timestamp(1528293910) // Change as necessary.
   255  		RootTarget = Target{0, 0, 2}             // Standard developer CPUs will be able to mine blocks with the race library activated.
   256  
   257  		TargetWindow = 20                              // Difficulty is adjusted based on prior 20 blocks.
   258  		MaxTargetAdjustmentUp = big.NewRat(120, 100)   // Difficulty adjusts quickly.
   259  		MaxTargetAdjustmentDown = big.NewRat(100, 120) // Difficulty adjusts quickly.
   260  		FutureThreshold = 2 * 60                       // 2 minutes.
   261  		ExtremeFutureThreshold = 4 * 60                // 4 minutes.
   262  
   263  		MinimumCoinbase = 30e3
   264  
   265  		OakHardforkBlock = 100
   266  		OakHardforkFixBlock = 105
   267  		OakDecayNum = 985
   268  		OakDecayDenom = 1000
   269  		OakMaxBlockShift = 3
   270  		OakMaxRise = big.NewRat(102, 100)
   271  		OakMaxDrop = big.NewRat(100, 102)
   272  
   273  		GenesisAirdropAllocation = []SiacoinOutput{
   274  			{
   275  				Value:      AirdropCommunityValue,
   276  				UnlockHash: UnlockHashFromAddrStr("436890aacc53f93f9cc4538d9b4abba27dd5be6ff8a064fae7b78a67809db5e210819ffc4a21"),
   277  			},
   278  			{
   279  				Value:      AirdropPoolValue,
   280  				UnlockHash: UnlockHashFromAddrStr("78054218b7d0bc04929e5a3e6a2ac5fed29b98898cba3d740dd31a1aae6e8c8b3ce7467d4e8f"),
   281  			},
   282  			{
   283  				Value:      AirdropNebulousLabsValue,
   284  				UnlockHash: UnlockHashFromAddrStr("7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567"),
   285  			},
   286  			{
   287  				Value:      AirdropSiaPrimeValue,
   288  				UnlockHash: UnlockHashFromAddrStr("aefe0af2713c112ba4d10dee7753726e5c4de3f237ea455151342615c95d0e797d7a8cce7b05"),
   289  			},
   290  		}
   291  
   292  		GenesisSiafundAllocation = []SiafundOutput{
   293  			{
   294  				Value:      NewCurrency64(2000),
   295  				UnlockHash: UnlockHash{214, 166, 197, 164, 29, 201, 53, 236, 106, 239, 10, 158, 127, 131, 20, 138, 63, 221, 230, 16, 98, 247, 32, 77, 210, 68, 116, 12, 241, 89, 27, 223},
   296  			},
   297  			{
   298  				Value:      NewCurrency64(7000),
   299  				UnlockHash: UnlockHash{209, 246, 228, 60, 248, 78, 242, 110, 9, 8, 227, 248, 225, 216, 163, 52, 142, 93, 47, 176, 103, 41, 137, 80, 212, 8, 132, 58, 241, 189, 2, 17},
   300  			},
   301  			{
   302  				Value:      NewCurrency64(1000),
   303  				UnlockHash: UnlockConditions{}.UnlockHash(),
   304  			},
   305  		}
   306  
   307  		ForkedGenesisSiafundAllocation = GenesisSiafundAllocation
   308  	} else if build.Release == "testing" {
   309  		// 'testing' settings are for automatic testing, and create much faster
   310  		// environments than a human can interact with.
   311  		ASICHardforkHeight = math.MaxInt64
   312  		ASICHardforkTotalTarget = Target{255, 255}
   313  		ASICHardforkTotalTime = 10e3
   314  
   315  		BlockFrequency = 1 // As fast as possible
   316  		MaturityDelay = 3
   317  		GenesisTimestamp = CurrentTimestamp() - 1e6
   318  		RootTarget = Target{128} // Takes an expected 2 hashes; very fast for testing but still probes 'bad hash' code.
   319  
   320  		// A restrictive difficulty clamp prevents the difficulty from climbing
   321  		// during testing, as the resolution on the difficulty adjustment is
   322  		// only 1 second and testing mining should be happening substantially
   323  		// faster than that.
   324  		TargetWindow = 200
   325  		MaxTargetAdjustmentUp = big.NewRat(10001, 10000)
   326  		MaxTargetAdjustmentDown = big.NewRat(9999, 10000)
   327  		FutureThreshold = 3        // 3 seconds
   328  		ExtremeFutureThreshold = 6 // 6 seconds
   329  
   330  		MinimumCoinbase = 299990 // Minimum coinbase is hit after 10 blocks to make testing minimum-coinbase code easier.
   331  
   332  		// Do not let the difficulty change rapidly - blocks will be getting
   333  		// mined far faster than the difficulty can adjust to.
   334  		OakHardforkBlock = 20
   335  		OakHardforkFixBlock = 23
   336  		OakDecayNum = 9999
   337  		OakDecayDenom = 10e3
   338  		OakMaxBlockShift = 3
   339  		OakMaxRise = big.NewRat(10001, 10e3)
   340  		OakMaxDrop = big.NewRat(10e3, 10001)
   341  
   342  		GenesisAirdropAllocation = []SiacoinOutput{
   343  			{
   344  				Value:      AirdropCommunityValue,
   345  				UnlockHash: UnlockHashFromAddrStr("436890aacc53f93f9cc4538d9b4abba27dd5be6ff8a064fae7b78a67809db5e210819ffc4a21"),
   346  			},
   347  			{
   348  				Value:      AirdropPoolValue,
   349  				UnlockHash: UnlockHashFromAddrStr("78054218b7d0bc04929e5a3e6a2ac5fed29b98898cba3d740dd31a1aae6e8c8b3ce7467d4e8f"),
   350  			},
   351  			{
   352  				Value:      AirdropNebulousLabsValue,
   353  				UnlockHash: UnlockHashFromAddrStr("7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567"),
   354  			},
   355  			{
   356  				Value:      AirdropSiaPrimeValue,
   357  				UnlockHash: UnlockHashFromAddrStr("aefe0af2713c112ba4d10dee7753726e5c4de3f237ea455151342615c95d0e797d7a8cce7b05"),
   358  			},
   359  		}
   360  
   361  		GenesisSiafundAllocation = []SiafundOutput{
   362  			{
   363  				Value:      NewCurrency64(2000),
   364  				UnlockHash: UnlockHash{214, 166, 197, 164, 29, 201, 53, 236, 106, 239, 10, 158, 127, 131, 20, 138, 63, 221, 230, 16, 98, 247, 32, 77, 210, 68, 116, 12, 241, 89, 27, 223},
   365  			},
   366  			{
   367  				Value:      NewCurrency64(7000),
   368  				UnlockHash: UnlockHash{209, 246, 228, 60, 248, 78, 242, 110, 9, 8, 227, 248, 225, 216, 163, 52, 142, 93, 47, 176, 103, 41, 137, 80, 212, 8, 132, 58, 241, 189, 2, 17},
   369  			},
   370  			{
   371  				Value:      NewCurrency64(1000),
   372  				UnlockHash: UnlockConditions{}.UnlockHash(),
   373  			},
   374  		}
   375  
   376  		ForkedGenesisSiafundAllocation = GenesisSiafundAllocation
   377  	} else if build.Release == "standard" {
   378  		// 'standard' settings are for the full network. They are slow enough
   379  		// that the network is secure in a real-world byzantine environment.
   380  
   381  		// A hardfork height of max int64 was chosen to clarify that the we
   382  		// expect the hardfork to never happen on the SiaPrime blockchain.
   383  		// A total time of 120,000 is chosen because that represents the total
   384  		// time elapsed at a perfect equilibrium, indicating a visible average
   385  		// block time that perfectly aligns with what is expected. A total
   386  		// target of 67 leading zeroes is chosen because that aligns with the
   387  		// amount of hashrate that we expect to be on the network after the
   388  		// hardfork.
   389  		ASICHardforkHeight = math.MaxInt64
   390  		ASICHardforkTotalTarget = Target{0, 0, 0, 0, 0, 0, 0, 0, 32}
   391  		ASICHardforkTotalTime = 120e3
   392  
   393  		// A block time of 1 block per 10 minutes is chosen to follow Bitcoin's
   394  		// example. The security lost by lowering the block time is not
   395  		// insignificant, and the convenience gained by lowering the blocktime
   396  		// even down to 90 seconds is not significant. I do feel that 10
   397  		// minutes could even be too short, but it has worked well for Bitcoin.
   398  		BlockFrequency = 600
   399  
   400  		// Payouts take 1 day to mature. This is to prevent a class of double
   401  		// spending attacks parties unintentionally spend coins that will stop
   402  		// existing after a blockchain reorganization. There are multiple
   403  		// classes of payouts in Sia that depend on a previous block - if that
   404  		// block changes, then the output changes and the previously existing
   405  		// output ceases to exist. This delay stops both unintentional double
   406  		// spending and stops a small set of long-range mining attacks.
   407  		MaturityDelay = 144
   408  
   409  		// The genesis timestamp is set to June 6th, because that is when the
   410  		// 100-block developer premine started. The trailing zeroes are a
   411  		// bonus, and make the timestamp easier to memorize.
   412  		GenesisTimestamp = Timestamp(1540955779)
   413  
   414  		// The RootTarget was set such that the developers could reasonable
   415  		// premine 100 blocks in a day. It was known to the developers at launch
   416  		// this this was at least one and perhaps two orders of magnitude too
   417  		// small.
   418  		RootTarget = Target{0, 0, 0, 0, 0, 0, 2}
   419  
   420  		// When the difficulty is adjusted, it is adjusted by looking at the
   421  		// timestamp of the 1000th previous block. This minimizes the abilities
   422  		// of miners to attack the network using rogue timestamps.
   423  		TargetWindow = 1e3
   424  
   425  		// The difficulty adjustment is clamped to 2.5x every 500 blocks. This
   426  		// corresponds to 6.25x every 2 weeks, which can be compared to
   427  		// Bitcoin's clamp of 4x every 2 weeks. The difficulty clamp is
   428  		// primarily to stop difficulty raising attacks. Sia's safety margin is
   429  		// similar to Bitcoin's despite the looser clamp because Sia's
   430  		// difficulty is adjusted four times as often. This does result in
   431  		// greater difficulty oscillation, a tradeoff that was chosen to be
   432  		// acceptable due to Sia's more vulnerable position as an altcoin.
   433  		MaxTargetAdjustmentUp = big.NewRat(25, 10)
   434  		MaxTargetAdjustmentDown = big.NewRat(10, 25)
   435  
   436  		// Blocks will not be accepted if their timestamp is more than 3 hours
   437  		// into the future, but will be accepted as soon as they are no longer
   438  		// 3 hours into the future. Blocks that are greater than 5 hours into
   439  		// the future are rejected outright, as it is assumed that by the time
   440  		// 2 hours have passed, those blocks will no longer be on the longest
   441  		// chain. Blocks cannot be kept forever because this opens a DoS
   442  		// vector.
   443  		FutureThreshold = 3 * 60 * 60        // 3 hours.
   444  		ExtremeFutureThreshold = 5 * 60 * 60 // 5 hours.
   445  
   446  		// The minimum coinbase is set to 10,000. Because the coinbase
   447  		// decreases by 1 every time, it means that Sia's coinbase will have an
   448  		// increasingly potent dropoff for about 5 years, until inflation more
   449  		// or less permanently settles around 2%.
   450  		MinimumCoinbase = 10e3
   451  
   452  		// The oak difficulty adjustment hardfork is set to trigger at block
   453  		// 135,000, which is just under 6 months after the hardfork was first
   454  		// released as beta software to the network. This hopefully gives
   455  		// everyone plenty of time to upgrade and adopt the hardfork, while also
   456  		// being earlier than the most optimistic shipping dates for the miners
   457  		// that would otherwise be very disruptive to the network.
   458  		//
   459  		// There was a bug in the original Oak hardfork that had to be quickly
   460  		// followed up with another fix. The height of that fix is the
   461  		// OakHardforkFixBlock.
   462  		OakHardforkBlock = 1500
   463  		OakHardforkFixBlock = 1500
   464  
   465  		// The decay is kept at 995/1000, or a decay of about 0.5% each block.
   466  		// This puts the halflife of a block's relevance at about 1 day. This
   467  		// allows the difficulty to adjust rapidly if the hashrate is adjusting
   468  		// rapidly, while still keeping a relatively strong insulation against
   469  		// random variance.
   470  		OakDecayNum = 995
   471  		OakDecayDenom = 1e3
   472  
   473  		// The block shift determines the most that the difficulty adjustment
   474  		// algorithm is allowed to shift the target block time. With a block
   475  		// frequency of 600 seconds, the min target block time is 200 seconds,
   476  		// and the max target block time is 1800 seconds.
   477  		OakMaxBlockShift = 3
   478  
   479  		// The max rise and max drop for the difficulty is kept at 0.4% per
   480  		// block, which means that in 1008 blocks the difficulty can move a
   481  		// maximum of about 55x. This is significant, and means that dramatic
   482  		// hashrate changes can be responded to quickly, while still forcing an
   483  		// attacker to do a significant amount of work in order to execute a
   484  		// difficulty raising attack, and minimizing the chance that an attacker
   485  		// can get lucky and fake a ton of work.
   486  		OakMaxRise = big.NewRat(1004, 1e3)
   487  		OakMaxDrop = big.NewRat(1e3, 1004)
   488  
   489  		GenesisAirdropAllocation = []SiacoinOutput{
   490  			{
   491  				Value:      AirdropCommunityValue,
   492  				UnlockHash: UnlockHashFromAddrStr("436890aacc53f93f9cc4538d9b4abba27dd5be6ff8a064fae7b78a67809db5e210819ffc4a21"),
   493  			},
   494  			{
   495  				Value:      AirdropPoolValue,
   496  				UnlockHash: UnlockHashFromAddrStr("78054218b7d0bc04929e5a3e6a2ac5fed29b98898cba3d740dd31a1aae6e8c8b3ce7467d4e8f"),
   497  			},
   498  			{
   499  				Value:      AirdropNebulousLabsValue,
   500  				UnlockHash: UnlockHashFromAddrStr("7d0c44f7664e2d34e53efde0661a6f628ec9264785ae8e3cd7c973e8d190c3c97b5e3ecbc567"),
   501  			},
   502  			{
   503  				Value:      AirdropSiaPrimeValue,
   504  				UnlockHash: UnlockHashFromAddrStr("aefe0af2713c112ba4d10dee7753726e5c4de3f237ea455151342615c95d0e797d7a8cce7b05"),
   505  			},
   506  		}
   507  
   508  		ForkedGenesisSiafundAllocation = []SiafundOutput{
   509  			{
   510  				Value:      NewCurrency64(10000),
   511  				UnlockHash: UnlockHashFromAddrStr("436890aacc53f93f9cc4538d9b4abba27dd5be6ff8a064fae7b78a67809db5e210819ffc4a21"),
   512  			},
   513  		}
   514  
   515  		GenesisSiafundAllocation = []SiafundOutput{
   516  			{
   517  				Value:      NewCurrency64(2),
   518  				UnlockHash: UnlockHash{4, 57, 229, 188, 127, 20, 204, 245, 211, 167, 232, 130, 208, 64, 146, 62, 69, 98, 81, 102, 221, 7, 123, 100, 70, 107, 199, 113, 121, 26, 198, 252},
   519  			},
   520  			{
   521  				Value:      NewCurrency64(6),
   522  				UnlockHash: UnlockHash{4, 158, 29, 42, 105, 119, 43, 5, 138, 72, 190, 190, 101, 114, 79, 243, 189, 248, 208, 151, 30, 187, 233, 148, 225, 233, 28, 159, 19, 232, 75, 244},
   523  			},
   524  			{
   525  				Value:      NewCurrency64(7),
   526  				UnlockHash: UnlockHash{8, 7, 66, 250, 25, 74, 247, 108, 162, 79, 220, 151, 202, 228, 241, 11, 130, 138, 13, 248, 193, 167, 136, 197, 65, 63, 234, 174, 205, 216, 71, 230},
   527  			},
   528  			{
   529  				Value:      NewCurrency64(8),
   530  				UnlockHash: UnlockHash{44, 106, 239, 51, 138, 102, 242, 19, 204, 197, 248, 178, 219, 122, 152, 251, 19, 20, 52, 32, 175, 32, 4, 156, 73, 33, 163, 165, 222, 184, 217, 218},
   531  			},
   532  			{
   533  				Value:      NewCurrency64(3),
   534  				UnlockHash: UnlockHash{44, 163, 31, 233, 74, 103, 55, 132, 230, 159, 97, 78, 149, 147, 65, 110, 164, 211, 105, 173, 158, 29, 202, 43, 85, 217, 85, 75, 83, 37, 205, 223},
   535  			},
   536  			{
   537  				Value:      NewCurrency64(1),
   538  				UnlockHash: UnlockHash{51, 151, 146, 84, 199, 7, 59, 89, 111, 172, 227, 200, 62, 55, 165, 253, 238, 186, 28, 145, 47, 137, 200, 15, 70, 199, 187, 125, 243, 104, 179, 240},
   539  			},
   540  			{
   541  				Value:      NewCurrency64(10),
   542  				UnlockHash: UnlockHash{53, 118, 253, 229, 254, 229, 28, 131, 233, 156, 108, 58, 197, 152, 17, 160, 74, 252, 11, 49, 112, 240, 66, 119, 40, 98, 114, 251, 5, 86, 233, 117},
   543  			},
   544  			{
   545  				Value:      NewCurrency64(50),
   546  				UnlockHash: UnlockHash{56, 219, 3, 50, 28, 3, 166, 95, 141, 163, 202, 35, 60, 199, 219, 10, 151, 176, 228, 97, 176, 133, 189, 33, 211, 202, 83, 197, 31, 208, 254, 193},
   547  			},
   548  			{
   549  				Value:      NewCurrency64(75),
   550  				UnlockHash: UnlockHash{68, 190, 140, 87, 96, 232, 150, 32, 161, 177, 204, 65, 228, 223, 87, 217, 134, 90, 25, 56, 51, 45, 72, 107, 129, 12, 29, 202, 6, 7, 50, 13},
   551  			},
   552  			{
   553  				Value:      NewCurrency64(10),
   554  				UnlockHash: UnlockHash{69, 14, 201, 200, 90, 73, 245, 45, 154, 94, 161, 19, 199, 241, 203, 56, 13, 63, 5, 220, 121, 245, 247, 52, 194, 181, 252, 76, 130, 6, 114, 36},
   555  			},
   556  			{
   557  				Value:      NewCurrency64(10),
   558  				UnlockHash: UnlockHash{72, 128, 253, 207, 169, 48, 1, 26, 237, 205, 169, 102, 196, 224, 42, 186, 95, 151, 59, 226, 203, 136, 251, 223, 165, 38, 88, 110, 47, 213, 121, 224},
   559  			},
   560  			{
   561  				Value:      NewCurrency64(50),
   562  				UnlockHash: UnlockHash{72, 130, 164, 227, 218, 28, 60, 15, 56, 151, 212, 242, 77, 131, 232, 131, 42, 57, 132, 173, 113, 118, 66, 183, 38, 79, 96, 178, 105, 108, 26, 247},
   563  			},
   564  			{
   565  				Value:      NewCurrency64(10),
   566  				UnlockHash: UnlockHash{74, 210, 58, 228, 111, 69, 253, 120, 53, 195, 110, 26, 115, 76, 211, 202, 199, 159, 204, 14, 78, 92, 14, 131, 250, 22, 141, 236, 154, 44, 39, 135},
   567  			},
   568  			{
   569  				Value:      NewCurrency64(15),
   570  				UnlockHash: UnlockHash{85, 198, 154, 41, 196, 116, 226, 114, 202, 94, 214, 147, 87, 84, 247, 164, 195, 79, 58, 123, 26, 33, 68, 65, 116, 79, 181, 241, 241, 208, 215, 184},
   571  			},
   572  			{
   573  				Value:      NewCurrency64(121),
   574  				UnlockHash: UnlockHash{87, 239, 83, 125, 152, 14, 19, 22, 203, 136, 46, 192, 203, 87, 224, 190, 77, 236, 125, 18, 142, 223, 146, 70, 16, 23, 252, 19, 100, 69, 91, 111},
   575  			},
   576  			{
   577  				Value:      NewCurrency64(222),
   578  				UnlockHash: UnlockHash{91, 201, 101, 11, 188, 40, 35, 111, 236, 133, 31, 124, 97, 246, 140, 136, 143, 245, 152, 174, 111, 245, 188, 124, 21, 125, 187, 192, 203, 92, 253, 57},
   579  			},
   580  			{
   581  				Value:      NewCurrency64(10),
   582  				UnlockHash: UnlockHash{110, 240, 238, 173, 78, 138, 185, 138, 179, 227, 135, 153, 54, 132, 46, 62, 226, 206, 204, 35, 174, 107, 156, 15, 142, 2, 93, 132, 163, 60, 50, 89},
   583  			},
   584  			{
   585  				Value:      NewCurrency64(3),
   586  				UnlockHash: UnlockHash{114, 58, 147, 44, 64, 69, 72, 184, 65, 178, 213, 94, 157, 44, 88, 106, 92, 31, 145, 193, 215, 200, 215, 233, 99, 116, 36, 197, 160, 70, 79, 153},
   587  			},
   588  			{
   589  				Value:      NewCurrency64(1),
   590  				UnlockHash: UnlockHash{123, 106, 229, 101, 220, 252, 50, 203, 38, 183, 133, 152, 250, 167, 210, 155, 252, 102, 150, 29, 187, 3, 178, 53, 11, 145, 143, 33, 166, 115, 250, 40},
   591  			},
   592  			{
   593  				Value:      NewCurrency64(5),
   594  				UnlockHash: UnlockHash{124, 101, 207, 175, 50, 119, 207, 26, 62, 15, 247, 141, 150, 174, 73, 247, 238, 28, 77, 255, 222, 104, 166, 244, 112, 86, 227, 80, 215, 45, 69, 143},
   595  			},
   596  			{
   597  				Value:      NewCurrency64(10),
   598  				UnlockHash: UnlockHash{130, 184, 72, 15, 227, 79, 217, 205, 120, 254, 67, 69, 10, 49, 76, 194, 222, 30, 242, 62, 88, 179, 51, 117, 27, 166, 140, 6, 7, 22, 222, 185},
   599  			},
   600  			{
   601  				Value:      NewCurrency64(25),
   602  				UnlockHash: UnlockHash{134, 137, 198, 172, 96, 54, 45, 10, 100, 128, 91, 225, 226, 134, 143, 108, 31, 70, 187, 228, 54, 212, 70, 229, 149, 57, 64, 166, 153, 123, 238, 180},
   603  			},
   604  			{
   605  				Value:      NewCurrency64(1),
   606  				UnlockHash: UnlockHash{143, 253, 118, 229, 109, 181, 141, 224, 91, 144, 123, 160, 203, 221, 119, 104, 172, 13, 105, 77, 171, 185, 122, 54, 229, 168, 6, 130, 160, 130, 182, 151},
   607  			},
   608  			{
   609  				Value:      NewCurrency64(8),
   610  				UnlockHash: UnlockHash{147, 108, 249, 16, 36, 249, 108, 184, 196, 212, 241, 120, 219, 63, 45, 184, 86, 53, 96, 207, 130, 96, 210, 251, 136, 9, 193, 160, 131, 198, 221, 185},
   611  			},
   612  			{
   613  				Value:      NewCurrency64(58),
   614  				UnlockHash: UnlockHash{155, 79, 89, 28, 69, 71, 239, 198, 246, 2, 198, 254, 92, 59, 192, 205, 229, 152, 36, 186, 110, 122, 233, 221, 76, 143, 3, 238, 89, 231, 192, 23},
   615  			},
   616  			{
   617  				Value:      NewCurrency64(2),
   618  				UnlockHash: UnlockHash{156, 32, 76, 105, 213, 46, 66, 50, 27, 85, 56, 9, 106, 193, 80, 145, 19, 101, 84, 177, 145, 4, 125, 28, 79, 252, 43, 83, 118, 110, 206, 247},
   619  			},
   620  			{
   621  				Value:      NewCurrency64(23),
   622  				UnlockHash: UnlockHash{157, 169, 134, 24, 254, 22, 58, 188, 119, 87, 201, 238, 55, 168, 194, 131, 88, 18, 39, 168, 37, 2, 198, 194, 93, 202, 116, 146, 189, 17, 108, 44},
   623  			},
   624  			{
   625  				Value:      NewCurrency64(10),
   626  				UnlockHash: UnlockHash{158, 51, 104, 36, 242, 114, 67, 16, 168, 230, 4, 111, 241, 72, 5, 14, 182, 102, 169, 156, 144, 220, 103, 117, 223, 8, 58, 187, 124, 102, 80, 44},
   627  			},
   628  			{
   629  				Value:      NewCurrency64(1),
   630  				UnlockHash: UnlockHash{160, 175, 59, 33, 223, 30, 82, 60, 34, 110, 28, 203, 249, 93, 3, 16, 218, 12, 250, 206, 138, 231, 85, 67, 69, 191, 68, 198, 160, 87, 154, 68},
   631  			},
   632  			{
   633  				Value:      NewCurrency64(75),
   634  				UnlockHash: UnlockHash{163, 94, 51, 220, 14, 144, 83, 112, 62, 10, 0, 173, 161, 234, 211, 176, 186, 84, 9, 189, 250, 111, 33, 231, 114, 87, 100, 75, 72, 217, 11, 26},
   635  			},
   636  			{
   637  				Value:      NewCurrency64(3),
   638  				UnlockHash: UnlockHash{170, 7, 138, 116, 205, 20, 132, 197, 166, 251, 75, 93, 69, 6, 109, 244, 212, 119, 173, 114, 34, 18, 25, 21, 111, 203, 203, 253, 138, 104, 27, 36},
   639  			},
   640  			{
   641  				Value:      NewCurrency64(90),
   642  				UnlockHash: UnlockHash{173, 120, 128, 104, 186, 86, 151, 140, 191, 23, 231, 193, 77, 245, 243, 104, 196, 55, 155, 243, 111, 15, 84, 139, 148, 187, 173, 47, 104, 69, 141, 39},
   643  			},
   644  			{
   645  				Value:      NewCurrency64(20),
   646  				UnlockHash: UnlockHash{179, 185, 228, 166, 139, 94, 13, 193, 255, 227, 174, 99, 120, 105, 109, 221, 247, 4, 155, 243, 229, 37, 26, 98, 222, 12, 91, 80, 223, 33, 61, 56},
   647  			},
   648  			{
   649  				Value:      NewCurrency64(5),
   650  				UnlockHash: UnlockHash{193, 49, 103, 20, 170, 135, 182, 85, 149, 18, 159, 194, 152, 120, 162, 208, 49, 158, 220, 188, 114, 79, 1, 131, 62, 27, 86, 57, 244, 46, 64, 66},
   651  			},
   652  			{
   653  				Value:      NewCurrency64(1),
   654  				UnlockHash: UnlockHash{196, 71, 45, 222, 0, 21, 12, 121, 197, 224, 101, 65, 40, 57, 19, 119, 112, 205, 166, 23, 2, 91, 75, 231, 69, 143, 221, 68, 245, 75, 7, 52},
   655  			},
   656  			{
   657  				Value:      NewCurrency64(44),
   658  				UnlockHash: UnlockHash{196, 214, 236, 211, 227, 216, 152, 127, 164, 2, 235, 14, 235, 46, 142, 231, 83, 38, 7, 131, 208, 29, 179, 189, 62, 88, 129, 180, 119, 158, 214, 97},
   659  			},
   660  			{
   661  				Value:      NewCurrency64(23),
   662  				UnlockHash: UnlockHash{206, 58, 114, 148, 131, 49, 87, 197, 86, 18, 216, 26, 62, 79, 152, 175, 33, 4, 132, 160, 108, 231, 53, 200, 48, 76, 125, 94, 156, 85, 32, 130},
   663  			},
   664  			{
   665  				Value:      NewCurrency64(80),
   666  				UnlockHash: UnlockHash{200, 103, 135, 126, 197, 2, 203, 63, 241, 6, 245, 195, 220, 102, 27, 74, 232, 249, 201, 86, 207, 34, 51, 26, 180, 151, 136, 108, 112, 56, 132, 72},
   667  			},
   668  			{
   669  				Value:      NewCurrency64(2),
   670  				UnlockHash: UnlockHash{200, 249, 245, 218, 58, 253, 76, 250, 88, 114, 70, 239, 14, 2, 250, 123, 10, 192, 198, 61, 187, 155, 247, 152, 165, 174, 198, 24, 142, 39, 177, 119},
   671  			},
   672  			{
   673  				Value:      NewCurrency64(1),
   674  				UnlockHash: UnlockHash{209, 1, 199, 184, 186, 57, 21, 137, 33, 252, 219, 184, 130, 38, 32, 98, 63, 252, 250, 79, 70, 146, 169, 78, 180, 161, 29, 93, 38, 45, 175, 176},
   675  			},
   676  			{
   677  				Value:      NewCurrency64(2),
   678  				UnlockHash: UnlockHash{212, 107, 233, 43, 185, 138, 79, 253, 12, 237, 214, 17, 219, 198, 151, 92, 81, 129, 17, 120, 139, 58, 66, 119, 126, 220, 132, 136, 3, 108, 57, 58},
   679  			},
   680  			{
   681  				Value:      NewCurrency64(3),
   682  				UnlockHash: UnlockHash{214, 244, 146, 173, 173, 80, 33, 185, 29, 133, 77, 167, 185, 1, 38, 23, 111, 179, 104, 150, 105, 162, 120, 26, 245, 63, 114, 119, 52, 1, 44, 222},
   683  			},
   684  			{
   685  				Value:      NewCurrency64(1),
   686  				UnlockHash: UnlockHash{217, 218, 172, 16, 53, 134, 160, 226, 44, 138, 93, 53, 181, 62, 4, 209, 190, 27, 0, 93, 105, 17, 169, 61, 98, 145, 131, 112, 121, 55, 97, 184},
   687  			},
   688  			{
   689  				Value:      NewCurrency64(1),
   690  				UnlockHash: UnlockHash{223, 162, 172, 55, 54, 193, 37, 142, 200, 213, 230, 48, 186, 145, 184, 206, 15, 225, 167, 19, 37, 70, 38, 48, 135, 87, 205, 81, 187, 237, 181, 180},
   691  			},
   692  			{
   693  				Value:      NewCurrency64(1),
   694  				UnlockHash: UnlockHash{241, 46, 139, 41, 40, 63, 47, 169, 131, 173, 124, 246, 228, 213, 102, 44, 100, 217, 62, 237, 133, 154, 248, 69, 228, 2, 36, 206, 47, 250, 249, 170},
   695  			},
   696  			{
   697  				Value:      NewCurrency64(50),
   698  				UnlockHash: UnlockHash{241, 50, 229, 211, 66, 32, 115, 241, 117, 87, 180, 239, 76, 246, 14, 129, 105, 181, 153, 105, 105, 203, 229, 237, 23, 130, 193, 170, 100, 201, 38, 71},
   699  			},
   700  			{
   701  				Value:      NewCurrency64(8841),
   702  				UnlockHash: UnlockHash{125, 12, 68, 247, 102, 78, 45, 52, 229, 62, 253, 224, 102, 26, 111, 98, 142, 201, 38, 71, 133, 174, 142, 60, 215, 201, 115, 232, 209, 144, 195, 201},
   703  			},
   704  		}
   705  	}
   706  
   707  	// Create the genesis block.
   708  	GenesisBlock = Block{
   709  		Timestamp: GenesisTimestamp,
   710  		Transactions: []Transaction{
   711  			{SiacoinOutputs: GenesisAirdropAllocation},
   712  			{SiafundOutputs: GenesisSiafundAllocation},
   713  		},
   714  	}
   715  	// Calculate the genesis ID.
   716  	GenesisID = GenesisBlock.ID()
   717  }