Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
76 views

Which one of methods should I choose for deployment of smart contract geth or a wallet if I have to build API for smart contracts in nodejs?

I'm having trouble to understand which method would be better for deployment geth or a wallet if I'm building API in nodejs using web3. Where exactly is the contract stored?? Is the contract ...
0
votes
2answers
3k views

Cannot read property 'deployed' of undefined issue

I am trying to launch an Election-Dapp. I have these dependencies installed: - Nodejs v9.11.1 - npm v5.8.0 - Truffle v4.1.3 - web3js v0.2 - ganache-cli Below is my solidity contract pragma ...
2
votes
1answer
382 views

Calling function from another contract reverts

I've been developing a dApp that needs ERC721 tokens. I have three contracts, a base contract, the one to mint tokens and another one for auctions. The inheritance looks like Base > Token > Auctions. ...
1
vote
1answer
142 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
223 views

SOLVED - truffle develop command doesn't return anything

I updated my node and nvm version. Then I ran truffle develop command on my project folder, this command doesn't return anything.. why? it just stays... local blockchain dosen't start. Versions: ...
0
votes
0answers
49 views

Using Webpack getting the error 'Uncaught Error: Module parse failed: Unexpected token (32:44)

Here is the complete error Uncaught Error: Module parse failed: Unexpected token (32:44) You may need an appropriate loader to handle this file type. | if(typeof window.web3 !== 'undefined') { | ...
1
vote
3answers
219 views

Reading the result of a function that change state by using events in Solidity

I would like to get the result of a function by listening its emitted event. These are two pieces of code of my contrats CONTRACT 1: function createTradeableContract() public stopInEmergency ...
3
votes
1answer
285 views

Can not deploy to Rinkeby via truffle - cannot read property 'bind'

I am using truffle: "^4.1.14" and ganache-cli version "^6.1.8". When I try to migrate to ganache cli network, it works without a problem. But when I try to migrate to Rinkeby, it always fails. The ...
0
votes
1answer
66 views

Unable to change the length of a global 2D storage array

I am facing difficulties changing the length of a global 2D storage array. It seems to be working correctly on Remix IDE, but when I try to test it on ganache-cli (formerly known as testrpc) - either ...
0
votes
1answer
157 views

A contract works in remix but not when used with truffle

Below is the contract: uint32 firstTimeUserPoints=10; struct struUser{ string orginalName; string originalKshoplink; string orginalDocumentConvention; bool ...
0
votes
0answers
14 views

Empty Address when using Truffle Debug

I currently have a local chain with Ganache. Say I have two contracts written in Solidity: Foo_v0_0_1.sol Bar_v0_0_1.sol In the code for my smart contract Foo_v0_0_1, I have the following: import &...
1
vote
3answers
424 views

Deploy smart contract on Ropsten with Truffle without truffle-hdwallet-provider

Here is my truffle-config.js networks: { ropsten: { network_id: 3, host: '127.0.0.1', port: 8545, gas: 4000000, from: "address_in_metamask" }, I ran a geth node using the command: geth --...
0
votes
0answers
23 views

Uncaught (in promise) TypeError: Cannot read property 'deployed' of undefined

I am working on a truffle dapp project. Other than init(), initWeb3(), and initContract(), I have been doing fine interacting with my contracts in several JavaScript functions, until I created my 9th ...
11
votes
4answers
5k views

I want to know how to quit the truffle console?

just like the question!! I always kill the progress by kill the main shell. I want to change this way.
0
votes
1answer
71 views

When closing node (geth ropsten) I cannot save created accounts

I am pretty new to this. I downloaded the ropsten blockchain using a geth command line. Then, using Truffle, I created an account, but when I closed my node (ctrl - c on the geth command line) and ...
1
vote
2answers
140 views

Truffle Ropsten Deployment Issues

I just made some updates to my contracts and tried to redeploy them - but I'm getting this message, over and over again. Its not even attempting any of the migrations - it just goes right to this ...
1
vote
1answer
95 views

Contract testing works in solidity but fails in truffle - testrpc

I have a contract like this: PublishService.sol, the strings.sol is taken from here. pragma solidity ^0.4.0; import "./strings.sol"; contract PublishService { using strings for *; struct ...
0
votes
1answer
126 views

Transfer contract address from truffle to meteor

I am very new to dApp-Development and therefore frankly i need some basic help. How can i get the address of my deployed contract by truffle in meteor? I hope there is a simple solution.
1
vote
2answers
288 views

Truffle and Remix compiles differently

I have a smart contract that outputs a different bytecode when compiled with truffle, and with remix, even though both seem to use the same compiler version: 0.5.7+commit.6da8b019 Is that a known ...
0
votes
1answer
131 views

Transaction reverted when testing requires/asserts in non void functions

im trying to test the requires of a Smart Contract using just solidity according to this article: http://truffleframework.com/tutorials/testing-for-throws-in-solidity-tests This is the contract, the ...
0
votes
1answer
89 views

Can't use token variable's method at contract that inherit zeppelin crowdsale?

Calling the method of Crowdsale's "token" on the source that inherited Crowdsale of zeppelin v1.8.0 inevitably causes "out of gas". Error: Error: VM Exception while executing eth_call: out of gas ...
0
votes
1answer
579 views

Import error in Truffle Pet Shop tutorial

I'm executing an example in the Truffle Pet Shop tutorial. While testing with file TestAdoption.sol, I have encountered the following error: Source truffle / Assert.sol not found The source code ...
0
votes
1answer
71 views

ReferenceError: cannot access 'CONTRACT' before initialization

I'm trying to test a single smart contract (PCE_Contract.sol) with (PCE_Contract_test.js) using Truffle. When I run Truffle test, console output is : ReferenceError: Cannot access 'PCE_Contract' ...
1
vote
1answer
584 views

Correct syntax for contract.method.send() function?

I have a problem understanding the web3 documentation at the readthedocs especially here: https://web3js.readthedocs.io/en/1.0/web3-eth-contract.html#id12 myContract.methods.myMethod([param1[, param2[...
0
votes
1answer
353 views

How can i connect external AWS server's truffle in browser?

I have deployed geth, truffle, testrpc whichever needed in live AWS server. All the configurations are working properly. I have initiated 'truffle develop' and 'npm run dev'. Both are working fine. ...
0
votes
0answers
24 views

How to work around warnings of infinite gas requirements for this function

This is the warning Gas costs: Gas requirement of function SimpleStorage.data is infinite: If the gas requirement of a function is higher than the block gas limit, it cannot be executed. Please avoid ...
1
vote
1answer
36 views

How do i test “it” methods with truffle?

I have this contract: contract('MetaCoin', (accounts) => { it('should put 10000 MetaCoin in the first account', async () => { const metaCoinInstance = await MetaCoin.deployed(); const ...
1
vote
1answer
11 views

How to change the sender of a function call?

I have this code from truffle unbox metacoin: ontract('MetaCoin', (accounts) => { it('should put 10000 MetaCoin in the first account', async () => { const metaCoinInstance = await MetaCoin....
1
vote
1answer
120 views

Transaction cost in a truffle test

I've a contract under test and the method I'm checking is supposed to transfer an amount, and in order to check I need to have the cost of the transaction. I'm using this code: var tx = await ...
0
votes
1answer
16 views

How to create a test contract that takes parameters?

I have a contract like so: pragma solidity ^0.5.16; pragma experimental ABIEncoderV2; Contract Ballot { constructor(string[] memory proposalNames) public { } } How do I create a test-instance ...
2
votes
3answers
830 views

Deploying smart contract with truffle and infura giving me error

I am having trouble deploying my smart contract to the ropsten network using infura and truffle am getting error that says "var sig = secp256k1.sign(msgHash, privateKey); ^ ...
0
votes
0answers
10 views

Does the Bytecode and ABI generated for each contract also include it's imports?

If not, how does a contract such as an ERC20 get deployed if each output has its own ABI and Binary file? When compiling with truffle, and looking at A.json (where A imports B and C) it seems that it ...
0
votes
2answers
880 views

Deploying on Rinkeby with Truffle using infura

If I want to use HDWalletProvider to deploy my contract on a specific address, what should I do? rinkeby: { provider: () => { return new HDWalletProvider("Mnemnoic", "https://ropsten.infura....
0
votes
2answers
97 views

why web3.eth.getBlockNumber().then(console.log) returns 0

I have build a Ethereum Full Node in Ubuntu 18.04. geth is running through the following command: nohup geth --rpcaddr 127.0.0.1 -rpcport 8545 --rpc -rpcapi "wb3,admin,eth,personal,net" --ws --wsaddr ...
1
vote
2answers
207 views

Program for interacting with deployed contracts via a GUI?

So I've deployed a contract to Rinkbey using truffle, and now I'd like to play with it. I'd like something that builds a GUI for me from the ABI like EthFiddle does. I just want something that lists ...
0
votes
2answers
136 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
3answers
155 views

Error in the truffle init command, quorum

i'm trying to truffle a project but each time it shows me this message, whereas, i'm sure i installed the truffle successfully. vagrant@ubuntu-xenial:~/quorum-examples$ cd project vagrant@ubuntu-...
0
votes
1answer
563 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....
2
votes
1answer
374 views

Passing one contract instance as an argument to the constructor of another contract

I need to use the functions of the ERC20 contract in another contract. The ERC20 contract is from the openZeppelin contract library. I found the following code on a website: import "../../...
0
votes
1answer
119 views

Nothing happens whe I run truffle test

I am new to solidity. Maybe I am missing something obvious in the setup. But when I run truffle test, I get nothing, the terminal just stays there forever. $ truffle test ... and I don't know why, ...
0
votes
1answer
19 views

What is the proper way to check if msg.sender is the contract owner?

I'm trying to make a function that returns true if msg.sender is the owner. This is my function; function isAdmin() public view returns (bool){ require(admin == msg.sender); return true; ...
1
vote
1answer
169 views

How can I configure node when I run truffle test?

How can I get truffle test to execute node with the --abort-on-uncaught-exception option? I'm guessing that I should probably add something in the Truffle's configuration file (truffle.js), but the ...
0
votes
1answer
75 views

Getting stuck in truffle testing

I am trying to run a test and I am getting the following message; I have tried the following; npm install scrypt npm install web3 as to solve the yellow message and when running truffle test ...
1
vote
3answers
809 views

Can't compile old solidity contracts(version 0.4.17)

I'm new with blockchain development. I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2; These versions were in the package.json file of the project. When I installed ...
5
votes
2answers
2k 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
1answer
456 views

Truffle Migrate Error: Could not find built Migrations contract: Unexpected token in JSON at position 0

Running truffle migrate with valid contract code started causing this error for me: Writing artifacts to ./build/contracts Using network 'development'. Error: Could not find built Migrations ...
3
votes
1answer
89 views

Non-specific error from truffle debugger

I am testing a contract which is using ecrecover function of solidity. While its testing when i go with a failed test case while debugging, it doesn't go step by step and at the end return the same ...
0
votes
1answer
113 views

Truffle testing not reading contract

Here's my solidity: contract Oracle { mapping(uint => uint) oracle_values; modifier onlyOwner { require(msg.sender == owner); _; } function Oracle() public { owner = msg....
0
votes
2answers
191 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
167 views

The contract code couldn't be stored, please check your gas amount while deploying contract

I'm trying to deploy 3 contract in 2_deploy_contract (I deploy all 3) but after the first is deployed I get the following error : The contract code couldn't be stored, please check your gas amount.

1 2
3
4 5
46