LinuxCommandLibrary

truffle

TLDR

Initialize project

$ truffle init
copy
Compile contracts
$ truffle compile
copy
Run migrations
$ truffle migrate
copy
Run tests
$ truffle test
copy
Start console
$ truffle console
copy
Deploy to network
$ truffle migrate --network [mainnet]
copy
Start development blockchain
$ truffle develop
copy
Create contract
$ truffle create contract [ContractName]
copy

SYNOPSIS

truffle command [--network network] [options]

DESCRIPTION

truffle develops Ethereum smart contracts. It provides complete development workflow.
Compilation converts Solidity to bytecode. Artifacts contain ABI and bytecode.
Migrations deploy contracts. Scripts run in order.
Testing verifies contract behavior. JavaScript and Solidity tests.
Development blockchain runs locally. Instant transactions, no gas costs.
Console interacts with contracts. Call functions directly.

PARAMETERS

init

Initialize project.
compile
Compile contracts.
migrate
Deploy contracts.
test
Run tests.
console
Interactive console.
develop
Local blockchain.
create TYPE NAME
Generate component.
--network NAME
Target network.
--reset
Reset migrations.

CAVEATS

Requires Node.js. Ethereum knowledge needed. Gas costs on mainnet.

HISTORY

Truffle was created by ConsenSys for Ethereum development. It became the standard framework before Hardhat gained popularity.

SEE ALSO

hardhat(1), ganache(1), solc(1)

Copied to clipboard