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.

1
vote
0answers
6 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
1answer
21 views

What is the best way to test calling a contract's function from another contract?

I'm playing around w/ Gnosis' MultiSigWallet and noticed in their replaceOwner function it has a modifier that requires msg.sender to be the MultiSigWallet contract itself: modifier onlyWallet() { ...
0
votes
2answers
26 views

Set up backup from private Ethereum (Ganache) [duplicate]

I have created an ethereum application with Ganache and truffle js. i have installed ganache in a server, and th application work. but when i stop the server i lose the the smart contract that i have ...
0
votes
0answers
23 views

How can i send data into blockchain Ethereum [on hold]

I set up a tukin factory How can i send data into blockchain After the work of a new Token
0
votes
0answers
22 views

Adding a timer to the Voting System. Ethereum (Solidity)

This is smart contract for decentrilized Election System. Currently it voters can vote, and each voter have one chance to vote. pragma solidity ^0.4.2; contract Election { // Model a Candidate ...
0
votes
0answers
18 views

ERC20 token with expiration date

I would like to create a ERC20 token with an expiration date to represent for example a ticket or a gift card. I've created a contract which overrides the open-zeppelin ERC20 contract methods. ...
0
votes
1answer
16 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
25 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
0answers
28 views

“ProviderError: Could not connect to your Ethereum client” for too many heavy transactions

I've been struggling with an error for quite some time now. Briefly: It seems my connection is properly set up, but when I send too many transactions at once, I get a connection error. Essentially, I ...
0
votes
0answers
13 views

Guys i am having trouble on showing my transaction details from my contracts.And my for loop is also not executing in app.js file [on hold]

pragma solidity^0.4.19; contract Banking { struct Applicants { uint id; bytes32 name; int date; bytes32 fatherName; bytes32 ...
0
votes
1answer
23 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
22 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 ...
0
votes
0answers
14 views

Truffle framework - multi page app [closed]

Has anyone built a multi page website with Truffle framework with webpack and react? I am currently struggling to define the routing to my second page /start.html as I always receive this error: ...
1
vote
1answer
17 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 ...
1
vote
0answers
13 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 ...
0
votes
1answer
24 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-...
0
votes
2answers
22 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: ...
0
votes
0answers
11 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
1answer
14 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.
0
votes
1answer
41 views

installing ganache-cli runs into permission problems [on hold]

I want to install ganache-cli for testing my contracts locally but I am facing these issues. when trying to install without sudo it goes like this. $ npm install -g ganache-cli npm WARN ...
0
votes
1answer
19 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
23 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
35 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
16 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; ...
1
vote
0answers
137 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....
0
votes
0answers
30 views

Javascript returns a “is not a contract address”, but the contract is deployed in Truffle

I am getting the following error within my web browser while running Truffle locally. I tried to re-compile and then I check with a fresh install. Any ideas on how I can fix this? Error: Error: ...
2
votes
2answers
21 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
35 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
46 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 ...
2
votes
0answers
82 views

Truffle Compile with Solidity 0.5

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
25 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
0answers
17 views

Best way to deal with Private Sale and Public Sale

I have plan to release Private sale and Public sale. Actually, I created two different contracts(DappTokenPrivSale.sol, DappTokenPubSale.sol), and tried to deploy them in different period. But, when I ...
0
votes
1answer
15 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
14 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
0answers
18 views

How To Call A Contract Method In Truffle To Test If It Would Execute (without actually executing transaction/modifying state)

I want to call a non-constant method in a contract without actually executing/modifying state; basically, I want to see if the method would, in fact, execute, and see what the return value would be, ...
0
votes
1answer
12 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
27 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
449 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
35 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 ...
3
votes
1answer
435 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
50 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
18 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
42 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
37 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
30 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
17 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
0answers
40 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
33 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
0answers
65 views

Contract is undefined after deployment / Cannot read property 'deployed' / 'at' of undefined

I have two smart contracts, one factory which keeps the addresses of created contracts in an array and one contract that has 2 parameters in its constructor, Price and creator address : contract ...
0
votes
2answers
197 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 '...