Install Development Tools
Installing caver-js
We recommend to create a klaytn project directory such that:
$ mkdir $HOME/klaytnYou need
npmandnode.jsinstalled to proceed. Please refer to get-npm and node.js for installation on your system.
caver-js is a JSON RPC framework for the Klaytn network (equivalent to web3.js in Ethereum). Before installing caver-js, you must generate package.json file via npm init command, and then type npm install caver-js to install caver-js.
$ npm init # initialize npm at the klaytn project directory
$ npm install caver-jsNOTE: If you already installed caver-js, please update it to the latest version.
$ npm cache clean --force # initialize npm cache
$ npm install caver-js@latest # update caver-js to the latest versionIf you receive the following errors while updating the caver-js, remove .git folder in the websocket directory.
npm ERR! path /Users/username/klaytn/node_modules/websocket
npm ERR! code EISGIT
npm ERR! git /Users/username/klaytn/node_modules/websocket: Appears to be a git repo or submodule.
npm ERR! git /Users/username/klaytn/node_modules/websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2019-06-25T01_49_37_032Z-debug.log
$ rm /Users/username/klaytn/node_modules/websocket/.gitNote: For all the function calls that begin with web3.eth... in web3.js, should be replaced with caver.klay....
web3.eth.sendTransaction({ ... }) (X)
caver.klay.sendTransaction({ ... }) (O)
Installing Truffle
In this tutorial, Truffle is used to compile and deploy smart contracts written in Solidity. Currently, Klaytn supports Truffle version 4.1.15. For further information about Truffle, refer to the following sites:
Truffle repository - https://github.com/trufflesuite/truffle
Truffle documents - https://trufflesuite.com/docs
We can install Truffle either
1) globally using npm by executing the following commands:
or
2) locally, i.e., in your local directory, by executing the followings:
Installing vvisp
vvisp is an easy-to-use cli tool/framework for developing smart contracts, provided by HEACHI LABS. You can easily set environment, deploy and execute Klaytn smart contracts with a single-command. It supports the Truffle framework, so developers familiar with Truffle can use vvisp without difficulty.
Here, we introduce how to install vvisp and use it to set up the Klaytn dApp development environment.
vvisp repository - https://github.com/HAECHI-LABS/vvisp
vvisp document - https://github.com/HAECHI-LABS/vvisp/blob/dev/README_KLAYTN.md
vvisp can be easily installed if you have npm or yarn by executing the following command:
Upon installation, you can utilize the vvisp command to ensure it has been installed properly. NOTE: You should use version over v2.1.0.
Last updated