> For the complete documentation index, see [llms.txt](https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/getting-started/sdk-for-go/usage.md).

# Usage

To use the SDK in your Golang project, you must first import it:

```go
import s6 "github.com/thesixnetwork/six-protocol-go-sdk/api"
```

## Creating Client

```go
gasPrice := "1.25usix" // default "1.25usix"
clientOptions := &s6.ClientOptions{
	BroadcastMode: "<broadcast-mode>", // default "block"
	GasPrices:     &gasPrice,
}
client, err := s6.NewClient(
	"<nodeURL>",
	"<armor>",
	"<passphrase>",
	"<chain-id>",
	clientOptions,
)
if err != nil {
	fmt.Println(err)
	return
}
```

### Broadcast Mode

`sync`: Wait for the transaction to pass/fail the CheckTx\
`async`: Do not wait for the transaction to pass/fail the CheckTx. Instead, send and return the transaction immediately.\
`block`: Wait for the transaction to pass/fail the CheckTx, DeliverTx, and be committed to a block. (Note: this is not recommended.)

<mark style="color:blue;">nodeURL</mark>: Endpoint URL for SIX Protocol\
&#x20;fivenet: [https://rpc1.fivenet.sixprotocol.net](https://api1.fivenet.sixprotocol.net)\
&#x20;sixnet: [https://sixnet-rpc.sixprotocol.net](https://sixnet-api.sixprotocol.net)\ <mark style="color:blue;">armor</mark>: An encrypted private key use with passphrase as a secret key.\ <mark style="color:blue;">passphrase</mark>: Together with encrypted private key is used as a secret key. [Here](/nft-gen-2-tech-doc/getting-started/sdk-for-go/preparing-key-for-authentication.md) is the detail about how to create both armor and passphrase.\ <mark style="color:blue;">chain-id</mark>: For testnet , the chain id is "fivenet" and "sixnet" for Testnet and Mainnet

## Construct Message

Create a message for each service that you need to use. You can find more messages [here](/nft-gen-2-tech-doc/getting-started/sdk-for-go/supported-messages-and-queries.md)

```go
import nftmngrtypes "github.com/thesixnetwork/sixnft/x/nftmngr/types"
```

```go
msg := &nftmngrtypes.MsgPerformActionByAdmin{
	Creator:       client.ConnectedAddress,
	NftSchemaCode: "nft-schema-code",
	TokenId:       "<token-id>",
	Action:        "<action-name>",
	RefId:         "<ref-idL>",
	Parameters:    []*nftmngrtypes.ActionParameter{},
}
```

## Broadcast Transaction

```go
txResponse, err := client.GenerateOrBroadcastTx(msg)
```

## Query

To query the data , you can use read-to-use query client from the constructed client. And for more detail about queries you can use , [here](/nft-gen-2-tech-doc/getting-started/sdk-for-go/supported-messages-and-queries.md) is the list.

```go
queryClient := client.QueryClient()
```

## go.mod

You would need to put the line below at the bottom of your go.mod

```go
replace github.com/gogo/protobuf v1.3.3 => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
```
