Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
45 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/...
Adam Lemmon's user avatar
36 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 = { ... ...
Paul Razvan Berg's user avatar
32 votes

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" --...
Greg Jeanmart's user avatar
25 votes

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 ...
carlolm's user avatar
  • 2,326
23 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 ...
Andrey's user avatar
  • 1,147
22 votes

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

I was stuck with the same error while trying to use this in nodejs.. I finally found the fix. Apparently, in Web3.js 4.x, we're supposed to import it like this: const { Web3 } = require('web3'); ...
Siddharth Maurya's user avatar
19 votes

what does `` 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 ...
KwahuNashoba's user avatar
16 votes

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 -> ...'s 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: …})
underdog's user avatar
  • 1,190
12 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, ...
zok's user avatar
  • 221
9 votes

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 ...
Kashish Khullar's user avatar
8 votes

Truffle Flattener creates empty flat file

Try to use output parameter: truffle-flattener .\contracts\WetherCrowdsale.sol --output WetherCrowdsale_flat.sol
Aquila's user avatar
  • 1,812
7 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 [email protected] or npm update -g ...
Neeldhwaj Pathak's user avatar
7 votes

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

I was able to make it work with recently released truffle-contract. [email protected] [email protected] [email protected] Issues for me so far: doesn't work with http provider: "TypeError: ...
szerte's user avatar
  • 1,241
7 votes

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....
GVyas's user avatar
  • 86
7 votes

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 ...
Finn Rothacker's 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 ...
adrianmcli's user avatar
6 votes

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

If you're running in a browser with MetaMask, then Web3 is injected as a side effect of this (although try not to rely on this behaviour). In server-side code, you must import web3 yourself, by ...
James_pic's user avatar
  • 1,110
5 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 ...
Sanchit's user avatar
  • 3,502
5 votes

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....
Abhishek's user avatar
  • 800
5 votes

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 ...
0xCrema.eth's user avatar
  • 1,192
5 votes

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 ...
Luigi Cerone's 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 ...
Rob Hitchens's user avatar
  • 55.3k
4 votes

Truffle invalid address

This worked for me. Hope my answer helps future readers. You have to the set the defaultAccount to be used: web3.eth.defaultAccount = web3.eth.accounts[0]; before using web3 instance. Also, In my ...
Pramesh Bajracharya's user avatar
4 votes

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 ...
manuhalo's user avatar
  • 812
4 votes

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',...
n1cK's user avatar
  • 3,388
4 votes

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

I believe what you are looking for is instance.address
Stephane Gosselin's user avatar
4 votes

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 ...
Alex G.P.'s user avatar
  • 1,277
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 = ...
qbsp's user avatar
  • 4,367
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> &...
d5t's user avatar
  • 41

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