Releases: trufflesuite/truffle
v0.4.0 pre-release!
Hi all! We're gearing up to release v0.4.0 of Truffle. As part of that, we're looking to the community to help test the new version.
Install
First uninstall your current version of Truffle:
$ npm uninstall -g truffle
Next, pull the code from source, since this is a pre-release:
$ git clone https://github.com/ConsenSys/truffle.git
$ cd truffle
$ npm install -g .
$ truffle --version # => 0.3.9
New Features
There are many:
-
Use truffle.js. You can now include a
truffle.js
file in your project instead oftruffle.json
. Withtruffle.js
, you can export your configuration and use Javascript to create that configuration on the fly, as you see fit. -
Intelligent compilation. Truffle now intelligently compiles only the contracts that have changed instead of recompiling your whole set of contracts during each compile or deploy. This is great for projects with many contracts. Use the
--compile-all
flag to override this behavior. -
Automatic library linking. Truffle will analyze your contracts' dependencies and will automatically link libraries to contracts that depend on those libraries during deployment. No need to do this yourself or maintain a separate deploy script!
-
Better log processing during failing tests. If one of your tests fail, Truffle will now better show the logs that applied to that specific failing test rather than display all logs fired over the course of the test run.
-
Mocha configuration in truffle.js. You can now specify the configuration of the test runner (Mocha) within your
truffle.js
/truffle.json
file. To do so, set the key"mocha"
to an object that contains the options shown here. -
Now serve on any port! Nice if you're running multiple development projects at once:
truffle serve -p 9999
-
Specify deployment transaction parameters. You can now specify the gas limit, gas price and from address within your configuration for transactions made during deployment. Just add those values to your
rpc
configuration, like below:module.exports = { rpc: { host: "localhost", port: 8545, gas: 3141592 // new! Default gas limit is 3141592 gasPrice: 100000000000, // new! Default gas price is 100 Shannon. from: "..." // new! Default from address is the first address available in your Ethereum client. } };
-
Updated example project. If you run
truffle init
you'll be given an example project that shows the whole lifecycle of working with a Truffle dapp, including contracts, libraries and tests, as well as a frontend that interacts with those contracts once deployed. -
Use your own build process. More to come on this feature, but you can now use your own build process instead of the one that comes default with Truffle, while still maintaining your desired level of integration. You can specify this build process in three ways:
-
Change the
build
keyword to be a string, representing a command to be run when Truffle requires a rebuild of your project:module.exports = { // This will run the `webpack` command on each build. // // The following environment variables will be set when running the command: // WORKING_DIRECTORY: root location of the project // NODE_ENV: current environment // BUILD_DESTINATION_DIRECTORY: expected destination of built assets (important for `truffle serve`) // BUILD_CONTRACTS_DIRECTORY: root location of this environment's .sol.js files // WEB3_PROVIDER_LOCATION: rpc configuration as a string, as a URL needed for web3's http provider. // build: "webpack", // ... }
-
Change the
build
keyword to be a function that will be run on each build:module.exports = { build: function(options, callback) { // Do something when a build is required. `options` contains these values: // // working_directory: root location of the project // contracts: metadata about your contract files, code, etc. // contracts_directory: root directory of .sol files // rpc: rpc configuration defined in the configuration // environment: current environment // destination_directory: directory where truffle expects the built assets (important for `truffle serve`) } // ... }
-
Create a module or object that implements the builder interface (i.e., contains a
build
function as a property that has the same signature as the one above). This is good for tighter integration with other build processes and allows for external modules that can be maintained separately. For instance, see truffle-default-builder:var DefaultBuilder = require("truffle-default-builder"); module.exports = { build: new DefaultBuilder(...) // specify the default builder configuration here. // ... }
-
Breaking changes
-
Solidity upgraded, Truffle imports removed. Before solidity and
solc
supported its own import mechanism, Truffle provided a feature that could perform imports for you. This included Truffle resolving two keywords within your solidity files,import
andimport_headers
. Truffle has dropped its custom support for these keywords in favor of solc's implementation, which only includes the keywordimport
. Note that because of this change, you'll need to add the correct file location on the end of all of your imports. i.e., this import:import "MyContract";
Must now become:
import "MyContract.sol";
Note that
import_headers
is no longer supported at all. To achieve the same behavior, you're better off maintaining an abstract version of the contract in another file and importing the abstract version when required.
Bug Fixes:
- #40, #56: Tests now ignore non-javascript files.
- #39, #60, #61, #89: If your contract file no longer defines the contract that Truffle expects, Truffle will throw an error.
- #75: Solidity upgraded
- #58: Improper bootstrapping when using the default builder, in some cases.
- #33: Configurable transaction parameters now available.
- #70, #71:
truffle init
and related tests are no longer broken.
Special thanks!
Special thanks to @area, @aaronstjohn, @tom-seddon, @vishakh, @simondlr, @janx, and @dominicwilliams for all their work related to this release. Much appreciated!
Truffle v0.3.1: Bug fixes, new demo dapp
New Features
Good news! We have a new demo dapp. truffle init
will now give you a simple demo application for free to get you off the ground. Simplest way to get started:
$ truffle init
$ truffle deploy
Compiling ./contracts/MetaCoin.sol...
Sending MetaCoin.sol to the network...
Writing built contract files to ./environments/development/contracts
$ truffle serve
Using environment development.
Serving app on port 8080...
Rebuilding...
Completed without errors on Fri Jan 08 2016 08:58:24 GMT-0800 (PST)
Then go checkout the new dapp at http://localhost:8080, and you're off to a great start!
Bug Fixes
Every point release comes with bugs. Here are some we fixed:
- Fix a bug where
truffle watch
andtruffle serve
wouldn’t rebuild the project after recompiling and redeploying contracts - Fix a bug in error handling where truffle would fail while trying to tell you your deploy configuration is incorrect
Cheers!
Truffle v0.3.0!
Happy New Year folks. A new year equals a new version of Truffle. Not bad.
Why the version bump?
Truffle v0.3.0 comes with a greater focus on comprehension as well as better management of dapp versions between environments (think, different blockchains). It also comes with loads of new features -- hats off to the people in the "Special Thanks" section below -- and given all the changes, we figured a version bump was necessary. You _will_ need to reorganize some files in your dapp in order to use version 0.3.0, but don't worry, it's easy. We've written migration instructions just for you!
New Features
- Built versions of your dapp are now saved per environment! This means you can deploy to your private blockchain, Morden and the main network, and maintain the built version of your dapp for each one, addresses, contracts and all. This required moving the old
./build
and./dist
directories into their respective environment directories, but it was well worth it. Note that other file restructuring was done as well. Be sure to check out the migration instructions. - All dapps get Mist integration, free. That is, all dapps that use the Truffle build system get Mist integration without doing any extra work. The build system will bootstrap your dapp and automatically detect Mist (or any other wallet that provides the
web3
object) if it's available. Splendid! - Tests run up to 50% faster, in some cases. If you're using @tcoulter's version of EtherSim or the pyethereum TestRPC, then Truffle can take advantage of EVM snapshotting within your tests to do away with excess deploys. In some cases, this has improved total test run time by up to 50%. You'll see more of a speedup the more test files you have.
- Event logs are displayed on test failures. If a test fails and your Ethereum client supports events, Truffle will now list the events fired during the test run so you can better debug what happened.
Special Thanks
I'd like to thank @chetan for his great work beefing up our test infrastructure; @FlySwatter for the bugs and suggestions; and everyone who aided the release of Truffle v0.3.0.
Also, shout out to @josiahwood for getting truffle working on Cloud9.
Truffle v0.2.1!
Truffle v0.2.1 ships with the updated version of Pudding as well as some awesome fixes:
-
The build process's flexibility has been significantly improved. Instead of generating a
contracts.json
file,truffle deploy
will now generate Pudding classes and place them within your environment's directory. These classes are automatically bootstrapped for you when using Truffle's build process, but they can easily be included in a custom build process as well. Make sure you check out the Pudding documentation for more details. -
Contracts are now redeployed automatically with
truffle watch
andtruffle serve
. If you edit a contract, it'll automatically deploy them without you having to switch to a different terminal window. -
Truffle uses the Javascript version of solc. You no longer have to install
solc
yourself or deal with the hassle of getting it working with your RPC client. Instead, Truffle will use the Javascript version ofsolc
, making your life a whole lot easier. -
Web3 has been bumped up to 0.14.0. Hooray!
-
You can now use the
import_headers
statement in solidity files:import_headers "MyOtherContract";
Instead of importing the whole file, this will just include an abstract version, reducing your contract's gas costs if your contract doesn't need to create new instances of
MyOtherContract
. -
You can now run a single test file instead of running all of them. It's easy:
$ truffle test ./path/to/test/file.js
-
Post-processor changes:
inject-contracts
processor has now been renamed tobootstrap
, which better describes what it does (it bootstraps browser-based dapp frontends).include-contracts
processor has been added which is useful for including your contracts in node-based libraries.
-
Advanced web3 and provider configuration has been removed. We've removed the advanced web3 and provider information because they seriously cluttered the codebase. If you want a frontend with advanced configuration, you'll instead need to use your own build process.
Embarking on a New Journey
With the most recent release of Embark v1.0.2, Truffle and Embark do things in very similar ways, and so it no longer makes sense to keep maintaining two separate codebases. To that end, Truffle and Embark will join forces and ideally merge our efforts sometime in the future. We're not sure what the landscape of this merge will look like yet, but we're sure that it'll bring the great features of both frameworks together and offer greater support for everyone.
Bug Fixes & Added Features
This version includes a few bug fixes and added functionality that makes working with contracts easier.
New Feature
Truffle contract classes now have an extend()
function so you can use them more like ORM-style objects:
// Assume we have a contract called Persona.
Persona.extend({
addAvatar: function(image) {
// This method exists within a Persona contract class, so it already
// has a reference to its own address at this.address. This method
// can then be used to seamlessly add the persona’s avatar to IPFS
// without interacting with functions external to the Persona object.
// ... implementation ...
}
});
// After calling .extend(), new instances of the Persona class will
// have the .addAvatar() function available.
var persona = Persona.at(“0x12345abcde...”);
persona.addAvatar(someImage); // calls out to ipfs, saves hash on the blockchain
Read more about this feature on the ether-pudding wiki.
Bug Fixes
- Via an ether-pudding update: contract event functions are no longer promisified, meaning you can use contract events from Truffle contract classes.
- Fixed #37: Contract paths stored in environments'
contract.json
file are now relative, meaning that you can more easily work others when contracts have already been deployed.
Version 0.1.0: Speed, reliability, and advancements
New to Truffle?
Check out the README.
What's new?
Truffle has undergone a huge rewrite under the hood, bumping it up to 0.1.0. Boot up speed has increased by 50% or more, messaging has improved all around, and many bugs have been fixed to make Truffle more reliable than it has ever been. In addition, we've also added some nice new features.
truffle serve
Have you ever wanted to run your built application from a web server rather than opening up the index.html file directly from a browser? Well now you can with truffle serve
. It will serve your built application at http://localhost:8080
and will automatically rebuild the app as you make changes.
Custom Web3 Version
You can now specify a custom version of web3 for both your app and your tests. This gives you control to choose which version works best for you. See the advanced configuration options for more details.
Custom Web3 Provider (alpha)
You can now choose the web3 provider Truffle will use throughout the application - for contract compilation, deployment, account management, etc. This allows you to better integrate and deploy applications with external blockchain-based services like BlockApps which aim to make Ethereum more consumable to your users. See the advanced configuration options for more details.
Bug Fixes
#30 - Promise.promisfy is now available to your tests.
#19 - Custom web3 version, mentioned above.
Special Thanks
Special thanks to JD Maresco, Aakil Fernandes, Andres Junge, Connor Keenan and Mike Goldin for contributions related to this release.
Additional Bug Fixes
There were still some lingering issues with our conversion from CoffeeScript.
- Make
.scss
files work again. - Fix an exceptional error case from (ironically) erroring itself.
Bug Fixes
Quick bug fix release:
- Directories no longer cause subsequent build targets to be skipped.
- Race condition causing some files not to be built correctly has now been fixed.
- The example configuration has now been updated to vanilla JS instead of Coffee.
create:test
no longer errors.
Thanks to all who wrote in issues. Keep 'em coming!
Big Change + New Features
This version of Truffle represents a complete rewrite (kindof) converting all CoffeeScript code to ES6 (using Babel). We wanted to invite more developers to contribute, and the call to use ES6 has been overwhelming. Se we delivered.
Beyond that, we have some great changes to announce:
- ES6 and JSX support is now built-in to Truffle. This means you can write your app code and test code in ES6, or include JSX natively in your frontend without having to worry about adding a custom processor. Just name your files
.es6
or.es
instead of.js
and Truffle will know what to do. CoffeeScript is still supported for app and test code, however, if you prefer. - We've deprecated the
"frontend"
configuration withinapp.json
and are now calling it"build"
. The configuration data is still the same, but we hope that Truffle can be used with Etherum-backed console applications and standalone contract-related library wrappers in addition to web applications with full user interfaces. The build processes for these types of applications are very different, and we hope to support each one. Note that for now the"frontend"
keyword will still work.
And here are some features that were released previously but unannounced:
truffle-exec
: Along with thetruffle
command line utility you're also giventruffle-exec
, which is an alias fortruffle exec --file="..."
. This will better allow you run scripts against your compiled contracts, perhaps within a larger build or deploy script.truffle deploy
now rebuilds your app with the new compiled and deployed contracts.
Please write up any bugs within the Github issue tracker. Cheers!
Tim
A few new features
- Began creating releases to communicate changelog.
- Added contract REPL.
truffle console
will create a javascript command line where you can then immediately use your compiled contracts. Use the-e
option to specify the environment. - Fixed #11: Don't recompile contracts before each test suite
- Fixed #18:
truffle compile
now writes out the new binary and abi info (it won't overwrite deployed addresses, if any) - Fixed a bug from release 0.0.12 where the web3 provider wasn't being set in some cases.