Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
6
votes
2answers
2k 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
0answers
6 views

Error: Truffle is currently using solc 0.5.8,

i run migrate in the terminalbut it shows Error: Truffle is currently using solc 0.5.8, but one or more of your contracts specify "pragma solidity ^0.4.27". Please update your truffle config or ...
0
votes
1answer
1k views

Truffle Error : VM Exception while processing transaction: revert

I am trying to call following function of smart contract from App.js: function addCandidate(bytes32 _name, bytes32 _party) public{ //require(msg.sender == votingAdmin); //if(msg.sender != ...
1
vote
1answer
58 views

Truffle config not matching web3 infos

At truffle.js I set the account to the third ganache's account Then I run truffle console and coinbase was set to the first account and defaultAccount to undefined. Not only that, I've tried to ...
3
votes
1answer
467 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
16 views

I am getting the following wrror while i tried to do node <file name> and also truffle test <file name>

Error: Cannot find module 'web3' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module....
0
votes
1answer
43 views

Deploy smart contract on Ropsten with Truffle without truffle-hdwallet-provider

Here is my truffle-config.js networks: { ropsten: { network_id: 3, host: '127.0.0.1', port: 8545, gas: 4000000, from: "address_in_metamask" }, I ran a geth node using the command: geth --...
0
votes
1answer
414 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
0answers
18 views

Error while installing truffle-hdwallet-provider

I am on windows OS and my current python version is 3.6 and node version is v10.12.0 I am trying to install truffle-hdwallet-provider by running following command: npm install --save truffle-...
0
votes
2answers
22 views

ParserError: Expected identifier, got 'LParen' constructor() public {

i don't know why i get this problem, anybody who can helps thanks a lot pragma solidity ^0.4.21; contract MathContract { function mulAtoB(uint a, uint b) pure public returns(uint) { ...
0
votes
1answer
37 views

Saving a function in a variable in Solidity

I am very new to solidity and stack exchange as well. I am trying to use the date time api from https://github.com/pipermerriam/ethereum-datetime/tree/master/contracts. What getYear(date) does is ...
1
vote
2answers
156 views

How secure is an Oracle?

I am working on oracles. I saw this link - https://kndrck.co/posts/ethereum_oracles_a_simple_guide/ The code works, I tested it. But what is the issue to me, is the code actually secure? Can someone ...
0
votes
0answers
14 views

Error: IPFSInbox has not been deployed to detected network

It's my first time writing smart contract in solidity and using IPFS to develop my dapp. I don't know how to solve it and why it pops up this errorNo web3 instance injected, using Local web3. Error: ...
0
votes
1answer
863 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 '...
0
votes
1answer
27 views

“truffle init” problem

What to do to resolve below issue coming in initiating a truffle project? YuweideMacBook-Air:vantoken yuwei$ truffle version Truffle v4.1.4 (core: 4.1.4) Solidity v0.4.21 (solc-js) YuweideMacBook-...
0
votes
2answers
69 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 ...
0
votes
2answers
65 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
439 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 ...
6
votes
4answers
3k views

Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist

I'm trying to initialize a directory with truffle init, but I'm getting the following error: Error: Truffle Box at URL https://github.com/truffle-box/bare-box.git doesn't exist. If you believe this ...
0
votes
1answer
22 views

how to correct this code with pragma solidity^ 0.5.8? thx

pragma solidity ^0.5.8; contract HelloWorld { function test() pure returns (string) { return "HelloWorld"; } }
2
votes
1answer
509 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 ...
1
vote
1answer
21 views

Upgradability Proxy ADMIN_SLOT assembly sstore does not update

I'm currently playing around with Proxy Upgradability, and noticed the use of assembly in terms of the new upgraded contract and the slot assigned. Real implementation can be seen here. I have ...
0
votes
1answer
566 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
27 views

TypeError: Cannot read property 'nodes' of undefined

I'm new to ethereum, and I'm trying to test the depositToken function of etherdelta on linux, which version is 0.4.9, and the token I use is vixcore which version is 0.4.24, and I got this error when ...
6
votes
3answers
6k views

Difference between Ganache and Truffle

What is the difference between this two? I understand that Ganache is like a fake blockchain, but Truffle has that too ? What are the limitations of each and under which circumstance we use either ...
0
votes
0answers
11 views

Truffle migrations - get deployed contracts list

I have the following problem: migrations no. 7: (deploy proxies) await deployer.deploy(TestProxy); await ExportUtils.addDeployed(await TestProxy.deployed(), true, { privileges: [ { ...
2
votes
2answers
494 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 ...
0
votes
1answer
59 views

Failed to install Truffle on MacOS Mojave

I am currently really struggling in getting Truffle up and running. I am running MacOS Mojave and have Node (v.10.16.0) and NPM (6.9.0) and have tried npm install -g truffle and have gotten: ...
4
votes
1answer
368 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 ...
0
votes
1answer
23 views

Cannot Find Module Error for Truffle-contract

Error:- Uncaught Error: Cannot find module './truffle-contract.min.js' at c (web3.min.js:1) at c (web3.min.js:1) at index.html:27 <!DOCTYPE html> <html lang="en"> <head&...
1
vote
2answers
2k 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....
0
votes
3answers
189 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 ...
2
votes
2answers
59 views

Ganache GUI installation error

node version v12.8.0,npm version 6.10.2 I followed the below steps to install the ganache GUI but I got the error $mkdir ~/ganache $git clone https://github.com/trufflesuite/ganache.git $npm install ...
1
vote
1answer
964 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)...
1
vote
1answer
943 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 ...
4
votes
1answer
306 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 ...
1
vote
1answer
545 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
140 views

Truffle tries deploy from unknown account

I am trying to deploy a contract to Ropsten using Infura with the config file truffle.js below. The deploy fails because the account listed in the error message has insufficient funds – however I do ...
0
votes
1answer
40 views

Simple Truffle tests timeout “before all” hook: prepare suite

I'm trying to write my first tests for truffle, but I run in a timeout each time I want to execute the tests. Error: Timeout of 120000ms exceeded. For async tests and hooks, ensure "done()" is ...
0
votes
2answers
24 views

Truffle error missmatch artifact

What does this means?network/artifact mismatch Contract has not been deployed to detected network but when i write truffle network i can see mine.
6
votes
2answers
2k views

getData() is not working

I want to call a function of the contract, something like this - module.exports.transfer = function(to,value,){ return token.methods.transfer.getData(to, value); } But I am facing the error ...
2
votes
1answer
268 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\...
5
votes
2answers
2k views

Accessing struct fields in Web3 returned by a promise in Truffle

I'm using web3js (via Truffle) to make a call to a contract, to access a struct in a mapping. mapping (bytes32 => entry) public entries; struct entry { Mode status; Deed deed; uint ...
1
vote
1answer
10 views

ganache test returns characters instead of numbers

mapping(uint256 => uint256) public amount; function saveAmount(uint256 _id, uint256 _amount) public { amount[_id] = _amount; } I have a function that saves amount in mapping. When I test ...
0
votes
1answer
403 views

Running A Smart Contract With Two Nodes on Truffle

We have installed truffle to two nodes and we initialize our private blockchain with: $geth --datadir node init genesis.json Then we run geth on both nodes with: $geth --datadir node --nodiscover -...
0
votes
1answer
27 views

Issue with Serverless deploy of smart contract-Dependency mismatch -Package.json,Package-lock.json error

I'm trying to deploy my smart contract serverless(AWS lambda) and I'm using Truffle framework. The code is getting deployed in an earlier system(earlier it was deployed here). Now I have updated the ...
0
votes
0answers
14 views

Use web3 0.2.x within Truffle V5

It's a pain to have to refactor tests written for TruffleV4 in web3 0.2.x to web3 1.0.x. Is there any way to avoid this situation by using web3 0.2.x instead within Truffle V5?
0
votes
1answer
2k views

invalid address error on running code - solidity

Here is my code : var Web3 = require('web3'); var fs = require("fs"); var Artifactor = require("truffle-artifactor"); var provider = new Web3.providers.HttpProvider("http://localhost:8545"); var ...
0
votes
1answer
23 views

Can't log struct member in truffle test

Contract : mapping (bytes32 => MyStruct) public myMapping; struct MyStruct { uint256 myMember; uint256 someOtherMember; } Test (Truffle) This works: let ...
1
vote
1answer
38 views

truffle migrate --network kovan issue

When I run truffle migrate --network kovan in the terminal the contract deployment doesn't run. Just: Compiling your contracts...==================== >Eveything is up to date, there is nothing to ...