Signature

Type EthSigner

Ethereum private key, opaque type.

Func NewEthSigner

func NewEthSigner(privateKey string) (*EthSigner, error)

Create a Ethereum private key signer from hex string.

input:

  • privateKey: hex string of private key

return: (*EthSigner, error)

Func (*EthSigner) SignMessage

func (*EthSigner) SignMessage(message []uint8) (PackedEthSignature, error)

Sign the message bytes

input:

  • message: []uint8

output: (String format of PackedEthSignature, error)

Func (*EthSigner) GetAddress

func (*EthSigner) GetAddress() Address

Get the address of Ethereum

output: Hex string format(with '0x' prefix) of Ethereum address.

example

Type StarkSigner

The signer of Starknet, opaque type.

NewStarkSigner

Create a random Starknet signer

output: *StarkSigner

func StarkSignerNewFromHexStr

Create a Starknet signer from hex string

input:

  • hexStr: hex string of private key(with or without 0x prefix)

func(*StarkSigner) SignMessage

Sign message bytes

input:

  • message: []uint8

example

Type ZkLinkSigner

ZkLinkSigner includes the L1 private key(Eth or Starknet) and L3 private key, opaque type.

func NewZkLinkSigner

Create a random seeded ZkLinkSigner

func ZkLinkSignerNewFromHexEthSigner

Creat a ZkLinkSigner from eth hex private key.

input:

  • hexPrivateKey: Eth hex private key string

func ZkLinkSignerNewFromHexStarkSigner

Create a ZkLinkSigner from Starknet hex private key.

input:

  • hexPrivateKey: Starknet hex private key string

func ZkLinkSignerNewFromBytes

Change the bytes to ZkLinkSigner

input:

  • slice: []uint8

func (*ZkLinkSigner) PublicKey

Get the public key of L3 private key

func (*ZkLinkSigner) SignMusig

Sign a bytes formatted message with L3 private key in ZkLinkSigner.

input::

  • msg: message bytes

Example

func SignChangePubkeyWithEthEcdsaAuth

input: tx: ChangePubKey

Sign the ChangePubkey and get the TxSignature result, for example:

func (*Signer) SignChangePubkeyWithOnchainAuthData

Sign ChangePubkey with OnChain auth data

func (*Signer) SignChangePubkeyWithCreate2dataAuth

Sign ChangePubkey with Create2Data auth data

Function

func GetPublicKeyHash

Get the public key hash of L3 PublicKey

arguments:

  • publicKey: string of L3 PublicKey

return: String of PubKeyHash

func EthSignatureOfChangePubkey

Create the Ethereum signature of ChangePubKey

func ZklinkMainNetUrl

Get the ZkLink main net url.

func ZklinkTestNetUrl

Last updated

Was this helpful?