Deploy a complex smart contract easily and quickly with Remix IDE

All source code for this tutorial is published on

Trong Dinh Thai Hoang
3 min readFeb 6, 2020

--

What is :

is a powerful, open source tool that helps you write Solidity contracts straight from the browser. Written in JavaScript, Remix supports both usage in the browser and locally.

Our smart contract:

This tutorial will use Provable.sol smart contract which is to help users approve an ERC20 token with zero fees.

Provable.sol

How to deploy the Provable smart contract with Remix:

  1. Use remixd:
  • Paste the Provable source code to Remix IDE
  • Wait. What’s wrong!!! The Remix IDE doesn’t detect the import “openzeppelin-solidity/contracts/token/ERC20/ERC20.sol”; Yes, it’s because of ERC20.sol only exists on your local computer. That’s why we need remixd.
  • remixd is a tool that intend to be used with (aka. Browser-Solidity). It allows a websocket connection between Remix IDE (web application) and the local computer.
  • Install : npm install -g remixd
  • Share folder between your local computer and Remix IDE
  • Press connect localhost button on Remix IDE and change the import statement like my screenshot below
  • Congratulations! You can able to press the Deploy button on Remix IDE now.

2. Use solidity flattener:

  • Like the title of this article. Use remixd still not quite easy yet. Let’s imagine something like if we can merge all the import files into one file (Provable.sol). The process will be easy, right?
  • Thanks to him for making it happens.
  • Let’s clone this repos and use this command: npm start "path_to_not_flat_contract_definition_file.sol" It will generate a Provable_out.sol to ./out directory
  • Paste the content of Provable_out.sol to Remix IDE. It will look like something like this one:
  • Enjoy!!! you can deploy Provable smart contract now.

3. Conclusion:

  • There still many ways to deploy the smart contract to Ethereum blockchain. This article only shows the easiest way I think.

Thanks for reading. If you have any feedback or comment, don’t hesitate to contact me via email: trongdth@gmail.com. The next tutorial will be deploying smart contracts by using ethers.js

📝 Save this story in .

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. .

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Trong Dinh Thai Hoang
Trong Dinh Thai Hoang

Written by Trong Dinh Thai Hoang

I’m a peaceful person who wants to make friend with people around the world.

No responses yet

Write a response