func Handler(w http.ResponseWriter, r *http.Request) {
	bridge.NewServer(&Bitcoin{}).Handler(w, r)
}
Handler is used for GCP compatibility
package main
import (
	"errors"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"strconv"
	"strings"
	"github.com/btcsuite/btcd/btcjson"
	"github.com/btcsuite/btcd/chaincfg/chainhash"
	"github.com/btcsuite/btcd/rpcclient"
	"github.com/linkpoolio/bridges/bridge"
)
type Bitcoin struct{}
func getBlockCount(client *rpcclient.Client) (int64, error) {
	return client.GetBlockCount()
}
func getDifficulty(client *rpcclient.Client) (float64, error) {
	return client.GetDifficulty()
}
func getRawTransaction(client *rpcclient.Client, txID *chainhash.Hash, verbose bool) (*btcjson.TxRawResult, error) {
	result, err := client.GetRawTransactionVerbose(txID)
	if err != nil {
		return &btcjson.TxRawResult{}, err
	}
	return result, nil
}
func getBlock(client *rpcclient.Client, blockNum int64, verbose bool, verboseTx bool) (*btcjson.GetBlockVerboseResult, error) {
	blockHash, err := client.GetBlockHash(blockNum)
	if err != nil {
		return &btcjson.GetBlockVerboseResult{}, err
	}
	result, err := client.GetBlockVerboseTx(blockHash)
	if err != nil {
		return &btcjson.GetBlockVerboseResult{}, err
	}
	return result, nil
}
func (btc *Bitcoin) Run(h *bridge.Helper) (interface{}, error) {
	obj := make(map[string]interface{})
	certs, err := ioutil.ReadFile(os.Getenv("BTCD_RPC_CERT"))
	if err != nil {
		log.Fatal(err)
	}
	connCfg := &rpcclient.ConnConfig{
		Host:         os.Getenv("BTCD_RPC_HOST"),
		Endpoint:     "ws",
		User:         os.Getenv("BTCD_RPC_USER"),
		Pass:         os.Getenv("BTCD_RPC_PASS"),
		Certificates: certs,
	}
	client, err := rpcclient.New(connCfg, nil)
	if err != nil {
		log.Println(err)
		return nil, errors.New("Unable to connect to btcd instance")
	}
	defer client.Shutdown()
	switch command := strings.ToLower(h.GetParam("rpc_command")); command {
	case "getblockcount":
		{
			blockCount, err := getBlockCount(client)
			if err != nil {
				return nil, err
			}
			obj["block_count"] = blockCount
		}
	case "getdifficulty":
		{
			difficulty, err := getDifficulty(client)
			if err != nil {
				return nil, err
			}
			obj["difficulty"] = difficulty
		}
	case "getrawtransaction":
		{
			txHash, err := chainhash.NewHashFromStr(h.GetParam("tx_id"))
			if err != nil {
				return nil, errors.New("Invalid tx_id specified")
			}
			txResult, err := getRawTransaction(client, txHash, true)
			if err != nil {
				return nil, err
			}
			obj["tx"] = txResult
		}
	case "getblock":
		{
			blockResult, err := getBlock(client, h.GetIntParam("block_num"), true, true)
			if err != nil {
				return nil, err
			}
			obj["block"] = blockResult
		}
	default:
		return nil, errors.New("Invalid or unsupported rpc_command specified")
	}
	return obj, nil
}
func (btc *Bitcoin) Opts() *bridge.Opts {
	return &bridge.Opts{
		Name:   "Bitcoin",
		Lambda: true,
	}
}