Create Transactions

Prerequisites

  • The private key to the account with both testnet KAS on Layer 1 and bridged KAS on Layer 2.

Step1

Sign an L2 transaction using your private key. Kasplex L2 supports both Legacy Transactions and EIP-1559 transactions.

	tx := types.NewTx(&types.LegacyTx{
		Nonce:    nonce,
		To:       to,
		Value:    amount,
		Gas:      gasLimit,
		GasPrice: gasPrice,
		Data:     txdata,
	})
	signedTx, err := types.SignTx(tx, types.NewEIP155Signer(chainID), privateKey)
	vmData := signedTx.MarshalJSON()

Step2

To ensure the Kasplex L2 engine correctly parses L1 transactions, a fixed identifier 'kasplex' and a transaction type description must be added to the transaction.

Kasplex currently supports four type descriptions:

Type
Description

0x00

Json

0x01

Binary

0x80

zlib compressed Json

0x81

zlib compressed Binary

circle-info

Read Deploy Contract chapter to understand why zlib compression is needed for data.

Step3

Check Transaction Receipt

Last updated