Go API

Signer

Handles transaction signing for ZKsync

The ECDSASinger class is designed to handle the creation and management of signing keys, allowing secure and authenticated interactions with the ZKsync Era blockchain.

Init

Creates a new instance of ECDSASigner based on the provided mnemonic phrase.

func NewECDSASignerFromMnemonic(mnemonic string, chainId *big.Int) (*ECDSASigner, error)

Creates a new instance of ECDSASigner based on the provided mnemonic phrase and account ID.

func NewECDSASignerFromMnemonicAndAccountId(mnemonic string, accountId uint32, chainId *big.Int) (*ECDSASigner, error)

Creates a new instance of ECDSASigner based on the provided raw private key.

func NewECDSASignerFromRawPrivateKey(rawPk []byte, chainId *big.Int) (*ECDSASigner, error)

Creates an instance of ECDSASigner with a randomly generated private key.

func NewRandomECDSASigner(chainId *big.Int) (*ECDSASigner, error)

Address

Returns the address associated with the signer.

Address() common.Address

ChainID

Returns the chain ID of the associated account.

ChainID() *big.Int

PrivateKey

Returns the private key associated with the signer.

PrivateKey() *ecdsa.PrivateKey

Signs the given hash using the signer's private key and returns the signature. The hash should be the 32-byte hash of the data to be signed.

SignTransaction

Signs the L2 transaction.

(s *ECDSASigner) SignTransaction(ctx context.Context, tx *types.Transaction) ([]byte, error)

SignTypeData

Signs the typed data.

SignTypedData(_ context.Context, typedData *apitypes.TypedData) ([]byte, error)

Made with ❤️ by the ZKsync Community