How can I transfer half mining award to an address?

By | July 12, 2018

Creating a dapp, which requires half allocated mining fee should go to an address.

I managed to cut down the mining as well as the block reward:


    // Accumulate the rewards for the miner and any included uncles
    reward := new(big.Int).Set(blockReward)
    rew := new(big.Int).Set(blockReward)
    r := new(big.Int)
    for _, uncle := range uncles {
        r.Add(uncle.Number, big8)
        r.Sub(r, header.Number)
        r.Mul(r, blockReward)
        r.Div(r, big8)
        state.AddBalance(uncle.Coinbase, r)

        r.Div(blockReward, big32)
        reward.Add(reward, r)

    changedRew := new(big.Int).Set(rew) // half reward
    changedRew.Div(changedRew, big.NewInt(2))
    log.Warn("Mining block reward status .. ", "CHANGED", changedRew )
    state.AddBalance(header.Coinbase, changedRew)


        if vmerr == vm.ErrInsufficientBalance {
            return nil, 0, false, vmerr
    log.Warn("Half fee taken away ")
    // change price 
    st.state.AddBalance(st.evm.Coinbase, changedRew.Div(new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice), big.NewInt(2)))

    return ret, st.gasUsed(), vmerr != nil, err

How can I now transfer the other half to an address? If I specify an account/address to be transferred , that can be easily changed without effecting the block rules. How can I do it securely ?

P.S : Just one account constant account for every node to transfer half mining fee.