Stack Exchange Network

Stack Exchange network consists of 174 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
1answer
71 views

Truffle Migrate Error: Could not find built Migrations contract: Unexpected token in JSON at position 0

Running truffle migrate with valid contract code started causing this error for me: Writing artifacts to ./build/contracts Using network 'development'. Error: Could not find built Migrations ...
2
votes
1answer
53 views

contract sendTransaction does not return transaction hash

I just started with truffle react box.. and i changed a little bit to : const tx = await instance.set.sendTransaction(999,{from : accounts[0]}); console.log("tx is on the way : ",tx); const txReceipt ...
0
votes
1answer
55 views

Solidity: How are multiple return values returned?

Working in truffle with TDD testing and am getting some errors when evaluating the return values of some functions. If a function is returning multiple values in Solidity, how are they presented? Is ...
1
vote
1answer
49 views

Using the Truffle command line debugger

I'm writing a contract in solidity, in which a test case fails. I want to step through the code to find what's going wrong. I'm using truffle for development. This is what I do after making changes to ...
2
votes
1answer
29 views

Truffle's npm run build doesn't give me any .html and .js files in /build directory [closed]

I successfully deployed my contract with the truffle console. Then I wrote my DApp with the files index.html and app.js in the /app folder. I attempted to build my codes for production by running the ...
2
votes
0answers
74 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 ...
1
vote
1answer
36 views

Truffle Assert with Truffle Beta

I just updated to Solidity 5 and Truffle Beta and am testing my contracts in JavaScript. I am trying to test my constructor events and want to use as per truffle-assertions documentation : truffle-...
1
vote
2answers
41 views

Why can't I catch solidity errors testing with truffle?

I'm testing the ERC20 standard. I try to send a transaction from an account with balance=0, which should throw an error. I'm trying to catch it. In my test function, I'm using the following: ...
1
vote
0answers
25 views

error in WebSocket connection

error : browser-sync-client.js?v=2.26.3:15 WebSocket connection to 'ws://localhost:3000/browser-sync/socket.io/?EIO=3&transport=websocket&sid=mW3 please i need help on this. i was getting ...
0
votes
3answers
58 views

Get more than 10 accounts in the truffle develop blockchain?

How do we get more than 10 accounts in the truffle develop blockchain ? If someone has an idea about the question in the title, would be of help to many people out there for testing. Thanks a lot.
1
vote
1answer
46 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: { ...
0
votes
1answer
32 views

Testing a function in Solidity

and am trying to write some test for a payable function in Solidity but i don't know how to go about it any help will be appreciated . I want to test for the case where the buyer send an amount less ...
4
votes
1answer
39 views

How to raise version of oraclize-api installed via Truffle

I'm using local instance of Oraclize API, to make truffle compile work. I've installed it by truffle install oraclize-api but for now, I'm getting following error if (oraclize_randomDS_args[...
0
votes
1answer
29 views

The default output of the function. Solidity

This is simple smart contract for election of two candidates : pragma solidity 0.4.24; contract Election { //Model a candidate struct Candidate{ uint id; string name; ...
4
votes
2answers
2k views

Source File requires different compiler version

I am using solidity version "pragma solidity ^0.4.20;". When I checked JSON files of contract, compiler version shows : "compiler": { "name": "solc", "version": "0.4.21+commit.dfe3193c....
2
votes
2answers
59 views

How do I read an array inside of a struct?

as part of learning solidity and smart-contract development, I am developing a simple part management/tracking system. I have a struct and a mapping for a list of parts as such: struct Part { uint ...
1
vote
1answer
44 views

How come npmjs website shows that Truffle latest version is 4.1.14, and that it was published 3 days ago?

According to this page, Truffle latest version is 4.1.14, and it was published 3 days ago. However: I have been using this version for months now. I have noticed this "published 3 days ago" several ...
1
vote
1answer
143 views

Solidity 0.5 Truffle Compile Error

I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and installed truffle@beta so that it can use v5. The problem I have is that ...
3
votes
2answers
472 views

Truffle Compile with Solidity 0.5.0

I just upgraded my code to Solidity 0.5 and am trying to use the truffle framework with it. I did update my code in Remix and it does seem to work. The problem I have is that I am unable to compile ...
1
vote
1answer
33 views

Solidity inheritance can't read parent's value correctly

I found a strange error in my contract and tried to resolve it, but it's so unreasonable. contract parentContract { uint num = 1; function setNum(uint _n) public returns(uint) { num ...
0
votes
1answer
27 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
20 views

What are the best Practices for writing truffle Tests for a Smart Contract ?

I am currently having a project where a banking system is to be made, what is the approach to get into it. Its suggested to write the tests first and then proceed with the smart contract. What are the ...
0
votes
1answer
18 views

Truffle Exec Return Events

I have set up a JavaScript file that takes in my contract and executes the various functions and then returns the correct events. The file runs through 'truffle exec'. I am using the following line ...
0
votes
1answer
30 views

InterfaceImp constract defined success,but interface function called failed

I'm trying to call a interface function for testing, but it can't work. Here is my test contract: pragma solidity ^0.4.24; interface InterfaceTest{ function testInterface() external pure ...
2
votes
2answers
466 views

Truffle in production it´s recommended [closed]

It´s recommended to use the truffle framework for production?? Or just to develop purpose?? I mean can I connect my truffle to my private blockchain and execute the compile/migrate commands without ...
1
vote
0answers
42 views

How to get back the ownership from crowdsale?

When I started crowdsale, I transferred token ownership to the crowdsale contract. When the sale finished, I'd like to send back the ownership to token so that the next crowdsale will start. How can I ...
8
votes
1answer
2k views

Member function “transfer” not found or not visible after argument-dependent lookup in contract?

I am having a problem with my smart contract making value transfers. My current environment: Truffle v5.0.0-beta.2 (core: 5.0.0-beta.2) Solidity v0.5.0 (solc-js) Node v8.11.1 I created the ...
2
votes
1answer
80 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 "../../...
0
votes
3answers
25 views

Truffle wrapper

ExampleContract { address public miner; constructor(){ address miner = msg.sender; } } I am using truffle and ganache-cli and I executed the following command: truffle migrate --...
0
votes
1answer
262 views

The send transactions “from” field must be defined!

I am trying to call a function of a contract that has been deployed to Ganache. I am trying to call a function that makes payouts to a few addresses and can be called by owner only. When I am calling ...
0
votes
1answer
138 views

Module not found: Can't resolve 'bignumber.js' [duplicate]

I'm using truffle unbox react to bootstrap my dapp. Whenever I run the client end of the application with npm run start, I see that React fails to compile with the following error: Module not found: ...
2
votes
0answers
42 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 ...
0
votes
2answers
23 views

What can i do if truffle doesn't execute commands?

First of all i can´t execute truffle writing truffle console. Instead of that I have to write truffle.cmd console. When im in the truffle console and I try to execute test over my contracts I get ...
1
vote
1answer
223 views

Could not find artifacts for ./Election from any sources

I tried solutions provided in ethereum stack, but nothing worked for me. My smart contract file: pragma solidity ^0.4.15; contract Election { string public candidate; function Eletion () ...
1
vote
1answer
63 views

What should I call the object returned from a Truffle contract function-call

When I perform a contract function-call via Truffle, and then resolve the returned promise, I get something like this: { "tx": "0x...", "receipt": { "transactionHash": "0x...", ...
0
votes
2answers
671 views

Error: Cannot find module 'truffle-hdwallet-provider'

I got the following errors while trying to deploy my smart contract: sers-Air:lottery user$ node deploy.js internal/modules/cjs/loader.js:582 throw err; ^ Error: Cannot find module '...
0
votes
2answers
29 views

Switch between accounts to run smart contracts

I'm using truffle develop to test my smart contracts. I've tried to switch between different accounts using web3.eth.defaultAccount = web3.eth.accounts[1] but had no success. How do I accomplish that?
0
votes
1answer
34 views

Why does “truffle migrate” to Rinkeby results two transactions per contract

I ran truffle migrate -f 2 --network rinkeby. Then, I navigated to https://rinkeby.etherscan.io/address/[ADDRESS_OF_DEPLOYER] And I got two TXs: The second TX is clear since To equals to "Contract ...
0
votes
1answer
96 views

how do i fix Expected primary expression error

Expected primary expression. j* = 10; ^ $ truffle migrate Error parsing C:\Users\Welcome\Downloads\ethereum-dapp\contracts\Integers.sol: ParsedContract.sol:29:16: ...
0
votes
1answer
55 views

Meta Mask - Breaking Change and Ganache

I have seen the announcement about the privacy changes that Meta Mask has made about no longer injecting Web3. And the article post they made gave a snip of code to include to request Web3 to be ...
0
votes
1answer
95 views

Calling fallback function in truffle to delegate a call

I'm playing with the upgradeable contracts via DelegateProxy in Solidity. This pattern posits that a MutableForwarder contract is deployed once, and all the subsequent calls to the upgradeable ...
1
vote
1answer
43 views

Testing smart contract with solidity vs javasciprt [duplicate]

I see the truffle have 3 major ways of testing smart contract 1) Testing smart contract with solidity 2) Testing smart contract with javascript (without web3) 3) Testing smart contract with ...
1
vote
2answers
151 views

Truffle Tests Events via JavaScript

I am testing my contract via the chai and truffle-assertions libraries from a JavaScript file and am testing if events return the correct values. I have an event called Message. In my function, the ...
2
votes
1answer
11 views

How (or where) to see errors when something goes wrong using truffle exec <script>?

I want to know how ( or where if logged somewhere) to find errors when running truffle exec . And this because i ran truffle command and a dependency was missing (i forget a require) and i didn't see ...
1
vote
1answer
58 views

Is Ganache GUI real EVM?

I was wondering whether Ganache GUI is real EVM or just a replica of it. Because its throughput and latency are way better than Geth client. Any comments on it?
0
votes
1answer
37 views

Is there a boilerplate dApp on Github which uses uPort, truffle and infura on the ropsten testnet?

I am developing a dApp using those technologies and facing difficult problems when trying to save information on Ropsten. I can't approve my transaction via uPort because the selected account balance ...
1
vote
1answer
68 views

Can not deploy to Rinkeby via truffle - cannot read property 'bind'

I am using truffle: "^4.1.14" and ganache-cli version "^6.1.8". When I try to migrate to ganache cli network, it works without a problem. But when I try to migrate to Rinkeby, it always fails. The ...
1
vote
2answers
126 views

Choosing between Javascript and Solidity for testing smart contracts

Truffle offers two ways to test smart contracts: either using test files written as Solidity contracts, or Javascript/Mocha. https://truffleframework.com/docs/truffle/testing/writing-tests-in-...
0
votes
1answer
60 views

“truffle test” says “assert.rejects” is not a function even it is Node 10

As per the official documentation, assert.rejects was added since Node v10.0.0. Also, the node console confirms that: even though, truffle test throws this error: TypeError: assert.rejects is ...
0
votes
1answer
28 views

PetShop Dapp error with when compiling and testing adoption.sol but completes anyway

Since the Petshop Dapp was updated earlier this week I noticed an error while compiling and and again whilst testing it seems to be on the adoption.sol file - now it could be something I did in ...