Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
32 views

Cannot create contract from another contract - truffle and ganache

I'm trying to write a test with ganache and truffle to create a contract instance from another contract. Everything works in Remix but it doesn't in ganache. This is the code const assert = require('...
0
votes
0answers
13 views

Truffle contract bytecode not updating with library address

After deploying a library using truffle, I want to compile a contract and use the library address inside its generated bytecode. Now inside the contract bytecode I get something like _DateTime______. ...
0
votes
0answers
17 views

ParserError: Expected token Semicolon got 'Return'

The error pops up whenever I try to compile through truffle, not able to figure out a solution any help is highly appreciated. Here is the error Compiling your contracts... ==========================...
0
votes
0answers
20 views

Migrating 2 contracts in one Contract.sol script using 'truffle migrate'

I have 2 contracts in 1 .sol file and when I run 'truffle migrate', it tells me that it has deployed 1 of the contracts and given me an additional error: Blockquote Invalid number of parameters ...
1
vote
0answers
7 views

What are the differences between Drizzle and the Truffle React box?

Truffle has many "boxes", two of which are: truffle unbox react And: truffle unbox drizzle They both seem to be focused on frontend development. Other than Drizzle being based on a Redux store, ...
0
votes
0answers
12 views

Automatically set app instance in Truffle console

Is there a way to load the truffle console with the following variables without having to do manual type-ins on every test? let app = await MyContract.deployed(); let accounts = web3.eth.getAccounts()...
0
votes
1answer
20 views

Importing OpenZeppelin loads all node_modules contracts into Ganache

I install OpenZeppelin's contracts npm install @openzeppelin/contracts Create a contract: pragma solidity ^0.5.0; import "@openzeppelin/contracts/token/ERC20/ERC20Mintable.sol"; contract NewCoin ...
0
votes
1answer
26 views

How to pass parameters into test script

I have a voting solidity file here: pragma solidity >=0.4.21 <0.7.0; // We have to specify what version of compiler this code will compile with contract Votingapp{ /* mapping field below is ...
0
votes
0answers
12 views

Tuffle. New account from mnemonic during migrations

I'm trying to create a new account from predefined mnemonic during Truffle migrations(both testing and prod environments). I want to pre-create multiple contracts using corresponded factories for this ...
0
votes
0answers
20 views

XMLHttpRequest() does not work probably in a Truffle project

I want to connect to my smart contract in a Truffle project and get some information from it. The smart contract's name is "TEST". The follow is my app.js code that should communicate with my smart ...
0
votes
1answer
13 views

How of should I migrate my Smart Contract?

I am developing a scraper which scrapes data and puts it on ethereum blockchain(ganache for dev) every week. So as to put this data onto the blockchain should I migrate my smart contract each time I ...
0
votes
1answer
20 views

How do i see my records stored in the ethereum blockchain

So I have a smart contract, in my code, I have an array and i am pushing to it using a particular method call addToUser, from the code below Contract Example{ string[] users; function addToUser(_user) ...
0
votes
0answers
18 views

Using web3.js to interface with smart contract

I am a beginner in Dapp and don't know about web3.js. I complie myslef contracts with Truffle. I did write the following contract: pragma solidity ^0.5.12; contract TEST{ bytes public name="...
0
votes
1answer
14 views

How do you pass an array as an argument to a contract *constructor* using Truffle deployment script

I need to pass array as argument to contract constructor using truffle deployment script. My contract code looks like this: pragma solidity ^0.5.0; contract ArrayArgument { uint[] public arrsv;...
0
votes
1answer
17 views

How to use older version of Solidity in Truffle suite

I've tried to migrate contract on an older version of solidity, I have modified the config.js to be as in the following and the smart contract solidity code I'm trying to deploy as follows The ...
0
votes
1answer
20 views

How do I get all logs for all time for a given contract using web3?

This answer worked when filter.get was not deprecated, but now I am not sure how to do the same thing with subscribe - web3.eth.subscribe hears new events and acts on them after I create the ...
0
votes
1answer
19 views

Transfer ethers from a smart contract to another smart contract in Truffle

I am beginner in Solidity, So my problem maybe simple. I have two contracts "BankA" and "customer". Whenever i deploy BankA in Truffle network and call pay() the following Error will emerge: Error: ...
1
vote
1answer
13 views

Is gas used during truffle tests on ganache the same as main net?

I am testing the amount of gas used for my contract functions using Truffle and Ganache CLI. Does anyone know if I can assume that the gas usage reported during my tests will be an accurate ...
0
votes
1answer
30 views

Unable to filter events with specific values of indexed parameters

I am currently trying to test a smart contract using the truffle suit ( with 'truffle test'). My contract is of a simple ERC20 token which includes the standard Transfer event: event Transfer(address ...
1
vote
1answer
35 views

Ganache: out-of-gas during deployment

I have a bunch of contracts which deploy just fine. Deployment of one of the contracts, XBRNetwork takes exactly 5418911 gas - no problems with that. However, once I add another trivial (public) ...
1
vote
1answer
28 views

Difference between web3.eth.personal.getAccounts() with web3.eth.getAccounts()

What are the differences between web3.eth.personal.getAccounts() and web3.eth.getAccounts()? environment truffle: v5.1.7 using truffle console.
-2
votes
2answers
42 views

Can I make a proper website by using ganache and truffle? Like maybe abc.com?

I have developed a voting system usinh dapp that runs on local host. It uses accounts from ganache and metamask for transactions of votes. Now if i want to buy a domain and make the thing work, is it ...
0
votes
2answers
43 views

Measuring deployment time of a group of transactions in a heavy load testing

I am currently trying to perform heavy load testing on a ERC20 token. My plan is to use truffle to test stuff like how long it would take for 500 transfer transactions to be deployed (on a private ...
0
votes
1answer
29 views

Compilation failed during instrumentation of solidity-coverage

Getting compilation failed error, while running solidity-coverage. Truffle compile is working fine Here is my truffle config networks: { coverage: { host: '127.0.0.1', network_id: ...
0
votes
1answer
51 views

Calling function from existing truffle contract in node.js

This is probably a very simple problem to solve, but I am setting up a node.js backend using express for my Dapp and I can now deploy new contracts just fine. I now need to figure out how to make ...
0
votes
1answer
11 views

Testing Smart Contract with multiple clients

After deploying a smart contract on Ropsten Testnet using Truffle framework, we can use truffle tests to do unit testing (create a client to interact with the deployed contract). My question is, how ...
0
votes
0answers
12 views

How to send a value back to html from node.js using express and truffle

I am running truffle code with Node.JS in the backend to deploy contracts. Using the Express Library, I can interact with the Node backend. Here is the code for the HTML page: <form id="myForm" ...
0
votes
1answer
17 views

Testing library functions with Javascript & Truffle

I'm trying to test functions of a library with Truffle. But they don't seem to be available. The library is named Commons and I include it as I would include a contract: var Commons = artifacts....
0
votes
1answer
51 views

Problem with running truffle code with node.js

I am trying to run truffle code with Node.JS in the backend to deploy contracts. I want to be able to do this interactively and I am intending to use the Express Library to interact with the Node ...
0
votes
1answer
45 views

Using the correct/best solc version with Truffle and general tooling setup

I haven't worked with Truffle/Solidity for a while and I am trying to get my environment/toolchain configure correctly. I have some questions regarding the compiler config. I was originally not ...
1
vote
1answer
30 views

Logic help needed, how to transfer funds to the address who placed bets on winning team?

This is a betting application and right now -> if I place bets on HOME, the amount gets stored but I want to transfer the amount only to the address who placed bets on winning team. I have developed ...
0
votes
1answer
47 views

How to Open console In geth 1.9.10

I am currently using geth in windows and 1.9.10LTS version of geth. I have to Open geth console, but when i try to implement geth console or geth attach or geth attach ipc:\\ .\pipe\geth.ipc it doesn'...
0
votes
1answer
10 views

Truffle test: “Cannot read property 'gasUsed' of null” error. Truffle migrate works fine

Whenever I try and do truffle test I get the error Cannot read property 'gasUsed' of null But truffle migrate --reset works fine More confusingly, to rule out something in one of my tests that is ...
0
votes
0answers
26 views

Not able to call the solidity function through App.js? Anyone know how to call a solidity function?

I'm trying to call a Solidity function from App.js, but I'm unsuccessful even after a number of tries. Its a very simple function betOnTeam(). Inside this function I just want to check condition and ...
0
votes
1answer
21 views

How to call such a function? (pass argument)

For example, here is the code What will the best code practice, either to repeat the code inside two different functions or what can I do? OraclizeContract.deployed().then(function(instance) { ...
0
votes
1answer
39 views

Enabling truffle compile optimizer does not change the deployment gas cost

I am trying to deploy my contract by enabling the optimizer to see how much I can save from the gas costs. I am using truffle for the deployment. In truffle I enable the optimizer by the following ...
0
votes
1answer
34 views

Function stopped working? No check is being done now on transfer function

I created a function to deposit and transfer ether and it was working great until i tried to deploy again and now the transfer function is not working anymore No errors are being thrown, the transfer ...
0
votes
2answers
39 views

Cannot transfer ether from smart contract to another address

I am using truffle and when we type truffle develop it provides us with 10 address ** So, the problem I am facing is I have created 2 functions one to deposit ether and the other one to transfer the ...
0
votes
0answers
26 views

“truffle migrate --network ropsten” stuck after compiling

I am trying to redeploy a contract on Ropsten Testnet using the command: truffle migrate --reset -f 1567182283 --network ropsten Here, "1567182283" is the prefix of my migration file. Upon executing,...
0
votes
1answer
17 views

Redeploy contract on Ropsten Network

I have already deployed my smart contract on Ropsten network for testing using truffle suite. The command line I used was: truffle deploy --network ropsten Now, I have made some changes to my ...
0
votes
0answers
50 views

Cant call solidity function from app.js?

Solidity function Using web3 0.20 version and Cant call solidity BETONTEAM function pragma solidity ^0.4.22; import "installed_contracts/strings.sol"; import "installed_contracts/oraclize-api/...
0
votes
0answers
29 views

Cant call solidity function from app.js while sending transaction

Solidity function As i want to call function so that oraclize can send query function betOnTeam(uint team) payable public { update(); emit LogInfo("Oraclize query was NOT sent, ...
1
vote
1answer
27 views

Can someone explain the difference between using metamask or web3 to send ether from truffle accounts?

I am using web3 and truffle (i am a newbie wants to understand concept) I need to transfer ether so i understand that i need to use web3.eth.sendtransaction But will it work as i am using localhost ...
0
votes
1answer
24 views

Can we take input of an address and pass it on the function to send ether using truffle and web3?

Actually i am trying to create a betting application so when i get the result that Home team has won Before this i will be taking both address as input (betting do two address whoever wins gets the ...
0
votes
1answer
37 views

How to encode an object with ABIEncoder V2?

How to encode an object with ABIEncoder V2? For example, this one: { items: [ { str: "str", num: 5, bol: true } ] } Solidity struct: struct Item { string str; ...
0
votes
1answer
33 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
2answers
27 views

How to read data returned by a function? [duplicate]

Counter.sol: pragma solidity >=0.5.0 <0.7.0; contract Counter { uint public _counter = 0; function GenNextID() public returns (uint) { return _counter++; } } I use ...
0
votes
2answers
35 views

Function, variable, struct or modifier declaration expected [duplicate]

I am using the following code structure; pragma solidity ^0.5.0; contract TtdmToken { uint256 public totalSupply; function TtdmToken () public { totalSupply = 1000000; } } ...
0
votes
0answers
49 views

How to call solidity function from javascript file? Keep getting error deploying through truffle and webpack

Error -> TypeError: fetch.amount is not a function [WDS] Disconnected! Please explain or provide code on how to call solidity function Trying to call from ready() function console.log(contract.abi)...
1
vote
1answer
16 views

Setting sending account in Truffle test

I need to create contracts from various accounts in a Truffle JS Test. To do so, I set: let accounts = await web3.eth.getAccounts(); MyContract.web3.from = accounts[9]; Before creating my contract ...

1 2 3 4 5 41