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

Why is gasestimate coming as “infinite” when I'm trying to return a dynamic array in solidity?

I understand, that as the list grows it is going to cost infinite gas. I'm making a temp array in memory of size of our dynamic array at present size and then returning that array. But does that make ...
1
vote
1answer
80 views

Solidity Error:Running Out of Gas / selfdestruct problem

I've been going through 'Building Cryptocurrency and its ICO' by DappUniversity. I know many have questioned this issue and I've been through all the post but couldn't resolve it. The problem is self-...
1
vote
1answer
39 views

What are the inputs to the truffle Txn?

I am testing truffle now and I want to know more about what it deploys and how. It seems to use two txns. I have some results - Running migration: 2_deploy_contracts.js Deploying CA12... ... ...
0
votes
2answers
33 views

Deploy contract dynamically based on user request

Inspired by this blog: https://medium.com/coinmonks/escrow-service-as-a-smart-contract-the-business-logic-5b678ebe1955 I want to deploy contract once a buyer want to purchase a service. However, I ...
0
votes
1answer
64 views

Solidity Test - which are the variables and keywords over here

Can anyone help me in understanding what is happening over here? I understand that the contract name is TestAdoption, but after that - what is the first word "Adoption"? The second word "adoption". I ...
1
vote
3answers
71 views

How do I determine the network within a truffle exec script?

I'm writing a script to be executed with truffle exec and I need to add some logic conditional on the network we're calling truffle exec with. This is (roughly) what I want in my script: const ...
0
votes
1answer
234 views

Unhandled Rejection (Error): invalid string value (arg=“x”, coderType=“string”, value=5)

Using Truffle unbox react to unbox a boilerplate. received the following error from running npm run start Changes: Addition of "memory" parameters in the simpleStorage.sol Changed unit to string in ...
1
vote
1answer
83 views

truffle deploy live | transaction not mined within 750 seconds

I'm trying to deploy my smart contract to the live ETH network. I've done the same process on rinkeby and it works fine. However during the block mining phase it times out and gives the error: " ...
0
votes
1answer
43 views

problem with sequence deployment

I followed this way of deploying contracts using truffle. // Deploy A, then deploy B, passing in A's newly deployed address deployer.deploy(A).then(function() { return deployer.deploy(B, A.address)...
1
vote
1answer
56 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 ...
1
vote
1answer
115 views

Debugging a VM error in solidity

I'm getting the following error while running a test in truffle: Error: Returned error: VM Exception while processing transaction: revert Now, the code is simply to big and complicated to run ...
1
vote
1answer
47 views

Initiate transaction from server to smart contract

In my case, i have an API written in PHP which periodically checks the database. If certain condition was met, i need to send an alert message from the API to an account/node in the Ethereum ...
0
votes
1answer
630 views

Specify different solc compiler for different files in truffle?

I am using truffle, and have a number of x.sol files in the contracts directory, different files require different versions of the compiler - how do i deal with that? I think i SHOULD be able to do ...
0
votes
1answer
584 views

Error: Transaction:exited with an error (status 0) after consuming all gas

New to Ethereum and learning unit testing with Truffle. Here in smart contract function; function createAgreement( bytes32 _id, address _owner, string _fileHash, ...
1
vote
1answer
110 views

How to call variadic function in erc223 contract

There is two transfer function in my contract, And i m trying to call transfer function of erc223 for transfer token to contract address using this function. Token.deployed() .then(function(i) { ...
0
votes
1answer
41 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 ...
0
votes
1answer
47 views

Gas amount to store a contract?

i'm trying to run truffle migrate and it gives me always this error. Error: The contract code couldn't be stored, please check your gas amount. MBP-de-Alicia-2:smartContracts alicialombarte$ truffle ...
1
vote
1answer
281 views

I am getting error while installing truffle in Ubuntu 16.04 LTS. How to resolve this issue? [closed]

When i enter this command: sudo npm install -g truffle I get the following error: > truffle@5.0.27 postinstall /usr/lib/node_modules/truffle > node ./scripts/postinstall.js Error: EACCES: ...
0
votes
2answers
310 views

File import callback not supported import “./IERC20.sol”;

when I try to compile my contract I see errors like this : DemirelToken.sol https://eksiup.com/p/4z49413damc3 here's the code : pragma solidity ^0.5.0; import "node_modules/openzeppelin-...
0
votes
1answer
28 views

How does a transaction verified with Truffle test?

I'm a new to Ethereum and Solidity, and I don't understand how Truffle executes transaction calls. From what I learned and understood, if I try to use a contract method which changes the contract's ...
2
votes
1answer
83 views

Kaleido private network transaction exited with an error (status 0) after consuming all gas

I've created a private PoA network with two geth nodes using Kaleido (release 1.0.13) and am trying to deploy some smart contracts to it using the drizzle-kaleido-box boilerplate from truffle. The ...
0
votes
0answers
18 views

Smart-contracts referencing each other [duplicate]

How would one retrieve these three addresses in the "Knot" smart-contract? I am very new to this, and would like to know whether this is even possible. The "Knot" contract should be able to reference ...
0
votes
1answer
54 views

Reverted tx on Ropsten but gas limit not reached

This is a timed crowed sale contract https://ropsten.etherscan.io/tx/0xaa3fa69a32060ad578cb9bc2a94fcc4cf7109f4e743f54c527c18f764f634ebb Error encountered, bailing. Network state unknown. Review ...
0
votes
0answers
32 views

uncaught error:invalid address

Uncaught (in promise) Error: invalid address at inputAddressFormatter (formatters.js:271) at inputTransactionFormatter (formatters.js:97) at method.js:89 at Array.map (<anonymous>...
2
votes
1answer
55 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! ...
1
vote
1answer
59 views

Smart contract - OpenWeatherMap API

I'm wanting to create a smart contract that sends an amount of ether to an address when the weather is above 30 degrees for 3 or more consecutive days, using the OpenWeatherMap API. How can I use ...
1
vote
1answer
53 views

ERC721 Transfer Event issue

Looking at the open-zeppelin ERC721 Contract's code, I see that the very last thing that its mint function is doing is call emit on the contract's pre-defined Transfer event. My question is: how do ...
1
vote
0answers
68 views

Cannot read property 'type' of undefined - abi-coder

I'm creating a simple voting contract. It is deployed with truffle and infura. This is the contract code: pragma solidity >=0.4.21 <0.6.0; contract Voter { struct OptionPos { uint ...
0
votes
1answer
65 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
2answers
193 views

How are truffle artifacts different from ABI?

How are truffle artifacts different from ABI? Do Truffle artifacts include fields that are different from ABI that is generated using remix?
1
vote
1answer
34 views

During gas-free transaction get an error “No relay responded! 4 attempted, 4 pinged”

I did all modification related to this instruction https://github.com/tabookey/tabookey-gasless However, when I'm trying to write some tests it fails and provides me the following error Error:...
1
vote
1answer
63 views

Not able to send Ether to contract

I am trying to send Ethers to a contract deployed on Ganache but I am getting VM Exception while processing transaction: revert, the same logic is able to transfer Ethers to other account. Following ...
1
vote
1answer
118 views

Deploy smart contract on Ropsten using truffle-hdwallet-provider

I have 7 smart contracts to deploy on the Ropsten network. I am using truffle-hdwallet-provider and below is the content of my truffle.js file: module.exports = { solc: { optimizer: { ...
3
votes
1answer
1k views

Transaction gas cost in truffle test case

Below is from a truffle test cases in javascript, where I was trying to add the gas cost to an account balance to confirm the sum of transaction, where the sum should be equal to the previous balance. ...
1
vote
0answers
25 views

estimateGas works on Truffle, but fails on geth

I'm trying to estimate the gas required for deploying a smart contract. It works fine in Truffle, but fails in Geth for some weird reason: truffle(develop)> await web3.eth.estimateGas({ data: '...
0
votes
1answer
52 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 ...
1
vote
1answer
66 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 ...
1
vote
0answers
22 views

“truffle init” not working after installing

After I install truffle with: $ npm install -g truffle And get: /usr/local/Cellar/node/12.5.0/bin/truffle -> /usr/local/Cellar/node/12.5.0/lib/node_modules/truffle/build/cli.bundled.js ...
1
vote
1answer
159 views

Truffle Deploy gas limit exhausted

I kept on getting this error. 9/10 of my deployment will fail. But out of the sudden it will be success without any reason. I have checked the transaction receipt and indeed it had reaches the gas ...
1
vote
1answer
54 views

Getting the transaction hash on function call

I am new to Solidity, Web3, and Ethereum. I am trying to build a web application through which users can upload a file to IPFS, then store the IPFS hash in the blockchain. I am using the React truffle ...
1
vote
1answer
216 views

UnimplementedFeatureError: Encoding type “struct BiddingContract.Bidder memory” not yet implemented

The code is broken with the new upgrade v0.5, using Truffle v5.0.1 (core: 5.0.1) struct Bidder { address bidders_address; uint productId; uint bidValue; } struct Product { uint ...
0
votes
2answers
64 views

Error: Invalid number of parameters (regular getter function). Got 0 expected 1!

Playing with drizzle, I am trying to use a getter for an uint variable campaignCounter, that gets incremented by 1 whenever a factory creates a new campaign. Here is my component's code: import ...
0
votes
1answer
135 views

Solidity: How are multiple return values returned?

Working in truffle with TDD testing and am getting some errors when evaluating the return values of some functions. If a function is returning multiple values in Solidity, how are they presented? Is ...
0
votes
1answer
65 views

I keep getting the error: “Uncaught (in promise) Error: Invalid number of arguments to Solidity function”

I have tested it in remix and the function does work, I also removed inputs just for testing purposes but it seems that it doesn't work anyway. Here is the function: struct Message{ string ...
0
votes
0answers
36 views

Hosting pet-shop DApp on IPFS - JSON Files problem

I am trying to host DApp "pet-shop" which one of the truffle boxes on IPFS. rsyncing of src, build/contracts and ipfs add files went very well and there are plenty of peers as seeders on the network ...
3
votes
2answers
69 views

How to test events that were sent by inner transaction / delegate call?

Usually, using truffle I can check for events like this: let { logs } = await myContract.doSomethingImportant( xxx ); // 1500 tokens are expected to get expectEvent.inLogs(logs, '...
2
votes
2answers
183 views

Error when running Truffle Test in Terminal

I am trying to use truffle to test my smart contracts and have written some test files. I am getting an error on the terminal trying to run the test and am unsure what the reason is. I access my ...
0
votes
1answer
91 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 ...
0
votes
2answers
74 views

Unused function parameter. Remove or comment out the variable name to silence this warning

I have a smart contact which have 2 owner address and 3 functions. my set functions is set a users with msg.sender and my getUser functions is returns name,surname and age and I want to add a admin ...
0
votes
1answer
43 views

Calling Smart Contract function returns tx object instead of expected return value in Truffle test

I have started writing a smart contract for a gift registry. When I write tests using the Truffle Framework I get unexpected return values. For example, when calling the offerGift function from ...