Your First Truffle Dapp — An attempt at a beginners guide to the Truffle Framework
In this series, we’ll walk through creating our first truffle Dapp for the Ethereum blockchain. This will be my attempt at a beginners guide to Truffle.
There’s a lot to love about the truffle framework:
· Truffle is a development environment, testing framework and asset pipline for Ethereum. Its main goal is to make life as an Ethereum developer easier. It is one of the most widely used IDE’s in the Ethereum community.
· Automated contract testing with Mocha and Chai
· A configurable build pipeline that supports both web apps and console apps.
· Console to easily work with your compiled contracts
· Support for JavaScript, Coffeescript, sass, ES6 and JSX built-in.
Don’t get me wrong, truffle has some great documentation and you can’t beat documentation straight from the source. But when I first started working with truffle, there was a gap, because a majority of the material was aimed at experienced Ethereum Dapp developers.
There was nothing written for absolute beginners.
As a means of trying to help fill this gap, and further my own understanding for the framework, I decided to write something. They say the best way to learn is to help teach someone. So the plan is simple: Write a series of articles I wish I had existed when I first started using truffle.
The core ambition of this series is to try and be a bridge. It won’t contain every last detail there is to know about the truffle framework, but it will contain everything that you need to know to make your first Truffle Dapp, while also helping you become a confident, independent problem solver. Hopefully by the time the series wraps up, you can say “I know how to make this thing work”. Do you feel the confidence?
You’ve probably heard all this before though. Every writer thinks their work is going to be the perfect reference material and will make the biggest difference. Let’s at least give it a chance, so allow me to suggest:
-
Make a nice cup or tea or coffee
-
Find a nice quite place
-
Work your ways through the series
The series are short, but I’ll do my best to keep them flowing regularly so that you’re not waiting long between each release.
Let’s begin. As a side note, if you prefer watching videos instead of reading, let me know and I’ll see if I have some time to put together a video series that covers the same topics…based on user demand.
Prerequisites
I’ve read a lot of technical tutorial series and I’ve notices that authors tend to use the words “for beginners” a little too easily. So, with that being said I want to clearly explain want you won’t need to take advantage of this series.
-
You won’t need prior experience with the truffle framework. I won’t dwell on what truffle is, but I will show you how to install it and how to start writing code as quickly and simply as possible.
-
You won’t need to have made a DAPP before. There are some theoretical aspects of Ethereum Dapp development that we won’t cover, but if your primarily an Ethereum developer using solidity, that will work fine. You shouldn’t have any trouble grasping the details of Dapp development with the truffle framework.
-
You won’t need to consult multiple other sources along the journey. You’re free to consult other articles and tutorials, of course, but this series will be designed to be an all-encompassing introduction to the basics and will try to only reference the official truffle document library alone.
You will, however, need a little background knowledge:
-
You will need a basic understanding of Solidity. This means being familiar with state variables, functions, modifiers, events, and mappings. You don’t need to be a solidity ninja, just be comfortable with the fundamentals.
-
You will need a basic understanding of the Ethereum blockchain. This means being familiar with transactions, promises and calls.
To acquire either of these skills, I’d suggest reading the official solidity documentation and the Ethereum getting started tutorials
· Solidity Development Documentation
What you’ll need for this journey
Well, you don’t need much to develop with truffle. This might seem like a minor detail, but you wouldn’t believe the amount of people that switch frameworks because getting up and going was a frustrating multi-day exercise, before they even get a change to write some code.
With truffle though, there’s only a few things you’ll need:
-
You’ll need a computer with a major operating system. This could be Mac OSX, Windows, Linux. All major operating systems are equally supported
-
You’ll need a text editor. This one is your choice, I’m a fan of sublime text 3 — a cross-platform editor with plenty of plugins and productivity features. But like I said, completely up to you, so stick with whatever you prefer.
-
You’ll need a relatively modern web browser. Google chrome is my browser of choice, and since we’ll be using it throughout the series, it might be worth installing a copy if you haven’t already.
And finally, you’ll also need Truffle, and we’ll install that in the next series.
Final words
I’ll try and end each series with a summary of what we’ve covered in that series, so for instance in this first series release, we’ve learnt:
· Truffle is a framework that makes it easier for beginners to start building DAPP’s for the Ethereum blockchain.
· You won’t need a lot of background knowledge to get starting with truffle, but the more you know about solidity and smart contracts, the better.
· There’s not that much setup to get you started with truffle, so there should be a very small gap between learning and actually writing code.
Along the series, I’ll also share a number of exercise, you don’t have to complete the exercises — but it might be helpful to circle back after you’ve worked your way through the core of the series, definitely worth trying at some point. Keep an eye out as we’ll get things started in the next series.
If you also want to follow my journey on creating an Ethereum based token for the Tap Project, you can follow us on Twitter: @ Tap_Coin or swing by and have a chat with us on Telegram: https://t.co/eIP47QmZ1E. We are currently in our Early Contribution stage of our project. Check out the Live Concentual alpha: platform.tapproject.net.