# ChangePubKey

### Type Create2Data

```go
type Create2Data struct {
	CreatorAddress ZkLinkAddress
	SaltArg        H256
	CodeHash       H256
}
```

### Type ChangePubKeyAuthDataEthCreate2

```go
type ChangePubKeyAuthDataEthCreate2 struct {
	Data Create2Data
}
```

### Type ChangePubKeyAuthDataEthEcdsa

```go
type ChangePubKeyAuthDataEthEcdsa struct {
	EthSignature PackedEthSignature
}
```

### Type ChangePubKeyAuthDataOnchain

```go
type ChangePubKeyAuthDataOnchain struct {}
```

### func CreateSignedChangePubkey

```go
func CreateSignedChangePubkey(zklinkSigner *ZkLinkSigner, tx *ChangePubKey, ethAuthData ChangePubKeyAuthData) (*ChangePubKey, error)
```

Create a signed [ChangePubkey](/developer/api-and-sdk/transaction/change_pubkey.md)

**input:**

* zklinkSigner: zklink [signer](#type-zklinksigner)
* tx: unsigned transaction [ChangePubkey](/developer/api-and-sdk/transaction/change_pubkey.md)
* ethAuthData: `ChangePubKeyAuthData` is a interface which can be [ChangePubKeyAuthDataOnchain](#changepubkeyauthdataonchain), [ChangePubKeyAuthDataEthCreate2](#changepubkeyauthdataethcreate2) or [ChangePubKeyAuthDataEthEcdsa](#changepubkeyauthdataethecdsa)

### type ChangePubKeyBuilder

The ChangePubKeyBuilder is used to build the type [ChangePubKey](#changepubkey)

```go
type ChangePubKeyBuilder struct {
	ChainId       ChainId
	AccountId     AccountId
	SubAccountId  SubAccountId
	NewPubkeyHash PubKeyHash
	FeeToken      TokenId
	Fee           BigUint
	Nonce         Nonce
	EthSignature  *PackedEthSignature
	Timestamp     TimeStamp
}
```

### type ChangePubKey

[ChangePubkey](/developer/api-and-sdk/transaction/change_pubkey.md) transaction type, it's a opaque data type.

#### func NewChangePubKey

Create a [ChangePubkey](#type-changepubkey)

```go
func NewChangePubKey(builder ChangePubKeyBuilder) *ChangePubKey
```

**input:**

* builder: [ChangePubKeyBuilder](#type-changepubkeybuilder)

#### func (\*ChangePubKey) GetSignature

```go
func (*ChangePubKey) GetSignature() ZkLinkSignature
```

Get the L3 signature of the [ChangePubKey](#type-changepubkey)

#### func (\*ChangePubKey) GetBytes

```go
func (*ChangePubKey) GetBytes() []uint8
```

Get the encoded bytes of [ChangePubKey](#type-changepubkey), which is used to create the L3 signature.

#### func (\*ChangePubKey) TxHash

```go
func (*ChangePubKey) TxHash() []uint8
```

Get the Transaction Hash of [ChangePubKey](#type-changepubkey)

#### func (\*ChangePubKey) JsonStr

```go
func (*ChangePubKey) JsonStr() string
```

Get the json str of [ChangePubKey](#type-changepubkey)

#### func (\*ChangePubKey) IsValid

```go
func (*ChangePubKey) IsValid() bool
```

Check if all the fields in ChangePubKey are valid. For example, if the `ChainId` is exceeded the maximum ChainId, it will return false.

#### func (\*ChangePubKey) IsOnchain

```go
func (*ChangePubKey) IsOnchain() bool
```

Check if the transaction's auth data is OnChain.

#### func (\*ChangePubKey) IsSignatureValid

```go
func (*ChangePubKey) IsSignatureValid() bool
```

Check if the L3 signature is valid or not.

#### func (\*ChangePubKey) SubmitterSignature

```go
func (*ChangePubKey) SubmitterSignature(signer *ZkLinkSigner) (ZkLinkSignature, error)
```

Create the submitter signature.

**input:**

* signer: [ZkLinkSigner](/developer/sdk/changelog/signer.md#type-zklinksigner)

#### func (\*ChangePubKey) ToZklinkTx

```go
func (*ChangePubKey) ToZklinkTx() ZkLinkTx
```

Change the ChangePubKey transaction type to [ZkLinkTx](/developer/sdk/changelog/basic_types.md#zklinktx) type.

####


---

# Agent Instructions: 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:

```
GET https://docs.zk.link/developer/sdk/changelog/transactions/1-change-pubkey.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
