func HashTransaction(tx *xdr.Transaction, passphrase string) ([32]byte, error) {
	var txBytes bytes.Buffer
	if strings.TrimSpace(passphrase) == "" {
		return [32]byte{}, errors.New("empty network passphrase")
	}
	_, err := fmt.Fprintf(&txBytes, "%s", ID(passphrase))
	if err != nil {
		return [32]byte{}, errors.Wrap(err, "fprint network id failed")
	}
	_, err = xdr.Marshal(&txBytes, xdr.EnvelopeTypeEnvelopeTypeTx)
	if err != nil {
		return [32]byte{}, errors.Wrap(err, "marshal type failed")
	}
	_, err = xdr.Marshal(&txBytes, tx)
	if err != nil {
		return [32]byte{}, errors.Wrap(err, "marshal tx failed")
	}
	return hash.Hash(txBytes.Bytes()), nil
}
HashTransaction derives the network specific hash for the provided
transaction using the network identified by the supplied passphrase.  The
resulting hash is the value that can be signed by stellar secret key to
authorize the transaction identified by the hash to stellar validators.
package network
import (
	"bytes"
	"fmt"
	"strings"
	"github.com/stellar/go/hash"
	"github.com/stellar/go/support/errors"
	"github.com/stellar/go/xdr"
)
const (
	PublicNetworkPassphrase = "Public Global Stellar Network ; September 2015"
	TestNetworkPassphrase = "Test SDF Network ; September 2015"
)
func ID(passphrase string) [32]byte {
	return hash.Hash([]byte(passphrase))
}