Use Truffle with Loom!

It might not seem much, but you just deployed the CryptoZombies smart contract!

Even if Truffle helped a lot, this is no small feat, so pat yourself on the back.

Loom Basechain

Now, if you want to build DApps on Ethereum, there's one thing you should be aware of - on the main net, users are required to pay gas fees for every transaction. But this isn't ideal for a user-facing DApp or a game. It can easily ruin the user experience.

Conversely, on Loom, your users can have much speedier and gas-free transactions, making it a much better fit for games and other non-financial applications.

This means that your Loom zombies will be fast zombies!

That's not all - deploying to Loom is no different from deploying to Rinkeby, or to the Ethereum main net. If you know how to do one, you also know how to do the other.

In the next chapters, we'll be walking you through deploying to Loom.

loom-truffle-provider

We at Loom are using Truffle to build, test, and deploy our smart contracts. To make our life easier, we developed something called a provider that lets Truffle deploy to Loom just like it deploys to Rinkeby or Ethereum main net.

Without delving too much into details, the provider works like a bridge that makes Web3 calls compatible with Loom. The beauty of it is that, to use it, you don't have to understand how it works under the hood.

npm install loom-truffle-provider

Deploy to Loom Testnet

In this chapter, we’re going to deploy our smart contract to the Loom Testnet, but before doing the deployment, some prep work is needed.

First, we should create our own Loom private key. The easiest way to do it is by downloading and installing Loom according to this tutorial.

Next, creating a private key is as as simple as this:

$./loom genkey -a public_key -k private_key
local address: 0x42F401139048AB106c9e25DCae0Cf4b1Df985c39
local address base64: QvQBE5BIqxBsniXcrgz0sd+YXDk=
$cat private_key
/i0Qi8e/E+kVEIJLRPV5HJgn0sQBVi88EQw/Mq4ePFD1JGV1Nm14dA446BsPe3ajte3t/tpj7HaHDL84+Ce4Dg==

Note: Never reveal your private keys! We are only doing this for simplicity's sake.

Updating truffle.js