Home KEVM IELE Roadmap Support

Filtered by

cardano logo

Mallet 2.0 tutorial

Once you have installed Mallet 2.0, follow the tutorial to:

  • connect to the testnet;
  • create accounts;
  • request tokens from the faucet;
  • compile a smart contract (only available for IELE testnet);
  • deploy it in the testnet;
  • execute a smart contract.

To run Mallet and connect to a testnet:

//connect to the IELE or KEVM testnet

./mallet iele 	

This will open a session in the read-eval-print-loop (Repl) environment for Node.js. Mallet commands are imported automatically.

Everything typed in the Repl has to be valid JavaScript. Technically speaking, the commands are simply functions and properties of a Mallet object. However, we tend to refer to them as commands because that reflects how they are used.

Basic Commands

Create an account
mallet> myAccount = newAccount('password') 

The newAccount command takes one argument, which is your password.

This will return your new account:


Note that we are assigning the return value of newAccount to a variable named myAccount so that we can refer to it later.

List existing accounts

mallet> listAccounts() 

Will return a list of all existing accounts.

Select an account

mallet> selectAccount(myAccount)

Get the balance of your account.

mallet> getBalance()

If you don’t give any argument, this will return the balance of the selected account.

Request tokens from the faucet

mallet> requestFunds()

It may take a few minutes for the funds to be transferred.

Now that you have created and funded your account, you can compile and deploy smart contracts.

Compiling contracts

The ability to compile contracts is currently only supported for IELE. Both IELE assembly code and Solidity (using the Solidity to IELE compiler) contracts can be compiled. Both compilers are services of the testnet that Mallet connects to (no additional dependencies).

Compile a smart contract

mallet> iele.compile('../filename')

Mallet can work with .sol or .iele files. Keep in mind that Solidity files will take a two-step compilation:

  • Solidity to IELE -> IELE assembly, and
  • .iele will take a single step through IELE assembly.

Get bytecode

To get the bytecode needed to deploy your smart contract, you can assign its value to a variable so that you can refer to it.

mallet> myBytecode = iele.compile('../filename.extension').bytecode

Next navigation arrow