aboutsummaryrefslogtreecommitdiffstats
path: root/utils/cmd.go
blob: 654014169a7178f5243080f29e188a7e04b45b4e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package utils

import (
    "github.com/ethereum/eth-go"
    "github.com/ethereum/eth-go/ethminer"
    _ "github.com/ethereum/eth-go/ethrpc"
    "github.com/ethereum/eth-go/ethutil"
    "log"
)

func DoMining(ethereum *eth.Ethereum) {
    // Set Mining status
    ethereum.Mining = true

    log.Println("Miner started")

    // Fake block mining. It broadcasts a new block every 5 seconds
    go func() {
        keyPair := ethutil.GetKeyRing().Get(0)
        addr := keyPair.Address()

        miner := ethminer.NewDefaultMiner(addr, ethereum)
        miner.Start()

    }()
}