44 votes

How to upgrade solidity compiler in truffle

You can force truffle to use a specific solc version by installing that version directly in the truffle directory. For example on Ubuntu the following with force truffle to use 0.4.15 $ cd /usr/...
user avatar
35 votes

How to upgrade solidity compiler in truffle

If you're using ^v5.0.0 (including beta releases), you can bring your own compiler by adding this in your truffle config file (in this example it's set to 0.4.25): module.exports = { ... ...
user avatar
32 votes
Accepted

Steps to deploy a contract using MetaMask and Truffle

Solution 1: With you own node You can easily deploy on the ropsten network if you own a full node running on your machine. i. Run geth $ geth --fast --cache=1048 --testnet --unlock "0xmyaddress" --...
user avatar
24 votes
Accepted

how to know the contract address which truffle is deploying with

There are a few ways to do this: 1) In your blockchain node (testrpc|ganache or your test/live network with geth/parity), the contract deployments will be logged and you can see the address created ...
user avatar
  • 2,276
22 votes

Truffle: Error: Could not find a compiler version matching 0.5.0

It's solved by running with elevated permissions once: sudo truffle compile - that will download the compiler and then you can continue using non-elevated command truffle compile. That is most ...
user avatar
  • 1,057
18 votes
Accepted

what does `deploy.link` exactly do in `truffle`

EDIT: As stated in the comment by @feihcsim autolink has been deprecated Let's say ecosystem of your dapp has a library and a contract that calls functions from that library. So you have: library ...
user avatar
15 votes
Accepted

Debugging JS unit tests with truffle framework in VS code

Your lucky day (had to solve this few days ago): See that you have truffle-core locally in your project. If not, do: npm install truffle-core Then use a configuration similar to this: ( Debug -> ...
user avatar
13 votes

Truffle invalid address

Thank's to Truffle Gitter channel I figured out. I have to call defaults function on my truffle-contract's abstraction. MyContract.defaults({from: …}) https://github.com/trufflesuite/truffle/tree/...
user avatar
  • 1,160
10 votes

How to upgrade solidity compiler in truffle

After a couple of attempts, I've made it by uninstalling and installing truffle, exactly as described in here: npm uninstall -g truffle npm install -g truffle That updated Truffle itself though, ...
user avatar
  • 201
8 votes

Truffle Flattener creates empty flat file

Try to use output parameter: truffle-flattener .\contracts\WetherCrowdsale.sol --output WetherCrowdsale_flat.sol
user avatar
  • 1,702
7 votes
Accepted

Truffle & Web3 1.0.0-beta : does it work for anyone?

I was able to make it work with recently released truffle-contract. web3@1.0.0-beta.20 truffle-contract@3.0.0 truffle@3.4.9 Issues for me so far: doesn't work with http provider: "TypeError: ...
user avatar
  • 1,131
7 votes
Accepted

How to access the deployed contract's address from Truffle JS tests?

const contract = require('truffle-contract'); const TokenArtifact = require('./../../build/contracts/YourToken.json'); var Token = contract(TokenArtifact); Token.setProvider(window.web3....
user avatar
  • 86
7 votes
Accepted

Unhandled promise rejection(gas limit) when deploying Contract to rinkeby using truffle-hdwallet-provider

I added '0x' + in front of the bytecode in the .deploy to make it Work. .deploy({ data: '0x' + bytecode, arguments: ['Hi there!'] }) If there's no '0x' the bytecode will convert the whole string to ...
user avatar
7 votes

How to get contract instance address for Web3 1.0 contract API?

I couldn't find where the address was stored because the JSON file I took was an out-dated version. It was one that was generated before I migrated on Truffle. It turns out that the JSON file is ...
user avatar
  • 336
6 votes

How to upgrade solidity compiler in truffle

You need to upgrade your truffle to do that. npm install -g truffle@X For example, to get solc 0.4.11 support, install truffle 3.2.2 or above. npm install -g truffle@3.2.2 or npm update -g ...
user avatar
5 votes
Accepted

How to generate truffle artifact for already deployed contract for use with web3

You would require ABI and the address at which the contract has been deployed. var abi = <ABI of contract>; // Set contract ABI var newContract = web3.eth....
user avatar
  • 770
5 votes
Accepted

Expected identifier, got 'LParen'

There is several problems with your code. You copy paste the function prototype instead of calling it you should use im_myAddressUintMap.insert( key, value); And you have to make this insert inside ...
user avatar
  • 1,132
5 votes
Accepted

TypeError: Expression has to be an lvalue. But before the code was working perfectly!

Memory is temporary. Storage is permanent. For example, you would perform intermediate computations using memory, and then save the result to storage. There are defaults for the storage location ...
user avatar
5 votes
Accepted

Difference between truffle-contract and web3.eth.Contract

As pointed out by @Ismael in the comment and after some days spent working with both library I can confirm what he has written. Truffle-contract is based on the stable version of web3 (v0.20), so it ...
user avatar
5 votes

How to convert BigNumber returned by Truffle Console

Some tips: have to do this asynchronously. Truffle makes the function thenable. don't need "call" explicitly because the get() is marked constant. once you have the BigNumber, then you can convert ...
user avatar
  • 51.3k
4 votes

How to upgrade solidity compiler in truffle

Check your solc compiler version using the following command - solc --version Then you can use following commands to uninstall solc(solidity) compiler and install it again. It shall give you latest ...
user avatar
  • 3,312
4 votes
Accepted

accessing truffle contract abstractions from external JS script

Not sure whether this is the intended way, but experimenting with bits and pieces of code found around the Internet resulted in something that seems to be working. Here's what I did in my javascript ...
user avatar
  • 812
4 votes
Accepted

What is the {from: account_one} third parameter in metacoin.js test example

in truffle you always need to add this object parameter representing the values you need for transactions in Ethereum. like in: eth.sendTransaction({from: '0x036a03fc47084741f83938296a1c8ef67f6e34fa',...
user avatar
  • 3,282
4 votes

How to access the deployed contract's address from Truffle JS tests?

I believe what you are looking for is instance.address
user avatar
4 votes
Accepted

Truffle work over HTTPS

I found workaround for this case, just add provider field to truffle.js: const Web3 = require('web3'); module.exports = { networks: { ropsten: { ................. provider: new ...
user avatar
  • 1,254
4 votes

Best practice for sharing truffle build files between developers

I don't know if there is a real answer for that, but I use this solution: I change the migration file and I write the ABI and its address after the deploy var fs = require('fs'); var MyContract = ...
user avatar
  • 4,157
4 votes

TypeError: Web3 is not a constructor when trying to use node.js with truffle-contract

I had the same error "...Web3 is not a constructor." The issue was in the order in which I had my following included in the html code: <script src="./js/truffle-contract.js"></script> &...
user avatar
  • 41
4 votes
Accepted

Calling contracts inside for() loop

This is not really an Ethereum question.. See https://stackoverflow.com/questions/750486/javascript-closure-inside-loops-simple-practical-example For your concrete case, you could do this: for(var ...
user avatar
  • 7,184
4 votes

solidity code compilation error?

You need to use constructor() to define constructor. Replace function Ballot() public with constructor() public Pass index of array whose value you want in return. Do the iteration on ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible