func genesisHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	m.logger.Debug("GET genesis")
	genesis, err := m.state.GetGenesis()
	if err != nil {
		m.logger.WithError(err).Error("Getting Genesis")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	js, err := json.Marshal(genesis)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling JSON response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
------------------------------------------------------------------------------
/*
GET /genesis
returns: JSON Genesis

This endpoint returns the content of the genesis.json file.
package service
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"math/big"
	"net/http"
	"strconv"
	"time"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/common/hexutil"
	ethTypes "github.com/ethereum/go-ethereum/core/types"
	"github.com/mosaicnetworks/evm-lite/src/state"
	"github.com/mosaicnetworks/evm-lite/src/version"
	"github.com/sirupsen/logrus"
	comm "github.com/mosaicnetworks/evm-lite/src/common"
)
func accountHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	ShowStorage := false
	param := r.URL.Path[len("/account/"):]
	address := common.HexToAddress(param)
	if m.logger.Level > logrus.InfoLevel {
		m.logger.WithField("param", param).Debug("GET account")
		m.logger.WithField("address", address.Hex()).Debug("GET account")
	}
	var fromPool bool
	qs := r.URL.Query().Get("frompool")
	if qs != "" {
		fp, err := strconv.ParseBool(qs)
		if err != nil {
			m.logger.WithError(err).Error("Error converting string to bool")
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
		fromPool = fp
	}
	nonce := m.state.GetNonce(address, fromPool)
	balance := m.state.GetBalance(address, fromPool)
	code := hexutil.Encode(m.state.GetCode(address, fromPool))
	if code == "0x" {
		code = ""
	}
	account := JSONAccount{
		Address: address.Hex(),
		Balance: balance,
		Nonce:   nonce,
		Code:    code,
	}
	if ShowStorage {
		account.Storage = m.state.GetStorage(address, fromPool)
	}
	js, err := json.Marshal(account)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling JSON response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
func callHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	if m.logger.Level > logrus.InfoLevel {
		m.logger.WithField("request", r).Debug("POST call")
	}
	decoder := json.NewDecoder(r.Body)
	var txArgs SendTxArgs
	err := decoder.Decode(&txArgs)
	if err != nil {
		m.logger.WithError(err).Error("Decoding JSON txArgs")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	defer r.Body.Close()
	callMessage, err := prepareCallMessage(txArgs)
	if err != nil {
		m.logger.WithError(err).Error("Converting to CallMessage")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	data, err := m.state.Call(*callMessage)
	if err != nil {
		m.logger.WithError(err).Error("Executing Call")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	res := JSONCallRes{Data: hexutil.Encode(data)}
	js, err := json.Marshal(res)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling JSON response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
func rawTransactionHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	if m.logger.Level > logrus.InfoLevel {
		m.logger.WithField("request", r).Debug("POST rawtx")
	}
	defer r.Body.Close()
	body, err := ioutil.ReadAll(r.Body)
	if err != nil {
		m.logger.WithError(err).Error("Reading request body")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	sBody := string(body)
	if m.logger.Level > logrus.InfoLevel {
		m.logger.WithField("body", body)
		m.logger.WithField("body (string)", sBody).Debug()
	}
	rawTxBytes, err := hexutil.Decode(sBody)
	if err != nil {
		m.logger.WithError(err).Error("Reading raw tx from request body")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	if m.logger.Level > logrus.InfoLevel {
		m.logger.WithField("raw tx bytes", rawTxBytes).Debug()
	}
	tx, err := state.NewEVMLTransaction(rawTxBytes, m.state.GetSigner())
	if err != nil {
		m.logger.WithError(err).Error("Decoding Transaction")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	if m.logger.Level > logrus.InfoLevel {
		m.logger.WithFields(logrus.Fields{
			"hash":     tx.Hash().Hex(),
			"from":     tx.From(),
			"to":       tx.To(),
			"payload":  fmt.Sprintf("%x", tx.Data()),
			"gas":      tx.Gas(),
			"gasPrice": tx.GasPrice(),
			"nonce":    tx.Nonce(),
			"value":    tx.Value(),
		}).Debug("Service decoded tx")
	}
	if m.minGasPrice != nil && tx.GasPrice().Cmp(m.minGasPrice) < 0 {
		err := fmt.Errorf("Gasprice too low. Got %v, MIN: %v", tx.GasPrice(), m.minGasPrice)
		m.logger.Debug(err)
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	if err := m.state.CheckTx(tx); err != nil {
		m.logger.WithError(err).Error("Checking Transaction")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	promise := m.state.CreateReceiptPromise(tx.Hash())
	m.logger.Debug("submitting tx")
	m.submitCh <- rawTxBytes
	m.logger.Debug("submitted tx")
	timeout := time.After(15 * time.Second)
	var receipt *comm.JSONReceipt
	var respErr error
	select {
	case resp := <-promise.RespCh:
		if resp.Error != nil {
			respErr = resp.Error
			break
		}
		receipt = resp.Receipt
	case <-timeout:
		respErr = fmt.Errorf("Timeout waiting for transaction to go through consensus")
		break
	}
	if respErr != nil {
		m.logger.Errorf("RespErr:  %v", respErr)
		http.Error(w, respErr.Error(), http.StatusInternalServerError)
		return
	}
	js, err := json.Marshal(receipt)
	if err != nil {
		m.logger.WithError(err).Error("Marshalling JSON Response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
func transactionReceiptHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	param := r.URL.Path[len("/tx/"):]
	txHash := common.HexToHash(param)
	m.logger.WithField("tx_hash", txHash.Hex()).Debug("GET tx")
	tx, err := m.state.GetTransaction(txHash)
	if err != nil {
		m.logger.WithError(err).Error("Getting Transaction")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	receipt, err := m.state.GetReceipt(txHash)
	if err != nil {
		m.logger.WithError(err).Error("Getting Receipt")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	jsonReceipt := comm.ToJSONReceipt(receipt, tx, m.state.GetSigner())
	js, err := json.Marshal(jsonReceipt)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling JSON response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
func infoHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	m.logger.Debug("GET info")
	stats, err := m.getInfo()
	if err != nil {
		m.logger.WithError(err).Error("Getting Info")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	if m.minGasPrice != nil {
		stats["min_gas_price"] = m.minGasPrice.String()
	} else {
		stats["min_gas_price"] = "0"
	}
	js, err := json.Marshal(stats)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling JSON response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
func poaHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	m.logger.Debug("GET poa")
	var al JSONContract
	al = JSONContract{
		Address: common.HexToAddress(m.state.GetAuthorisingAccount()),
		ABI:     m.state.GetAuthorisingABI(),
	}
	js, err := json.Marshal(al)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling JSON response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}
func versionHandler(w http.ResponseWriter, r *http.Request, m *Service) {
	m.logger.Debug("GET version")
	js, err := json.Marshal(version.JSONVersion)
	if err != nil {
		m.logger.WithError(err).Error("Marshaling Version response")
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/json")
	w.Write(js)
}