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/...
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 = {
...
...
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" --...
25
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 ...
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 ...
19
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 ...
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 -> ...
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/...
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, ...
11
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');
...
8
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 ...
8
votes
Truffle Flattener creates empty flat file
Try to use output parameter:
truffle-flattener .\contracts\WetherCrowdsale.sol --output WetherCrowdsale_flat.sol
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 ...
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.
[email protected]
[email protected]
[email protected]
Issues for me so far:
doesn't work with http provider: "TypeError: ...
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....
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 ...
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 ...
6
votes
Accepted
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 ...
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 ...
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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',...
4
votes
How to access the deployed contract's address from Truffle JS tests?
I believe what you are looking for is instance.address
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 ...
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 = ...
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>
&...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
truffle-contract × 316truffle × 201
solidity × 116
web3js × 59
truffle-migration × 54
contract-development × 37
truffle-deployment × 29
contract-deployment × 23
truffle-compile × 21
truffle-test × 20
ganache × 18
go-ethereum × 17
metamask × 16
testrpc × 13
contract-design × 11
contract-invocation × 11
javascript × 10
blockchain × 9
contract-debugging × 9
testing × 9
remix × 8
tokens × 8
react × 8
events × 6
nodejs × 6