Truffle

Compatibility with Truffle

In Klaytn, a smart contract written in Solidity can be compiled and deployed via Truffle. At the moment, Klaytn supports up to Truffle v5.0.26, the latest version at the time of writing. Please find details about Truffle on the websites below.

You can install Truffle as the following:

$ sudo npm install -g truffle

If you have a local EN running, you can deploy contracts directly with truffle framework. For more details, refer to this link.

If you want to deploy with a remote EN node, you should use truffle-hdwallet-provider-klaytn.

Configuring truffle-hdwallet-provider-klaytn

truffle-hdwallet-provider-klaytn is a JavaScript HD wallet provider forked from truffle-hdwallet-provider.

Install as the following:

$ nvm use 10
$ yarn install [email protected]
$ nvm use 12 # for node v12 and higher
$ yarn install [email protected]

Set truffle-config.js as below.

Using a mnemonic

Using a private key

WARNING: Be very careful not to expose your mneomonic or private key.

Deploying on Klaytn :

Making transaction on Klaytn : (using an example from Truffle Docs quick start - Creating a project)

Last updated