Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
0
votes
3answers
390 views

Can I avoid out of gas errors using testrpc

I am writing a proof of concept using truffle and testrpc and I have to spend hours optimizing the code to avoid out of gas errors. Is there a way to bypass this error or have a very high value. I ...
0
votes
1answer
201 views

Oraclize code not compiling using TRUFFLE COMPIL

I am trying to compile below mentioned code (taken from Oraclize documents) using TRUFFLE but am getting compilation error saying : 'Cannot parse one.sol: Unexpected token p in JSON at position 0'. ...
0
votes
1answer
142 views

Why is a state-modifying function working from Truffle console, but not when calling from web3?

I have a contract which offers two functions: 1) A state modifying function which takes two parameters 2) A constant function I have a web frontend in React calling these functions. When I call the ...
0
votes
1answer
274 views

Comparing msg.value using javascript test always fails

So I have this solidity function: function claimGoodTest(uint256 typeId) public payable { if (msg.value < 4000) revert(); } I test it with the following: var result = await contract....
0
votes
2answers
431 views

How to call Base contract function externally when only Derived contract deployed

Base pragma solidity ^0.4.18; contract ZombieFactory { event NewZombie(uint zombieId, string name, uint dna); uint dnaDigits = 16; uint dnaModulus = 10 ** dnaDigits; struct Zombie ...
0
votes
1answer
181 views

Interacting with Contract Abstraction from file

In the official Truffle Docs over here, it is demonstrated how to interact with a deployed contract. So far, I've come across only the Truffle Console, which is everything but intuitive for larger ...
0
votes
1answer
715 views

How to deploy a contract with Truffle and MetaMask [duplicate]

How do I deploy a contract with MetaMask & truffle-contract? Currently if I want to deploy a contract with truffle-contract I'll have the following code. var web3 = new Web3(new Web3.providers....
0
votes
0answers
413 views

Add accounts to truffle test environment at run time

I would like to add the keys and unlock some additional addresses at runtime for my truffle tests. Why? I have the need to create address from a seed generated elsewhere in my test so the private ...
0
votes
1answer
169 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
1answer
350 views

how can you deploy smart contracts on main ethereum network? [duplicate]

I have created a dapp and using truffle I have migrated and tested it on ganache, I was wondering how can I deploy same application on main ethereum network.
0
votes
2answers
245 views

Test pass with Remix but fails with Truffle

I have two contracts: ElephanteumStorage and ElephanteumCore. Storage just keeps some data. Core is provided to change the data in the Storage. As a constructor argument, ElephanteumCore receives ...
0
votes
2answers
120 views

After deployment, interaction with functions not giving desired output using Web3, Truffle

The set of contract-functions give expected behaviour when tested on Remix. But when the same functions are deployed on TestRPC using Truffle & Web3 and accessed using a Web Interface, it doesn't ...
0
votes
1answer
410 views

Running A Smart Contract With Two Nodes on Truffle

We have installed truffle to two nodes and we initialize our private blockchain with: $geth --datadir node init genesis.json Then we run geth on both nodes with: $geth --datadir node --nodiscover -...
0
votes
1answer
199 views

Trouble while installing truffle-contract module

When I run the command sudo npm install truffle-contract it gives me this error: npm ERR! code 1 npm ERR! Command failed: /usr/bin/git clone -q https://github.com/debris/bignumber.js.git /home/ubuntu/...
0
votes
1answer
385 views

Empty/null address handling in truffle pet shop tutorial

I am trying out the Truffle Pet Shop tutorial and it seems to be working all well except for a small issue. My solidity function getAdopters() returns an address[16] function getAdopters() public ...
0
votes
1answer
102 views

Problems running truffle [duplicate]

I am trying to follow a tutorial to deploy a smart contrat on Ropsten Testnet. I am in part 4. Deploy the contract to Ropsten test network: https://medium.com/@mvmurthy/full-stack-hello-world-voting-...
0
votes
2answers
696 views

How to represent the complete big number (all e)

When I convert a variable using the functions toNumber() or toString() I obtain this result: x.toNumber() 1e+27 But I want to see the entire number with all the figures. Because If I don´t convert ...
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 ...
0
votes
1answer
93 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
0answers
400 views

Truffle: errors when I try to access variables of a ERC20 token contract

I got a few errors when I try to access variables of a ERC20 token contract. The contract is the "Sample fixed supply token contract" from https://theethereum.wiki/w/index.php/ERC20_Token_Standard ...
0
votes
1answer
148 views

Deploying with Truffle

I deployed a contract through remix and then I run the following code MyContract.deployed() .then(instance => { c = instance; return c.getCreator(); }) .then(result => { ...
0
votes
1answer
345 views

Error: Invalid address

I keep encountering an error saying invalid address. Why is this? const Web3 = require('web3'); const contract = require('truffle-contract'); const MyContract = require('../build/contracts/...
0
votes
1answer
58 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 ...
0
votes
0answers
167 views

Log data along with transactions on the blockchain

I have a smart contract and on my web interface I'd like to display the 5 latest transactions. Currently these include any ether being sent to my contract which are retrieved using web3.eth....
0
votes
1answer
338 views

Why 'web3.eth.syncing' (Truffle console) returns 'false' when actually the testnet is running?

I run the ethereum testnet using the following command geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024 --rpcport 8545 --rpcaddr 127.0.0.1 --rpccorsdomain "*" --...
0
votes
1answer
331 views

Truffle testrpc - public variable getter method error

I'm running into a weird issue where I couldn't retrieve the value of a public variable in truffle console. It's a public variable used as a counter to track the number of records added. I spent ...
0
votes
0answers
26 views

What's the best way to monitor contract variables whilst developing?

I'm running a contract locally using Truffle, is there a way I can keep track of the variables in real-time whilst interacting with it on the front-end (Web3). I guess what I'm looking for here is ...
0
votes
1answer
229 views

Contracts work on testrpc but not Rinkeby. Using delegatecall (upgradeable contracts) pattern and trying to add new Contract() to array is failing

I have a series of contracts that work perfectly fine on testrpc but not when I deploy to Rinkeby. I am using a standard token contract with Zeppelin that I am having no issues with. The issue is ...
0
votes
1answer
411 views

Accessing Web3 in trufflebox's react-auth-box

Hi I am using trufflebox boilerplate react-auth-box. Created a new component called Foo where I am trying to access the web3 object that has been mapped from Store to this.props. However the console....
0
votes
1answer
242 views

Unable to deploy contracts through truffle and local geth

I get the contracts through truffle to post but seems to hang, and getting the following warnings in the local geth. all seems ok, but contract does not Deploy. Version: 1.7.2-stable Git Commit: ...
0
votes
0answers
190 views

Why does truffle console not start?

Trying to follow the tutorial on Medium, I would like to open the truffle console (Ubuntu 16.04). I get the following output: mzh@021-voting $ truffle console Error: Invalid JSON RPC response: "" ...
0
votes
1answer
388 views

truffle-contract Contract.new() produce an empty contract(no state)

I am making a new copy of a already deployed contract. I am using truffle, truffle-contract to do so. From JS front end var conf = contract(MyContract) conf.setProvider(this.state.web3....
0
votes
1answer
49 views

Any “testing” contracts I can migrate?

I am testing a private network and I want to test using truffle to migrate/deploy some contracts. Is there a library of test contracts somewhere that I can use for this?
0
votes
1answer
656 views

Accessing a 3rd party contract's functions using Truffle

I'm trying to build a basic dashboard that will allow me to track the status of any given ICO (assuming the token is ERC20). Right now, I managed to deploy a simple Crowdsale + Coin contract based ...
0
votes
2answers
397 views

How to detect what instruction caused “truffle test” to result in “invalid opcode” error?

I wrote a test for my contract and it returns invalid opcode as a result. Full output: 1) Contract: FPCoin1 One can purchase tokens for ether: Error: VM Exception while processing transaction: ...
0
votes
1answer
353 views

Events are not getting recognised TypeError: Contract.events.event is not a function

I am trying to get older state of a contract. I have deployed contract using truffle. my contract is pragma solidity ^0.4.15; contract NDA { bytes32 party1name; bytes32 party2name; bytes32 ...
0
votes
0answers
210 views

Console logging in Truffle promises throws exception

Does anyone know why console.log in Truffle Javascript promises causes errors given below? I have the following code, where as soon as I remove the console.log statements, the errors given below go ...
0
votes
2answers
792 views

Truffle TestRPC Error: VM Exception while executing eth_call: invalid opcode

I've created a project from a Truffle Box. I have created my own contract for voting. At this point i want to be able to vote, which seems to be working, and return the total votes for all candidates, ...
0
votes
1answer
114 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.
0
votes
1answer
198 views

How to chain functions in truffle framework?

I am wondering how to chain functions in truffle testing framework to avoid writing the same code twice. To give an example, I am experimenting with the old version of King of the Ether Throne ...
0
votes
1answer
867 views

solidity how to test a crowdsale contract in truffle and testrpc by sending 1 ether

my solidity MyContract running on testrpc with truffle i am trying to write a test using solidity to test the crowdsale contract i want to test when an address send 1 eth to the contract address the ...
0
votes
1answer
101 views

Why I am unable to write to contract in ethereum wallet?

I clicked on the watch contract and entered address and ABI. But I can't see any functions to write to contract. I compiled and deployed contract by using truffle framework ABI: { "...
0
votes
1answer
2k views

invalid address error on running code - solidity

Here is my code : var Web3 = require('web3'); var fs = require("fs"); var Artifactor = require("truffle-artifactor"); var provider = new Web3.providers.HttpProvider("http://localhost:8545"); var ...
0
votes
0answers
215 views

How to deploy smart contract using truffle , metamask with ropsten network [duplicate]

This question is an extension of Deploying to testnet using Truffle and Metamask Need to deploy smart contracts over ropsten testnet that connected through metamask . I am using truffle framework to ...
0
votes
2answers
333 views

Cannot assign value to a variable in truffle console and other problems

I'm trying to do very basic things with Truffle 3.4.6 console. I've been able to successfully compile and migrate a contract and access its contents using both: CoinCrowdsale.deployed() CoinCrowdsale....
0
votes
1answer
312 views

truffle init webpack on Heroku

I'm having a hard time exporting the Truffle sample app on Heroku. I'd like to use it with Metamask. I tried simply pushing the code from my local machine (where the code is working) adding the ...
0
votes
1answer
269 views

Cannot call function and send write-Transaction from geth-console

I have a contract which has this function: function registerSensor(bytes32 name, bytes32 unit, bytes32 location) returns (bool success) { sensors[msg.sender].exists = true; sensors[msg.sender]...
0
votes
1answer
766 views

How to return the index value of an Enum?

I am trying to build a simple double escrow contract. I have an enum for the state: enum State { Created, Locked, Inactive } State public state; When I try to interact with the contract through the ...
0
votes
2answers
280 views

Contract not disbursing MetaCoin to parent account

I've combined MetaCoin and created an Ownable contract to allow for my Relay contract have access to MetaCoin methods and variables. Everything is successfully deployed using truffle. My assumption is ...
0
votes
1answer
494 views

How to assign ether value at deployment of contract

I am trying to run this buyer seller contract in truffle using testrpc. I am unable to assign the address and value for seller at the time of deploying contract. Here is my solidity code and deploy.js ...