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
3 views

What causes .deployed() to return same contract instances in each test

It took me awhile to diagnose the problem. At first I just noticed that the states of my contracts were being affected by previous tests when running truffle test I then looked in the terminal tab in ...
0
votes
0answers
4 views

Truffle Object Keeps Changing to Undefined When I Try To Play With Data With React

The question is in the title. I have a React Component that displays the appropriate data when I do it in a very specific way, but breaks when I try to play with the data. state = { dataKey: "1",...
0
votes
1answer
323 views

Truffle test: error when passing more than one file as input

I have several test files, which I can successfully execute via truffle test (having started a ganache-cli process). For example: ganache-cli truffle test test/test1.js truffle test test/test2.js ...
0
votes
2answers
130 views

RPC error when interacting with contract using Ganache GUI, but it works fine when using Ganache CLI

I have a truffle project, if I migrate it onto ganache-cli and then interact with my contract (via Metamask) it works great. But if I try and do the exact same thing using ganahe-gui the contract ...
1
vote
1answer
7 views

How to add gas to a Truffle generated account imported to MetaMask

I am a beginner and was building a dapp using truffle unbox react. In my app, I was just taking input of a string and printting it using a simple contract. Everything is working fine. But, when i ...
0
votes
1answer
14 views

Smart Contract Deployment Failed powershell

a beginner smart contract developer here, this is my smart contract pragma solidity ^0.5.16; contract Ballot { struct Voter { uint weight; bool voted; uint8 vote; /...
0
votes
0answers
12 views

If I set unlimited gas in a dev environment, am I just postponing dealing with a problem in my contract or is it a Truffle issue?

Booted up ganache with this command: ganache-cli --gasLimit=0x1fffffffffffff --allowUnlimitedContractSize -e 1000000000 because I was running into this error on truffle migrate in my development ...
0
votes
2answers
205 views

After compiling contract, there is no build directory inside project directory?

After writing 'truffle compile' in terminal , it just give the message i.e. compiling your contracts...and exit, no build directory is formed in Project directory. What is the issue?
0
votes
1answer
39 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 ...
0
votes
0answers
15 views

TypeError: Operator != not compatible with types string storage ref and int_const 0

Im using blockchain technology for the first time, for a college project. Im trying to run a smart contract from Github (in Powershell windows 10). Im unable to compile the contract due the following ...
1
vote
1answer
38 views

What is the best way to deploy and test smart contracts on multiple machines?

I have recently started developement on Ethereum and the concepts are pretty much new to me. I need to test event emitting/listening on multiple machines for my contract. For the same, I have tried ...
0
votes
1answer
17 views

truffle exec scripts/seed-exchange.js --network kovan

I've been running into an error when I attempt to seed my exchange/contracts on the kovan test network. Any help would be appreciated. Using network 'kovan'. Token fetched ...
0
votes
0answers
13 views

Call contract function from truffle console

I want to call a fucntion of deployed contract not deployed by me (I have a contract address and ABI), is it possible to do from truffle console? There are a lot of examples how to do it using js, but ...
0
votes
0answers
10 views

Tutorials on blockchain decentralized application [closed]

which video tutorials can you guys recommend to person like me who want to developed a blockchain decentralized application that can store files on blockchain network. Patiently waiting to hear from ...
0
votes
1answer
15 views

Im getting the following error: ParserError: Expected primary expression. struct ManagingOrder.Parking memory new_Parking = Parking({

Im using blockchain technology for the first time, for a college project. Im trying to run a smart contract from Github. After debugging the errors shown while compiling the smart contract (in ...
2
votes
1answer
479 views

How to debug transaction from truffle test on development network

I am trying to debug a failing solidity function, which I am calling from the JS test files with truffle. When I run my test, I am successfully able to get a transaction id. However, my solidity ...
1
vote
1answer
265 views

What is the networkid and chain id of truffle cli?

I am using truffle console to deploy contracts and using Nodejs/web3js to interract with it. I wanted to use ethereumjs-tx for signing transaction, here is the reference link. I am not sure ,how can ...
-1
votes
0answers
22 views

Error Go --> Error: Transaction was not mined within 50 blocks

Hy All, have any idea about this randomly error? Error Go --> Error: Transaction was not mined within 50 blocks, please make sure your transaction was properly sent. Be aware that it might still ...
4
votes
1answer
201 views

Can't debug transactions that fail during the Web3.js estimateGas() call? No Tx Hash

NOTE: I am doing my work with the Ganache v1.2.2 GUI client on a Linux Ubuntu 18.04 station. There are many revert errors that happen during the estimateGas() call that precedes the actual Web3.js ...
0
votes
1answer
14 views

Cannot find module '@truffle/hdwallet-provider' [duplicate]

I am trying to deploy a smart contract that works nicely in Ganache to a test net (Kovan). However, all the tutorials out there use a package called hdwallet provider. When I follow the ...
1
vote
1answer
170 views

Solidity Error:Running Out of Gas / selfdestruct problem

I've been going through 'Building Cryptocurrency and its ICO' by DappUniversity. I know many have questioned this issue and I've been through all the post but couldn't resolve it. The problem is self-...
0
votes
0answers
9 views

How to get block size and block mining time while using ganache and truffle

I am using truffle framework and Ganache (GUI) as emulator. I want to know the size of the generated block. Also I want to know the time required to mine/generate/create a block after the command. I ...
0
votes
1answer
538 views

Build failed SyntaxError: Unexpected token: name (length)

I setup truffle unbox react-auth and add few libraries as shown in my package.json below. I have no problem running npm run start but failed to compile npm run build with the following error: ...
0
votes
2answers
285 views

Solidity & truffle: get elements from strings array

i'm glad to follow this forum, it is very helpful. I'm using truffle to develop contracts and i just found that dynamic arrays are not yet suported, for that reason i was using string arrays with a ...
0
votes
1answer
55 views

Execution gas cost

I use web3 and truffle to get info about my testnet transactions. There are few fields about gas used per transaction, such as: gasPrice, gas, gasUsed. But how to get field 'execution cost'?
0
votes
1answer
25 views

Solidity test fails when testing onlyOwner functions

I have a contract where some functions can be called only by the owner of the contract and I want to test it with a solidity test in truffle. The contract looks like this: contract owned { ...
0
votes
1answer
27 views

“VM Exception while processing transaction: invalid opcode” only with Byzantium hardfork

i'm testing my Smart Contract with Truffle and Ganache, everything works fine while using hadfork version "Petersburg", but when i switch to Byzantium i receive this error while truffle performs ...
2
votes
2answers
1k views

Truffle - How to get event?

I can't figure out how can I get event. I was trying with "contract.NewVoting().watch{}" but it says that watch is not a function. I found out that watch has been removed and there is EventEmitter ...
0
votes
1answer
36 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
59 views

Truffle - call migration file multiple times

I would like to execute migration file "6_deploy_and_register_group.js" every time when I need to create a new group. Is this a proper way to use migrations? If yes, how can I make it working? ...
0
votes
1answer
18 views

Deploying contract to infura via @truffle/hdwallet-provider is hanging

I created a contract and deployed to Ganache test network successfully but it is not deploying to infura. //this section is clean. worked for Ganache var output = JSON.parse(solc.compile(JSON....
0
votes
1answer
396 views

Truffle-contract error on deployed contract

Playing around with the gnosis multisig, using truffle-contract to interact with already deployed MultiSigWallet using truffle migrate. Contents of the file I am trying to run: var contract = ...
1
vote
2answers
226 views

How to inherit an interface?

This code works - taken from Wiki - pragma solidity ^0.4.18; contract ERC20Interface { function transfer(address to, uint tokens) public returns (bool success); } contract FixedSupplyToken is ...
1
vote
2answers
37 views

Can the mapping storage change after contract deployment?

I am beginner in mapping.I work on Truffle and Ganache. I deploy the following contract: pragma solidity ^0.5.12; contract customerFinder{ mapping(uint256 => address payable) public ...
0
votes
0answers
13 views

truffle test fails with `Error: Callback was already called.`

I have a single .sol contract that includes 2 libraries, 1 interface and 3 contracts A, B and C such that B is A and C is A, B. The contract C is the one I am interested in as it includes all the ...
0
votes
1answer
38 views

Why do I always get “Returned values are not valid, did it run Out of Gas”?

I'm new on Ethereum blockchain and I'm working on deploy and using smart contract using truffle on my private blockchain. I have followed exactly this guide https://www.trufflesuite.com/docs/...
0
votes
2answers
28 views

How do you launch a custom develop blockchain in truffle?

I am using truffle 5.0.30 and I want to create a development blockchain where I can run and test my contracts. This is the truffle-config.js that I am using: module.exports = { networks: { ...
1
vote
0answers
21 views

solidity-coverage error

I want to make code coverage for my project. I installed the solidity-coverage from this page: https://github.com/sc-forks/solidity-coverage and then ran this command in truffle : truffle run ...
1
vote
1answer
117 views

How to call variadic function in erc223 contract

There is two transfer function in my contract, And i m trying to call transfer function of erc223 for transfer token to contract address using this function. Token.deployed() .then(function(i) { ...
1
vote
1answer
58 views

Initiate transaction from server to smart contract

In my case, i have an API written in PHP which periodically checks the database. If certain condition was met, i need to send an alert message from the API to an account/node in the Ethereum ...
7
votes
1answer
563 views

Truffle unbox drizzle not working properly

truffle version = 4.1.4 truffle unbox drizzle truffle compile truffle migrate npm run build npm run start this gets me this error: Truffle Drizzle-box fails with TypeError: (0 , _drizzle....
0
votes
0answers
29 views

resolved- uint parameter could not pass as a correctly in truffle test [closed]

How can I send a uint parameter value to the contract in truffle? i have a function that has two uint parameter and I wrote test that function but I guess the uint parameters cannt be sent as a ...
0
votes
1answer
25 views

uint value usage as a parameter in truffle

How can I send a uint parameter value to the contract in truffle? i have a function that has two uint parameter and I wrote test that function but I guess the uint parameters cannt be sent as a ...
2
votes
1answer
223 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 ...
0
votes
1answer
130 views

Getting “gas required exceeds allowance (93846700840810) or always failing transaction” on private network. How to access geth client via nodejs?

I have recently started using Ethereum. I am trying to test my contract using multiple machines. Only solution I found was to setup a private network using Geth and add peers. Following is the genesis ...
0
votes
1answer
24 views

In up gradable design pattern how to set the allowed contracts or owner during deployment of smart contracts

Functional Background: Contracts for upgradable design pattern: ProofDB.sol : contract to store the data. Proof.sol : contract that contains the business logic. Registry.sol: contract that ...
0
votes
2answers
331 views

truffle migrate --network ropsten issues

When i run truffle migrate --network ropsten i don't see the contract deployment but just Compiling your contracts... =========================== > Everything is up to date, there is nothing to ...
0
votes
1answer
11 views

Test for Require statement in Truffle

I wrote a function that generate a key value. the function codes is here mapping(string => bool) processedHash; mapping(uint => bool) HashList; function generateHash(uint256 ...
9
votes
2answers
10k views

In the truffle console, how to set and get current account?

I'm using the $ truffle console. I can see my available accounts using truffle(development)> web3.eth.accounts. But when I run some smart contract code, which account is running the contract? ...
0
votes
1answer
80 views

Manage accounts in Remix Web3 Provider env connected to a TestRPC client node

When I run the TestRPC client (ganache-cli), it provides me with 10 different accounts and private keys along with a local server at localhost:8545 Available Accounts (0) ...

1
2 3 4 5
42