Before you use a Truffle box, you need to have Truffle and other useful tools installed in your computer. In this tutorial, I will show you step-by-step on how to install and configure the prerequisites to use any RSK Truffle box on RSK networks.
Here is a summary of the steps we will take in this tutorial:
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines the application programming interface (API), along with command line shells and utility interfaces, for software compatibility with variants of Unix and other operating systems. Source: Wikipedia
cmdterminal, or PowerShell, the commands here may not work. Consider installing Git for Windows, which comes with Git Bash bundled. Here is a tutorial on installing and using Git Bash.
This is a system command that is likely already installed on your system, which allows you to make network requests, such as HTTP requests, from your command line.
curl --version displays an error,
then download curl.
C:\>curl --version curl 7.55.1 (Windows) libcurl/7.55.1 WinSSL Release-Date: [unreleased] Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp Features: AsynchDNS IPv6 Largefile SSPI Kerberos SPNEGO NTLM SSL C:\>
Another dependency is NPM, which comes bundled with Node.js.
To check if you have node already installed, enter this command into your terminal:
node --version npm --version
C:\>node --version v10.16.3 C:\>npm --version v6.9.0 C:\>
If there’s no output like the one above, go to Node.js install.
Note that NPM is usually installed together with Node.js, so after installing Node.js, there’s no need to install it separately.
If you want to have more than one version installed,
the most fuss-free way to install and manage multiple versions of
node on your computer is nvm.
VS Code is a good choice if you don’t already have one.
In this tutorial, we will use VS Code to create our project.
Go to VS Code download if you would like to use it too.
Verify if your VS Code installation was successful by typing the following command into the terminal:
C:\>code -v 1.45.1 5763d909d5f12fe19f215cbfdd29a91c0fa9208a x64 C:\>
Truffle is a popular development framework with a mission to make smart contract development easier for developers. Amongst its features, it has a smart contract lifecycle management, scriptable deployment & migrations, automated contract testing and simple network management.
It also makes developing on RSK easier, with the ability to configure custom networks for RSK.
To install Truffle, input the command below into the terminal and press
enter at your project location:
npm install -g truffle
C:\>npm install -g truffle C:\Program Files\nodejs\truffle -> C:\Program Files\nodejs\node_modules\truffle\build\cli.bundled.js > firstname.lastname@example.org postinstall C:\Program Files\nodejs\node_modules\truffle > node ./scripts/postinstall.js - Fetching solc version list from solc-bin. Attempt #1 + email@example.com updated 1 package in 11.679s C:\>
When the installation is finished, close the terminal, open it again and check the Truffle version:
C:\>truffle version Truffle v5.1.28 (core: 5.1.28) Solidity v0.5.16 (solc-js) Node v10.16.3 Web3.js v1.2.1 C:\>
To use testnet, we need tR-BTC and an address to store them. The best way is to create a wallet from a mnemonic, using the pattern defined at BIP39
There are a few ways to do this.
Another way is using this web app:
Note: In this tutorial, the method used to store the mnemonic is not recommended to be used for any ‘real’ wallet because it’s not secure enough to generate a private key in a website, however we will use this here for learning purposes, and because we’re using the Testnet, so no real amounts are at stake.
Generate a random mnemonic field, select
12 words and click on the
The result appears in the
BIP39 Mnemonic field.
They should be 12 random words like the words in the image:
My mnemonic is:
energy knife ice mouse merge track cram brown decorate atom rule virus
Copy these 12 words, we’ll use it later.
RSK Networks have their own derivation path. Learn more about account based RSK addresses.
Go to top