Giter Site home page Giter Site logo

trufflesuite / truffle Goto Github PK

View Code? Open in Web Editor NEW
14.0K 338.0 2.3K 180.65 MB

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.

Home Page: https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_

License: MIT License

JavaScript 35.35% Shell 0.20% Solidity 6.73% Python 0.01% TypeScript 57.63% HTML 0.02% Vyper 0.02% Yul 0.01% SCSS 0.04%
truffle ethereum framework blockchain solidity smart-contracts smart-contract-tools javascript hacktoberfest

truffle's Introduction

⚠️ The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.

npm npm GitHub Discussions Coverage Status gitpoap badge


Truffle is a development environment, testing framework, and asset pipeline for Ethereum, aiming to make life as an Ethereum developer easier. With Truffle you get:

  • Built-in smart contract compilation, linking, deployment and binary management.
  • Automated contract testing with Mocha and Chai.
  • Configurable build pipeline with support for custom build processes.
  • Scriptable deployment & migrations framework.
  • Network management for deploying to many public & private networks.
  • Interactive console for direct contract communication.
  • Instant rebuilding of assets during development.
  • External script runner that executes scripts within a Truffle environment.
ℹ️ Contributors: Please see the Development section of this README.

Install

$ npm install -g truffle

Note: To avoid any strange permissions errors, we recommend using nvm.

Quick Usage

For a default set of contracts and tests, run the following within an empty project directory:

$ truffle init

From there, you can run truffle compile, truffle migrate, and truffle test to compile your contracts, deploy those contracts to the network, and run their associated unit tests.

Truffle comes bundled with a local development blockchain server that launches automatically when you invoke the commands above. If you'd like to configure a more advanced development environment we recommend you install the blockchain server separately by running npm install -g ganache at the command line.

  • ganache: a command-line version of Truffle's blockchain server.
  • ganache-ui: A GUI for the server that displays your transaction history and chain state.

Documentation

Please see the Official Truffle Documentation for guides, tips, and examples.

Development

We welcome pull requests. To get started, just fork this repo, clone it locally, and run:

# Install
npm install -g yarn
yarn bootstrap

# Test
yarn test

# Adding dependencies to a package
cd packages/<truffle-package>
yarn add <npm-package> [--dev] # Use yarn

If you'd like to update a dependency to the same version across all packages, you might find this utility helpful.

Notes on project branches:

  • master: Stable, released version (v5)
  • beta: Released beta version
  • develop: Work targeting stable release (v5)
  • next: Not currently in use

Please make pull requests against develop.

There is a bit more information in the CONTRIBUTING.md file.

License

MIT

truffle's People

Contributors

benjamincburns avatar cds-amal avatar cgewecke avatar chetan avatar cliffoo avatar cruzmolina avatar davidmurdoch avatar dependabot[bot] avatar dongmingh avatar eggplantzzz avatar evgeniuz avatar fainashalts avatar gnidan avatar haltman-at avatar johnmcdowall avatar kale-io avatar kevinbluer avatar kevinweaver avatar leeftk avatar legobeat avatar lsqproduction avatar michaeljohnbennett avatar mikeseese avatar mrrefactoring avatar nicholasjpaterno avatar rkalis avatar skywing avatar sukanyaparashar avatar tcoulter avatar tenthirtyone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

truffle's Issues

Truffle within Cloud9 online IDE

Hi, I am running truffle within Cloud9 online IDE. I finally got truffle to run but I am getting the below error:

inasacu:~/workspace/Conference (master) $ truffle test
Using environment test.
Compiling contracts...

Contract: Conference
✓ should assert true (136ms)
✓ Initial conference settings should match (749ms)

/home/ubuntu/.nvm/versions/node/v4.2.1/bin/truffle: line 20: 2673 Killed $TRUFFLE_NPM_LOCATION/node_modules/.bin/babel-node -- $TRUFFLE_NPM_LOCATION/truffle.es6 ${args}

Is this the right place where I should post this or should I go directly threw link to Cloud9! services?

Allow RPC Configuration for Deployment

I would like to have a configuration property in the app.json file that allows customization of the gas used to deploy contracts. This is especially useful for contracts that require more gas than the hard-coded value of 3141592.

constructor parameters ?

The embark framework allows to pass parameters to the contract constructor, is it possible with truffle ?

inject-contracts post-processor don't work in node environment

Currently, if an empty file is post processed with "inject-contracts" it works in the browser, but not in the node environment, because the window dependent code is not wrapped:

Currently the output file looks like this:

// If we're in the browser, call the helpers using the global
// (window) scope. If we're in node, export the helpers as a module.
if (module != null) {
  module.exports = __provisioner;
}
__provisioner.provision_contracts(window);

/* code */

; __provisioner.set_provider(window);

When it should look like this:

// If we're in the browser, call the helpers using the global
// (window) scope. If we're in node, export the helpers as a module.
if (module != null) {
  module.exports = __provisioner;
} else {
  __provisioner.provision_contracts(window);
}


; if( module == null ) {
  __provisioner.set_provider(window);
}

Can't run truffle init

I installed as per the instructions and I try to run truffle init and I get.

Error: Source directory undefined doesn't exist!
  at module.exports.load (/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/loader.js:8:13)
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:35:6
  at Object.gather (/usr/local/lib/node_modules/truffle/lib/config.es6:332:17)
  at /usr/local/lib/node_modules/truffle/truffle.es6:150:23
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:35:6
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:345:14)
  at Module._compile (module.js:435:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:435:26)
  at Object.Module._extensions..js (module.js:442:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at startup (node.js:134:18)
  at node.js:961:3

Can't install via node 5.0.0 and npm 3.3.9

-> % npm version
{ npm: '3.3.9',
  ares: '1.10.1-DEV',
  http_parser: '2.5.0',
  icu: '56.1',
  modules: '47',
  node: '5.0.0',
  openssl: '1.0.2d',
  uv: '1.7.5',
  v8: '4.6.85.28',
  zlib: '1.2.8' }

Tried: npm install -g truffle

Got:

npm WARN install Couldn't install optional dependency: Error extracting /Users/greg/.npm/solc/0.1.5/package.tgz archive: ENOENT: no such file or directory, open '/Users/greg/.npm/solc/0.1.5/package.tgz'

As a hack, symlinking ~/.npm/solc/0.1.5 -> 0.1.6-2 gets it to install.

Using Truffle with Meteor

Is it possible to use the truffle framework in conjunction with Meteor?

In other words: can I

  • set up a Dapp via Meteor,
  • then move the app under truffletest/, and
  • the solidity contract into the contract folder

Or is there something that speaks against such an approach?
How would you do it?

Warn instead of fail if processor not found.

What it says on the tin. :)

Trying to copy over .json to build/dist but it is failing because I don't have a .json processor and don't require one. Just warn the user if processors aren't there and it will just copy it over.

Compile error

When I try to compile contracts, I get the following strange error:

m@888@m:~/dmc/truffleTest$ truffle compile
Compiling ./contracts/HDC.sol...
/home/m/npm-global/lib/node_modules/truffle/node_modules/solc/bin/soljson-latest.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["r

TypeError: Cannot read property 'bytecode' of undefined
  at /home/m/npm-global/lib/node_modules/truffle/lib/contracts.es6:171:45
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:356:13
  at iterate (/home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:262:13)
  at async.forEachOfSeries.async.eachOfSeries (/home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:281:9)
  at _asyncMap (/home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:355:9)
  at Object.mapSeries (/home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:347:20)
  at Object.compile_all (/home/m/npm-global/lib/node_modules/truffle/lib/contracts.es6:144:11)
  at /home/m/npm-global/lib/node_modules/truffle/lib/contracts.es6:210:14
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:713:13
  at iterate (/home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:262:13)
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:274:29
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:44:16
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:718:17
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/async/lib/async.js:167:37
  at /home/m/npm-global/lib/node_modules/truffle/lib/contracts.es6:206:11
  at /home/m/npm-global/lib/node_modules/truffle/lib/config.es6:220:9
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/web3/lib/web3/property.js:118:13
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:89:9
  at [object Object].request.onreadystatechange (/home/m/npm-global/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
  at [object Object].dispatchEvent (/home/m/npm-global/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
  at setState (/home/m/npm-global/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
  at IncomingMessage.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
  at emitNone (events.js:72:20)
  at IncomingMessage.emit (events.js:166:7)
  at endReadableNT (_stream_readable.js:903:12)
  at doNTCallback2 (node.js:439:9)
  at process._tickDomainCallback (node.js:394:17)
  at Function.module.exports.loopWhile (/home/m/npm-global/lib/node_modules/truffle/node_modules/deasync/index.js:64:21)
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/deasync/index.js:36:18
  at runTask (/home/m/npm-global/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/truffle.es6:347:14)
  at Module._compile (module.js:435:26)
  at normalLoader (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at Object.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:435:26)
  at Object.Module._extensions..js (module.js:442:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at startup (node.js:134:18)
  at node.js:961:3

Please help 👍

Specify the order of tests

You should be able to specify the order in which tests are run. Right now tests are run in alphabetical order. Since some contracts might depend on other contracts working it is confusing if the dependant contract runs first. Therefore it would be nice to be able to specify the order in a config file.

Fatal error: Invalid array length

We're getting a fatal error during truffle deploy.

Please see below.

Output

$ truffle deploy
Using environment development.
Compiling GoldRegistry.sol...
Sending GoldRegistry.sol to the network...
Verifying deployment...
Fatal error: Invalid array length

Contract

contract GoldRegistry {
    address public ca;

    mapping (address => bool) public bars;

    modifier onlyca { if (msg.sender == ca) _ }

    function GoldRegistry() {
        ca = msg.sender;
    }

    function registerGold(address goldid) onlyca {
        bars[goldid] = true;
    }
}

config.json

{
  "frontend": {
    // Copy ./app/index.html (right hand side) to ./build/index.html.
    "index.html": "index.html",
    "app.js": [
      // Paths relative to "app" directory that should be
      // concatenated and processed during build.
      "javascripts/app.coffee" 
    ],
    "app.css": [
      // Paths relative to "app" directory that should be
      // concatenated and processed during build.
      "stylesheets/app.scss"
    ],
    // Note: You can also include directories.
    // This will copy a static images directory to the build directory.
    "images/": "images/"
  },
  "deploy": [
    // Names of contracts that should be deployed to the network.
    "GoldRegistry"
  ],
  "rpc": {
    // Default RPC configuration.
    "host": "jonsix",
    "port": 8080
  }
}

Project contents

$ tree
.
├── app
│   ├── images
│   ├── index.html
│   ├── javascripts
│   │   └── app.coffee
│   └── stylesheets
│       └── app.scss
├── config
│   ├── app.json
│   ├── development
│   │   ├── config.json
│   │   └── contracts.json
│   ├── production
│   │   ├── config.json
│   │   └── contracts.json
│   ├── staging
│   │   ├── config.json
│   │   └── contracts.json
│   └── test
│       ├── config.json
│       └── contracts.json
├── contracts
│   └── GoldRegistry.sol
└── test
    └── goldregistry.coffe

solc compilation

$ solc --binary stdout
contract GoldRegistry {
    address public ca;

    mapping (address => bool) public bars;

    modifier onlyca { if (msg.sender == ca) _ }

    function GoldRegistry() {
        ca = msg.sender;
    }

    function registerGold(address goldid) onlyca {
        bars[goldid] = true;
    }
}
^D
======= GoldRegistry =======
Binary:
60606040525b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b6101a9806100406000396000f30060606040526000357c01000000000000000000000000000000000000000000000000000000009004806313e8e8e11461004f5780637934fd9614610062578063b3c0960f146100995761004d565b005b61006060048035906020015061010b565b005b61006d6004506100c0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100aa6004803590602001506100e6565b6040518082815260200191505060405180910390f35b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160005060205280600052604060002060009150909054906101000a900460ff1681565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156101a5576001600160005060008373ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908302179055505b5b5056

Environment

Geth/v0.9.35/freebsd/go1.4.2

ERROR sending contract

Getting an error but not telling me what's actually wrong.

truffle deploy --verbose-rpc --stack --verbose --debug
Initializing
Command-line options: --verbose-rpc=--stack, --verbose, --debug=1

Reading "Gruntfile.coffee" Gruntfile...OK

Registering Gruntfile tasks.
Reading package.json...OK
Parsing package.json...OK
Initializing config...OK

Registering "grunt-available-tasks" local Npm module tasks.
Reading /usr/local/lib/node_modules/truffle/node_modules/grunt-available-tasks/package.json...OK
Parsing /usr/local/lib/node_modules/truffle/node_modules/grunt-available-tasks/package.json...OK
Loading "available_tasks.js" tasks...OK
+ availabletasks

Registering "grunt-contrib-watch" local Npm module tasks.
Reading /usr/local/lib/node_modules/truffle/node_modules/grunt-contrib-watch/package.json...OK
Parsing /usr/local/lib/node_modules/truffle/node_modules/grunt-contrib-watch/package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "Gruntfile.coffee" tasks...OK
+ build, compile, create:contract, create:test, default, deploy, dist, exec, init, init:config, init:contracts, init:tests, list, list:after, test, version

Running tasks: deploy
[D] Task source: /usr/local/lib/node_modules/truffle/Gruntfile.coffee
Using environment development.
   > {
   >   "jsonrpc": "2.0",
   >   "method": "eth_coinbase",
   >   "params": [],
   >   "id": 1
   > }
 <   {
 <     "id": 1,
 <     "jsonrpc": "2.0",
 <     "result": "0xe19df13253d2d5c460845a712c23730e55031b4f"
 <   }
Compiling HelloSystem.sol...
   > {
   >   "jsonrpc": "2.0",
   >   "method": "eth_getCompilers",
   >   "params": [],
   >   "id": 2
   > }
 <   {
 <     "id": 2,
 <     "jsonrpc": "2.0",
 <     "result": [
 <       "Solidity"
 <     ]
 <   }
   > {
   >   "jsonrpc": "2.0",
   >   "method": "eth_compileSolidity",
   >   "params": [
   >     "contract HelloSystem {\n\n    address owner;\n\n        function HelloSystem() {\n        owner = msg.sender;\n    }\n\n    function remove() {\n        if (msg.sender == owner){\n            suicide(owner);\n        }\n    }\n}\n\n"
   >   ],
   >   "id": 3
   > }
 <   {
 <     "id": 3,
 <     "jsonrpc": "2.0",
 <     "result": {
 <       "HelloSystem": {
 <         "code": "0x60606040525b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b60d58061003f6000396000f30060606040526000357c010000000000000000000000000000000000000000000000000000000090048063a7f43779146037576035565b005b60406004506042565b005b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141560d257600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16ff5b5b56",
 <         "info": {
 <           "source": "contract HelloSystem {\n\n    address owner;\n\n        function HelloSystem() {\n        owner = msg.sender;\n    }\n\n    function remove() {\n        if (msg.sender == owner){\n            suicide(owner);\n        }\n    }\n}\n\n",
 <           "language": "Solidity",
 <           "languageVersion": "0",
 <           "compilerVersion": "0.9.28",
 <           "abiDefinition": [
 <             {
 <               "constant": false,
 <               "inputs": [],
 <               "name": "remove",
 <               "outputs": [],
 <               "type": "function"
 <             },
 <             {
 <               "inputs": [],
 <               "type": "constructor"
 <             }
 <           ],
 <           "userDoc": {
 <             "methods": {}
 <           },
 <           "developerDoc": {
 <             "methods": {}
 <           }
 <         }
 <       }
 <     }
 <   }
ERROR sending contract:

Error with node-sass when running truffle init

I'm getting an error trying to run truffle init. I have tried the recommended fix npm rebuild node-sass. I have reinstalled node-sass. I have upgraded from Node 0.12 to 5.0. Still same error

$ truffle init
Error: The `libsass` binding was not found in /usr/local/lib/node_modules/truffle/node_modules/node-sass/vendor/darwin-x64-14/binding.node
This usually happens because your node version has changed.
Run `npm rebuild node-sass` to build the binding for your current node version.
  at Object.sass.getBinaryPath (/usr/local/lib/node_modules/truffle/node_modules/node-sass/lib/extensions.js:158:11)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/node-sass/lib/index.js:16:36)
  at Module._compile (module.js:460:26)
  at Module._extensions..js (module.js:478:10)
  at Object.require.extensions.(anonymous function) [as .js] (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:214:7)
  at Module.load (/usr/local/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:310:12)
  at Module.require (module.js:365:17)
  at require (module.js:384:17)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/lib/processors/scss.es6:3:12)
  at Module._compile (module.js:460:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (/usr/local/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:310:12)
  at Module.require (module.js:365:17)
  at require (module.js:384:17)
  at Object.gather (/usr/local/lib/node_modules/truffle/lib/config.es6:227:38)
  at /usr/local/lib/node_modules/truffle/truffle.es6:150:23
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:35:6
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:347:14)
  at Module._compile (module.js:460:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Function.Module.runMain (module.js:501:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:460:26)
  at Object.Module._extensions..js (module.js:478:10)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Function.Module.runMain (module.js:501:10)
  at startup (node.js:129:16)
  at node.js:814:3

Toward one command development

Currently the docs state you can "easily swap" TestRPC for geth or eth:

Though we suggest you use the TestRPC during development, you can easily swap it out for geth or eth and re-run your tests without changing a single line of code.

While this is technically true, in practice it is not so easy, and if you count the command-line voodoo that's required in a separate terminal as "a single line of code", then this claim is misleading at best.

The developer must be aware of the ins and outs of geth to be able to do this, and from my understanding of Embark it is by no means trivial to setup geth in a fake dev mode.

Ideally, you'd be able to do the following:

truffle serve --geth

And tuffle, like Embark, would setup and run geth for you. Right now, however, the developer must know how to run geth themselves in a way that does not put their account balances at risk.

If instead, you could just specify the EVM source via truffle serve --testrpc (or something like that), and have truffle do all the work of setting everything up safely and cleaning up after itself when it's done, then development would be so much simpler, safer, and smoother.

Function calls that returns in a throw in testrpc crashes truffle

Here is a screenshot of what happens:
screenshot from 2015-12-17 15 15 27

Basically, whenever a function call ends up in a throw, truffle gives an error message. This makes you unable to test that contracts that should return a throw under certain conditions. Happens with testrpc, but not with geth.

Support synchronous testing of transactions

Given a Solidity code that looks like this:

contract TestContract
   address public addr;
   function setter(address a) {
      addr = a;
   }
}

We would get:

TestContract.at(TestContract.deployed_address).setter(val).sendTransaction({from: caller})

and

TestContract.at(TestContract.deployed_address).addr.call()

It would be nice to have a way to be able to synchronously test this by making the test framework determine the tx_blocknumber where the transaction was created then wait a few blocks until such that current_blocknumber > (tx_blocknumber + number) to ensure that the transaction commits to TX storage and be able to make assertions on the results.

There will be situations where the value of addr can be changed by other contracts or EOAs and we would like to be able to elegantly test these different cases.

Truffle creates paths with two slashes

For example, you might see the text .//contracts/Example.sol in contracts.json. This complicates copying and pasting out of the terminal, as the double slash confuses emacs (and maybe other tools?). Paths should ideally have one slash at a time.

Thanks,

--Tom

Readme is misleading

In the readme, it says: "'Truffle shares many similarities to the Embark Framework but differs in philosophy. The main development goals of Truffle are:"

This seems to be imply erroneously that the development goals can't be done with Embark and difference lies there, misleading the reader. Could you please remove "but differs in philosophy".
Also please consider contributing.

Possible mistake in front page?

Is .isTrue() the function you want in this example? It seems it should be .equal()

assert.isTrue(20000, my_balance, "I was not given 20000 on contract creation!");

truffle init should make a .gitignore

It would be nice. I always need to add one for every new project.

proposed content:

# Logs
logs
*.log

# Directories used by tools like mocha & istanbul
coverage
shippable

# Dependency directory
node_modules

# Generated files
config/development/contracts.json
config/development/*.sol.js
config/test/contracts.json
build
dist



Compiler for .sol~ not yet supported

Compiler for .sol~ not yet supported by Truffle. We hope to support every compiler eventually. Express your interested by filing a bug report on Github.

which i find odd considering that example.sol was generated by the "truffle init" command

create:test is broken

$ truffle create:test --name foo
Warning: ENOENT: no such file or directory, open '/Users/.../.nvm/versions/io.js/v2.0.1/lib/node_modules/truffle//example/test/example.coffee' Use --force to continue.

Aborted due to warnings.

Navigating a project's contracts directory with Finder on OSX creates a .DS_Store file which truffle tries to compile, resulting in an error.

$ truffle deploy
Using environment development.
Compiling ./contracts/.DS_Store...
/usr/local/lib/node_modules/truffle/node_modules/solc/bin/soljson-latest.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileS

TypeError: Cannot read property 'bytecode' of undefined
  at /usr/local/lib/node_modules/truffle/lib/contracts.es6:171:45
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:356:13
  at iterate (/usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:262:13)
  at async.forEachOfSeries.async.eachOfSeries (/usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:281:9)
  at _asyncMap (/usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:355:9)
  at Object.mapSeries (/usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:347:20)
  at Object.compile_all (/usr/local/lib/node_modules/truffle/lib/contracts.es6:144:11)
  at /usr/local/lib/node_modules/truffle/lib/contracts.es6:230:16
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:713:13
  at iterate (/usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:262:13)
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:274:29
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:44:16
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:718:17
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:167:37
  at /usr/local/lib/node_modules/truffle/lib/contracts.es6:226:9
  at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/property.js:118:13
  at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:89:9
  at [object Object].request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
  at [object Object].dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
  at setState (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
  at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
  at emitNone (events.js:72:20)
  at IncomingMessage.emit (events.js:166:7)
  at endReadableNT (_stream_readable.js:905:12)
  at doNTCallback2 (node.js:450:9)
  at process._tickDomainCallback (node.js:405:17)
  at Function.module.exports.loopWhile (/usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:64:21)
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:36:18
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:347:14)
  at Module._compile (module.js:425:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:457:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:425:26)
  at Object.Module._extensions..js (module.js:432:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:457:10)
  at startup (node.js:136:18)
  at node.js:972:3

A check (no hidden files?) should be added to lib/contracts.es6 line 122.

Array inputs to contract functions lead to Bignum errors

I'm testing this contract

contract ArrayTest {

    uint public x;

    function testArray(uint[] inputArray) {
    x = inputArray[0];
    }
}

with test

contract 'ArrayTest', (accounts) ->

  it "should assert true", (done) -> 
    arr = ArrayTest.at(ArrayTest.deployed_address)
    arr.testArray([1,2,3,4]).then () ->
      assert.isTrue(true)
      done()

It gives the error message below:

Unhandled rejection BigNumber Error: new BigNumber() not a number: [object Object]
  at raise (/usr/lib/node_modules/truffle/node_modules/web3/node_modules/bignumber.js/bignumber.js:1177:25)
  at /usr/lib/node_modules/truffle/node_modules/web3/node_modules/bignumber.js/bignumber.js:1165:33
  at new BigNumber (/usr/lib/node_modules/truffle/node_modules/web3/node_modules/bignumber.js/bignumber.js:193:67)
  at new BigNumber (/usr/lib/node_modules/truffle/node_modules/web3/node_modules/bignumber.js/bignumber.js:203:69)
  at toBigNumber (/usr/lib/node_modules/truffle/node_modules/web3/lib/utils/utils.js:328:12)
  at Object.toTwosComplement (/usr/lib/node_modules/truffle/node_modules/web3/lib/utils/utils.js:339:21)
  at [object Object].formatInputInt [as _inputFormatter] (/usr/lib/node_modules/truffle/node_modules/web3/lib/solidity/formatters.js:41:38)
  at [object Object].SolidityType.formatInput (/usr/lib/node_modules/truffle/node_modules/web3/lib/solidity/coder.js:83:17)
  at [object Object].SolidityCoder._formatInput (/usr/lib/node_modules/truffle/node_modules/web3/lib/solidity/coder.js:161:36)
  at /usr/lib/node_modules/truffle/node_modules/web3/lib/solidity/coder.js:187:21
  at Array.map (native)
  at [object Object].SolidityCoder.encodeParams (/usr/lib/node_modules/truffle/node_modules/web3/lib/solidity/coder.js:186:32)
  at [object Object].SolidityFunction.toPayload (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/function.js:69:52)
  at [object Object].SolidityFunction.sendTransaction (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/function.js:131:24)
  at [object Object].SolidityFunction.execute (/usr/lib/node_modules/truffle/node_modules/web3/lib/web3/function.js:208:37)
  at [object Object].<anonymous> (/usr/lib/node_modules/truffle/node_modules/ether-pudding/build/ether-pudding.js:132:23)
  at [object Object].<anonymous> (/usr/lib/node_modules/truffle/node_modules/ether-pudding/build/ether-pudding.js:249:21)
  at [object Object].tryCatcher (/usr/lib/node_modules/truffle/node_modules/bluebird/js/main/util.js:24:31)
  at [object Object].ret [as testArray] (<anonymous>:14:23)
  at Context.<anonymous> (/home/chris/dev/balanc3/test/array_test.coffee:6:14)
  at Test.Runnable.run (/usr/lib/node_modules/truffle/node_modules/mocha/lib/runnable.js:233:15)
  at Runner.runTest (/usr/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:390:10)
  at /usr/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:473:12
  at next (/usr/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:315:14)
  at /usr/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:325:7
  at next (/usr/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:260:23)
  at Immediate._onImmediate (/usr/lib/node_modules/truffle/node_modules/mocha/lib/runner.js:292:5)
  at processImmediate [as _immediateCallback] (timers.js:367:17)

When I try the same contract & function in Node with web3 it works.

truffle web3 version

Right now a specific web3 is packaged w truffle. It would be cool if app.json could accept a pointer to a local web3 module

Run individual tests

There should be a way to run only specific tests.
An interface for this could be:
truffle test - run all tests
truffle test testname - run specific test, where testname is a file in the test/ folder called testname.coffee

contracts.json relative paths for contract source

currently the contracts.json from a truffle compile produces a json where the value of source is an absolute path. a disadvantage is that everyone would have a different local path to the contract (and is also OS dependent, like /Users/tim/contract.sol vs /home/tim/contract.sol)

i am just starting out with truffle, but if relative paths could be used like ./contract.sol then teams could easily work from the same repo

init command called twice shows a warning

To reproduce: create a new directory and run truffle init and then truffle init. A warning is shown Warning: Couldn't find environment undefined.. I run it the second time because I wanted to recreate the original files.

Better stack trace error reporting and verbosity options for tests.

I spent quite some time trying to figure out a problem with my tests. The only error I was getting was a timeout issue. --stack didn't give anything meaningful. It turned out to be a typo in the test code.

  Contract: Gold
    1) "before all" hook: redeploy before each contract

  Contract: GoldRegistry
    2) "before all" hook: redeploy before each contract


  0 passing (4m)
  2 failing

  1) Contract: Gold "before all" hook: redeploy before each contract:
     Error: timeout of 120000ms exceeded. Ensure the done() callback is being called in this test.


  2) Contract: GoldRegistry "before all" hook: redeploy before each contract:
     Error: timeout of 120000ms exceeded. Ensure the done() callback is being called in this test.

truffle test errors are 2 lines off

@Firescar96 pointed this out first on Gitter and I've confirmed, the error messages are 2 lines off.

e.g.

  2) Contract: GameRunner joinGame should return 3 when a 3rd person tries to join:
     TypeError: undefined is not a function
    at /Users/jd/Development/fudge/test/gamerunner.js:34:23

The error says line 34, but it's actually on line 36. I think it may be because of the way you're adding the global contract() method?

https://github.com/ConsenSys/truffle/blob/master/lib/test.es6#L33-L64

Unclear error message produced when contract is named wrongly

Steps:

  1. Run preferred RPC client &c

  2. Create new truffle project and check it works.

    mkdir /tmp/x
    cd /tmp/x
    truffle init
    truffle test

    (the test is expected to pass)

  3. Rename contract file

    mv contracts/Example.sol contracts/Example2.sol

  4. Do truffle test again

Expected results:

Test passes as before, or some message is presented.

Actual results:

truffle barfs with a stack dump, along these lines: https://gist.github.com/tom-seddon/ae2ea3e184d9715651cf

PR to follow.

--Tom

Specify which contracts should be deployed for each test

Right now all contracts are redeployed before each separate testfile is run. If you where able to specify which contracts that should be deployed before each test it would speed up the testing process.
This could be specified in the top of the testfile, stating which contracts that should be deployed.

truffle init problem

After installing truffle, and trying to launch it with truffle init, I get the following errors:

m@888@m:~/dmc/truffleTest$ npm rebuild node-sass

> [email protected] install /home/m/dmc/node_modules/node-sass
> node scripts/install.js


> [email protected] postinstall /home/m/dmc/node_modules/node-sass
> node scripts/build.js

` /home/m/dmc/node_modules/node-sass/vendor/linux-x64-46/binding.node ` exists. 
 testing binary.
Binary is fine; exiting.
[email protected] /home/m/dmc/node_modules/node-sass
m@888@m:~/dmc/truffleTest$ truffle init
Error: The `libsass` binding was not found in /home/m/npm-global/lib/node_modules/truffle/node_modules/node-sass/vendor/linux-x64-46/binding.node
This usually happens because your node version has changed.
Run `npm rebuild node-sass` to build the binding for your current node version.
  at Object.sass.getBinaryPath (/home/m/npm-global/lib/node_modules/truffle/node_modules/node-sass/lib/extensions.js:158:11)
  at Object.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/node_modules/node-sass/lib/index.js:16:36)
  at Module._compile (module.js:435:26)
  at Module._extensions..js (module.js:442:10)
  at Object.require.extensions.(anonymous function) [as .js] (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:214:7)
  at Module.load (/home/m/npm-global/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:311:12)
  at Module.require (module.js:366:17)
  at require (module.js:385:17)
  at Object.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/lib/processors/scss.es6:3:12)
  at Module._compile (module.js:435:26)
  at normalLoader (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (/home/m/npm-global/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
  at Function.Module._load (module.js:311:12)
  at Module.require (module.js:366:17)
  at require (module.js:385:17)
  at Object.gather (/home/m/npm-global/lib/node_modules/truffle/lib/config.es6:227:38)
  at /home/m/npm-global/lib/node_modules/truffle/truffle.es6:150:23
  at /home/m/npm-global/lib/node_modules/truffle/node_modules/deasync/index.js:35:6
  at runTask (/home/m/npm-global/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/truffle.es6:347:14)
  at Module._compile (module.js:435:26)
  at normalLoader (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at Object.<anonymous> (/home/m/npm-global/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:435:26)
  at Object.Module._extensions..js (module.js:442:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:311:12)
  at Function.Module.runMain (module.js:467:10)
  at startup (node.js:134:18)
  at node.js:961:3

Note that before launching truffle, I did npm rebuild node-sass , but still get the corresponding error.
Please help

Promise.promisify not included

If I write something like

var myBalance = Promise.promisify(web3.eth.getBalance)

I'm getting an error message

Fatal error: undefined is not a function

Truffle should ignore non-development files.

Truffle picks up VIM buffer files (*.swp) and other files such as (.DS_Store) when running tests, which causes it to break. Only sol & se should probably be allowed at this point.

Similarly with the tests themselves, it also does the same. Perhaps only javascript files should be allowed in that scenario.

/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/loader.js:19

root@vagrant:/home/vagrant# mkdir truffle-test
root@vagrant:/home/vagrant# cd truffle-test/
root@vagrant:/home/vagrant/truffle-test# truffle init

/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/loader.js:19
for (var file of files) {
^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.require.extensions.(anonymous function) as .js
at Module.load (/usr/local/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/local/lib/node_modules/truffle/lib/exec.es6:9:21)
at Module._compile (module.js:456:26)
at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) as .es6
at Module.load (/usr/local/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/local/lib/node_modules/truffle/lib/config.es6:12:12)
at Module._compile (module.js:456:26)
at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) as .es6
at Module.load (/usr/local/lib/node_modules/truffle/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/usr/local/lib/node_modules/truffle/truffle.es6:14:14)
at Module._compile (module.js:456:26)
at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) as .es6
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at Object. (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

Error: Insufficient funds for gas * price + value

Pretty sure I have enough ether (>3) to deploy the contract https://etherchain.org/account/0xb735bf53abc79525a4f585a004a620d08cc66b27

Using environment development.

{
"jsonrpc": "2.0",
"method": "eth_coinbase",
"params": [],
"id": 1
}
< {
< "id": 1,
< "jsonrpc": "2.0",
< "result": "0xb735bf53abc79525a4f585a004a620d08cc66b27"
< }
Compiling Lotto.sol...
{
"jsonrpc": "2.0",
"method": "eth_getCompilers",
"params": [],
"id": 2
}
< {
< "id": 2,
< "jsonrpc": "2.0",
< "result": [
< "Solidity"
< ]
< }
{
"jsonrpc": "2.0",
"method": "eth_compileSolidity",
"params": [
"contract Lotto {\n \n uint constant public blocksPerRound = 5760;\n \n uint constant public ticketPrice = 100000000000000000;\n \n uint constant public blockReward = 5000000000000000000;\n\n function getBlocksPerRound() constant returns(uint){ return blocksPerRound; }\n function getTicketPrice() constant returns(uint){ return ticketPrice; }\n \n struct Round {\n address[] buyers;\n uint pot;\n uint ticketsCount;\n mapping(uint=>bool) isCashed;\n mapping(address=>uint) ticketsCountByBuyer;\n }\n mapping(uint => Round) rounds;\n \n function getRoundIndex() constant returns (uint){\n \n return block.number/blocksPerRound;\n }\n\n function getIsCashed(uint roundIndex,uint subpotIndex) constant returns (bool){\n \n return rounds[roundIndex].isCashed[subpotIndex];\n }\n\n\n function calculateWinner(uint roundIndex, uint subpotIndex) constant returns(address){\n \n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n \n if(decisionBlockNumber>block.number)\n return;\n \n var decisionBlockHash = getHashOfBlock(decisionBlockNumber);\n var winningTicketIndex = decisionBlockHash%rounds[roundIndex].ticketsCount;\n \n var ticketIndex = uint256(0);\n\n for(var buyerIndex = 0; buyerIndex<rounds[roundIndex].buyers.length; buyerIndex++){\n var buyer = rounds[roundIndex].buyers[buyerIndex];\n ticketIndex+=rounds[roundIndex].ticketsCountByBuyer[buyer];\n\n if(ticketIndex>winningTicketIndex){\n return buyer;\n }\n }\n\n }\n\n function getDecisionBlockNumber(uint roundIndex,uint subpotIndex) constant returns (uint){\n return ((roundIndex+1)_blocksPerRound)+subpotIndex;\n }\n\n function getSubpot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot/getSubpotsCount(roundIndex);\n }\n\n function getSubpotsCount(uint roundIndex) constant returns(uint){\n \n var subpotsCount = rounds[roundIndex].pot/blockReward;\n\n if(rounds[roundIndex].pot%blockReward>0)\n subpotsCount++;\n\n return subpotsCount;\n }\n\n function cash(uint roundIndex, uint subpotIndex){\n \n var subpotsCount = getSubpotsCount(roundIndex);\n\n if(subpotIndex>=subpotsCount)\n return;\n\n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n\n if(decisionBlockNumber>block.number)\n return;\n\n if(rounds[roundIndex].isCashed[subpotIndex])\n return;\n \n var winner = calculateWinner(roundIndex,subpotIndex); \n var subpot = getSubpot(roundIndex);\n\n var isSent = winner.send(subpot);\n\n if(!isSent) return;\n \n rounds[roundIndex].isCashed[subpotIndex] = true;\n }\n\n function getHashOfBlock(uint blockIndex) constant returns(uint){\n var blockhash = block.blockhash(blockIndex);\n return uint(blockhash);\n }\n \n function getBuyers(uint roundIndex,address buyer) constant returns (address[]){\n return rounds[roundIndex].buyers;\n }\n\n function getTicketsCountByBuyer(uint roundIndex,address buyer) constant returns (uint){\n return rounds[roundIndex].ticketsCountByBuyer[buyer];\n }\n\n function getPot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot;\n }\n\n function() {\n \n var roundIndex = getRoundIndex();\n var value = msg.value-(msg.value%ticketPrice);\n\n if(value==0) return;\n\n if(value<msg.value){\n msg.sender.send(msg.value-value);\n }\n \n var ticketsCount = value/ticketPrice;\n \n if(rounds[roundIndex].ticketsCountByBuyer[msg.sender]==0){\n var buyersLength = rounds[roundIndex].buyers.length++;\n rounds[roundIndex].buyers[buyersLength] = msg.sender;\n }\n\n rounds[roundIndex].ticketsCountByBuyer[msg.sender]+=ticketsCount;\n rounds[roundIndex].ticketsCount+=ticketsCount;\n \n rounds[roundIndex].pot+=value;\n \n }\n\n}"
],
"id": 3
}
< {
< "id": 3,
< "jsonrpc": "2.0",
< "result": {
< "Lotto": {
< "code": "0x6060604052610a7f806100136000396000f300606060405236156100c1576000357c01000000000000000000000000000000000000000000000000000000009004806328d3ad3f14610319578063305a762a14610340578063358d5dc21461036d578063459f93f71461039a57806346a2679a146103fb5780636572ae131461042257806367af1c81146104655780638089d0011461048657806386bb7121146104ad57806387bb7ae0146104ce57806393dafba2146104ef578063ce5566c514610516578063df2f0a4a1461052f576100c1565b6103175b60006000600060006100d5610580565b935067016345785d8a000034063403925060008314156100f457610311565b34831015610132573373ffffffffffffffffffffffffffffffffffffffff166000843403604051809050600060405180830381858888f19350505050505b67016345785d8a00008304915060006000600050600086815260200190815260200160002060005060040160005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505414156102625760006000506000858152602001908152602001600020600050600001600050805480919060010190908154818355818115116101ff578183600052602060002091820191016101fe91906101e0565b808211156101fa57600081815060009055506001016101e0565b5090565b5b5050509050336000600050600086815260200190815260200160002060005060000160005082815481101561000257906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b816000600050600086815260200190815260200160002060005060040160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082828250540192505081905550816000600050600086815260200190815260200160002060005060020160008282825054019250508190555082600060005060008681526020019081526020016000206000506001016000828282505401925050819055505b50505050565b005b61032a600480359060200150610a51565b6040518082815260200191505060405180910390f35b6103576004803590602001803590602001506109f8565b6040518082815260200191505060405180910390f35b610384600480359060200180359060200150610591565b6040518082815260200191505060405180910390f35b6103b1600480359060200180359060200150610949565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b61040c60048035906020015061078a565b6040518082815260200191505060405180910390f35b6104396004803590602001803590602001506105de565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610470600450610580565b6040518082815260200191505060405180910390f35b61049760048035906020015061092f565b6040518082815260200191505060405180910390f35b6104b860045061055c565b6040518082815260200191505060405180910390f35b6104d960045061056b565b6040518082815260200191505060405180910390f35b610500600480359060200150610752565b6040518082815260200191505060405180910390f35b61052d600480359060200180359060200150610803565b005b610546600480359060200180359060200150610739565b6040518082815260200191505060405180910390f35b60006116809050610568565b90565b600067016345785d8a0000905061057d565b90565b60006116804304905061058e565b90565b600060006000506000848152602001908152602001600020600050600301600050600083815260200190815260200160002060009054906101000a900460ff1690506105d8565b92915050565b60006000600060006000600060006105f68989610739565b9550438611156106055761072d565b61060e8661092f565b9450600060005060008a8152602001908152602001600020600050600201600050548506935060009250600091505b600060005060008a8152602001908152602001600020600050600001600050548260ff16101561072c57600060005060008a815260200190815260200160002060005060000160005082815481101561000257906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060005060008a815260200190815260200160002060005060040160005060008273ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050548301925082508383111561071e5780965061072d565b5b818060010192505061063d565b5b50505050505092915050565b600081611680600185010201905061074c565b92915050565b600061075d8261078a565b6000600050600084815260200190815260200160002060005060010160005054049050610785565b919050565b60006000674563918244f4000060006000506000858152602001908152602001600020600050600101600050540490506000674563918244f4000060006000506000868152602001908152602001600020600050600101600050540611156107f55780806001019150505b8091506107fd565b50919050565b600060006000600060006108168761078a565b9450848610151561082657610926565b6108308787610739565b93504384111561083f57610926565b60006000506000888152602001908152602001600020600050600301600050600087815260200190815260200160002060009054906101000a900460ff161561088757610926565b61089187876105de565b925061089c87610752565b91508273ffffffffffffffffffffffffffffffffffffffff16600083604051809050600060405180830381858888f1935050505090508015156108de57610926565b600160006000506000898152602001908152602001600020600050600301600050600088815260200190815260200160002060006101000a81548160ff021916908302179055505b50505050505050565b600060008240905080600190049150610943565b50919050565b6020604051908101604052806000815260200150600060005060008481526020019081526020016000206000506000016000508054806020026020016040519081016040528092919081815260200182805480156109e657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116109b2575b505050505090506109f2565b92915050565b60006000600050600084815260200190815260200160002060005060040160005060008373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050549050610a4b565b92915050565b600060006000506000838152602001908152602001600020600050600101600050549050610a7a565b91905056",
< "info": {
< "source": "contract Lotto {\n \n uint constant public blocksPerRound = 5760;\n \n uint constant public ticketPrice = 100000000000000000;\n \n uint constant public blockReward = 5000000000000000000;\n\n function getBlocksPerRound() constant returns(uint){ return blocksPerRound; }\n function getTicketPrice() constant returns(uint){ return ticketPrice; }\n \n struct Round {\n address[] buyers;\n uint pot;\n uint ticketsCount;\n mapping(uint=>bool) isCashed;\n mapping(address=>uint) ticketsCountByBuyer;\n }\n mapping(uint => Round) rounds;\n \n function getRoundIndex() constant returns (uint){\n \n return block.number/blocksPerRound;\n }\n\n function getIsCashed(uint roundIndex,uint subpotIndex) constant returns (bool){\n \n return rounds[roundIndex].isCashed[subpotIndex];\n }\n\n\n function calculateWinner(uint roundIndex, uint subpotIndex) constant returns(address){\n \n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n \n if(decisionBlockNumber>block.number)\n return;\n \n var decisionBlockHash = getHashOfBlock(decisionBlockNumber);\n var winningTicketIndex = decisionBlockHash%rounds[roundIndex].ticketsCount;\n \n var ticketIndex = uint256(0);\n\n for(var buyerIndex = 0; buyerIndex<rounds[roundIndex].buyers.length; buyerIndex++){\n var buyer = rounds[roundIndex].buyers[buyerIndex];\n ticketIndex+=rounds[roundIndex].ticketsCountByBuyer[buyer];\n\n if(ticketIndex>winningTicketIndex){\n return buyer;\n }\n }\n\n }\n\n function getDecisionBlockNumber(uint roundIndex,uint subpotIndex) constant returns (uint){\n return ((roundIndex+1)_blocksPerRound)+subpotIndex;\n }\n\n function getSubpot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot/getSubpotsCount(roundIndex);\n }\n\n function getSubpotsCount(uint roundIndex) constant returns(uint){\n \n var subpotsCount = rounds[roundIndex].pot/blockReward;\n\n if(rounds[roundIndex].pot%blockReward>0)\n subpotsCount++;\n\n return subpotsCount;\n }\n\n function cash(uint roundIndex, uint subpotIndex){\n \n var subpotsCount = getSubpotsCount(roundIndex);\n\n if(subpotIndex>=subpotsCount)\n return;\n\n var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);\n\n if(decisionBlockNumber>block.number)\n return;\n\n if(rounds[roundIndex].isCashed[subpotIndex])\n return;\n \n var winner = calculateWinner(roundIndex,subpotIndex); \n var subpot = getSubpot(roundIndex);\n\n var isSent = winner.send(subpot);\n\n if(!isSent) return;\n \n rounds[roundIndex].isCashed[subpotIndex] = true;\n }\n\n function getHashOfBlock(uint blockIndex) constant returns(uint){\n var blockhash = block.blockhash(blockIndex);\n return uint(blockhash);\n }\n \n function getBuyers(uint roundIndex,address buyer) constant returns (address[]){\n return rounds[roundIndex].buyers;\n }\n\n function getTicketsCountByBuyer(uint roundIndex,address buyer) constant returns (uint){\n return rounds[roundIndex].ticketsCountByBuyer[buyer];\n }\n\n function getPot(uint roundIndex) constant returns(uint){\n return rounds[roundIndex].pot;\n }\n\n function() {\n \n var roundIndex = getRoundIndex();\n var value = msg.value-(msg.value%ticketPrice);\n\n if(value==0) return;\n\n if(value<msg.value){\n msg.sender.send(msg.value-value);\n }\n \n var ticketsCount = value/ticketPrice;\n \n if(rounds[roundIndex].ticketsCountByBuyer[msg.sender]==0){\n var buyersLength = rounds[roundIndex].buyers.length++;\n rounds[roundIndex].buyers[buyersLength] = msg.sender;\n }\n\n rounds[roundIndex].ticketsCountByBuyer[msg.sender]+=ticketsCount;\n rounds[roundIndex].ticketsCount+=ticketsCount;\n \n rounds[roundIndex].pot+=value;\n \n }\n\n}",
< "language": "Solidity",
< "languageVersion": "0",
< "compilerVersion": "0.1.1",
< "abiDefinition": [
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< }
< ],
< "name": "getPot",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "buyer",
< "type": "address"
< }
< ],
< "name": "getTicketsCountByBuyer",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "getIsCashed",
< "outputs": [
< {
< "name": "",
< "type": "bool"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "buyer",
< "type": "address"
< }
< ],
< "name": "getBuyers",
< "outputs": [
< {
< "name": "",
< "type": "address[]"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< }
< ],
< "name": "getSubpotsCount",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "calculateWinner",
< "outputs": [
< {
< "name": "",
< "type": "address"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [],
< "name": "getRoundIndex",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "blockIndex",
< "type": "uint256"
< }
< ],
< "name": "getHashOfBlock",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [],
< "name": "getBlocksPerRound",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [],
< "name": "getTicketPrice",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< }
< ],
< "name": "getSubpot",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< },
< {
< "constant": false,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "cash",
< "outputs": [],
< "type": "function"
< },
< {
< "constant": true,
< "inputs": [
< {
< "name": "roundIndex",
< "type": "uint256"
< },
< {
< "name": "subpotIndex",
< "type": "uint256"
< }
< ],
< "name": "getDecisionBlockNumber",
< "outputs": [
< {
< "name": "",
< "type": "uint256"
< }
< ],
< "type": "function"
< }
< ],
< "userDoc": {
< "methods": {}
< },
< "developerDoc": {
< "methods": {}
< }
< }
< }
< }
< }
Sending Lotto.sol to the network...
{
"jsonrpc": "2.0",
"method": "eth_sendTransaction",
"params": [
{
"from": "0xb735bf53abc79525a4f585a004a620d08cc66b27",
"gas": "0x2fefd8",
"gasPrice": "0xe8d4a51000",
"data": "0x6060604052610a7f806100136000396000f300606060405236156100c1576000357c01000000000000000000000000000000000000000000000000000000009004806328d3ad3f14610319578063305a762a14610340578063358d5dc21461036d578063459f93f71461039a57806346a2679a146103fb5780636572ae131461042257806367af1c81146104655780638089d0011461048657806386bb7121146104ad57806387bb7ae0146104ce57806393dafba2146104ef578063ce5566c514610516578063df2f0a4a1461052f576100c1565b6103175b60006000600060006100d5610580565b935067016345785d8a000034063403925060008314156100f457610311565b34831015610132573373ffffffffffffffffffffffffffffffffffffffff166000843403604051809050600060405180830381858888f19350505050505b67016345785d8a00008304915060006000600050600086815260200190815260200160002060005060040160005060003373ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000505414156102625760006000506000858152602001908152602001600020600050600001600050805480919060010190908154818355818115116101ff578183600052602060002091820191016101fe91906101e0565b808211156101fa57600081815060009055506001016101e0565b5090565b5b5050509050336000600050600086815260200190815260200160002060005060000160005082815481101561000257906000526020600020900160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b816000600050600086815260200190815260200160002060005060040160005060003373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082828250540192505081905550816000600050600086815260200190815260200160002060005060020160008282825054019250508190555082600060005060008681526020019081526020016000206000506001016000828282505401925050819055505b50505050565b005b61032a600480359060200150610a51565b6040518082815260200191505060405180910390f35b6103576004803590602001803590602001506109f8565b6040518082815260200191505060405180910390f35b610384600480359060200180359060200150610591565b6040518082815260200191505060405180910390f35b6103b1600480359060200180359060200150610949565b60405180806020018281038252838181518152602001915080519060200190602002808383829060006004602084601f0104600302600f01f1509050019250505060405180910390f35b61040c60048035906020015061078a565b6040518082815260200191505060405180910390f35b6104396004803590602001803590602001506105de565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610470600450610580565b6040518082815260200191505060405180910390f35b61049760048035906020015061092f565b6040518082815260200191505060405180910390f35b6104b860045061055c565b6040518082815260200191505060405180910390f35b6104d960045061056b565b6040518082815260200191505060405180910390f35b610500600480359060200150610752565b6040518082815260200191505060405180910390f35b61052d600480359060200180359060200150610803565b005b610546600480359060200180359060200150610739565b6040518082815260200191505060405180910390f35b60006116809050610568565b90565b600067016345785d8a0000905061057d565b90565b60006116804304905061058e565b90565b600060006000506000848152602001908152602001600020600050600301600050600083815260200190815260200160002060009054906101000a900460ff1690506105d8565b92915050565b60006000600060006000600060006105f68989610739565b9550438611156106055761072d565b61060e8661092f565b9450600060005060008a8152602001908152602001600020600050600201600050548506935060009250600091505b600060005060008a8152602001908152602001600020600050600001600050548260ff16101561072c57600060005060008a815260200190815260200160002060005060000160005082815481101561000257906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060005060008a815260200190815260200160002060005060040160005060008273ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050548301925082508383111561071e5780965061072d565b5b818060010192505061063d565b5b50505050505092915050565b600081611680600185010201905061074c565b92915050565b600061075d8261078a565b6000600050600084815260200190815260200160002060005060010160005054049050610785565b919050565b60006000674563918244f4000060006000506000858152602001908152602001600020600050600101600050540490506000674563918244f4000060006000506000868152602001908152602001600020600050600101600050540611156107f55780806001019150505b8091506107fd565b50919050565b600060006000600060006108168761078a565b9450848610151561082657610926565b6108308787610739565b93504384111561083f57610926565b60006000506000888152602001908152602001600020600050600301600050600087815260200190815260200160002060009054906101000a900460ff161561088757610926565b61089187876105de565b925061089c87610752565b91508273ffffffffffffffffffffffffffffffffffffffff16600083604051809050600060405180830381858888f1935050505090508015156108de57610926565b600160006000506000898152602001908152602001600020600050600301600050600088815260200190815260200160002060006101000a81548160ff021916908302179055505b50505050505050565b600060008240905080600190049150610943565b50919050565b6020604051908101604052806000815260200150600060005060008481526020019081526020016000206000506000016000508054806020026020016040519081016040528092919081815260200182805480156109e657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116109b2575b505050505090506109f2565b92915050565b60006000600050600084815260200190815260200160002060005060040160005060008373ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600050549050610a4b565b92915050565b600060006000506000838152602001908152602001600020600050600101600050549050610a7a565b91905056"
}
],
"id": 4
}
< {
< "id": 4,
< "jsonrpc": "2.0",
< "error": {
< "code": -32603,
< "message": "Insufficient funds for gas * price + value"
< }
< }
ERROR sending contract:
Error: Insufficient funds for gas * price + value
at Object.module.exports.InvalidResponse (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/errors.js:35:16)
at /usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/requestmanager.js:101:36
at /usr/local/lib/node_modules/truffle/lib/config.es6:337:11
at [object Object].request.onreadystatechange (/usr/local/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
at [object Object].dispatchEvent (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:572:25)
at setState (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:14)
at IncomingMessage. (/usr/local/lib/node_modules/truffle/node_modules/web3/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:431:13)
at IncomingMessage.emit (events.js:129:20)
at _stream_readable.js:908:16
at process._tickDomainCallback (node.js:381:11)
at Function.module.exports.loopWhile (/usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:57:21)
at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:29:18
at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:41:5)
at Object. (/usr/local/lib/node_modules/truffle/truffle.es6:256:14)
at Module._compile (module.js:460:26)
at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
at Object.require.extensions.(anonymous function) as .es6
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at Object. (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3

web3 appears to be missing.

web3 does not appear to be present in truffle console or truffle test. Pudding.web3 is available, just not the original web3.

truffle init clobbers existing files

If you have a truffle environment set up and accidentally run truffle init it will clobber a bunch of your config files:

chris@chris-VBox:~/dev/dGrid$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean
chris@chris-VBox:~/dev/dGrid$ truffle init
Warning: Couldn't find environment undefined.
chris@chris-VBox:~/dev/dGrid$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   config/app.json
    modified:   config/development/contracts.json
    modified:   config/test/contracts.json

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    app/images/
    contracts/Example.sol
    test/example.coffee

no changes added to commit (use "git add" and/or "git commit -a")

truffle init - Error: Source directory undefined doesn't exist!

I am stopped by an error right away. I installed truffle, then:

$ truffle 
Error: Source directory undefined doesn't exist!
  at module.exports.load (/usr/local/lib/node_modules/truffle/node_modules/ether-pudding/loader.js:8:13)
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:35:6
  at Object.gather (/usr/local/lib/node_modules/truffle/lib/config.es6:332:17)
  at /usr/local/lib/node_modules/truffle/truffle.es6:150:23
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:35:6
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:345:14)
  at Module._compile (module.js:460:26)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Function.Module.runMain (module.js:501:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:460:26)
  at Object.Module._extensions..js (module.js:478:10)
  at Module.load (module.js:355:32)
  at Function.Module._load (module.js:310:12)
  at Function.Module.runMain (module.js:501:10)
  at startup (node.js:129:16)
  at node.js:814:3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.