Questions tagged [truffle]

Questions regarding the implementation and use of the Truffle development and testing environment.

Filter by
Sorted by
Tagged with
4
votes
4answers
4k views

Truffle develop (Ganache) increase block gas limit

I can deploy my contract on Remix (Javascript VM and Rinkeby), but if I try to use truffle develop and migrate, I am getting an error: Error: Exceeds block gas limit. The gas used in Remix is 3585084. ...
4
votes
2answers
3k views

What should be the gas and gasPrice for Ropsten Network in Truffle Config?

I just want to test my smart contract to be deployed in the Ropsten network, and I'm still puzzled on what should I put for the gas and gasPrice in the Truffle config. Thoughts about this? ropsten: { ...
4
votes
2answers
4k views

Truffle — Microsoft JScript runtime error [duplicate]

Running truffle from command line gives me this Windows 7 popup message: While init runs successfully. I see file truffle.js in my project folder. How can I handle this gently?
4
votes
3answers
942 views

Iterating through an array in JS and simple promises (web3/pudding)

This might be more to do with my lack of understanding some JS basics however it's in ethereum/web3 context so here it goes. I have a public array posts in my contract and a global variable in JS of ...
4
votes
3answers
3k views

Truffle develop get new contract instance from contract address

From a truffle develop console, is there a way I can get the contract instance from the contract's address? I have a remote ec2 with truffle/geth installed and truffle develop instance running. From ...
4
votes
1answer
5k views

Truffle mingration: Error: authentication needed: password or unlock

I deploying contract using Truffle and got an error Error: authentication needed: password or unlock. I already checked related questons and found only ugly hacks like "unlock desired account directly ...
4
votes
1answer
5k views

Web3 - Uncaught TypeError: contract.abi.filter is not a function

I have compiled and deployed a simple Hello World contract using truffle: pragma solidity ^0.4.4; contract Greeter { function Greeter() { } function sayHello() returns(string) { ...
4
votes
2answers
621 views

Mock Smart Contract For Unit Testing

I'm new to Ethereum and solidity, I'm developing a simple decentralized application using Truffle where I have an abstract contract Storage and another contract Reader which uses storage. contract ...
4
votes
2answers
2k views

How much does it cost to upload a smart contract?

I'm using a local Ethereum testnet and it seems to me that the price of uploading a smart contract is a bit too high. This is the code for the smart contract: contract Transfer { address owner; ...
4
votes
2answers
468 views

How to connect two truffle instances?

How can we connect two truffle applications with each other? E.g., if we have two metacoin applications, how can these two communicate with each other?
4
votes
1answer
77 views

couldnt understand implementaion of UpgradeabilityProxyFactory

I want to use UpgradeabilityProxy provided by zeppelin, they have one method createProxyAndCall which they say initialize the new implementation with data parameter we provided which looks like: * ...
4
votes
3answers
878 views

Truffle migration contract not found - but it's there!

I have a feeling this is going to be a forehead-slapper, but here goes... I'm attempting to run Truffle's "Pet Shop" demo app on AWS. The truffle compile command ran fine, with a few non-fatal ...
4
votes
4answers
491 views

Truffle Drizzle-box fails with TypeError: (0 , _drizzle.generateContractsInitialState) is not a function

Right after unboxing Drizzle-box I'm getting a TypeError: (0 , _drizzle.generateContractsInitialState) is not a function. Ganache is running on localhost:8545, contracts are deployed, Metamask ...
4
votes
1answer
549 views

Should I use new() or deployed() in Truffle unit tests?

What's the difference in using new() or deployed() when creating a contract instance to use in Truffle unit tests? Should I use // VERSION A it("should work", async () => { let instance = await ...
4
votes
1answer
915 views

How do I compile a Solidity contract with an import to standalone byte code?

I am trying to compile the MetaCoin contract (part of the Truffle Init Webpack). I need to get the byte code as hex numbers so that I can use it with Nethereum. The MetaCoin contains an import to ...
4
votes
1answer
5k views

Expected identifier, got 'LParen'

I try using IterableMapping by this example. I have error when I compiling contract by truffle: Expected identifier, got 'LParen' This is my code: pragma solidity ^0.4.15; import "./itMapsLib....
4
votes
2answers
419 views

Truffle tests not resetting account states

I've written some truffle tests that interact with the account balances. Example: A contract transfers X amount of ether from account A to account B. Surprisingly the state of the accounts (...
4
votes
1answer
650 views

Is the address used to deploy contracts in JS tests in truffle always accounts[0]

I've noticed that the deploying address in my truffle .js tests is equal to the address at accounts[0]. Since it's important to me to test the ownership of a contract, I'd like to know if it's ...
4
votes
1answer
5k views

Account is locked, after running Truffle migrate command [duplicate]

I am new to this technology and I am trying to Deploy the contract to Ropsten test network. I have my geth running in one terminal. In my truffle console I have an account with some ether. I unlock it,...
4
votes
3answers
1k views

Truffle v5 runs out of gas but Truffle v4 deploys the contract

Truffle v4 used to deploy the contract successfully, but Truffle v5 truffle migrate command fails. My process to deploy: 1) delete buidl/ folder 2) truffle compile 3) truffle migrate Truffle v5 ...
4
votes
1answer
211 views

solidity-coverage adds extra events which make unit-test fail

It seems that when using the latest solidity-coverage (0.5.11), truffle (5.0.0-next.25) ganache-cli (6.2.4-beta.1) and solc (0.5.0) additional events / logs are emitted during tests which make the ...
4
votes
1answer
1k views

How do I make truffle migrate replace just one contract?

I have a dapp consisting of two contracts, which don't particularly have a dependency on each other or know about each other. I want to replace one of the contracts, but not the other one. If I did ...
4
votes
1answer
337 views

Can I truffle migrate with geth --light?

I get invalid address when I try to, I suspect --light doesn't enable deploys -- is that so?
4
votes
1answer
365 views

Truffle Migrations contract constructor argument

I'm reading the Truffle Migrations contract and looking at the code for upgrade(): function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); // * ...
4
votes
1answer
3k views

Deploy smart contract to mainnet with Infura and MetaMask

I am trying to deploy my smart contract to the main net using the following code: truffle.js: module.exports = { networks: { live: { provider: new HDWalletProvider("mnemonic from ...
4
votes
2answers
1k views

How to import a smart contract on github in a truffle contract?

I am using a smart contract that imports and uses the Oraclize contract at https://github.com/oraclize/ethereum-api/blob/master/oraclizeAPI_0.4.sol, if in the remix editor this can be done as follows: ...
4
votes
4answers
3k views

Truffle for Windows: I can't make it work

I've installed Truffle v3.2.1 for Windows. If I try to run: truffle console Could not find suitable configuration file. If I run: truffle create:contract MyContract I get nothing but command ...
4
votes
1answer
3k views

truffle console - return (array of addresses) issue

This problem happens only when I place contracts A and contract B in seperate file. When placed in same file, I get the array elements perfectly Please find the contract below. I was able to ...
4
votes
3answers
1k views

Deploying contracts on geth returns Error: connect ECONNREFUSED 127.0.0.1:8545

I'm using truffle (which uses pudding) to deploy contracts to my testrpc. No I'm running a geth instance locally with: geth --mine -rpccorsdomain "*" --ipcapi "admin,eth,miner" --rpcapi "eth,...
4
votes
1answer
979 views

truffle migrate specific file

Is it possible to truffle migrate only one specific file? I found this on the internet: https://github.com/trufflesuite/truffle-migrate/issues/23 but truffle migrate -from 2 starts to migrate from ...
4
votes
1answer
2k views

Return a mapping in Truffle test

How would you guys call a mapping from a test and get the values? This is the mapping that I have on my contract: mapping(address => uint[29]) balanceOf; It´s a mapping to an array of integers ...
4
votes
2answers
664 views

Deploy Contract (compiled by Truffle) without using Truffle

A contract SimpleStorage.sol has been compiled by Truffle using truffle compile. Its artifact is found at build/contracts/SimpleStorage.json. However, this contract should only be deployed to the ...
4
votes
1answer
710 views

Error: invalid address during truffle migration process in Rinkeby network

I can't deploy my contract to Rinkeby network through truffle migrate --reset --network rinkeby. My truffle.js file looks like this: { networks: { rinkeby: { { ...
4
votes
1answer
1k views

truffle migrate fails with Network state unknown, Error: account is locked

I'm trying to run the truffle demo on the ethereum testnet but truffle migrate fails with "Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: account is ...
4
votes
1answer
4k views

Get block address through web3.eth.getBlock(1)

I'm getting a list of the last few blocks like described here. Now I can't seem to get the address of each block or the associated contract, through web3.eth.getBlock. A lot gets returned, but no ...
4
votes
2answers
1k views

truffle deploy to geth failing, generating “receipt not found” repeatedly from geth

I've just installed truffle on an ubuntu virtualbox, and it is failing to deploy to a geth dev setup. Geth gives me a never-ending receipt not found for transaction ...
4
votes
2answers
47 views

How to test a function call that should fail?

Im using Truffle to test my smart contracts written in Solidity and I would like to mark test as passed if function call/execution fails. Example: await instance.cancelOrder({from: accounts[1]}); ...
4
votes
2answers
922 views

Truffle Migrations | Same contract deployed multiple times

I'm using truffle migrations a lot, and I would like to deploy a contract twice during my migrations. Is it possible? Nowadays, I'm using migrations like const MyContract = artifacts.require('...
4
votes
1answer
792 views

Contract deployed successfully to Ganache via Truffle, fails to deploy on live network

I basically followed this Zeppelin crowdsale tutorial, just changed the names of the contracts. I was able to successfully deploy on a local Ganache, but then when trying to deploy to the live ...
4
votes
1answer
2k views

How to set truffle-hdwallet-provider as the Web3 currentProvider inside a web page

https://github.com/trufflesuite/truffle-hdwallet-provider/blob/master/README.md provides sample usage for the deployment configuration inside tuffle.js. I need a sample that update the Web3 ...
4
votes
1answer
584 views

Using truffle migrate with Ledger Nano S

I am using truffle to develop new contracts and I have successfully deployed contracts to the Rinkeby Testnet directly with truffle. However, this process, like the one using the MainNet, requires ...
4
votes
2answers
629 views

Failing Transaction within Truffle Testing

How does one test a transaction that is supposed to fail when testing with truffle? For example, say I was testing an ERC token, in which accounts[0] had a balance of 20. Within a test, I call ERC....
4
votes
3answers
2k views

How can I setup Angular with Truffle?

I've been looking for a way to hook up Angular with Truffle for a demo dApp I'm thinking of building but I'm unsure as to how to setup the development environment that would allow me to work with both ...
4
votes
1answer
656 views

Implementation of Oraclize callback tests with Truffle/Mocha

I'm trying to write tests in Mocha/JS with Truffle for a Solidity function that uses Oraclize. I want to test if the result in the callback of my Oraclize query is correct. As Oraclize needs some time ...
4
votes
1answer
2k views

Truffle.js and Kovan/Ropsten

I am trying to use truffle.js and the testnet. I want to test using Kovan an Ropsten. Here is the doc from truffle - networks: { "live": { network_id: 1, // Ethereum public network // optional ...
4
votes
1answer
2k views

Error: VM Exception while executing transaction: out of gas

I'm new to smart contracts, so please be gentle ;) I'm having trouble deploying a contract to testrpc using truffle. $ truffle deploy Error deploying LFC: Error: VM Exception while ...
4
votes
2answers
829 views

Truffle Compile with Solidity 0.5.0

I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and it does seem to work. The problem I have is that I am unable to compile ...
4
votes
2answers
3k views

What is use of HDWalletProvider in Truffle config?

The sample code here for deploying to Ropsten used HDWalletProvider and a mnemonic in the config, but I am not sure I understand its purpose. Is this just telling it the account that will become the ...
4
votes
1answer
609 views

Solidity, Ethereum ICO, Truffle and my head exploding

I am trying to somehow end up with a solidity code (for an Ethereum token and a Crowdsale contract), that I can paste in the source code bar in Ethereum Wallet and deploy the Token and the Crowdsale ...
4
votes
1answer
2k views

Truffle console.log is not working

I've installed Truffle by npm, and running testrpc, but console.log is not working in Truffle console. A simple console.log('test'); do nothing. Any idea?

1
3 4
5
6 7
42