Questions tagged [truffle]

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

626 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
249 views

Error when I try to deploy with infura

Running migration: 1_initial_migration.js Deploying Migrations... ... 0x0ed88dd40f380a805ed0ba1b5b0a9d8178321ab6da9e5c0cb247f5700337b173 Migrations: 0xcfc4ba0488f20c7a2bb24e735f43e240bf249bc8 Saving ...
2
votes
0answers
104 views

web3: getPastEvents works in Truffle on instance, not in web3 script on page

I am looking to collect the previously logged events of a certain type using getPastEvents. It does not seem to work in my web3 script on my site but it does work in truffle console on a deployed ...
2
votes
0answers
59 views

Tracking Non-Deployer Transaction Gas Use In Truffle Migrate

In Truffle, gas used by a Migration in deployer.deploy() is tracked by a Reporter using events emitted by the Migration. If I have code of the form: deployer.deploy(MyContract) .then(instance =>...
2
votes
0answers
103 views

IntelliJ + truffle tests

I would like to run truffle tests from IntelliJ. I found a tutorial here: https://charterhouse.github.io/2017/05/12/running-truffle-unit-tests-in-intellij-idea.html Unfortunately, it does not seem ...
2
votes
1answer
209 views

Truffle Deploy gas limit exhausted

I kept on getting this error. 9/10 of my deployment will fail. But out of the sudden it will be success without any reason. I have checked the transaction receipt and indeed it had reaches the gas ...
2
votes
0answers
45 views

Unable to send large transactions on ethereum private chain

I have a small contract pragma solidity ^0.4.17; contract A10test{ mapping(uint=>string) public data; uint public revisionNo=0; function setdata(string _data) public { data[revisionNo] = ...
2
votes
0answers
303 views

Transaction not mined error when deploying to quorum maker server

I get the following error when attempting to deploy my zeppelin erc20 token to a quorum server(used quorum maker). (master) $ node migrations/2_proj.js ``````` transactionHash ...
2
votes
1answer
172 views

Deploy smart contract on Ropsten using truffle-hdwallet-provider

I have 7 smart contracts to deploy on the Ropsten network. I am using truffle-hdwallet-provider and below is the content of my truffle.js file: module.exports = { solc: { optimizer: { ...
2
votes
1answer
305 views

Passing one contract instance as an argument to the constructor of another contract

I need to use the functions of the ERC20 contract in another contract. The ERC20 contract is from the openZeppelin contract library. I found the following code on a website: import "../../...
2
votes
0answers
121 views

Using OpenZeppelin's increaseTime.js

I'm writing a test for a time-dependent solidity function. I'd like to use the increaseTime.js helper from v1.12.0 of OpenZeppelin's library. When I try to call this helper inside my test, I get an ...
2
votes
1answer
256 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
69 views

How to process Smart Contracts payable functions in batch?

I am aware that metamask will enable effective security for processing via the web browser a payable function action to a smart contract. What happens in batch? I have an API service which then ...
2
votes
1answer
68 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
147 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
1k 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
0answers
1k 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
292 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
151 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
37 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
154 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
304 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
0answers
226 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
799 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
115 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
361 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
228 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
155 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
148 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
48 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
0answers
83 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
1answer
48 views

What are the inputs to the truffle Txn?

I am testing truffle now and I want to know more about what it deploys and how. It seems to use two txns. I have some results - Running migration: 2_deploy_contracts.js Deploying CA12... ... ...
2
votes
0answers
204 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
376 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
288 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
1answer
1k 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)...
2
votes
0answers
306 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
49 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
306 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
220 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
0answers
329 views

Truffle constant functions run out of gas, how to simulate a local node

I am new to solidity and web3. I am getting familiar with Truffle, testrpc and web3 1.x. I am also using React as a front end. I know that functions that don't change the smart contract state can ...
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
1answer
332 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
80 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
99 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
745 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
996 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
228 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
293 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
205 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
669 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 ...

1
2
3 4 5
13