If you are using geth here's a patch that I use to accelerate mining. You could probably modify it to decelerate mining if you wish. (I'm curious why you wish to go slower). In any event, I think the answer to "how does the interval for mining get set" is "not very clear from the code"... but this patch should give you a head start in understanding the timing of geth.
diff --git a/eth/fetcher/fetcher.go b/eth/fetcher/fetcher.go
index d88d919..f03fd30 100644
--- a/eth/fetcher/fetcher.go
+++ b/eth/fetcher/fetcher.go
@@ -34,7 +34,7 @@ import (
const (
arriveTimeout = 500 * time.Millisecond // Time allowance before an announced block is explicitlrd
gatherSlack = 100 * time.Millisecond // Interval used to collate almost-expired announces witfs
- fetchTimeout = 5 * time.Second // Maximum alloted time to return an explicitly requestebk
+ fetchTimeout = 1 * time.Second // Maximum alloted time to return an explicitly requestebk
maxUncleDist = 7 // Maximum allowed backward distance from the chain head
maxQueueDist = 32 // Maximum allowed distance from the chain head to queue
hashLimit = 256 // Maximum number of unique blocks a peer may have annoued
diff --git a/eth/peer.go b/eth/peer.go
index 15ba22f..0201057 100644
--- a/eth/peer.go
+++ b/eth/peer.go
@@ -41,7 +41,7 @@ var (
const (
maxKnownTxs = 32768 // Maximum transactions hashes to keep in the known list (prevent DOS)
maxKnownBlocks = 1024 // Maximum block hashes to keep in the known list (prevent DOS)
- handshakeTimeout = 5 * time.Second
+ handshakeTimeout = 1 * time.Second
)
// PeerInfo represents a short summary of the Ethereum sub-protocol metadata known
diff --git a/miner/worker.go b/miner/worker.go
index 754a6fc..2b62b59 100644
--- a/miner/worker.go
+++ b/miner/worker.go
@@ -466,7 +466,7 @@ func (self *worker) commitNewWork() {
tstamp = parent.Time().Int64() + 1
}
// this will ensure we're not going off too far in the future
- if now := time.Now().Unix(); tstamp > now+4 {
+ if now := time.Now().Unix(); tstamp > now {
wait := time.Duration(tstamp-now) * time.Second
glog.V(logger.Info).Infoln("We are too far in the future. Waiting for", wait)
time.Sleep(wait)
diff --git a/p2p/rlpx.go b/p2p/rlpx.go
index aaa7338..ce82eb7 100644
--- a/p2p/rlpx.go
+++ b/p2p/rlpx.go
@@ -57,7 +57,7 @@ const (
// total timeout for encryption handshake and protocol
// handshake in both directions.
- handshakeTimeout = 5 * time.Second
+ handshakeTimeout = 2 * time.Second
// This is the timeout for sending the disconnect reason.
// This is shorter than the usual timeout because we don't want
diff --git a/params/protocol_params.go b/params/protocol_params.go
index dcc17e0..21a49c5 100755
--- a/params/protocol_params.go
+++ b/params/protocol_params.go
@@ -29,10 +29,10 @@ var (
CallNewAccountGas = big.NewInt(25000) // Paid for CALL when the destination address didn'e.
TxGas = big.NewInt(21000) // Per transaction. NOTE: Not payable on data of cas.
TxDataZeroGas = big.NewInt(4) // Per byte of data attached to a transaction that u.
- DifficultyBoundDivisor = big.NewInt(2048) // The bound divisor of the difficulty, used in thep.
+ DifficultyBoundDivisor = big.NewInt(1) // The bound divisor of the difficulty, used in thep.
QuadCoeffDiv = big.NewInt(512) // Divisor for the quadratic particle of the memoryo.
- GenesisDifficulty = big.NewInt(131072) // Difficulty of the Genesis block.
- DurationLimit = big.NewInt(13) // The decision boundary on the blocktime duration e.
+ GenesisDifficulty = big.NewInt(1) // Difficulty of the Genesis block.
+ DurationLimit = big.NewInt(1) // The decision boundary on the blocktime duration e.
SstoreSetGas = big.NewInt(20000) // Once per SLOAD operation.
LogDataGas = big.NewInt(8) // Per byte in a LOG* operation's data.
CallStipend = big.NewInt(2300) // Free gas given at beginning of call.
@@ -57,7 +57,7 @@ var (
CreateDataGas = big.NewInt(200) //
Ripemd160Gas = big.NewInt(600) //
Ripemd160WordGas = big.NewInt(120) //
- MinimumDifficulty = big.NewInt(131072) // The minimum that the difficulty may ever be.
+ MinimumDifficulty = big.NewInt(1) // The minimum that the difficulty may ever be.
CallCreateDepth = big.NewInt(1024) // Maximum depth of call/create stack.
ExpGas = big.NewInt(10) // Once per EXP instuction.
LogGas = big.NewInt(375) // Per LOG* operation.
Best Answer
Ethereum nodes (regardless of mining) need to have an accurate time, otherwise they will not be able to connect to peers and to the network (https://github.com/ethereum/go-ethereum/wiki/Connecting-to-the-network).
Small differences in time are tolerated by nodes, but as one node's time gets further away from Coordinated UTC Time (per NTP), its number of peers will reduce and eventually it will have zero peers and be disconnected from the network.
A miner M wants to have a time consistent with the network, so that other miners will build upon the blocks that M mines.
Blocks must be within reasonable Unix time, otherwise miners are unlikely to build upon blocks with unreasonable timestamps. (Example)
EDIT: For clarity, in Ethereum, the only rule about timestamps is that the timestamp must be greater than the previous timestamp. There is no other rule: old docs such as the white paper and wiki may mention 15 minutes (900 seconds), and here are the corrections:
White paper:
wiki:
Unfortunately, the outdated, wrong information has been picked up by others such as here and here.
The Yellow paper is the formal specification and see Block Header Validity (section 4.4.4, equation 48).