Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [truffle]

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

2
votes
1answer
248 views

Pending transactions are not mined

Preconditions I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network. Versions ...
0
votes
0answers
17 views

I can not make a transaction in the system Blockchain

I am studying blockchain, found a project on github. Make all the necessary settings, the project launched, but I can not make a transaction when adding data to the system. The project is under the ...
0
votes
3answers
22 views

Solidity Compatibility Configuration

I am a cyber security analyst who is new to ethereum and working on a project to study crypto security. It's a series of 22 vulnerable smart contracts that you're supposed to exploit. For anyone who ...
1
vote
1answer
187 views

No output when writing data to IPFS and storing its hash through Solidity

So I am using truffle. Following from Creating a form in IPFS for users to enter data [check the code in answer], doing some changes: Contract name - IpfsContract.sol test.js uses the following JSON ...
0
votes
1answer
7 views

Why Could not find artifacts for contract from any sources

I am using windows 10 with truffle and ganache-cli. I have 2 contracts file to be deployed contain interfaces of other contracts defined within the contract: Contracts: ERC721Mintable.sol Ownable ...
0
votes
0answers
25 views

Web3 Cannot read property 'apply' of undefined

I'm new to dapp and trying to follow iwaldman to build an ipfs-image-dapp. Here is the repo: https://github.com/iwaldman/ipfs-image-dapp. But running yarn start gives the error Cannot read property '...
0
votes
1answer
12 views

truffle testing enum

I am trying to test an enum value from a test. This is simplified version of the contract: pragma solidity >=0.5.0 <0.7.0; contract Foo { enum State { StateA, StateB } State ...
0
votes
1answer
252 views

Can I find constructor arguments from truffle artifact?

I'm in the process of verifying my contract on Etherscan. Etherscan asks for ABI-encoded constructor arguments during the verification process, though I was a bit silly and don't quite know what they ...
0
votes
0answers
7 views

Quorum 7nodes example unable to finish simplestorage migration using privateFor

I'm following this example: truffle quorum example I created a cluster using docker-compose and all the nodes are up and running but when I run the truffle migrate command the migration doesn't end ...
1
vote
1answer
189 views

Truffle test case to unit test withdrawal pattern

How can I test the withdraw() function in a truffle javascript test case for the below contract? The problem is, If I use the msg.sender from the same contract, the before and after balance will be ...
1
vote
1answer
2k views

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

With truffle-contract, all you needed to do to get the contract instance was something like this: const getContract = require('truffle-contract') const contractJSON = require('./MyContract.json') ...
0
votes
2answers
509 views

How to access Truffle deployed contracts with app's javascript code?

I have some smart contracts deployed with Truffle on the local Ganache network, but I don't know how to access it with the app's javascript in order to make function calls to the contract. How would I ...
1
vote
2answers
41 views

Truffle Ropsten Deployment Issues

I just made some updates to my contracts and tried to redeploy them - but I'm getting this message, over and over again. Its not even attempting any of the migrations - it just goes right to this ...
0
votes
1answer
63 views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...
1
vote
0answers
14 views

truffle unbox react - front end is unable to read / set state of the contract

I am experiencing problems with the Truffle React boilerplate code that the front end is unable to read / set state of the contract. Here are the details: I unboxed the React boilerplate using ...
0
votes
2answers
32 views

find the bytecode of a contract during compilation

Is there a solution to recover the complete bytecode (init + runtime) of a contract imported in solidity. For example "bytes code = getBytecode (Escrow.sol)" and this would be replaced by bytecode ...
-2
votes
0answers
8 views

truflle consile error BN { negative: 0, words: [ 0, <1 empty item> ], length: 1, red: null [on hold]

i was getting error in truffle console BN { negative: 0, words: [ 0, <1 empty item> ], length: 1, red: null
0
votes
1answer
243 views

Comparing msg.value using javascript test always fails

So I have this solidity function: function claimGoodTest(uint256 typeId) public payable { if (msg.value < 4000) revert(); } I test it with the following: var result = await contract....
1
vote
0answers
37 views

openzeppelin,VM Exception while processing transaction: revert

using openzeppelin-solidity to create crowdsale. Then I use this statement to Buy Token: MyCrowdsaleInstance.sendTransaction({ from: purchaser[1], value: web3.utils.toWei("0.5", "ether"), ...
0
votes
1answer
184 views

How can I use truffle to deploy my contract to a local testnet (not testrpc)?

I followed the steps in the following link to create a local Ethereum testnet, but now I want to deploy a contract to "MyTestNetNode": https://medium.com/@WWWillems/how-to-set-up-a-private-ethereum-...
1
vote
2answers
924 views

Identifier not found or Not Unique testing contract truffle

Created a simple HelloEthereum.sol contract: pragma solidity ^0.4.17; contract HelloEth { string message; function HelloEth() public{ message = "Hello Ethereum!"; } ...
3
votes
1answer
29 views

Ganache + Truffle: how to deploy a contract without considering the gas

I am working with Ganache and Truffle. I am trying to deploy kind of a huge smart contract, but most of the functions in this smart contract are pre-prod functions, so I do not really worry about real-...
0
votes
1answer
177 views

Loading truffle library in remix browser IDE

Besides writing smart contracts in the browser, I would also like to write my test in this IDE. Any suggestions how to load the truffle files in http://remix.ethereum.org? I appreciate your help!
0
votes
2answers
248 views

TypeError: Data location must be “memory” for parameter in function, but none was given

Contract fail to compile in IDE Remix.due to the following error: TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given. version:0.5.6+commit....
2
votes
2answers
634 views

modify truffle console command to execute function on ropsten deployed contract thru geth

There are a couple of commands, reproduced below, which I've used successfully in the truffle console, executing on testrpc, which work and elicit the responses that I expect. How can I change them ...
0
votes
0answers
14 views

Contract has no network id set, cannot lookup artifact data

I am using web3 v1.0.0-beta.37 and truffle contract for server.js configuration. I have defined two contracts FlightSuretyData.sol and FlightSuretyApp.sol FlightSuretyApp contract access functions ...
0
votes
1answer
206 views

Error: The contract code couldn't be stored, please check your gas amount during deploy

I know this issue was discussed before several times, but I cant get the solution to my problem. I'm trying to deploy a contract with Truffle on Ganache. During the deployment in 2_deploy_contracts....
0
votes
0answers
25 views

Error : Could not connect to your Ethereum client with the following parameters:

Im creating my dapp with following below tutorial. http://www.dappuniversity.com/articles/the-ultimate-ethereum-dapp-tutorial however Im facing an error when I run truffle console it shows >...
1
vote
2answers
32 views

What are contract Variables and how are they different from normal varables declaration

pragma solidity ^0.4.2; import DappToken; contract DappTokenSale { address admin; DappToken public tokenContract; function DappTokeSale(DappToken _tokenContract) public { ...
0
votes
2answers
24 views

Load accounts to truffle

I'm using truffle v5.0.14 to handle my contracts. All was well while developing with ganache, but when I wanted to deploy to the real network (a private one) I have problems with the account. The ...
0
votes
0answers
16 views

truffle-assertions: TypeError: Cannot read property 'filter' of undefined

There is a part of my Solidity code: event elo(address pAddress); function test() external { emit elo(m_Registry); } And a chunk of my test: const truffleAssert = require('truffle-...
0
votes
1answer
246 views

Contract not using Upgraded Proxy Contracts

There's 2 contracts A and B, A imports B, where B is a library that can be upgraded. To achieve this, I tried replacing B with a proxy contract and a delegate contract. We now have contracts Foo, ...
0
votes
1answer
221 views

How to deploy smart contract to main ethereum network

I am tring to deploy our ERC20 token in main net it gives an error Error: exceeds block gas limit. First I download or sync whole blockchain using geth command ( geth --syncmode "fast" --rpc --rpcapi ...
0
votes
0answers
15 views

Error occurs when I attempt to run `npm install drizzle` (Truffle product)

I am having an issue using Drizzle. When I run the command npm install drizzle I get the following error: How can I fix this?
39
votes
6answers
18k views

Truffle Migrate doesn't work: Error: No network specified. Cannot determine current network

When I try to run my migration with truffle migrate the following error message appears: Error: No network specified. Cannot determine current network. at Object.detect (/usr/local/lib/...
0
votes
2answers
445 views

Deploying on Rinkeby with Truffle using infura

If I want to use HDWalletProvider to deploy my contract on a specific address, what should I do? rinkeby: { provider: () => { return new HDWalletProvider("Mnemnoic", "https://ropsten.infura....
1
vote
2answers
22 views

How do I determine the network within a truffle exec script?

I'm writing a script to be executed with truffle exec and I need to add some logic conditional on the network we're calling truffle exec with. This is (roughly) what I want in my script: const ...
1
vote
1answer
124 views

call graphs for solidity smart contracts

Do we have some open source tools where we can get call graphs for solidity smart contracts execution ? For ex: Suppose Function A in contract C calls some other function B so the graph should contain ...
1
vote
3answers
38 views

Issue deploying this contract

This is a contract im trying to deploy and i think its an abstract contract as most of the functions dont seem to be implemented... anyway the issue im facing is that truffle is telling me i cant ...
0
votes
1answer
44 views

problem of call() returns null

contract permission{ struct transaction { address payable sender; address receiver; string datatype; Status status; } function getTransactionCount() public view ...
0
votes
1answer
30 views

A single exception in Truffle test causes every other test cases to fail

I'm making test script for my contract and it looks likes contract('...', async () => { let token = null; before('deploy', async () => { token = await MyContract.new(...); })...
4
votes
1answer
278 views

Truffle test fails to call the base function, wants the override

I have an extended ERC20 contract with ERC827 functions, which are overrides of ERC20 with an extra callback parameter. I have these two pairs of base/override functions: Base: function ...
0
votes
1answer
276 views

problem starting ganache

I'm using truffle with ganache GUI. It worked fine at first, but now I am unable to start it. (I made it executable) When I run ./ganache.AppImage I get this message: installed: X-AppImage-BuildId=...
2
votes
1answer
202 views

How would one use stubs for unit testing solidity code?

Given some contract A, that depends on another contract B, what would be the best way to unit test functions from A without inadvertently testing code from B. Normally, we could use stubs to return ...
0
votes
1answer
27 views

Truffle Exec Return Events

I have set up a JavaScript file that takes in my contract and executes the various functions and then returns the correct events. The file runs through 'truffle exec'. I am using the following line ...
2
votes
2answers
716 views

Truffle cannot find Ethereum client when running tests

By default this is the content of the file truffle.js: module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! }; ...
0
votes
1answer
259 views

Passing command-line arguments to 'truffle test'

I have a JS script which I pass to truffle test from command line: truffle test my_script.js I would like this script to take an input argument (retrieved via process.argv[2]). Does `truffle ...
2
votes
1answer
942 views

token transfer fails in crowdsale contract

I have a token contract and a crowdsale contract. When I try to send ether to the crowdsale contract from accounts[3](or any other really), I get an opcode error: Error: VM Exception while processing ...
1
vote
1answer
545 views

Invalid number of arguments error for getter function with no passed arguments

I am receiving this error when trying to call the getUsers getter function from the contract below: Invalid number of arguments to Solidity function. Running on Truffle in develop mode. mapping (...
0
votes
1answer
19 views

Truffle migrations - UNABLE TO MIGRATE (Error: Deployment Failed)

The compilations goes well on the Rinkeby testnet using the command geth --rinkeby --rpc --rpcapi="personal,eth,network,web3,net" --ipcpath "~/Library/Ethereum/geth.ipc" --syncmode light --cache 64 --...