The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [truffle]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
132 views

Truffle: How to test for inheritance

I have a Contract B which should inherit from contract A. Using Truffle, how can I test that this is indeed the case?
1
vote
0answers
280 views

Separate contract calling mint from token contract

I have a standard ERC20 token contract with minting functions: pragma solidity ^0.4.11; import "./Stake.sol"; import "./Mint.sol"; contract Token is Stake, Mint { //omitted standard ERC20 text }...
0
votes
1answer
96 views

Where do i define the test contract params?

lets say i have this code (taken from here) // Specifically request an abstraction for MetaCoin var MetaCoin = artifacts.require("MetaCoin"); contract('MetaCoin', function(accounts) { it("should put ...
1
vote
1answer
263 views

Specify Token Price

I'm pretty much new on this. But I really want to learn. I just created a contract for mintable token on Kovan test-net. But, I'm getting confused when I try to buy the token, it's always shown x000....
2
votes
1answer
1k views

Using view modifer in solidity gives error in truffle compiler “ParserError: Expected token LBrace got 'View'”

I am running truffle test with the following simple test contract, however it seems that it doesn't understand the view modifier. Contract pragma solidity ^0.4.18; contract MetaCoin { function ...
3
votes
1answer
137 views

Client to sign transaction and deploy contracts with no chain downloaded

I'd like to deploy contracts from truffle using a localhost wallet but without syncing all the chain. I think this should be possible: a lightweight client able to connect to the network and to sign ...
0
votes
2answers
163 views

Contract Name Types in Truffle Solidity Tests

The example in the docs for truffle .sol tests has these lines: MetaCoin meta = MetaCoin(DeployedAddresses.MetaCoin()); and MetaCoin meta = new MetaCoin(); I've had a good read through the docs ...
0
votes
1answer
247 views

Web3: Perform contract function but only receive transaction hash or incorrect value

I am trying to demo a function on my own geth testnet. I deployed a sample contract I found at http://solidity.readthedocs.io/en/develop/types.html?highlight=crowdfunding. pragma solidity ^0.4.11; ...
2
votes
0answers
95 views

Standard Truffle assertions documentation

I have found Assert.sol which is the code that defines the standard Truffle assertions. Is there a document which describes the available functions? An index would be useful as a start...
1
vote
0answers
34 views

Can only deploy contracts on Parity when --geth flag is invoked [duplicate]

When I try to truffle migrate a contract on a private blockchain using Parity, I get The contract code couldn't be stored, please check your gas amount But when I do everything else the same, ...
0
votes
1answer
51 views

Dummy/test truffle contract?

I am having trouble migrating a contract using truffle. So I want to test with another contract. I know nothing about this. Can someone point me to a contract/project I can download and migrate? I'...
3
votes
1answer
2k views

Can't retrieve Event logs with MetaMask Web3

I have no problem retrieving events with this code: contract.MyEvent({}, { fromBlock: 0 }).get((err, data) => console.log(data)) But when I use the exact same code in a browser that is using ...
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?
1
vote
1answer
758 views

How to generate new address for new contract created by constructor

I'm trying to resolve a problem and google is not useful this time. On my localhost truffle + testrpc I have a contract which returns a new instance of a new contract. import 'contracts/...
5
votes
3answers
2k views

accessing truffle contract abstractions from external JS script

When writing tests in truffle (v3.2.1) I can forget about things like a contract's ABI and address and just use ContractName.deployed() to interact with a contract on my testrpc chain. How can I mimic ...
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 ...
2
votes
1answer
511 views

Truffle work over HTTPS

I installed my own ethereum node and put it behind HTTPS nginx proxy. geth attach works perfectly but truffle deploy failed with error: <html> <head><title>400 The plain HTTP ...
2
votes
1answer
2k views

Deploying to testnet using Truffle and Metamask

Is it possible to deploy a smart contract developed using truffle to testnet using just Metamask (without a local eth client instance running)? I tried importing the private key of metamask wallet to ...
0
votes
1answer
1k views

How to call a function from truffle

I'm new to ethereum. I followed a tutorial and I ended up with a contract that looks like this pragma solidity ^0.4.15; contract HelloWorld { uint public balance; function HelloWorld() { ...
0
votes
1answer
407 views

Truffle-Contract error with Metamask

It seems that on my computer/web browser Google Chrome is slow to inject meta-mask. Therefore I have to write something like this for my App to actually get the web3 instance instead of failing: ...
0
votes
2answers
582 views

Token not found on Etherscan after Deploying Crowdsale

I am deploying contract that creates a token and a crowdsale, based on code slightly modified from zeppelin-solidity. Problem: After deploying the contract to Rinkeby using Truffle and Infura, ...
4
votes
1answer
4k 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 ...
0
votes
1answer
274 views

Hello world not working. Function not found

I have a simple test contract that I've deployed using truffle: pragma solidity ^0.4.4; contract TestObject { uint public myValue; function TextObject() { myValue = 1000; } ...
2
votes
1answer
3k views

Truffle migrate does not run 2_deploy_contracts.js

I am having problems with truffle migrate on the default Truffle project and using Infura as the provider. Steps to reproduce problem truffle init npm install ethereumjs-wallet bip39 web3-provider-...
1
vote
2answers
3k views

truffle-contract .new() contract method

The Truffle documentation says that the new() contract method deploys a new instance to the network. I have the following code: const Web3 = require('web3'); const provider = new Web3.providers....
1
vote
2answers
2k views

Deploy multiple contracts with dependencies - Truffle

Say I have two contracts, an oracle and a reader. How do I test (or even deploy) them both? contract Oracle { struct DocumentStruct{bytes32 name; uint value;} mapping(bytes32 =&...
2
votes
2answers
1k views

`Synchronous requests are not supported.` in truffle 4.0

The following code in truffle (v4.0-beta) is failing: .then(() => web3.eth.sendTransaction( {from: accounts[0], to: swt.address, value: 1e10})) Error: Synchronous requests are not ...
1
vote
0answers
265 views

Adding payable to my contract constructor causes the contract deployment cost to be really high ~100 Ether

Here is an abstract/interface contract I created because I want to call this contract which will be deployed before my other contracts. It just holds the addresses of all the contracts I have deployed....
1
vote
0answers
80 views

Solve Git Code Error Contract Crowdsale

I am getting the following error when doing truffle migrate on the following code: https://github.com/CoinFabrik/ico/tree/9ac3487b6103c96958cdabf8b9ce2071a7250cd8 Deploying Crowdsale... Error ...
0
votes
0answers
211 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 ...
1
vote
0answers
172 views

How to deploy contracts within the same Truffle project at different times

If I have a Truffle project with two different contracts in it, can I deploy them at two separate times? Can I run an additional command alongside truffle migrate that will allow me to deploy just one,...
0
votes
1answer
39 views

Why are there two types of tests in Truffle?

Can someone help me understand why there's 2 tests in the test directory when using Truffle, for the default configuration? There's metacoin.js and TestMetaCoin.sol. What can one test with metacoin....
1
vote
1answer
290 views

it should be possible to use interfaces with truffle

we have an interface contract which we would like to declare as interfaceI have created a file with only this code: pragma solidity ^0.4.14; interface UserDirectoryFactoryI { function ...
0
votes
1answer
430 views

How do I tell what account for Truffle to use when testing contracts?

I'm using Truffle together with Parity to test contracts. How do I tell truffle what account to use with Parity when testing contracts? I have a total of 3 accounts in Parity currently. The command ...
0
votes
2answers
794 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, ...
15
votes
2answers
5k views

Truffle Migrations Account Locked Error with --network command

I have started a private blockchain using the command, geth --networkid 1337 --datadir ~/home/xyz/testnet --ipcpath /home/xyz/.ethereum/geth.ipc --rpc --rpcapi eth,web3 --rpcport 8545 --rpcaddr ...
3
votes
1answer
102 views

Issue in executing transaction using testrpc in truffle

I have created an app using truffle and testrpc. I have verified the contract functions using truffle console..It worked. But while executing the transaction from front-end it is getting the following ...
3
votes
0answers
261 views

Problem migrating contract using truffle. Unknow account message

I am trying to migrate a contract using truffle but I get a "Unknown account" message eventhough I tried various ways to unlock the account beforehand. Am I missing something? Any help really ...
3
votes
1answer
2k views

Truffle: Contract transaction couldn't be found after 50 blocks

I'm trying to deploy a contract to the Ropsten testnet via the truffle console. In my truffle.js file, I set the gas parameter to gas: 4700000. When I run migrate --reset, I always get this error no ...
0
votes
1answer
259 views

Export a JS package from Truffle?

Truffle has this whole build process for deploying fronted code that is kinda mediocre. Does anyone know if I can just have Truffle output a single javascript file that will work in a web3 enabled ...
3
votes
1answer
1k views

Unable to migrate contracts to Kovan using truffle.js (testrpc and dev chain works though)

I'm having problems deploying contracts to kovan. I'm able to deploy to testrpc, as well as the parity dev chain, but the exact same process fails on kovan. The contract hangs at: Running migration: ...
8
votes
3answers
857 views

trouble matching gas used in transaction with difference in account balance

I've fired up my testrpc and deployed a simple HelloWorld contract using truffle. I send a simple transaction to my contract and I log my account balance before and after the transaction. ...
1
vote
0answers
678 views

How can I sign raw transaction generated by truffle?

I can create tokens by the following way. However, I want to sign raw transaction generated by truffle so that I don't need to store my private key online. How can I get raw unsigned transaction? $ ...
5
votes
3answers
1k views

Does deploying a contract mean it will overwrite the last instance?

I must have missed something about deploying contracts, but to be sure: I'm using Truffle, Does deploying a contract mean it will overwrite the last instance? Since I see that it gets a new address ...
1
vote
1answer
1k views

Geth or truffle which one?

I've been using truffle, testrpc and metamask to test my contracts. Recently I've observed that people are using geth to test deployed contract. Question: Which one is recommended and better? Edit:...
2
votes
1answer
987 views

Uncaught TypeError: web3.personal.sign is not a function while using a dapp built using truffle

I'm running Metamask on Chrome. When I run the following in the developer console on a random page or even Etherdelta Metamask prompts me to sign a message and this is the expected behaviour. web3....
0
votes
1answer
553 views

Cannot connect to testrpc

I have a testrpc running on a virtual machine (Ubuntu 16.04) and it works properly when I interact with it using the truffle console. My only goal is to call a smart contract that simply sends ether ...
4
votes
0answers
224 views

how to get revert at the previous timestamp of evm in testrpc

I am testing my contracts so at some point i need to increase the timestamp of evm that i achieve through evm_timeIncrease but now i want to execute some functions on the basis of current timestamp ...
1
vote
1answer
582 views

Keep contract state after truffle test

I just figured out how to deploy smart contracts on a test RPC with truffle. This is great! But when I do my tests, I am wondering how to keep the state of a deployed contract for the following test. ...
0
votes
1answer
734 views

Truffle always exceeds my gas limit

In truffle saving 1 struct exceeds the default gas of testrpc. Is this function poorly written, or is this common in truffle. VM Exception while processing transaction: out of gas solidity pragma ...