import json


def get_genesis_content(accounts):
    """
    Create genesis json for geth.

    Accounts will be funded with 1 million ether.
    Accounts[0] is the coinbase/etherbase
    """
    # 1 Million ether
    initial_balance = '0xD3C21BCECCEDA1000000'
    data = {
      "config": {
        "chainId": 1213,
        "clique": {
          "period": 3,
          "epoch": 30000
        }
      },
      "nonce": "0x0",
      "timestamp": "0x5b007880",
      "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000{0}0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000".format(accounts[0]['address'][2:]),
      "gasLimit": "0x5fdfb1",
      "difficulty": "0x1",
      "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "coinbase": "0x0000000000000000000000000000000000000000",
      "alloc": {
        accounts[0]['address']: {
          "balance": initial_balance
        }
      }
    }

    # add remaining accounts to alloc
    for account in accounts[1:]:
        data['alloc'][account['address']] = {'balance': initial_balance}

    return json.dumps(data)