Questions tagged [truffle]

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

539 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
134 views

How to implement percentage deposit function to smart contract

I need to implement on the deposit function when the ownerAddress is doing a deposit a 10% to be freeze in the smart contract and and if the ownerAddress want's to call the returnDeposit function by ...
2
votes
1answer
55 views

Transaction execution and interacting with truffle

pragma solidity ^0.4.23; contract Hotelbooking{ address receiver; function deposit(uint256 _amount) payable public { require(msg.value == _amount); // nothing else to do! ...
2
votes
2answers
126 views

Truffle interaction with my smart contract getting Vm exception

pragma solidity ^0.4.23; contract Hotelbooking { event Transfer( address indexed _from, address indexed _to, uint256 _value ); mapping(address => uint256) public ...
2
votes
2answers
871 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! }; ...
2
votes
1answer
218 views

Geth Sync Problems | Rinkeby, Ropsten | Deploy contracts

Get Geth to sync --> Rinkeby test network. For the love of god I just want to deploy a contract. I have deployed it to Ganache-cli, GUI, remixIDE, deployed with truffle/Infuria.io...I keep failing to ...
2
votes
2answers
183 views

Error when running Truffle Test in Terminal

I am trying to use truffle to test my smart contracts and have written some test files. I am getting an error on the terminal trying to run the test and am unsure what the reason is. I access my ...
2
votes
0answers
717 views

web3.personal.newAccount() successfully created but not listed in ganache accounts.why?

I am using truffle framework for Dapp development and I am new in Blockchain.I used the command web3.personal.newAccount() to create a new account. But i cannot view this account when i take ...
2
votes
0answers
194 views

Getting Json file from remix

I have been deploying contracts on rinkeby but we are almost done to go to mainnet. I have been comparing deployments with truffle and remix and there is a huge difference in gas uses, so I would ...
2
votes
0answers
132 views

Send ERC20 Tokens from Fixed Supply Token Contract to TokenCrowdSale Contract

For ICO Crowd Sale I have created 2 contracts one is MyToken.sol & other is MyTokenCrowdSale.sol. MyToken.sol creates fixed supply ERC20 tokens. contract MyToken is DetailedERC20, StandardToken { ...
2
votes
0answers
32 views

Orders Facilitator Contract has not been deployed to detected network

I'm trying to deploy a simple contract to truffle. This is very confusing now because truffle has it's own network built into it, yet the tutorial I'm following uses test-rpc. I've looked at a few ...
2
votes
0answers
147 views

calling method from another contract throws Revert

I have a smart Contract "RecommendContract" contains this method: function addVacancy(address sender, bytes32 vacancyId, uint256 incentive) external { Vacancy vacancy = vacancies[...
2
votes
1answer
298 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 ...
2
votes
1answer
218 views

Calling function from another contract reverts

I've been developing a dApp that needs ERC721 tokens. I have three contracts, a base contract, the one to mint tokens and another one for auctions. The inheritance looks like Base > Token > Auctions. ...
2
votes
2answers
513 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
0answers
200 views

Truffle deployment with metamask to ganache leads private key error

I'm using Truffle, web3js and Metamask to build a webapp. I'm using ganache for local testing. I'm trying to deploy a contract with import TruffleDeployer from 'truffle-deployer'; import ...
2
votes
3answers
733 views

Deploying smart contract with truffle and infura giving me error

I am having trouble deploying my smart contract to the ropsten network using infura and truffle am getting error that says "var sig = secp256k1.sign(msgHash, privateKey); ^ ...
2
votes
0answers
109 views

Import contracts, compiling and deployment

quick question. I have a set of contracts A,B,C. A contains import 'B' and import 'C'. Should I just compile A and then deploy it on the blockchain for the functions in B and C to be implemented ...
2
votes
0answers
296 views

Unexpected behavior with `block.timestamp` in truffle test

I am doing some experiments with block.timestamp(which is now's alias). I wrote some code to see if block.timestamp really represents the timestamp of the last mined block. From the documentation: ...
2
votes
1answer
161 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 ...
2
votes
0answers
304 views

How to use logx in Solidity?

Aim: To log data from a smart contract. Following function is written in accordance with low level interface to Logs in ethereum. However, due to lack of documentation, and being new in Solidity, I ...
2
votes
0answers
152 views

How to get meaningful error msg from truffle unit test?

I am writing unit tests in truffle. No matter it's solidity unit tests or js unit tests, all of the error msg I can get is: Error: VM Exception while processing transaction: revert at Object....
2
votes
1answer
116 views

Branch a Truffle test into various Ganache blockchain states

I am currently testing a contract that can evolve in different ways, depending on the interaction between parties. But all these possible scenarios share the same initialization. So, the question I ...
2
votes
0answers
46 views

Configure Truffle to automatically run tests before contract deployment

How do I configure Truffle to automatically carry out all my tests before it deploys the smart contract? Ideally, it should also halt deployment in case of any test errors.
2
votes
3answers
2k views

Unable to install Truffle - Command Not Found

I am unable to install Truflle on my Windows 10. I am running latest versions of npm and node. I have tried uninstalling and then reinstalling but it still doesn't work. I have installed Truffle ...
2
votes
0answers
76 views

Truffle - Stub contract functions in Mocha

How do I stub out contract functions while testing in truffle in javascript. Normally in mocha I would import sinon and do a sinon.stub command. It doesnt seem that I can import npm modules into the ...
2
votes
0answers
185 views

Reduce gas usage in contract that creates other contracts

I have a contract that is exceeding block gas limits (using something like 8000000 gas) when I deploy it. I think it is because it is importing a bunch of other contracts and has functions that create ...
2
votes
0answers
353 views

truffle assert equal not accurate for small differences

For some reason my truffle test suite "should send coin correctly" passes when it shouldn't. I'm just running a test suite on the standard ERC20 code found on ethereum.org. When you take 1e+21 -1010, ...
2
votes
0answers
258 views

transfer function is not working for the smart contract

Below is the Scenario of the problem: I made some changes in the real concept because it will hard to understand the problem so I try to make it real simple. I make a contract to facilitate some ...
2
votes
0answers
271 views

Using Truffle with Node JS (MongoDB)

I am trying to use truffle along with a MongoDB database which means that I need multiple ports. For local testing, I have been starting up my RPC, switching the port that the app is listening, and ...
2
votes
0answers
48 views

Why would a contract throw after it has executed the last line of code?

I'm debugging a contract function with Truffle. It always throws the following error: Error: VM Exception while processing transaction: revert However, I'm certain that the function has reached the ...
2
votes
1answer
273 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\...
2
votes
1answer
196 views

How do I get access to uPort from a mobile Browser

I've developed a simple DApp that uses uPort and it works fine on Desktop - where I can login through uPort with the QR Code. On a mobile browser (Anrdoid Chrome) I'm auto directed to uPort where it ...
2
votes
3answers
534 views

writing tests in solidity for functions returning multiple values

I have a function that returns multiple values function getInfo(string id) returns(string x,string y){ bytes32 _id= strToBytes(id); return (infostruct[_id].x,infostruct[_id].y) ; } Now i want ...
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 ...
2
votes
0answers
689 views

Sign transaction using truffle-contract

Is it possible to call contract methods protected with modifier like onlyOwner without access to the node with the keyfile using only private key? I know that I can create raw transaction and sign it ...
2
votes
1answer
307 views

Error: VM Exception while processing transaction: invalid opcode at transfer function

I try test function transfer in my contract. I following by tutorial. Full project locate on my git. It is my test.js code: var SPT = artifacts.require("StepanToken2"); contract("Testing ERC20 ...
2
votes
1answer
67 views

Simulating the DAO attack using truffle

I'm trying to simulate the DAO attack for a research project I'm working on. I have truffle and testrpc setup on my machine. I use the sample code given in this tutorial. I try calling the BankAttack ...
2
votes
0answers
95 views

Standard Truffle assertions documentation

I have found Assert.sol which is the code that defines the standard Truffle assertions. Is there a document which describes the available functions? An index would be useful as a start...
2
votes
1answer
534 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 ...
2
votes
1answer
961 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 ...
2
votes
0answers
226 views

I can't see any events triggered in tests

I'm using Truffle Framework and TestRPC. Sometimes I can see events, but not always, so how do I show events in the console when running: truffle test ?
2
votes
0answers
286 views

Truffle Contract transaction doesn't wait to be mined

I have a thing that has been annoying me when using truffle-contract, ever since updating from Truffle 2 to Truffle 3. I am no longer able to run transactions synchronously - even though it is stated ...
2
votes
0answers
202 views

How can I get my dapp interface to work on Mist? I'm using truffle framework and it works with Metamask

I can't get my interface to work on Mist using truffle contract abstraction. After building and testing successfully with Metamask I thought I'd test it on Mist as well and, surprise, it doesn't work. ...
2
votes
0answers
617 views

How to connect frontend with contract backend using truffle?

Right now I'm having some trouble understanding how it all fits together if I want to make a Dapp. I did create a contract and the frontend using truffle. Then I compiled it and deployed it to ...
2
votes
2answers
667 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 ...
2
votes
1answer
214 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 ...
2
votes
0answers
290 views

TypeError: filterCreationErrorCallback is not a function

trying to deploy contract to Ropsten network-
2
votes
0answers
379 views

truffle log location?

Does anyone know where truffle keeps logs? I am unable to perform a migration. It gives me no error message; it just hangs on: Running migration: 1_initial_migration.js Deploying Migrations... ...
2
votes
0answers
507 views

Truffle - Migrations cannot be found

I have recently done a fresh install of truffle v2.1.1 as I want to compare this version to the recently updated version. truffle init Works as expected. However, when doing; truffle migrate --...
2
votes
0answers
351 views

Truffle/Web3: myContract.method.estimateGas causes BigNumber error

I get the following error when running truffle test: { BigNumber Error: new BigNumber() not a number: [object Object] at raise (/Users/danielyakobian/.nvm/versions/node/v7.5.0/lib/node_modules/...