Getting started

In this guide, we’ll explore how to start using Buidler in your Ethereum project.

What makes Buidler special? What can you achieve with it?

Buidler allows you to streamline your development workflow by making it easy to incorporate other tools into your process, as well as granting you all the flexibility you need to adapt the tools to your exact needs. What dependencies and tools you use is up to you. Buidler will only help you orchestrate them.

Out of the box, you can compile your Solidity code, install plugins and create your own tasks.

Let’s install it to try it out:

npm install @nomiclabs/buidler

To create a Buidler project just run npx buidler in your project folder:

Let’s create the sample project and go through the steps to try out the sample task, compile, test and deploy the sample contract.

If you take a look at buidler.config.js, you will find the definition of the task accounts:

task("accounts", "Prints a list of the available accounts", async () => {
  const accounts = await ethereum.send("eth_accounts");

  console.log("Accounts:", accounts);

module.exports = {};

NOTE: in the Buidler 1.0.0 beta release we’ve disabled the automatic ganache instance feature to keep working on its stability, so you’ll need to run it manually. This feature will be back by the time we ship the stable release. Run ganache-cli.

To run it, try npx buidler accounts:

If you would like to learn how to create your own tasks, take a look at our task creation guide.

Next, if you take a look at contracts/, you should be able to find Greeter.sol:

pragma solidity ^0.5.1;

contract Greeter {

    string greeting;

    constructor(string memory _greeting) public {
        greeting = _greeting;

    function greet() public view returns (string memory) {
        return greeting;


To compile it, simply run:

npx buidler compile

Now, you’ll likely want to run some tests. Out of the box Buidler provides an EIP1193-compatible provider, which is the new standard for an Ethereum JavaScript interface, but it can be somewhat rough to use directly. For a fully featured development tool with a nice interface, you’ll need to install one of the core plugins that we’ve built.

These are:

The sample project comes with a test written using the Ethereum provider, but let’s also install buidler-truffle5 and test out the Truffle 5 integration:

npm install @nomiclabs/buidler-truffle5 @nomiclabs/buidler-web3 
npm install --save-exact [email protected]

Add usePlugin("@nomiclabs/buidler-truffle5") to the top of your buidler.config.js, and let’s change test/sample-test.js to:

const assert = require("assert");

describe("Ethereum provider", function() {
  it("Should return the accounts", async function() {
    const accounts = await ethereum.send("eth_accounts");
    assert(accounts.length !== 0, "No account was returned");

contract("Greeter", function() {
  it("Should give the correct greeting", async function() {
    const Greeter = artifacts.require("Greeter");
    const greeter = await"Hello, Buidler!");

    assert.equal(await greeter.greet(), "Hello, Buidler!");

And run npx buidler test

You can then deploy by writing a deployment script deploy.js with the Truffle 5 plugin:

async function main() {
  const Greeter = artifacts.require("Greeter");

  const greeter = await"Hello, Buidler!");
  console.log("Greeter deployed to:", greeter.address);

  .then(() => process.exit(0))
  .catch(error => {
npx buidler run scripts/deploy.js

Congrats! You have created a project, ran a Buidler task, compiled a smart contract, installed a Truffle integration plugin, wrote and ran a test using the Truffle plugin, and deployed a contract.

These cover the basics to start using Buidler. Head over to Github for more guides that cover the more advanced usage that allow your process and dev toolkit to be amazingly flexible.

For any questions or feedback you may have, you can find us in the Buidler Support Telegram group.

Last Updated: 6/12/2019, 1:51:28 PM