Truffle for VS Code
Truffle for VS Code simplifies how you create, build, debug and deploy smart contracts on Ethereum and all EVM-compatible blockchains and layer 2 scaling solutions. The extension has built-in integration with a growing number of tools and services including Truffle, Ganache, and Infura.
Native IDE Debugging
Please note that this is a beta release of the IDE debugger and there are some known (and possibly unknown) issues that we are actively resolving. Feel free to review status and / or open any new issues or feature requests here.
Truffle for VS Code also offers comprehensive native IDE Solidity debugging support, taking advantage of VS Code's great debugging features such variables, watches, and breakpoints. No more jumping between differents tools or windows during your edit, compile, deploy, transact, debug loop.
To install this extension to VS Code, simply click the "Install" button above. Beyond this, there are some local dependencies you may have already installed. If not, the extension will prompt you accordingly. To help smooth out the dependency installation process, we've created a guide which you can find here.
Create a New Project
The Truffle for VS Code was built to work effectively for both new users to Ethereum, but not get in the way for those familiar with the process. One of the primary goals is to help users create a project structure for developing smart contracts, help in the compilation and building of these assets, deployment of these assets to blockchain endpoints as well as debugging of these contracts.
Developers that are familiar with Truffle CLI may use
For developers who are not familiar with Truffle, or prefer to use the Command Palette, the extension can easily scaffold out a project directory using the following steps.
Build your smart contracts
Your newly scaffolded-out directory includes a simple contract and all the necessary files to build and deploy a simple, and working contract to an RPC-endpoint. Use the following steps to build your contract:
Deploy to the RPC endpoint
Once compiled, you will have your contract, contract metadata (e.g., contract ABI, bytecode) available in the smart contract .json file which will be located in the
For new users, this can be hard to understand, because there are multiple steps that need to occur for the deployment to be successful. To ease this burden, the extension provides a simple model to deploy to various networks. By default, this will be a local network, using Ganache. The extension will start and run an instance of ganache for the user. The options to initiate this deployment are below.
Deploy with Truffle Ganache locally
For rapid development of smart contracts, having the ability to deploy contracts to a blockchain quickly for testing and debugging purposes is a key principle. One of the most popular models to achieve this is using Ganache, which acts as a local blockchain simulator to allow this quick deployment and iteration that is ideal for developers.
The extension has integrated Ganache directly into the IDE to further lower the barrier to entry, and allow even faster development iteration. By default, there is nothing to configure, and the following steps can be used.
OPTIONAL: If there is a need to control this Ganache instance more or change the configuration, there are some other options that can be used that the IDE can help with as well.
Deploy with Infura to Ethereum mainnet and testnets
If you are a developer that would like to target public testnet and mainnet for Ethereum, the ability to leverage Infura from inside the IDE is provided via this extension.
For those that aren't familiar with Infura, it provides the tools and infrastructure that allow developers to easily take their blockchain application from testing to scaled deployment - with simple, reliable access to Ethereum mainnet and testnets, and also has support for IPFS. Details can be found on the Getting started with Infura blog and on the Infura Docs pages.
To use Infura, the first step is to either create or connect to an existing Infura project. The IDE will step through this process.
Deploy with Hyperledger Besu
Hyperledger Besu is a popular Ethereum client that is unique in that it offers a client that can be used in either public networks, such as Ethereum mainnet or private, consortium based networks. It can be deployed a variety of ways, and recently a preview has been made available in Azure.
Currently, the Hyperledger Besu is fully compatible with the extension, however the provisioning of the nodes is not yet fully integrated. To connect to a running Besu node with the extension, you can do the following:
Add the following to the configuration:
Our Docs page includes a comprehensive getting started guide with detailed usage instructions for this plugin
We welcome pull requests. To get started, just fork this repo, clone it locally, and run:
There are more docs online at the VS Code website on how to develop plugins at the VS Code Docs - Extension API.
VS Code collects usage data and sends it to ConsenSys Software Incorporated to help improve its products and services. Read our privacy statement to learn more. If you don’t wish to send usage data, you can set the