Skip to content

Dakavon/foundry-vagrant-env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VM for Ethereum smart contract development

on the basis of Ubuntu 22.04 LTS ("Jammy Jellyfish") with pre-installed software e.g. Foundry and Python + Hardhat (*) to get started straight away.

(* Hardhat needs a local installation within a project.)

See bootstrap.sh for software versions.

Installed Software

  • Foundry - Smart contract development framework (forge, cast, anvil, chisel)
  • Node.js 20.x LTS - JavaScript runtime
  • Python 3 with pip and venv
  • Git - Version control
  • Ganache - Local Ethereum blockchain
  • Screen - Terminal multiplexer
  • Vim - Text editor
  • Additional tools: jq, build-essential, nodemon

Get started

Download and install Vagrant for your system

➡️ https://www.vagrantup.com/downloads

Download and install Virtualbox for your system (because Vagrant relies on "providers")

➡️ https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html (or https://download.virtualbox.org/virtualbox)

$ sudo dpkg -i virtualbox-_VERSION_~Ubuntu~_PLATFORM.deb
$ sudo apt-get install --fix-broken

Prepare development environment

  1. Clone this repo

    $ git clone git@github.com:Dakavon/foundry-vagrant-env.git
  2. Go into the download folder and prepare development environment with

    $ cd foundry-vagrant-env
    $ vagrant up
  3. Wait until it is finished :)

  4. The Vagrant VM is now running. To shut it down, you can enter the following:

    $ vagrant halt

Run development environment

  1. If you haven't already create a DAPPS folder within your users home folder, e.g. via terminal

    $ mkdir ~/DAPPS
  2. Open VM installation folder in a terminal

  3. Start VM and log in

    $ vagrant up && vagrant ssh
  4. Go to ~/DAPPS folder inside the VM

    vagrant@devVM:~$  cd ~/DAPPS/
  5. Clone project from _REPOSITORY_ to your DAPPS folder (likely from outside the VM due to public-key authentication)

    $ git clone git@github.com:_REPOSITORY_

    and go to _PROJECT_ folder inside the VM

    vagrant@devVM:~/DAPPS$  cd _PROJECT_

    and e.g.

    • install dependencies via

      vagrant@devVM:~/DAPPS/_PROJECT_$  npm install
    • or use hardhat within project through local installation

      vagrant@devVM:~/DAPPS/_PROJECT_$   npm install --save-dev hardhat
  6. Or set up a new _PROJECT_ with Foundry

    vagrant@devVM:~/DAPPS$  mkdir _PROJECT_ && cd _PROJECT_
    vagrant@devVM:~/DAPPS/_PROJECT_$  forge init .

    In case forge is not available, try

    vagrant@devVM:~/DAPPS/_PROJECT_$  foundryup

Python Development

  1. Create a Python virtual environment for your project

    vagrant@devVM:~/DAPPS$  mkdir _PROJECT_ && cd _PROJECT_
    vagrant@devVM:~/DAPPS/_PROJECT_$  python3 -m venv venv
  2. Activate the virtual environment

    vagrant@devVM:~/DAPPS/_PROJECT_$  source venv/bin/activate
  3. Install Python packages

    (venv) vagrant@devVM:~/DAPPS/_PROJECT_$  pip install <package-name>
  4. Deactivate when done

    (venv) vagrant@devVM:~/DAPPS/_PROJECT_$  deactivate

Delete development environment

  1. Go to the download folder and delete development environment with
    $ cd foundry-vagrant-env
    $ vagrant destroy

About

Let Vagrant build an Ubuntu 22.04 LTS ("Jammy Jellyfish") machine to use Geth + Foundry (+ Hardhat)

Resources

Stars

Watchers

Forks

Contributors

Languages