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
2answers
78 views

How To store data in ethereum network using truffle framework ?How to achieve the database layer in dapps?

I am creating a dapp which has to be a login authentication system and some datas has to be store in database. So I really cant' store all the datas in Solidity's variable or class object, it has to ...
0
votes
1answer
76 views

Truffle migrate code with library, interface and contract

Suppose that I have a token contract as follow. How can i write the new migration.js file in truffle to deploy the contract? TestCoin.sol import "openzeppelin-solidity/contracts/math/SafeMath.sol"; ...
0
votes
1answer
66 views

Truffle develop vs Ganache. Is there a reason to prefer one over the other?

Now that Ganache is usable, I don't see a reason to use truffle develop anymore. Is there still a scenario where the latter is preferred?
0
votes
1answer
24 views

Creating contract account with ether balance in original sendTransaction?

trying to send a very simple contract creation transaction that includes a value with it so that the created contract already contains an ether balance. Is this not possible. Basically I'm sending a ...
2
votes
0answers
52 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 ...
1
vote
0answers
48 views

is not contract address during truffle test

I have a stupid smart contract like this: pragma solidity ^0.4.24; contract ProdottoFactory { function foo() view returns(string nome){ return "foo"; } } And I want to test it ...
1
vote
1answer
103 views

Truffle test, logs do not include an emitted event

I am calling a contract function which emits an event in a transaction. This transaction should include the event and is typically visible via: const receipt = await contractInstance.someFunction() ...
1
vote
0answers
21 views

Read args object from particular block transaction in truffle console.

Hi I have question on how to read args from specific block transaction that are passed when event was called. I have triggered an event, my block is created and i got transaction tx. In the ' Logs: ' ...
1
vote
0answers
91 views

truffle-hdWallet-provider not return correact address when using private key

I want to access MyEtherWallet account address from truffle-hdwallet-provider. This is the code. ``` var HDWalletProvider = require("truffle-hdwallet-provider"); var privateKey = process.env.KEY; ...
2
votes
0answers
69 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
42 views

Unresolved libraries error with a single sol file

I initially had my libraries in separate contracts, but I had trouble deploying my contracts. I am trying to debug the issue so I moved all of my contracts into one file, ERC20God.sol: pragma ...
2
votes
2answers
111 views

Metamask now longer interacts with PetShop Dapp

Since November the 4th - In order for MetaMask to interact with your webpage dapps, you need to implement the windows.ethereum.enable as part of your scripts I have run through the pet shop tutorial -...
0
votes
0answers
176 views

Deploy Contract with truffle on Private Network using Parity

First I followed this demo PoA tutorial to build a private PoA network using Parity. Then I wanted to use truffle to compile and deploy a smart contract. I tested the deployment using ganache test ...
2
votes
2answers
129 views

Zeppelin OS: revert Cannot call fallback function from the proxy admin

I have been attempting to create a simple upgradable contract using Zeppelin OS: Following the tutorial I have been able to: - Create a new contract - Deploy it using zos push - Create the proxy ...
1
vote
0answers
14 views

Contract mined but Truffle gives error

Something weird happened, and I can't understand what to do now. While migrating the contract to the MainNet, I received this: $ truffle migrate --network live Using network 'live'. Running ...
0
votes
0answers
164 views

Deploying a contract from Remix IDE, using from Truffle

As I understand, if I compile a contract via truffle compile to have the Contract.json, and then deploy the contract from Remix IDE to, say, Ropsten, the dapp should work via MetaMask pointed to ...
2
votes
1answer
31 views

How to specify the Gas price for ICO contract

I am writing a ICO contract in truffle using openzeppelin I used the below code in the truffle.js and I am trying to launch in mainnet. When I tried this I could see that the transaction is using the ...
0
votes
0answers
146 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 = ...
0
votes
1answer
40 views

Truffle console no compile or init options

While using truffle.cmd console I tried to use the compile option, or even init. These options are not available, so I cannot compile using console. truffle(development)> .help .break Sometimes ...
1
vote
0answers
99 views

How to specify Truffle contracts directory

I am looking to use Truffle for testing. For JS tests (in test/*.js), Truffle expects (requires?) all my solidity files (mocks, contracts) to be located in contracts/. I would prefer if my mocks ...
0
votes
2answers
40 views

How to make Truffle tests run separately without contaminating state

I have a test contract with four test functions. Using truffle compile && truffle test. If I run it as normal, functions 1-3 pass and #4 fails. If I commend out function #2 then functions 1,...
0
votes
1answer
73 views

Loading multiple truffle artifacts from a single sol file

Big picture: How do I get multiple contract instances from a single sol file using truffle-contract? I have two Contracts in my .sol file (it's more of a contract factory) const artifacts = require(...
0
votes
1answer
26 views

Problem watching events without invoke functions in the Smart Contract

I have an event which is sent each time when a contract is deployed. It is launched in the constructor. I have a Dapp where I want to watch this event to send a tx each time that a smart contract is ...
1
vote
1answer
122 views

How to turn off specific warnings for the solidity compiler?

Whenever I use pragma experimental ABIEncoderV2 and truffle, I get the following warning in the terminal: Warning: Experimental features are turned on. Do not use experimental features on live ...
0
votes
2answers
50 views

How to debug mappings of structs in truffle tests

This is my test file: pragma solidity ^0.4.24; import "truffle/Assert.sol"; import "truffle/DeployedAddresses.sol"; import "../contracts/Salaries.sol"; contract TestSalaries { function ...
0
votes
1answer
28 views

Ownership trasfer to crowdsale contract fails while deploying in truffle

I have created a "Token" and the "Crowdsale" contract as mentioned in the openzeppelin. Below is my deployment code in truffle. I am new to ICO related coding and solidity. The question may be very ...
1
vote
1answer
33 views

Must token contract transfer all tokens to crowdsale contract before it can sell them?

I notice that on the standard tests for crowdsale contracts in Openzeppelin, they transfer the tokens from the Token contract to the Crowdsale Contract: context('once deployed', async function () { ...
1
vote
0answers
63 views

How to get gasPrice from API and use it in truffle.js mainnet network?

I'm fairly new to javascript and I'm trying to automate pulling the gas price from an api and using it into the truffle.js used to execute via truffle. Basically, I can pull the gasprice via the API ...
0
votes
1answer
197 views

How to use specific version of web3

I have listed the versions of web3 versions installed in my system npm ls web3 inbox@1.0.0 /home/mdvenkatesh/Desktop/etherium solidity programes/inbox +-- truffle-hdwallet-provider@...
1
vote
1answer
67 views

Is there a way to test an onlyOwner function from a Truffle/Solidity unit test?

I have a contract with a function marked as onlyOwner (from OpenZeppelin, so only the address that deployed the contract can call it). pragma solidity ^0.4.17; import "./Ownable.sol"; contract ...
0
votes
1answer
111 views

Error: Cannot find module 'ethereumjs-wallet'

A truffle test needs ethereumjs-wallet const wallet = require('ethereumjs-wallet'); I tried npm install ethereumjs-wallet and even npm uninstall ethereumjs-wallet npm install --save ethereumjs-...
0
votes
1answer
68 views

Truffle Flattener creates empty flat file

Using trufffle-flattener, I am trying to create a flat file merging all the related solidity based codes. After executing the flattening scripts, I see only the empty flat file getting created. Could ...
1
vote
3answers
75 views

ERC20 totalSupply not returning the correct value

I am testing an ERC20 contract based on Openzeppelin-solidity template. But I am observing a curious behavior with reading a global variable. Here is the contract: pragma solidity ^0.4.24; import ".....
2
votes
1answer
494 views

How to get private keys on Truffle from Ganache accounts

Doing some ERC-735 tests on truffle+ganache I got stuck when creating claim signatures. They need to be signed from my ganache account, but I don't know its private key. The code to be used is this: ...
0
votes
2answers
158 views

Truffle : dotenv is not working in truffle.js

I am trying to get the seed words from the powershell command prompt. Hence I am using the 'dotenv' in truffle.js require('dotenv').config(); console.log('aa - process.env.MNEMONIC : '+mnemonic); ...
1
vote
0answers
181 views

Issue in installing truffle-hdwallet-provider

I am trying to install "truffle-hdwallet-provider" using the command "npm i truffle-hdwallet-provider --save". I am getting the beow mentioned error. Please assist me in resolving this. truffle-...
1
vote
1answer
53 views

Testing deployed contract on Truffle

I'm having trouble testing a contract using truffle. I have the latest version of truffle installed as well a TestRPC. It's to my understanding that the latest version of truffle comes with a ...
0
votes
1answer
140 views

Remix IDE + Ganache vs Truffle + Ganache

I have an issue migrating a smart contract from Truffle into Ganache. However, when I run the same smart contract from Remix IDE via MetaMask into Ganache, everything works fine. To bypass the ...
1
vote
0answers
16 views

Wallet files in a Dapp

I am developing an application from the truffle webpack and I have created my own wallet, adding my account to a json file: $.getJSON('../wallet.json', function(data) { var password = "xxx"; ...
1
vote
1answer
124 views

Truffle migrate got stuck

Issue I ran the official example code: truffle migrate,and stuck there for a long long time: truffle migrate Running migration: 1_initial_migration.js Deploying Migrations... Steps to Reproduce I ...
1
vote
2answers
98 views

Saving contract address after deploying with Truffle

To automate my development cycle I want to save the addresses of deployed contracts so that my DApp can read this information and know where to find the contracts on my private block chain: for ...
0
votes
1answer
20 views

Deploying using Truffle unbox

The following code is taken from truffle unbox initContract: function() { $.getJSON("adding.json", function(addingdappfrontend) { App.contracts.Add = TruffleContract(...
0
votes
2answers
37 views

promise chaining in test.js file

it("should throw an exception if you try to buy an article that does not exist", function() { return ChainList.deployed().then(function(instance) { chainListInstance = instance; ...
1
vote
1answer
64 views

Unit test in truffle fails

pragma solidity ^0.4.23; contract adding{ uint256 public total; function add(uint256 val1,uint256 val2) public returns(uint256){ total = val1+val2; return total; } } The above code ...
0
votes
2answers
77 views

Intracting with dapp using frontend truffle petbox

App = { web3Provider: null, contracts: {}, account: '0x0', init: function() { // Load pets. return App.initWeb3(); }, initWeb3: function() { if (typeof web3 !== 'undefined') {...
0
votes
1answer
975 views

Uncaught ReferenceError: TruffleContract is not defined

I am working on a smart contract. When I try to serve my smart contract via lite-server I see following error in the browser console Here my app.js source code: https://pastebin.com/UjFuYCyQ I have ...
1
vote
2answers
125 views

Error: No network specified. Cannot determine current network. for Truffle Migrate

I am getting this error for truffle migrate. truffle migrate Error: No network specified. Cannot determine current network. at Object.detect (/usr/local/lib/node_modules/truffle/build/webpack:/...
3
votes
0answers
125 views

How to get Truffle to generate artifacts for contracts outside of project?

Say I have a contract MyToken.sol which has already been deployed to a public Ethereum network. Its source is maintained in an external repository and is included in my package.json file so that it ...
0
votes
2answers
41 views

Uncaught in promise error: DAI has not been deployed to detected network, network artifact mismatch

I reviewed the other questions that had a similar error and they didn't help with my problem. On my main net contract, with my MetaMask on main net, I am getting this error when processing ...
1
vote
1answer
30 views

Starting Ethereum Development [duplicate]

Sorry for vague question but just looking to get some insight. I have just began developing a dapp for the ethereum network and I need some advice on what development frameworks/technologies to use. I ...