Solidity Development: Setting up the environment

Nowadays, everything related to the crypto-world is becoming more and more popular. I bet you’ve also thought about launching your own successful startup with millions in investments! As the saying goes, though, no pain no gain. But at least let’s make the development of smart contracts less painful… Choosing the right development kit and setting up the environment is a first step to success. In this blog we’ll consider the most popular solutions for starting up your decentralized app, such as:

  • Remix IDE
  • Intellij-Solidity Plugin + Truffle + Ganache
  • Solidity Extension for Visual Studio + Blockapps-bloc

Remix IDE

Remix — is a web-based IDE for writing, deploying and running Solidity smart contracts. For now, it’s one of the most featured IDEs for smart contracts. After opening the Remix website you’ll see something like this:

Remix offers you an out-of-the-box ready solution for decentralized app development. You don’t have to install any plugins or modules, just open the browser and start coding. Everything else is already done for you.

Pros:

  • Code highlighting and analysis
  • Terminal with integrated JavaScript interpreter and the web3 object
  • Running locally stored files
  • Ability to run transactions, deploy and compile smart contracts

Cons:

  • Works only in web browser
  • Clearing of LocalStorage will remove all of your files (there is a workaround with using RemixD)

Intellij-Solidity Plugin + Truffle + Ganache

Intellij-Solidity — is a plugin for Intellij-based IDEs such as Webstorm, PhpStorm and PyCharm. This plugin offers syntax highlighting, code formatting and autocomplete for Solidity files. However, it doesn’t provide any solutions for compiling and deploying contracts.

For compiling and deploying you can use Truffle Framework with Ganache CLI.

Truffle Setup

Firstly, you have to install Truffle globally using the npm package manager:

npm install -g truffle

Then you have to create a new directory for your project and go into it (the directory has to be empty):

mkdir MyFirstSolidityProject
cd MyFirstSolidityProject/

And finally run init truffle in our project directory:

truffle init

After initializing truffle in your project directory, you’ll get the following files generated:

We will cover why we need these files in the next blog. For now, we’ll just add some code to our truffle.js file to make it look like this:

module.exports = {
    networks: {
        development: {
            host: "127.0.0.1",
            port: 7545,
            network_id: "*"
        }
    }
}

Here we specified the environment, called development, running on 127.0.0.1:7545. We’ll use it for deploying our contracts to the local Ethereum network.

Ganache CLI Setup

Now we have to install the Ganache CLI package globally with the npm package manager:

npm install -g ganache-cli

Ganache will run a local instance of the Ethereum network on your machine, which may be useful during development and debugging. We have to run ganache on the port specified for our development environment above (7545). This could be done by the following command:

ganache-cli -p 7545

After that you’ll see a list of generated test account addresses, their private keys, and mnemonic phrases for the wallet:

Wrap Up

Now that we have the local network up and running, we can compile and migrate our project to that network. To do this, we have to run the following command:

truffle compile

This will generate a json file for our contracts under ./build/contracts directory. Then we will migrate this data to the network using the developmentenvironment:

truffle migrate --network development

Pros:

  • Can be used in many modern IDE’s without breaking previous settings
  • Supports goto declarations, code completion, syntax highlighting
  • Provides file templates for generated contracts and libraries
  • Truffle and Ganache provide a big variety of project setups with React, Redux, Authentication etc.

Cons:

  • The Intellij-Solidity plugin is currently in alpha, so it could have some bugs
  • A lot of actions have to be done manually for setting up the compilation and deployment process

Solidity extension for Visual Studio + Blockapps-bloc

The Solidity extension enables smart contract development in Visual Studio IDE. It allows you to start a new project for your decentralized app with everything set up.

This extension requires installation of the blockapps-bloc package. This package allow you to run a local Ethereum network (like ganache-cli).

Blockapps-bloc Setup

Firstly, we have to go to our project directory and install the blockapps-blocpackage using the npm package manager:

npm install blockapps-bloc

Then we have to initalize this module with a nameusername and apiUrl of your choice. You’ll be prompted to supply that info after running the following command:

bloc init

After that, install the required npm packages and start bloc package:

npm install
bloc start

Now we have a server running on the default 8000 port. VS extension will use this server by default. You can check or change the extension properties in Visual Studio in the Project Properties dialog:

Pros:

  • Ability to setup multi-project applications with ASP.NET or Node.js
  • Ready-to-use application templates
  • Provides compiling and deploying of smart contracts

Cons:

  • Needs some additional package installation (blockapps-bloc)
  • A lot of issues from users, related to expired certificates, that could make extension unavailable for some time

Conclusion

All in all, we’ve discovered the most popular solutions for setting up your environment and starting to develop smart contracts for Solidity with ease. I hope you’ve found something appropriate for your needs. In the next blog we’ll write our first smart contract and will deploy it to the local network.

Related Blog Posts

We hope you’ve found this to be helpful and are walking away with some new, useful insights. If you want to learn more, here are a couple of related articles that others also usually find to be interesting:

Our Gear Is Packed and We're Excited to Explore With You

Ready to come with us? 

Together, we can map your company’s software journey and start down the right trails. If you’re set to take the first step, simply fill out our contact form. We’ll be in touch quickly – and you’ll have a partner who is ready to help your company take the next step on its software journey. 

We can’t wait to hear from you! 

Main Contact

This field is for validation purposes and should be left unchanged.

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the form below. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Montage Portal

Montage Furniture Services provides furniture protection plans and claims processing services to a wide selection of furniture retailers and consumers.

Project Background

Montage was looking to build a new web portal for both Retailers and Consumers, which would integrate with Dynamics CRM and other legacy systems. The portal needed to be multi tenant and support branding and configuration for different Retailers. Trailhead architected the new Montage Platform, including the Portal and all of it’s back end integrations, did the UI/UX and then delivered the new system, along with enhancements to DevOps and processes.

Logistics

We’ve logged countless miles exploring the tech world. In doing so, we gained the experience that enables us to deliver your unique software and systems architecture needs. Our team of seasoned tech vets can provide you with:

Custom App and Software Development

We collaborate with you throughout the entire process because your customized tech should fit your needs, not just those of other clients.

Cloud and Mobile Applications

The modern world demands versatile technology, and this is exactly what your mobile and cloud-based apps will give you.

User Experience and Interface (UX/UI) Design

We want your end users to have optimal experiences with tech that is highly intuitive and responsive.

DevOps

This combination of Agile software development and IT operations provides you with high-quality software at reduced cost, time, and risk.

Trailhead stepped into a challenging project – building our new web architecture and redeveloping our portals at the same time the business was migrating from a legacy system to our new CRM solution. They were able to not only significantly improve our web development architecture but our development and deployment processes as well as the functionality and performance of our portals. The feedback from customers has been overwhelmingly positive. Trailhead has proven themselves to be a valuable partner.

– BOB DOERKSEN, Vice President of Technology Services
at Montage Furniture Services

Technologies Used

When you hit the trails, it is essential to bring appropriate gear. The same holds true for your digital technology needs. That’s why Trailhead builds custom solutions on trusted platforms like .NET, Angular, React, and Xamarin.

Expertise

We partner with businesses who need intuitive custom software, responsive mobile applications, and advanced cloud technologies. And our extensive experience in the tech field allows us to help you map out the right path for all your digital technology needs.

  • Project Management
  • Architecture
  • Web App Development
  • Cloud Development
  • DevOps
  • Process Improvements
  • Legacy System Integration
  • UI Design
  • Manual QA
  • Back end/API/Database development

We partner with businesses who need intuitive custom software, responsive mobile applications, and advanced cloud technologies. And our extensive experience in the tech field allows us to help you map out the right path for all your digital technology needs.

Our Gear Is Packed and We're Excited to Explore with You

Ready to come with us? 

Together, we can map your company’s tech journey and start down the trails. If you’re set to take the first step, simply fill out the contact form. We’ll be in touch – and you’ll have a partner who cares about you and your company. 

We can’t wait to hear from you! 

Thank you for reaching out.

You’ll be getting an email from our team shortly. If you need immediate assistance, please call (616) 371-1037.