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

Truffle test fails while checking if the contract instance has the owner address

As I was going through the truffle test for the smart contract below to check if it has the owner address: pragma solidity >=0.4.21 <0.7.0; contract Owner { address public owner; ...
0
votes
0answers
31 views

Verification of ECDSA signature is not valid while testing HashDice.sol

While practising on the ethereum contract HashDice.sol using truffle, the verification of the ECDSA signature is getting invalid after running the test script. describe('verify()', () => { it('...
0
votes
1answer
16 views

When i call a function: Error: Returned error: VM Exception while processing transaction: invalid opcode

I work on Truffle. My contract is A and its function is infoRep(). infoRep() returns some data. Whenever i call the function in Truffle console the below error occurs: Error: Returned error: VM ...
0
votes
1answer
41 views

How to act as another wallet when using Truffle exec scripts?

I am writing a seed to add data on the smart contract after I deploy it. I'm using ropsten network, setted up like this in truffle-config: ropsten: { provider: function () { return new ...
0
votes
0answers
18 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
2answers
13 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
13 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
0answers
25 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 ...
0
votes
0answers
16 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
1answer
22 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 ...
0
votes
1answer
17 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
34 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
44 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 ...
0
votes
2answers
31 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
0answers
34 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
2answers
32 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: { ...
0
votes
1answer
30 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 ...
0
votes
2answers
20 views

How to prevent someone to replace our smart contract

I'm still learning to develop dApp and currently, I conduct some testing on my dApp. I found out that someone who is part of the blockchain network (miner and node) can replace our deployed smart ...
0
votes
1answer
8 views

When i am doing migration, the netwrok name is ganache instead of development and multiple errors are there

D:\>truffle migrate --reset Compiling your contracts... =========================== > Compiling .\contracts\Migrations.sol > Artifacts written to D:\build\contracts > Compiled ...
0
votes
1answer
29 views

With TRUFFLE: Call public function of contract from within another contract

Similar to How do you call a function of a deployed contract from another contract? (first answer), but because Truffle has access to the ABI's of compiled contracts thought I could avoid low-level ...
0
votes
0answers
26 views

Truffle test using multiple connections

I am running a test which involves sending transactions to a smart contract from multiple nodes. Right now, I have seperate truffle folders in each node, with a test file that sends the transactions ...
0
votes
1answer
26 views

Smart contract transaction takes different amounts of gas on different platforms

I have an ERC-20 token contract on which I want to perform some testing on a local chain. I got my chain setup, contract deployment and testing scripts ready on my Windows machine. However, since I ...
0
votes
2answers
27 views

What is .new()?

I am using the following code to deploying a smart contract to a private network with Node-js. But the error TypeError: contract_object.new is not a function occurs. What are .new() and the error's ...
0
votes
0answers
32 views

Error: VM Exception while processing transaction: revert at PromiEvent When calling variable function from the deployed contract variable

I am new to blockchain and development and learning from the dapp university tutorial. I have created a contract Todolist.sol pragma solidity ^0.5.0; contract TodoList{ uint public ...
0
votes
0answers
15 views

How can you test with a mock when the address is hard coded in the real contract?

For testing purposes, is there any way to replace a contract referenced by a hardcoded address with a mock? I'm defining an interface in my contract address interfaceAddress = 0x...; IInterface if = ...
0
votes
0answers
14 views

Unpacking Open Zeppelin starter pack warnings and errors

When unpacking OZ starter pack I get a couple of 100 lines of red code (warnings) and then it ends with a bunch of errors (see below). npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! sha3@1.2.3 ...
0
votes
0answers
67 views

Error: [number-to-bn] while converting number “test” to BN.js instance

I'm trying to deploy the contract which does not use number to bignumber conversion itself. But I'm getting the following error about the code from node_modules: Error: Error: [number-to-bn] while ...
0
votes
0answers
53 views

Truffle revert when deploying contract

solidity newbie here working on moving from remix to truffle suite. I have a contract that worked fine on remix but is raising the following error message when attempting to deploy to local test chain ...
0
votes
1answer
109 views

Error : Number can only safely store up to 53 bits

Hi I am trying to run the following tests var chai = require("chai"); var chaiAsPromised = require("chai-as-promised"); chai.use(chaiAsPromised); var expect = chai.expect; var Bet = artifacts....
0
votes
0answers
15 views

I got the error when I do 'truffle test' in Truffle tutorial that pet-shop-tutorial

I'm doing truffle tutorial the pet-shop-tutorial but when I typed truffle test in cmd, I got the error. Here is the error message. I have no idea how I can fix it and where should I check. Please ...
0
votes
0answers
27 views

Truffle develop freezing. Trying to check variable values

truffle-config.js module.exports = { compilers: { solc: { version: "^0.6.0" } }, networks: { development: { host: "127.0.0.1", port: ...
0
votes
0answers
9 views

Aragon: How to update files after a contract compiles

I need to update certain files (in app/public/) every time when a contract compiles. Namely I need to extract the ABI from a contract and store in app/public/. Is it possible with the current version ...
0
votes
1answer
72 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
20 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
27 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 ...
0
votes
0answers
15 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
45 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
0answers
19 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
1answer
24 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
0answers
23 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
22 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
21 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
40 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 ...
0
votes
1answer
51 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
14 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
19 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
100 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
18 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
28 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 ...

1
33 34
35
36 37
43