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.

0
votes
2answers
150 views

Retrieve specific account in truffle 5 console

I am following a truffle tutorial where the individual users web3.eth.accounts to retrieve all the accounts from Ganash. However that seemed depreciated and to duplicate his results I used web3.eth....
1
vote
1answer
785 views

Can't connect to local rinkeby node from web3.js

I'm developing a Dapp using truffle and I need to connect to a contract that I uploaded on rinkeby using truffle migrate --network rinkeby. Problem is that I'm unable to connect to the rinkeby network ...
0
votes
0answers
12 views

why .call() in Truffle did not return results as expected?

I'm deploying a contract to my private chain and try to call the contract's function. After I got in the geth console and finished deploy contract, I called the function but it doesn't work ...
0
votes
1answer
444 views

Deploy to mainnet with Truffle + Infura: nonce too low [duplicate]

I'm trying to deploy a very simply ERC20 token contract using Truffle and Infura and getting this: Running migration: 1_initial_migration.js Deploying Migrations... ... ...
6
votes
2answers
1k views

Conversion of address to string in Solidity

The Solution given in Convert address to string did not help. Motive: To convert an address to string type so that I can use it as a parameter to a function for which string type is necessary. Code ...
0
votes
1answer
18 views

TypeError: tokenInstance.balanceOf is not a function

It happen when use truffle test, here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin; DappToken public tokenContract; ...
0
votes
1answer
15 views

tokenInstance.balanceOf is not a function

It happen when use truffle test, and here my DappTokenSale file: var DappToken = artifacts.require('./DappToken.sol'); var DappTokenSale = artifacts.require('./DappTokenSale.sol'); contract('...
3
votes
1answer
448 views

Deploying on contract on main net - Error: insufficient funds for gas * price + value

Running geth v 1.7.3 truffle 4.0.5 truffle-config.js module.exports = { networks: { development: { host: "localhost", port: 8545, network_id: "*" // Match any network id ...
0
votes
1answer
13 views

ReferenceError: admin is not defined

It happen when use truffle test, here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin; DappToken public tokenContract; ...
1
vote
0answers
35 views

Error: Returned values aren't valid, did it run Out of Gas?

I got this problem when follow the instruction, here my two contract: 1) token sale contract: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address payable admin;...
0
votes
1answer
371 views

truffle migrate cause “Error: insufficient funds for gas * price + value truffle migrate”

When I run "truffle migrate" to deploy contract to geth, I got this error: "Error: insufficient funds for gas * price + value truffle migrate". this is the genesis block of my private chain: { "...
0
votes
2answers
39 views

(Truffle) how to call finalize() function after finishing crowdsale

I would like to call token.transferOwnership(msg.sender) after finishing timed crowdsale. So, I inherited FinalizableCrowdsale contract, then override finalization() function to call transferOwnership ...
0
votes
1answer
21 views

Operator == not compatible with type unit256 and address // TypeError: Invalid type for argument in function call

I got 2 problem when i follow instruction. Here my contract file: pragma solidity ^0.5.0; import "./DappToken.sol"; contract DappTokenSale { address admin; DappToken public tokenContract; ...
1
vote
1answer
20 views

Struct member access in web3 requires additional dummy field

If a struct contains a single field, then that field is inaccessible from web3. In the below example, field uint b must also be present in order to access field uint c from web3. Of course, it's not ...
0
votes
1answer
848 views

Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: VM Exception while processing transaction: revert

Googled around and nothing could solve this error. truffle migrate --network development Using network 'development'. Running migration: 2_deploy_contracts.js 1520374082 1522102082 1000 '...
2
votes
1answer
3k views

Send ether from web3 to fallback payable contract function

I'm trying to send some Ether to the payable function of my contract and I'm unable to find/understand a resource to do so. Here's my attempt below: Web3 App file (simplified, without initialisation ...
6
votes
4answers
627 views

Truffle: Migrate to ropsten - fails silently

When I run the following command I receive no output whatsoever: truffle migrate --network ropsten This is just after creating a new project using truffle init and creating a single contract. When ...
2
votes
1answer
428 views

Truffle Bytecode Different from Etherscan Bytecode

I am having difficulty verifying my contract code on Etherscan using the code generated by Truffle. Using Etherscan VerifyContract V1: https://rinkeby.etherscan.io/verifyContract Truffle produced ...
0
votes
1answer
510 views

How to deploy a contract to parity using truffle?

I get this when trying to deploy to parity - Writing artifacts to ./build/contracts Invalid JSON RPC response: "Provided Host header is not whitelisted.\n" I am new to using truffle with ...
0
votes
1answer
23 views

Create a large number of contracts with different addresses

I'm developing a performance test where I check the time a gateway spends to find a contract in a blockchain. I'm using ganache-cli to simulate the blockchain, my doubts are: 1) Is it possible to ...
0
votes
1answer
22 views

Invalid number of parameters for “undefine”. Got 0 expected 1!

I start my trial token sale contract, but it keep pop out this error when i test it with truffle. Here my token sale contract: pragma solidity ^0.5.0; import "./DappToken.sol"; contract ...
0
votes
1answer
399 views

Pass address[] array to Truffle deployer (MultisigWallet)

I am trying to deploy the MultisigWallet contract on testrpc. However, I can't figure out how to provide the address[] _owners constructor parameter in the deployment command. I've tried several ...
1
vote
1answer
11 views

Can ganache-cli connects to another ganache-cli?

Is it possible to create a private network using ganache-cli? Can a ganache-cli running on port 8545 connect to ganache-cli running on port 9545? Can we use ganache-cli as a node? Or it is a ...
0
votes
1answer
24 views

Accessing one smart contract contained in another smart contract from javascript

I'm cross-posting this from Stack Overflow, since there seems to be more activity here. I am trying to develop a dApp with Truffle and want to test my smart contract. The contract contains a second ...
0
votes
2answers
63 views

Having trouble figuring out Truffle testing with Javascript

I've started unit testing my contracts with Truffle (using Javascript). I'm fairly new to Truffle and Mocha both, and while I've tried to follow the tutorials, I'm struggling to follow exactly what's ...
1
vote
1answer
122 views

“before all” hook: prepare suite

This is the error code: Adoption.sol code: TestAdoption.sol code: I dont know how to solve this, it fails when i try to use this comand: "truffle test". Thanks.
0
votes
1answer
33 views

Can I automate the truffle (smart contracts) test scripts?

As we all aware about smart contract testing using truffle framework. Currently, we are writing the test scripts either in solidity or in java-script manually. Is there any way so that I can auto ...
1
vote
1answer
54 views

Deploy new contract through another contract function in Truffle

I have a function in my contract minter.sol that creates another contract etnX.sol: function createNewContract(string memory name, string memory symbol, uint256 _maxSupply) public onlyOwner { ...
1
vote
0answers
8 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
0
votes
1answer
24 views

invalid number value (arg=“_goal”, coderType=“uint256”, value=2000000000000000000)

i am following a tutorial from here. And upon running truffle test. It produces following error. 2_HashnodeCrowdsale.js ====================== Deploying 'HashnodeCrowdsale' ------...
0
votes
2answers
29 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 ...
1
vote
2answers
1k views

Out of gas when executing contract via web3 js

I am having a trouble invoking contract via web 3 js in browser. I am using truffle develop and have migrated and run tests successfully. I am also getting the info when I console.log the contract....
1
vote
1answer
753 views

Calling event.watch() and event.get() prevents truffle JS tests to terminate

My contract is contract SimpleContract { uint storedData; event SimpleEvent(uint p); // EVENT function set(uint x) public { storedData = x; SimpleEvent(x); // TRIGGER ...
1
vote
1answer
889 views

rinkeby balance says 0 after syncing even though transaction shows ether was sent

I'm using truffle to deploy a contract on the rinkeby testnet Here is transaction info saying that my address received ether however as shown below, the balance still shows as 0. truffle(rinkeby)...
0
votes
0answers
17 views

Manage accounts in Remix Web3 Provider env connected to a TestRPC client node

When I run the TestRPC client (ganache-cli), it provides me with 10 different accounts and private keys along with a local server at localhost:8545 Available Accounts (0) ...
0
votes
2answers
515 views

deploying contracts on private node taking forever

I am trying to deploy contracts on a private geth node. I have mined enough that I have the account balance and the DAG was created. Here is the netstats for the node : Now, the contracts start ...
0
votes
0answers
10 views

Can ganache serve at a directory in addition to a port?

Using the ganache command line interface I can set a seed and a port: ganache-cli --seed 2048 --port 2020 Which serves to Listening on 127.0.0.1:2020 Can I get it to serve to a directory of my ...
-1
votes
0answers
22 views

Error: Unexpected end of input [closed]

I got an problem when i run truffle test, here my cmd: and here my js file: var DappToken = artifacts.require("./DappToken.sol") contract(DappToken, function(accounts) { var tokenInstance; ...
4
votes
1answer
296 views

How do I get configuration variables (such as gasPrice) in a truffle test?

I learned from this answer that truffle configures gasPrice in truffle.js, defaulting to 100000000000. I'd like to use gasPrice in a test, without hardcoding the raw number. Is there any way to ...
0
votes
1answer
134 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....
1
vote
1answer
923 views

truffle migrate hanging on Deploying Migrations

I am deploying a contract on Ropsten Network,These are my settings 2_deploy_contracts.js var SafeMath = artifacts.require("./SafeMath.sol"); var TahaCoin = artifacts.require("./TahaCoin.sol"); var ...
0
votes
3answers
93 views

Truffle compile command stuck at “Compiling your contracts…”

I developed a dapp using my PC (OS: Pop_OS!) and it was running fine. Then I had to format PC and installed new OS (Ubuntu 18.04 LTS), due to some issues in compatibility and performance.After that, I ...
1
vote
1answer
399 views

call function from truffle console (newbie)

This should be fairly simple, but I'm still trying to wrap my mind around a lot of things. What is the easiest way of testing by hand the function addEntity? What command do I type into the truffle ...
0
votes
1answer
298 views

Truffle testrpc - public variable getter method error

I'm running into a weird issue where I couldn't retrieve the value of a public variable in truffle console. It's a public variable used as a counter to track the number of records added. I spent ...
2
votes
2answers
381 views

Cannot read property 'getBlock' of undefined

I'm having an issue with running truffle test on a Javascript test. I get the error TypeError: Cannot read property 'getBlock' of undefined. I am trying to get the time of the latest block by using a ...
2
votes
1answer
245 views

How can I use solc solidity compiler on truffle webpack?

When I try to import solc, it raises an error which says: ERROR in ./~/require-from-string/index.js Module not found: Error: Can't resolve 'module' in 'C:\users\bisrat\Desktop\webpacksample\...
0
votes
1answer
14 views

Error: sets the total supply upon deployment

Please help ! When i try to run test from truffle, i got this problem, here my test js code: var DappToken = artifacts.require("./DappToken.sol") contract(DappToken, function(accounts) { it ('...
4
votes
1answer
359 views

How long does it take to “save artifacts” to Ropsten?

Migrating contracts with Truffle I get stuck at Saving artifacts... Sometimes for 10 minutes or more. I also get: Error: Transaction 0x123...123 wasn't processed in 240 seconds! Is it normal that ...
1
vote
1answer
14 views

Return each struct value from a key inside a mapping, where the key is also a value from array inside another mapping

I have a project that I'm working on and I'm trying to figure out a way to do as the title says. I'm looking for the easiest and/or cheapest way(gas wise) and since I'm stuck I'm open to better ways ...
0
votes
1answer
18 views

This declaration shadows an existing declaration

When i try to run migration from truffle, i got this problem, here my contract code: pragma solidity ^0.5.0; contract DappToken { uint256 public totalSupply; function DappToken () public ...