func getEventHub( client fab.FabricClient) (fab.EventHub, error) {
	eventHub, err := events.NewEventHub(client)
	if err != nil {
		return nil, errors.WithMessage(err, "NewEventHub failed")
	}
	foundEventHub := false
	peerConfig, err := client.Config().PeersConfig("org1")
	if err != nil {
		return nil, errors.WithMessage(err, "PeersConfig failed")
	}
	for _, p := range peerConfig {
		if p.URL != "" {
			serverHostOverride := ""
			if str, ok := p.GRPCOptions["ssl-target-name-override"].(string); ok {
				serverHostOverride = str
			}
			eventHub.SetPeerAddr(p.EventURL, p.TLSCACerts.Path, serverHostOverride)
			foundEventHub = true
			break
		}
	}
	if !foundEventHub {
		return nil, errors.New("event hub configuration not found")
	}
	return eventHub, nil
}
getEventHub initilizes the event hub
package main
import (
	fabricapi "github.com/hyperledger/fabric-sdk-go/def/fabapi"
	"github.com/hyperledger/fabric-sdk-go/pkg/errors"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/orderer"
	"fmt"
	identityImpl "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/identity"
	"io/ioutil"
	"encoding/hex"
	afc "github.com/hyperledger/fabric-sdk-go/api/apifabclient"
	"github.com/hyperledger/fabric-sdk-go/api/apitxn"
	fab "github.com/hyperledger/fabric-sdk-go/api/apifabclient"
	peerapi "github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/peer"
	"github.com/hyperledger/fabric-sdk-go/pkg/fabric-client/events"
)
func main() {
	test()
}
func test(){
	sdkOptions := fabricapi.Options{
		ConfigFile: "./fabricsdk/config_test.yaml",
	}
	sdk, _ := fabricapi.NewSDK(sdkOptions)
	session, _ := sdk.NewPreEnrolledUserSession("org1", "Admin")
	client, _ := sdk.NewSystemClient(session)
	channel, _ := client.NewChannel("roberttestchannel12")
	orderer, _ := orderer.NewOrderer("grpc://192.168.23.212:7050", "", "", client.Config())
	channel.AddOrderer(orderer)
	peer ,_ := fabricapi.NewPeer("grpc://192.168.23.212:7051","","",client.Config())
	channel.AddPeer(peer)
	blockchainInfo, _ := channel.QueryInfo()
	fmt.Println(" the peer block height  %d",blockchainInfo.Height)
}
func fabric_local(){
		sdkOptions := fabricapi.Options{
			ConfigFile: "./fabricsdk/config_test.yaml",
		}
		sdk, err := fabricapi.NewSDK(sdkOptions)
		if err != nil {
			check(err, "SDK init failed")
		}
		session, err := sdk.NewPreEnrolledUserSession("org1", "Admin")
		if err != nil {
			check(err, "failed getting admin user session for org")
		}
		sc, err := sdk.NewSystemClient(session)
		if err != nil {
			check( err ,"NewSystemClient failed")
		}
		client := sc
		channel, err := client.NewChannel("roberttestchannel12")
		if err != nil {
			 check( err , "NewChannel failed")
		}
		orderer, err := orderer.NewOrderer("grpc://192.168.23.212:7050", "", "", client.Config())
		if err != nil {
			check(err, "NewOrderer failed")
		}
		channel.AddOrderer(orderer)
		peer ,err := fabricapi.NewPeer("grpc://192.168.23.212:7051","","",client.Config())
		if err != nil {
			check(err, "NewOrderer failed")
		}
		channel.AddPeer(peer)
		peer188 ,err := fabricapi.NewPeer("grpc://172.16.10.188:7051","","",client.Config())
		if err != nil {
			check(err, "NewPeer  failed")
		}
		channel.AddPeer(peer188)
		targets := peerapi.PeersToTxnProcessors(channel.Peers())
		transientData := make(map[string][]byte)
		request := apitxn.ChaincodeInvokeRequest{
			Targets:      targets,
			Fcn:          "invoke",
			Args:         [][]byte{[]byte("a"),[]byte("b"),[]byte("1")},
			TransientMap: transientData,
			ChaincodeID:  "cc_endfinlshed",
		}
		transactionProposalResponses, txnID, err := channel.SendTransactionProposal(request)
		fmt.Println("   tx id  : %s",txnID)
		if err != nil {
			check(err," send transtion error ")
		}
		for _, v := range transactionProposalResponses {
			if v.Err != nil {
				check(v.Err, "endorser %s failed")
			}
		}
		tx, err := channel.CreateTransaction(transactionProposalResponses)
		transactionResponse, err := channel.SendTransaction(tx)
		fmt.Println(" srarch result   %s " , transactionResponse )
}