> 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
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://sixnetwork.gitbook.io/nft-gen-2-tech-doc/getting-started/sdk-for-go/usage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
