Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
5
votes
1answer
377 views

Getter function on solidity

what mistake did I make? pragma solidity ^0.4.0; contract Getter_check { uint public data = 50; function f() constant returns (uint r) { r = data; } } pragma solidity ^0.4.0; ...
5
votes
1answer
2k views

How to deploy truffle contracts to Rinkebey?

What are the parameters that I have to specify to be able to deploy solidity contracts using Truffle in the config file? I am using Metamask to store test ether and have a unique mnemonic to define ...
5
votes
2answers
762 views

Events being fired twice

Given a function and a event in a contract: event OtherCreated(address other, address addr1, address addr2); function doSomething(address addr1, address addr2){ if(aBool == true){ ...
5
votes
2answers
852 views

Run truffle test without recompile every time?

Is there a way to run truffle test and not recompile the solidity code each time? It takes a lot of time if i just want to play around with the javascript tests... Thanks!
5
votes
1answer
390 views

Truffle error “Don't set config.from directly”

I have parity running on my mac and I can start it with parity --rpcaddr 0.0.0.0 --rpcport 8547 --port 30305 --rpccorsdomain '*' --rpcapi "eth,net,web3" Once It's all sync'd up I then make a new ...
5
votes
1answer
600 views

Out of gas exception: error when using GUI/JS but not within truffle

I'm trying something with Ethereum and my current testing environment is Truffle. In the smart contract I have a struct with 5 fields (bytes32, bytes32, bytes32, address, bool). If a call a function (...
5
votes
0answers
169 views

Dapp Development using Truffle framework getting error

I am using truffle framework, which has pudding functionality. I have compiled the same contract on the both Dapps and deployed it on the one Dapp. Now i am trying to access it from another Dapp using ...
4
votes
2answers
4k views

Deploying a Contract at Test Time with truffle

I'm having trouble getting my test harness set up in truffle. I have 2 contracts. The first is an Issuing authority and in order for the second to be deployed, the creation address must be ...
4
votes
3answers
82 views

I got this error during migration in truffle. : ParserError: Expected '(' but got identifier

This is my smartcontract code pragma solidity ^0.5.0; contract DappToken{ uint256 public totalSupply; constructor DappToken() public{ totalSupply = 10000; } } This is code for ...
4
votes
4answers
4k views

Truffle develop (Ganache) increase block gas limit

I can deploy my contract on Remix (Javascript VM and Rinkeby), but if I try to use truffle develop and migrate, I am getting an error: Error: Exceeds block gas limit. The gas used in Remix is 3585084. ...
4
votes
2answers
3k views

What should be the gas and gasPrice for Ropsten Network in Truffle Config?

I just want to test my smart contract to be deployed in the Ropsten network, and I'm still puzzled on what should I put for the gas and gasPrice in the Truffle config. Thoughts about this? ropsten: { ...
4
votes
2answers
4k views

Truffle — Microsoft JScript runtime error [duplicate]

Running truffle from command line gives me this Windows 7 popup message: While init runs successfully. I see file truffle.js in my project folder. How can I handle this gently?
4
votes
3answers
956 views

Iterating through an array in JS and simple promises (web3/pudding)

This might be more to do with my lack of understanding some JS basics however it's in ethereum/web3 context so here it goes. I have a public array posts in my contract and a global variable in JS of ...
4
votes
3answers
3k views

Truffle develop get new contract instance from contract address

From a truffle develop console, is there a way I can get the contract instance from the contract's address? I have a remote ec2 with truffle/geth installed and truffle develop instance running. From ...
4
votes
1answer
5k views

Truffle mingration: Error: authentication needed: password or unlock

I deploying contract using Truffle and got an error Error: authentication needed: password or unlock. I already checked related questons and found only ugly hacks like "unlock desired account directly ...
4
votes
1answer
5k views

Web3 - Uncaught TypeError: contract.abi.filter is not a function

I have compiled and deployed a simple Hello World contract using truffle: pragma solidity ^0.4.4; contract Greeter { function Greeter() { } function sayHello() returns(string) { ...
4
votes
2answers
703 views

Mock Smart Contract For Unit Testing

I'm new to Ethereum and solidity, I'm developing a simple decentralized application using Truffle where I have an abstract contract Storage and another contract Reader which uses storage. contract ...
4
votes
2answers
2k views

How much does it cost to upload a smart contract?

I'm using a local Ethereum testnet and it seems to me that the price of uploading a smart contract is a bit too high. This is the code for the smart contract: contract Transfer { address owner; ...
4
votes
2answers
473 views

How to connect two truffle instances?

How can we connect two truffle applications with each other? E.g., if we have two metacoin applications, how can these two communicate with each other?
4
votes
1answer
100 views

couldnt understand implementaion of UpgradeabilityProxyFactory

I want to use UpgradeabilityProxy provided by zeppelin, they have one method createProxyAndCall which they say initialize the new implementation with data parameter we provided which looks like: * ...
4
votes
3answers
947 views

Truffle migration contract not found - but it's there!

I have a feeling this is going to be a forehead-slapper, but here goes... I'm attempting to run Truffle's "Pet Shop" demo app on AWS. The truffle compile command ran fine, with a few non-fatal ...
4
votes
4answers
519 views

Truffle Drizzle-box fails with TypeError: (0 , _drizzle.generateContractsInitialState) is not a function

Right after unboxing Drizzle-box I'm getting a TypeError: (0 , _drizzle.generateContractsInitialState) is not a function. Ganache is running on localhost:8545, contracts are deployed, Metamask ...
4
votes
1answer
1k views

How do I compile a Solidity contract with an import to standalone byte code?

I am trying to compile the MetaCoin contract (part of the Truffle Init Webpack). I need to get the byte code as hex numbers so that I can use it with Nethereum. The MetaCoin contains an import to ...
4
votes
1answer
5k views

Expected identifier, got 'LParen'

I try using IterableMapping by this example. I have error when I compiling contract by truffle: Expected identifier, got 'LParen' This is my code: pragma solidity ^0.4.15; import "./itMapsLib....
4
votes
2answers
430 views

Truffle tests not resetting account states

I've written some truffle tests that interact with the account balances. Example: A contract transfers X amount of ether from account A to account B. Surprisingly the state of the accounts (...
4
votes
1answer
656 views

Is the address used to deploy contracts in JS tests in truffle always accounts[0]

I've noticed that the deploying address in my truffle .js tests is equal to the address at accounts[0]. Since it's important to me to test the ownership of a contract, I'd like to know if it's ...
4
votes
1answer
5k views

Account is locked, after running Truffle migrate command [duplicate]

I am new to this technology and I am trying to Deploy the contract to Ropsten test network. I have my geth running in one terminal. In my truffle console I have an account with some ether. I unlock it,...
4
votes
1answer
208 views

Alternatives for Truffle for running and writing tests

Truffle offers many conveniences for writing tests for Ethereum smart contracts. The benefits include no need for a separate chain process like Ganache, complex automation of linking and deploying of ...
4
votes
1answer
230 views

solidity-coverage adds extra events which make unit-test fail

It seems that when using the latest solidity-coverage (0.5.11), truffle (5.0.0-next.25) ganache-cli (6.2.4-beta.1) and solc (0.5.0) additional events / logs are emitted during tests which make the ...
4
votes
1answer
3k views

Convert hash function hex to bytes32

The output of hash function SHA256 is a hex string of size 64. For example: 3ed54831f488a22b28398de0c567a3b064b937f54f81739ae9bd545967f3abab I want to call the function of a smart contract with the ...
4
votes
1answer
2k views

How do I make truffle migrate replace just one contract?

I have a dapp consisting of two contracts, which don't particularly have a dependency on each other or know about each other. I want to replace one of the contracts, but not the other one. If I did ...
4
votes
1answer
359 views

Can I truffle migrate with geth --light?

I get invalid address when I try to, I suspect --light doesn't enable deploys -- is that so?
4
votes
1answer
375 views

Truffle Migrations contract constructor argument

I'm reading the Truffle Migrations contract and looking at the code for upgrade(): function upgrade(address new_address) public restricted { Migrations upgraded = Migrations(new_address); // * ...
4
votes
1answer
3k views

Deploy smart contract to mainnet with Infura and MetaMask

I am trying to deploy my smart contract to the main net using the following code: truffle.js: module.exports = { networks: { live: { provider: new HDWalletProvider("mnemonic from ...
4
votes
4answers
3k views

Truffle for Windows: I can't make it work

I've installed Truffle v3.2.1 for Windows. If I try to run: truffle console Could not find suitable configuration file. If I run: truffle create:contract MyContract I get nothing but command ...
4
votes
1answer
3k views

truffle console - return (array of addresses) issue

This problem happens only when I place contracts A and contract B in seperate file. When placed in same file, I get the array elements perfectly Please find the contract below. I was able to ...
4
votes
3answers
1k views

Deploying contracts on geth returns Error: connect ECONNREFUSED 127.0.0.1:8545

I'm using truffle (which uses pudding) to deploy contracts to my testrpc. No I'm running a geth instance locally with: geth --mine -rpccorsdomain "*" --ipcapi "admin,eth,miner" --rpcapi "eth,...
4
votes
1answer
466 views

Ganache + Truffle: how to deploy a contract without considering the gas

I am working with Ganache and Truffle. I am trying to deploy kind of a huge smart contract, but most of the functions in this smart contract are pre-prod functions, so I do not really worry about real-...
4
votes
1answer
361 views

“ app.candidates is not a function” getting these error while caling the function through truffle console with "app.candidate'

pragma solidity ^0.5.0; contract Election { //Model a Candidate struct Candidate { uint id; string name; uint voteCount; } //Store Candidate //Fetch ...
4
votes
1answer
2k 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. ...
4
votes
1answer
2k views

Return a mapping in Truffle test

How would you guys call a mapping from a test and get the values? This is the mapping that I have on my contract: mapping(address => uint[29]) balanceOf; It´s a mapping to an array of integers ...
4
votes
2answers
694 views

Deploy Contract (compiled by Truffle) without using Truffle

A contract SimpleStorage.sol has been compiled by Truffle using truffle compile. Its artifact is found at build/contracts/SimpleStorage.json. However, this contract should only be deployed to the ...
4
votes
1answer
731 views

Error: invalid address during truffle migration process in Rinkeby network

I can't deploy my contract to Rinkeby network through truffle migrate --reset --network rinkeby. My truffle.js file looks like this: { networks: { rinkeby: { { ...
4
votes
1answer
1k views

truffle migrate fails with Network state unknown, Error: account is locked

I'm trying to run the truffle demo on the ethereum testnet but truffle migrate fails with "Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: account is ...
4
votes
1answer
5k views

Get block address through web3.eth.getBlock(1)

I'm getting a list of the last few blocks like described here. Now I can't seem to get the address of each block or the associated contract, through web3.eth.getBlock. A lot gets returned, but no ...
4
votes
2answers
1k views

truffle deploy to geth failing, generating “receipt not found” repeatedly from geth

I've just installed truffle on an ubuntu virtualbox, and it is failing to deploy to a geth dev setup. Geth gives me a never-ending receipt not found for transaction ...
4
votes
2answers
81 views

How to test a function call that should fail?

Im using Truffle to test my smart contracts written in Solidity and I would like to mark test as passed if function call/execution fails. Example: await instance.cancelOrder({from: accounts[1]}); ...
4
votes
2answers
790 views

How can I access the address of a contract in a drizzle dapp?

I've started working from the drizzle box and can access functions within contracts, but if I want to give an allowance to a contract address so it can use users tokens how can I give the correct ...
4
votes
1answer
877 views

Contract deployed successfully to Ganache via Truffle, fails to deploy on live network

I basically followed this Zeppelin crowdsale tutorial, just changed the names of the contracts. I was able to successfully deploy on a local Ganache, but then when trying to deploy to the live ...
4
votes
1answer
2k views

How to set truffle-hdwallet-provider as the Web3 currentProvider inside a web page

https://github.com/trufflesuite/truffle-hdwallet-provider/blob/master/README.md provides sample usage for the deployment configuration inside tuffle.js. I need a sample that update the Web3 ...

1
3 4
5
6 7
44