Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
3
votes
1answer
336 views

testing fallback function with truffle js

SOLUTION BELOW How do I go about testing the following fallback function: function () public payable { revert(); } being that the function does not have a function name, what do I need to do to ...
3
votes
1answer
572 views

How to store encrypted mnemonic for Truffle + Infura mainnet deploy

I'm about to deploy a small Dapp to Mainnet using infura. Built using express + truffle. I'm curious to hear how people are storing their mnemonic value when deploying to mainnet using truffle + ...
3
votes
2answers
4k views

how to uninstall truffle in usr/bin

My truffle got installed in usr/bin/truffle, how do I uninstall it, npm uninstall/remove is not working, please help. Thanks
3
votes
1answer
757 views

How to run truffle tests on testnet?

My truffle tests use several accounts and send tokens between them, so how would I run such a truffle test on testnet, e.g. Rinkeby?
3
votes
1answer
196 views

Conditions in truffle migration

How can I arrange conditional branching in truffle migration based on the chosen of the network for migration(development, ropsten, main, etc) or based on the Linux environment variables?
3
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 ...
3
votes
1answer
291 views

How can I pass Mocha switches when calling Truffle?

When calling truffle test some_test.js, I would like to pass Mocha switches. For example: truffle --no-colors test some_test.js works fine. However: truffle --reporter json-streams test some_test.js ...
3
votes
2answers
2k views

How to test contract functions with onlyOwner modifier?

I have a contract that inherits from Ownable, and some of its functions use onlyOwner modifier. I use truffle for local deployments to Ganache and testing. Say, I have a contract: contract ...
3
votes
1answer
1k views

instance.balanceOf(…).call is not a function

I have ERC20 standard token functions in my code...I´m trying to test the function balanceOf(address _owner) with a javascript test on truffle but I have the following problem: TypeError: ovxet....
3
votes
1answer
653 views

Having to set reset flag with truffle migrate

I am having a weird issue where my migrations are not being deployed when I run truffle migrate --network development. But when I run truffle migrate --network development --reset, the contracts are ...
3
votes
1answer
322 views

What are the differences between callback and OAR address

I am using Oraclize with testrpc and truffle and I have confused in some points Now when I choose an address account when run the bridge, why and what is the purpose of the choice. node bridge -a 1 ...
3
votes
1answer
2k views

Truffle error: Cannot read property 'call' of undefined [duplicate]

I am trying to run the following contract in truffle, which is pretty much the same HelloWorld but I kept the name MetaCoin from the truffle example. I have read this, this, and this posts related to ...
3
votes
1answer
624 views

truffle test - not able to understand why the control jumps to different test case

I am trying to write unit test cases in truffle framework.I am able to write and execute them. However, whenever I have 2 or more test cases the control jumps from 1 test case to another. For ex: In ...
3
votes
2answers
1k views

Truffle on Windows 10: how to unlock an account for migration to a private network

I try to migrate a smart contract to a private network via truffle on Windows 10. I specify a certain account in truffle.js and so far I get the following error: Error encountered, bailing. Network ...
3
votes
1answer
2k views

Ether transfer to another account

-I am trying to transfer ether from one account to another using smart contract which is deployed on azure. -when I call receiverAddress.send(amount) in the function in my contract it returns the ...
3
votes
1answer
1k views

Preset testRPC account balances not showing up in Solidity contract mapping, during truffle console session

I notice that preset balances in testrpc, like this: unix$ testrpc --account="privKey1,balance1" --account="privKey2,balance2" ... don't get passed to this Solidity data structure: mapping(address =...
3
votes
1answer
242 views

TestRPC - Pythereum - No handlers could be found for logger “jsonrpc.manager”

I am trying to get the standard init tests to work but I am getting the subject error. could you please help me to resolve this. Thanks, TestRPC/0.8.7/linux2/python2.7.12 Available Accounts ...
3
votes
3answers
1k views

Why does truffle console work fine with testrpc but truffle serve isn't finding accounts?

I'm running testrpc on the default port 8545. I run truffle console and test with: web3.eth.sign(web3.eth.accounts[0], web3.sha3("123")) This works fine. According to docs the sign method only works ...
3
votes
1answer
631 views

Assigning a 2D byte array and accessing via Web3

So I'm trying to work with two-dimensional byte arrays and am experiencing some results that I don't quite understand. I am using Truffle v2.0.4 for compiling/deploying my contracts with ethereumjs-...
3
votes
1answer
146 views

Migration between frameworks

How much effort would it be to migrate a Dapp written in embark to truffle or vice-versa? Which parts of the code can be preseved (would work in both frameworks)?
3
votes
2answers
718 views

Error while migrating contracts to Ropsten using truffle - Error: legacy access request rate exceeded

I'm deploying some contract to Ropsten ethereum test network using Truffle but it gave me this error: Error: legacy access request rate exceeded I have no idea what does it means and what should I ...
3
votes
1answer
257 views

“ app.candidates is not a function” getting these error while caling the function through truffle console with "app.candidate'

pragma solidity ^0.5.0; contract Election { //Model a Candidate struct Candidate { uint id; string name; uint voteCount; } //Store Candidate //Fetch ...
3
votes
1answer
414 views

Pass array of structs to contract from truffe using ABIEncoderV2

How do you pass an array of structs from Truffle (javascript) to a smart contract (Solidity)? There are a few similar questions (like this one and this one) whose answers say you cannot pass a struct ...
3
votes
2answers
1k views

How to Listen to Contract Events in Drizzle

Let's take the example of the SimpleStorage contract that comes with the truffle box drizzle-box How can we listen to the event StorageSet and console.log it to the JS console? drizzleOptions.js ...
3
votes
1answer
619 views

Truffle - Transfer leads to “Error: VM Exception while processing transaction: revert”

For reference, I am using Solidity to develop a smart contract for my company. I created a smart contract and attempted to use Truffle and Ganache to unit test it. However, I'm having a bit of an ...
3
votes
2answers
601 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 ...
3
votes
1answer
2k views

Convert hash function hex to bytes32

The output of hash function SHA256 is a hex string of size 64. For example: 3ed54831f488a22b28398de0c567a3b064b937f54f81739ae9bd545967f3abab I want to call the function of a smart contract with the ...
3
votes
2answers
639 views

How can I access the address of a contract in a drizzle dapp?

I've started working from the drizzle box and can access functions within contracts, but if I want to give an allowance to a contract address so it can use users tokens how can I give the correct ...
3
votes
2answers
2k views

TypeError: Web3 is not a constructor when trying to use node.js with truffle-contract

I'm trying to use node.js with my smart contract for my app. As I've tried to convert from using the default app.js set-up to index.js set-up I've ran into this weird issue I can't fix. It throws ...
3
votes
1answer
379 views

Truffle Test: How to test SafeMath Library for overflow

How can I test if a function is resistant against overflow with truffle test? contract SafeMath{ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b;...
3
votes
3answers
3k views

Truffle Error- VM Exception while processing transaction: revert

I create a smart contract to sell my token.I am following the Dapp University(youtube channel) course. I have done unit testing of smart contract.All test cases pass. And I am trying to buy token ...
3
votes
1answer
2k views

Truffle Framework “Block-scoped declarations not yet supported outside strict mode”

I have tried to install and use the Truffle Framework through npm on Elementary OS (Ubuntu distribution). There where no obvious issues with the installation but when running any command e.g. "truffle ...
3
votes
1answer
2k views

Transaction gas cost in truffle test case

Below is from a truffle test cases in javascript, where I was trying to add the gas cost to an account balance to confirm the sum of transaction, where the sum should be equal to the previous balance. ...
3
votes
1answer
2k views

Problem with bytes32 values

I am facing problem with bytes32. Here is my sample contract: pragma solidity ^0.4.16; contract Test { bytes32 public input; function test(bytes32 _in) public { input = _in; } } ...
3
votes
1answer
494 views

Past transactions inconsistent on Metamask with Ganache

I completed the truffle framework pet shop tutorial using Metamask and Ganache. The blokchain (locally hosted on port 7545) stores my "pet adoptions" which are represented as ethereum transactions. I ...
3
votes
2answers
1k views

Ethereum Smart Contract for crowdsale with KYC verification

I have created the ERC20 token. I am looking to do a crowdsale with KYC. Is there any tool for crowdsale or demo project that uses KYC so I can learn about it?
3
votes
1answer
1k views

Truffle CMD Bignumber to number; hex to string

A function in my contract when called on the truffle develop command line gives output in BigNumber format. Here is what I wrote on the command line: instance = contract.at('deployed address') ...
3
votes
4answers
2k views

How do I get ETH into my testnet Metamask wallet?

After switching to testnet from the dropdown in Metamask, the address used is still my Mainnet address. web3.eth.getAccounts(function(a,b) { Merchant.accounts = b; console.log("Merchant ...
3
votes
1answer
299 views

How to include an other contract from a different folder while unit-testing with truffle?

The folder structure is as follows: Examples | +- Multiply | +- Solidity | +- contracts | +- MultiplyContract.sol | +- UUIDProvider ...
3
votes
1answer
397 views

Truffle Test: Checking for Tx Failure: tx.receipt.status vs. throw/revert

Post Byzantium, when I am testing contract functions, some either (1) return a transaction object/receipt with a status field, while others (2) fail and revert. Checking for 1) transaction object ...
3
votes
1answer
368 views

Contract getters not returning correct result

I am trying to interact with a basic certifications contract that stores certifications using truffle and when I deployed this contract on Remix, everything works. But as soon as I deploy it locally,...
3
votes
1answer
1k views

Truffle. How to link deployed library by address during migration?

For now I use this code to link library during truffle migration: deployer.deploy(SafeMathLibExt); deployer.link(SafeMathLibExt, [CrowdsaleTokenExt]); deployer.deploy(CrowdsaleTokenExt); This code ...
3
votes
1answer
102 views

Issue in executing transaction using testrpc in truffle

I have created an app using truffle and testrpc. I have verified the contract functions using truffle console..It worked. But while executing the transaction from front-end it is getting the following ...
3
votes
1answer
2k views

Truffle: Contract transaction couldn't be found after 50 blocks

I'm trying to deploy a contract to the Ropsten testnet via the truffle console. In my truffle.js file, I set the gas parameter to gas: 4700000. When I run migrate --reset, I always get this error no ...
3
votes
1answer
460 views

Solidity Browser and Truffle giving different bytecodes

I am compiling in solidity browser and then compiling the same exact code in truffle. The code is the following: pragma solidity ^0.4.11; contract double{function d(int256 a)constant returns(int256){...
3
votes
1answer
234 views

fallback-to-build error while installing Truffle in Ubuntu 16.10

I was installing Truffle in Ubuntu 16.10 using sudo, but I got the following error message: npm WARN wrtc@0.0.63 license should be a valid SPDX license expression npm ERR! Linux 4.4.0-59-...
3
votes
1answer
653 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 ...
3
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 ...
3
votes
1answer
1k views

Parity mining on --chain dev for truffle migrate

I am using Parity to create a custom app and so I am using it locally on --dev. "$ truffle migrate" fails, I think because there is no balance in the account. It says: Error: Insufficient funds. ...
3
votes
1answer
408 views

Truffle Migrations missing ConvertLib.sol, etc

Using testrpc v3.0.3 and solidity Getting the above error while deploying this contract in testrpc private net pragma solidity ^0.4.4; import "./ConvertLib.sol"; import "./Agreement.sol"; contract ...

1 5 6 7 8 9 41