Developers
EVM Tools

Truffle

9min

Truffle is a great tool for Solidity development. Since Caduceus is a EVM compatible blockchain, it is a good tool to run unit and integration tests on your smart contracts. You can also write scripts to deploy your contract onto the the Caduceus Testnet. Remember you can get test tokens by going here. You can learn more about Truffle here.

Truffle Benefits include:

  • Built-in smart contract compilation, linking, deployment and binary management.
  • Automated contract testing for rapid development.
  • Scriptable, extensible deployment & migrations framework.
  • Network management for deploying to any number of public & private networks.
  • Package management with EthPM & NPM, using the ERC190 standard.
  • Interactive console for direct contract communication.
  • Configurable build pipeline with support for tight integration.
  • External script runner that executes scripts within a Truffle environment.
  • NodeJS v12 or later
  • Windows, Linux or Mac OS X

Requirements

Node v8+ and git are required on your local machine before you can install Truffle.

Getting Started

Shell


Your truffle.js file can contain multiple network configurations, but in general you will only work with a single network at a time. While you can issue a command to migrate to a single network (truffle migrate --network live), a minimal network connection will nevertheless be opened to every network defined with a provider.

Adding Caduceus to Truffle

  • Go to truffle-config.js
  • Update the truffle-config.js with Caduceus credentials.



JS


Deploying a Contract to Caduceus

Shell


The contract will be deployed to the Caduceus Galaxy Test net. The output will look similar to the below example.

Shell




Testing Your Contracts

Framework

Truffle comes standard with an automated testing framework to make testing your contracts a breeze. This framework lets you write simple and manageable tests in two different ways:

  • In Javascript and TypeScript, for exercising your contracts from the outside world, just like your application.
  • In Solidity, for exercising your contracts in advanced, bare-to-the-metal scenarios.

Both styles of tests have their advantages and drawbacks. See the next two sections for a discussion of each one.

Location

All test files should be located in the ./test directory. Truffle will only run test files with the following file extensions: .js, .ts, .es, .es6, and .jsx, and .sol. All other files are ignored.

To test, simply type:

Shell




Updated 25 Mar 2024
Doc contributor
Did this page help you?