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.

0
votes
0answers
8 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
12 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
18 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
0answers
20 views

constructor is not getting initialized when deployed contract using truffle-hdwallet-provider on rinkeby test network

My contract is getting successfully deployed on the Rinkeby test network using truffle-hdwallet-provider but, the value I gave to the constructor (string a) while deployment is not getting initialized ...
0
votes
1answer
14 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
0answers
17 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
2answers
23 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 ".....
1
vote
1answer
34 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
30 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); ...
0
votes
0answers
21 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
7 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
27 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
8 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
20 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
34 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
15 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
1answer
20 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
23 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
32 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
0answers
12 views

I hace the following error making unit test with solidity: TypeError: Member “lengthEqual”

I want to assert that i have a transaction receipt hash when calling a method in my contract, so I want to use Assert.lengthEqual, which I can see in the Assert.sol library contract, but I have the ...
0
votes
1answer
23 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 ...
0
votes
1answer
15 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:/...
1
vote
0answers
21 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 ...
1
vote
1answer
22 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 ...
1
vote
0answers
22 views

how can I measure a function execution time based on truffle

I'm using truffle to test my smart contract written in solidity language deployed on the Quorum blockchain. I want to measure the execution time of the invocation of a function using truffle. Is ...
1
vote
0answers
16 views

How do I set up the azure truffle boxes?

Hi I was looking through the newly added azure-boxes on truffle boxes such as the azure-simple-marketplace-box and was wondering how to set up the front-end for these boxes. Is it just suppose to be ...
1
vote
1answer
17 views

How to process Smart Contracts payable functions in batch?

I am aware that metamask will enable effective security for processing via the web browser a payable function action to a smart contract. What happens in batch? I have an API service which then ...
0
votes
0answers
17 views

Error in test file in vscode file not found

With truffle 4.0.5 on windows, test files fail to "import" with error: Error ParserError: Source "truffle/Assert.sol" not found: File not supplied initially. import "truffle/Assert.sol"; ParserError:...
1
vote
1answer
37 views

Transaction execution and interacting with truffle

pragma solidity ^0.4.23; contract Hotelbooking{ address receiver; function deposit(uint256 _amount) payable public { require(msg.value == _amount); // nothing else to do! ...
0
votes
0answers
24 views

Setup Parity PoA network compatible with truffle framework deployment mechanizm

The question from the title kind of wraps around the real problem but it is actually what I'm having trouble making work. I'm trying to setup production PoA network so using all the flags made for ...
1
vote
2answers
40 views

Truffle interaction with my smart contract getting Vm exception

pragma solidity ^0.4.23; contract Hotelbooking { event Transfer( address indexed _from, address indexed _to, uint256 _value ); mapping(address => uint256) public ...
1
vote
1answer
12 views

Token export error

I am writing tests for my smart contract and when I type in "truffle test" I keep getting this error. Does anyone have an idea what might be wrong? SyntaxError: Unexpected token export at ...
0
votes
1answer
32 views

Not able to deploy contract in testnet(Ropseten)

I am trying to deploy a crowdsale contract which is build upon openzeppelin while deploying it on geth --dev and ganache it gets deployed perfectly but whenever I am trying to deploy the contract on ...
1
vote
1answer
15 views

Link library inside contract creation

I have a contract like this pragma solidity ^0.4.24; import './MyLibrary.sol'; contract A { // Do Stuff } And I have a factory contract instanciating A contracts pragma solidity ^0.4.24; ...
1
vote
1answer
20 views

What are contract Variables and how are they different from normal varables declaration

pragma solidity ^0.4.2; import DappToken; contract DappTokenSale { address admin; DappToken public tokenContract; function DappTokeSale(DappToken _tokenContract) public { ...
0
votes
1answer
9 views

How can I persist the chain state of Truffle develop? [duplicate]

Is it possible to persist the chain state of Truffle develop? If my truffle console crash, can I restore the chain state?
-1
votes
1answer
16 views

I have deployed my contract using truffle but to see my accounts i am using web3 can any one explain what is going inside my contract while deploying

web3.eth.accounts [ '0x5aad8308d0c45d2b9fc1c465316ba071d2eb6f9c', '0x9d73990623df116eb56d300773aa458a11b11e4b', '0x1ea4dc6c3ab6d9ddca32083e3d5313ee319abd29', '...
0
votes
2answers
43 views

Running solidity-coverage with truffle gives error: can not find 'coverageEnv/migrations'

Running solidity-coverage gives the following error: $npm run coverage ... Writing artifacts to ./build/contracts Launched testrpc on port 8555 Running: node --max-old-space-size=4096 ../...
0
votes
1answer
22 views

Error: Web3ProviderEngine does not support synchronous requests

Error: Web3ProviderEngine does not support synchronous requests. I have an error when deploying contract to rinkeby provider const HDWalletProvider = require('truffle-hdwallet-provider') module....
1
vote
1answer
38 views

fromAccount and web3.js

This is my function in solidity function transferForm(address _from, address _to, uint256 _value) public returns (bool success) { } Now i am calling the same function in test file for testing my ...
0
votes
1answer
55 views

Testing transfer of tokens with truffle

I Have a Token contract: pragma solidity ^0.4.24; import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol"; contract MyToken is StandardToken{ string public name = "MyToken"; ...
1
vote
2answers
37 views

Truffle cannot find Ethereum client when running tests

By default this is the content of the file truffle.js: module.exports = { // See <http://truffleframework.com/docs/advanced/configuration> // to customize your Truffle configuration! }; ...
2
votes
2answers
66 views

Truffle Migrations | Same contract deployed multiple times

I'm using truffle migrations a lot, and I would like to deploy a contract twice during my migrations. Is it possible? Nowadays, I'm using migrations like const MyContract = artifacts.require('...
1
vote
2answers
40 views

Working of Truffle

The following is my code in solidity pragma solidity ^0.4.2; contract DappToken { //Constructor // set no of Tokens // Read the total number of Tokens uint256 public totalSupply; ...
0
votes
1answer
23 views

Accessing Contract Variables from JS Unit Tests

I am having trouble unit testing my contracts: I am using Mocha, Chai and calling truffle test I am testing LoanRecord.sol contract LoanRecord { public bool on; ... constructor(...){ ... ...
3
votes
0answers
21 views

Running a geth light client, how do I resolve the error: “No trusted canonical hash trie”?

I've been running a geth light client to deploy smart contracts through Truffle Migrations to mainnet. I'm getting: "Error: No trusted canonical hash trie". Any help in what this entails and how to ...
0
votes
1answer
48 views

i want a to write a function to get user data by giving the id of the user

pragma solidity ^0.4.23; contract ChainList { struct data { uint ownernumber; uint id; } uint value; mapping (uint256 => data) public datamatching; function storedata (...
1
vote
1answer
22 views

I have deployed my smart contract but i am unable to interact with it using truffle

MY ChainList.sol code pragma solidity ^0.4.23; contract ChainList { struct data { uint ownernumber; uint id; } uint value; mapping (uint256 => data) public datamatching; ...
0
votes
0answers
18 views

Is it safe to make the the code size to 128KB in ethereum private network?I have my concerns for DOS attack

I deployed a private Ethereum network with POA consensus. After deployment, I was deploying a smart contract (this contract is 600+ lines) for my application. I got this error: Error: oversized ...
0
votes
1answer
28 views

Difference between the way methods are called in smart contract

What is the difference between instance.totalSupply() vs instance.methods.totalSupply().call() To my knowledge one is for truffle and the other is for web3. But truffle also uses web3 then why can ...