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
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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

0
votes
0answers
14 views

TypeError: “this is undefined” in truffle while invoking a contract

ProofOfOwnership.sol contract ProofOfOwnership { address public owner; mapping( string => Document) documents; struct Document { string docHash; string docTimestamp; ...
1
vote
2answers
17 views

what is the role of Migrations.sol contract in truffle project?

I have started working with truffle since 4 months and I don't give importance to Migrations.sol, I thought it's just a "get started" contract. But when I removed it caused a problem. can anyone ...
0
votes
0answers
15 views

Cannot get return value of ContractData call outside of return method

I have been trying to use Truffle's Drizzle Box to render data from my Solidity Application. While I am able to access return values from my application in the render function of Home.js, I cannot ...
0
votes
1answer
39 views

Deploy to mainnet with Truffle + Infura: nonce too low

I'm trying to deploy a very simply ERC20 token contract using Truffle and Infura and getting this: Running migration: 1_initial_migration.js Deploying Migrations... ... ...
0
votes
1answer
18 views

when to use MyContract.deployed()?

I was going through truffle-contract docs and came across this function MyContract.deployed() As mentioned in docs this function create an instance of contract abstraction(abi) representing the ...
0
votes
1answer
20 views

Who is paying for a transaction within a contract?

Let's assume I do a transaction to a contract function with my external account, then I have to pay gas for this transaction. If the function within the contracts makes now a transaction on his own ...
0
votes
0answers
25 views

Truffle migrate fails with geth

When I run "truffle migrate" I wait for few seconds than the geth node fall down and I got this truffle error : "Error encountered, bailing. Network state unknown. Review successful transactions ...
0
votes
2answers
41 views

How to setup testing environment for smart contract in solidity

I am following https://truffleframework.com/docs/getting_started/solidity-tests to set up a test in solidity for smart contract. Here is my test.sol pragma solidity ^0.4.17; import "truffle/Assert....
0
votes
0answers
18 views

Can't call contract functions from a separate contract deployed on same local testrpc (two separate Truffle projects)

I have two Truffle projects on my local machine and the contracts in them compile and deploy properly (no errors are raised and in my ganache-cli I get receipts with their addresses). I'm trying to ...
0
votes
1answer
33 views

Sending string as address to smartcontract

I have trouble sending an address to a deployed contract, my function looks like this: function addNote(uint _value, address _owner) public { ... } and when I'm sending the parameters: contract....
0
votes
2answers
18 views

Contract is not defined in truffle tests

I am trying to test one of my contracts, but truffle complains that it is not defined. I can see that the test compiles to the build folder, and I have imported it the same way as other contracts, I ...
0
votes
0answers
35 views

Migrated successfully,but not able to deploy

Smart contract migrated successfully. But while deploying the contract function, it is showing an error. I gave the command in terminal as : Swap.deployed().then(function(contract) {contract....
1
vote
1answer
19 views

Trouble executing transactions on a private PoA network with blocktime set to 0

I'm trying to run a private PoA(Proof of Authority) network with the blockTime (clique.period in the gensis block) set to 0. I'm testing a truffle contract against this network, and when executing ...
0
votes
0answers
13 views

Connecting to Truffle Develop's Console?

You can create a local Truffle instance of the Blockchain, connect to it with the console, deploy your Smart Contracts, and monitor its log via the following commands. Terminal Tab 1: truffle ...
0
votes
0answers
24 views

Unable to pass an array of addresses to a contract from js

I am trying to write a test for an airdrop contract, which takes in an array of addresses and sends a number of tokens to them. The test code is as follows: it("should airdrop 20 tokens to 3 ...
0
votes
0answers
8 views

can not find module leafpad after installed

error Error: Cannot find module 'leftpad' at Function.Module._resolveFilename (module.js:470:15) at Function.Module._load (module.js:418:25) at Module.require (module.js:498:17) at ...
0
votes
0answers
14 views

truffle syntax error [closed]

not sure why this error SyntaxError: missing ) after argument list at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:549:28) at ...
0
votes
1answer
20 views

why i get a lot of errors when i use truffle?

Seems that i have a lot of lost dependencies for example installing sha3 errors: > node-gyp rebuild C:\Windows\system32\node_modules\sha3>if not defined npm_config_node_gyp (node " C:\Program ...
0
votes
0answers
19 views

truffle migrate stop at the first contract

When I tried to run "truffle migrate" with geth (private network), the migration process stop at this point: Running migration: 1_initial_migration.js ...
0
votes
0answers
12 views

truffle error module is undefined

the error http://prntscr.com/kf9plb I just tried using truffle test and fails. Project https://github.com/cexdelta/0xbitcoin-token Code truffle module.exports = { networks: { development: {...
0
votes
1answer
29 views

truffle migrate cause “Error: insufficient funds for gas * price + value truffle migrate”

When I run "truffle migrate" to deploy contract to geth, I got this error: "Error: insufficient funds for gas * price + value truffle migrate". this is the genesis block of my private chain: { "...
0
votes
1answer
24 views

Basic token transfer and unit test

I am having trouble testing a very naive transfer method for my coin, based off of the ethereum.org demo coin. I've simplified it down into the essentials, yet my solidity unit test keeps failing. ...
0
votes
0answers
18 views

Undeclared Identifier running truffle and solidity

I have amended my contract to use the new constructor for solidity ^0.4.17 and i keep getting this error Undeclared identifier. I am new to solidity does anyone have any ideas ? FeverContract.sol ...
1
vote
1answer
54 views

Pending transactions are not mined

Preconditions I'm running a private network with Geth, having custom smart contracts deployed by Truffle and a simple frontend which using Metamask as a provider to connect the network. Versions ...
0
votes
0answers
16 views

Trying to compile with truffle show vbs error

Error http://prntscr.com/ker26k fIle require('babel-register'); require('babel-polyfill'); module.exports = { networks: { development: { host: "localhost", port: 7545, ...
1
vote
1answer
20 views

Smart Contract Balance = 0

Ok, I am pretty new to developing contracts, and I did so by using dAPP and truffle. But when adding it to the chain, it says there is no balance to the contract. How can I add tokens to be bought? ...
0
votes
1answer
19 views

Expect Error: transaction in Truffle [duplicate]

Im testing wheter a require function does its job by reverting and want to test in within a truffle test. it("The URI should be unique", async () =>{ const dupURI = await token....
0
votes
0answers
39 views

truffle box webpack Uncaught SyntaxError: Unexpected token {

I executed truffle unbox webpack in powershell and downloaded the package. After I did npm install and npm run dev I get the following error: Uncaught SyntaxError: Unexpected token { and it ...
0
votes
1answer
17 views

Created Standard Token, deployed successfully but on Myetherwallet error

Here is the token contract I created - https://ropsten.etherscan.io/address/0x2cccce414fcdf028c0574766af4302a4abeb5788 Address: 0x2CCcCe414FCdF028C0574766Af4302A4aBEB5788 For some reason I can not ...
0
votes
1answer
35 views

What address deploys a contract in truffle test

I have a contract called AccessControl, in which the owner of the contract is set when it is deployed. I want to test that the method on it setCEO updates correctly, but in order to do this the ...
1
vote
1answer
39 views

Error: Invalid number of arguments to Solidity function - I'm pretty sure the number of arguments is correct?

General problem: Using double linked list. Because of block gas limits, I call a function off-chain to find the exact insertion point. https://github.com/genesisdotre/ethereum-auction Branch: no-...
0
votes
2answers
30 views

Get array values in Truffle console

Is there a way to print the values of an array in my contract to a console (using truffle or geth for example)? Suppose this is my contract: contract MetaCoin { uint256[] public someNumbers; ...
1
vote
1answer
29 views

The contract code couldn't be stored, please check your gas amount. Truffle, privatenet

I'm developing a smart contract over private blockchain using Truffle framework. Developed smart contract was running well, today we have been introduced one pure method as per requirement. Afterwords,...
1
vote
2answers
29 views

The contract code couldn't be stored, please check your gas amount. [Zeppelin, Truffle.js, Ropsten]

I am having some problem with deploying the simple Token Contract to Ropsten network. Error is "The contract code couldn't be stored, please check your gas amount". I tried to change Gas values ...
0
votes
2answers
33 views

Stuck in truffle compile

When I run truffle compile it stuck forever after compiling contracts . I am importing openzeppelin library and using infura , ropsten and metamask to deploy contract on testnet. . Here is the output ...
0
votes
1answer
20 views

Why does triggering a send on a contract method work, while call doesn't?

I'm still somewhat new to web development and solidity, so do correct any of my misunderstandings. I've been working with web3 on the front end, but now I'm trying to set up a server side web3 ...
0
votes
1answer
18 views

Truffle Javascript tests won't change Contract State (Contract State won't Change)

I reviewed a similar answer but it didn't work. Right now I'm starting with an Example trying truffle, I did a small Echo project based on the Pet Store Box from Truffle. And i'm having some problems: ...
0
votes
0answers
22 views

Retrieve bytes32 type array values in web application using web3 which contains all the number inside it

In my smart contract, I have one array of bytes32 datatype. And I am initlizing the value while migrating the smart contract like this : module.exports = function(deployer,accounts) { deployer....
0
votes
1answer
29 views

Unable to read contract instance variable from deployed contract with truffle test

I am attempting to write some unit tests as I'm working on the development of some smart contracts, but I've run into an issue that's preventing me from continuing. I'm attempting to check the address ...
0
votes
0answers
24 views

How to find module in truffle pack

I am trying to run a JS test script with truffles but I can not seem to find the right place to store the assertRevert file so that the module can be found by the script when I try to run the test. ...
0
votes
0answers
16 views

Cannot read property '2' of null ERROR during truffle compilation

Here is the source code. pragma solidity ^0.4.24; import"./SafeMath.sol"; contract erc20 { function totalSupply() public view returns (uint256); function balanceOf(address who) public view ...
0
votes
0answers
32 views

problems with web3 and geth

I am developing a DAPP, I am using truffle 4.1.13, geth 1.8.12, web3 0.20.7. for network I am using rinkeby. When I try to migrate the project it was saying the address needed to be unlocked in order ...
0
votes
1answer
24 views

Error while deploying contract

While deploying contract to ropsten tesnet (truffle migrate --network ropsten) I am getting an error: insufficient funds for gas * price + value ropsten: { network_id: 3, host: "...
0
votes
0answers
27 views

Simply throw ETH to the crowdsale contract address,Error: VM Exception while processing transaction: revert

I deployed my simple ERC20 token and simple Crowdsale contract into development network with locally installed Truffle, and I Simply throw ETH to the crowdsale contract address, but received this ...
0
votes
2answers
23 views

How to pass msg.sender and constructor params in truffle tests?

I have the following constructor: constructor(address _payee) public { payer = msg.sender; payee = _payee; } And this function in my JavaScript tests: beforeEach(async () => { ...
4
votes
3answers
466 views

I get error couldn't find module 'ethereumjs-wallet/hdkey'

I was running this code deploy.js const HDWalletProvider = require('truffle-hdwallet-provider'); const Web3 = require('web3'); const { interface, bytecode } = require('./compile'); const provider = ...
0
votes
1answer
47 views

No network specified. Cannot determine current network

How to solve the following problem? $ truffle migrate Error: No network specified. Cannot determine current network. at Object.detect (C:\Users\Welcome\AppData\Roaming\npm\node_modules\...
0
votes
1answer
9 views

Error npm installing consensys diligence takehome bignumber util

``` /sudo npm install Password: Unhandled rejection Error: Command failed: /usr/local/bin/git clone --depth=1 -q -b master https://github.com/debris/bignumber.js.git /Users/quantum/.npm/_cacache/tmp/...
0
votes
0answers
15 views

how to solve this problem truffle compile error [duplicate]

$ truffle compile Error: Cannot find module 'babel-register' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:...
0
votes
0answers
13 views

Create and manage user accounts on ethereum(truffle) with my web app (on Ruby on Rails)

I have created a small application on truffle, simple voting system. I followed a tutorial and it works like a charm. I am basically a full stack rails developer and now want to connect my truffle ...