Smart Contract Deploy
TxTypeSmartContractDeploy deploys a smart contract to the given address. The following changes will be made by this transaction type.
Import the web3 and @kaiachain/web3js-ext packages to add kaia features on web3
Define sender address and sender private key
Smart contract bytecode to deploy, you can retreive it from compiled solidity code
Set up the provider with the specified kaia Baobab testnet URL. A provider in web3js is a read-only abstraction to access the blockchain data.
Also, you can change the provider URL from baobab to allthatnode
Create a KlaytnWeb3 instance using the provider
Convert the sender's private key to an account using web3.eth.accounts.privateKeyToAccount
Define a transaction object for the Cancel transaction
Set type: TxType.SmartContractDeploy
for the transaction type of deploying contract
Set data: bytecode
or input: bytecode
for the source of the contract
Set params from, humanReadable, codeFormat as value in example
Sign the transaction with the sender's account
Send the signed transaction to the kaia network. It will return the transaction receipt