Questions tagged [testrpc]

Questions related to the test RPC client/simulator https://github.com/ethereumjs/testrpc

Filter by
Sorted by
Tagged with
26
votes
10answers
10k views

How can you handle an expected throw in a contract test using truffle and ethereum-testRPC?

Is it possible to write a test using truffle that attempts to confirm that a throw occurs in a contract? For example, if I had a contract with function... contract TestContract { function testThrow(...
21
votes
2answers
5k views

Oracle (oraclize.it) with Truffle and Testrpc

As I understood in the blockchain, it is "not" possible to interact with webservices outside the blockchain. This must be done over oracles in order to verfiy that the request is secure, and the state ...
19
votes
6answers
10k views

truffle has not been deployed to detected network

Is it possible to referer to a contract that has been deployed with Contract.new() with Contract.deployed() ? When referencing .deployed() in my test it throws : has not been deployed to detected ...
18
votes
2answers
10k views

Problem with Truffle Console: Cannot read property 'call' of undefined

I´m having problem with the basic HelloWorld example coded in Solidity and managed with truffle with testrpc. pragma solidity ^0.4.2; contract HelloWorld { uint public balance; ...
17
votes
4answers
10k views

'Error: base fee exceeds gas limit' When creating new contract instance (Using Truffle, Web3Js and testrpc)

I have the following code in app.js file of my truffle project. import { default as Web3} from 'web3'; import { default as contract } from 'truffle-contract' import conferrence_artifacts from '../../...
16
votes
1answer
5k views

What is the difference between testRPC and geth?

I wonder what is the difference between testRPC and geth (on private network) because, they both can create: blockchains nodes accounts The "only" difference I see, is that the testRPC has almost ...
12
votes
1answer
4k views

Truffle migrate fails

I am using testrpc. While running truffle migrate I get the following error: /usr/local/lib/node_modules/truffle/node_modules/truffle-contract/contract.js:671 throw new Error(this....
12
votes
2answers
4k views

How to pass constructor parameters to a contract using Truffle?

I am using testrpc and truffle for deploying contracts.I want to pass constructor parameters while deploying. contract User { string public userName; function User(string ...
11
votes
2answers
13k views

How do Enums work?

I am just starting out with Solidity and JavaScript and am trying to understand Enums. I have a simple contract pragma solidity ^0.4.4; contract SimpleEnum { enum SomeData {Channel} SomeData ...
11
votes
3answers
6k views

Truffle invalid address

With Truffle 3.0 when I call one of my contract's function, in console I have this error: Uncaught (in promise) Error: invalid address I found this workaround, and in my code I try this with no ...
11
votes
3answers
3k views

are there “public” ethereum nodes? or any recommendations on hosting solutions?

I've always ran apps on Heroku. Just developed a smart contract and I need to check the blockchain from the app. Are there public nodes I can connect to to get the info I need to show on my app? If ...
11
votes
1answer
3k views

Truffle's Ganache VS Testrpc

Is there any major difference between Truffle's Ganache and TestRPC? Do they run irrespective of each other as test blockchains, are there any side effects running both at same time? Is the only ...
11
votes
1answer
4k views

Setting the initial balance of an account in ganache-cli

How can I set the initial balance of an account when launching ganache-cli (aka testrpc)? There's nothing in ganache-cli --help to indicate that this is possible. However, when I launch ganache-cli -...
10
votes
2answers
3k views

truffle + testrpc time manipulation [duplicate]

I use truffle + testrpc for testing my contracts and I need to test some time-dependant code (I guess that situation is quite common). I set some objects, check some conditions, then I need to ...
10
votes
2answers
5k views

Manually execute transactions using testrpc and truffle

I started doing a bit of work in the geth console: geth --dev console but have moved to developing using truffle. To debug in the geth console, I'm used to executing the following: eth....
9
votes
1answer
2k views

Custom balance accounts testrpc?

I am setting up unit tests with for my contracts using truffle. I am using also testrpc, but having accounts with 2.123...... *10^37 Wei is not very helpful to visualise and debug things. I am trying ...
9
votes
1answer
566 views

Filtering on events of the entire blockchain not possible in testrpc via truffle

A contract I wrote has an event in its constructor. Since I want to find it back in the logs it doesn't seem possible to start listening to the latest block. Because the event is already 'fired' ...
8
votes
1answer
9k views

In the truffle console, how to set and get current account?

I'm using the $ truffle console. I can see my available accounts using truffle(development)> web3.eth.accounts. But when I run some smart contract code, which account is running the contract? ...
8
votes
2answers
2k views

Call an arbitrary JSON-RPC method with web3

I want to use web3 to call evm_snapshot (only available on testrpc). This is not in web3's list of methods, but I don't want to have to make an actual http call.
8
votes
1answer
723 views

Migrating solidity program testrpc+truffle - Error: Invalid JSON RPC response: “” at Object.InvalidResponse

I am trying to make a truffle application. truffle compile : working fine making a 'build' folder with .json files in it. truffle migrate : Gives the following error I am running testrpc in ...
8
votes
2answers
306 views

Is there the opposite function for evm_increaseTime?

I'm using the following function in my JS tests (with truffle) to move forward in time to test time dependent functions: const timeTravel = function (time) { return new Promise((resolve, reject) =&...
8
votes
2answers
681 views

TestRPC and Metamask: hanging on pending transactions

I'm using Remix and connecting to Testrpc via Metamask. I can successfully launch contracts to testrpc, but then it hangs on the subsequent calls that Remix makes to the public methods (Remix says "9 ...
7
votes
3answers
2k views

Simulating the passage of time with testrpc

Any tips on how to simulate real network conditions on the testrpc testing client using truffle? I have some functions that look at blocknumber and try to deal with passing time. Has anyone come up ...
7
votes
3answers
4k views

Error encountered, bailing. Network state unknown. Review successful transactions manually

Problem I get the following error after running $ truffle migrate --reset: Running migration: 1_initial_migration.js Replacing Migrations... ... ...
7
votes
1answer
2k views

How to use the testrpc `evm_increaseTime` parameter from truffle console? [duplicate]

I am creating smart contracts with truffle and testrpc. When writing unit tests I wish to change the block time to simulate different times that smart contracts may be called. How does one set ...
7
votes
1answer
1k views

How can I take a snapshot of Ganache or Truffle Develop state and reload later?

I would like to be able to save the state of my local Ganache or Truffle Develop chains into some sort of file. At a later time, I would like to be able to restart Ganache or Truffle Develop and apply ...
7
votes
2answers
2k views

MetaMask not showing the testrpc accounts

I run testrpc on the terminal and I get the 9 accounts but when I go on crhome and check on metamask after selecting the testrpc blockchain it won't show any of the 9 accounts from metamask but ...
7
votes
2answers
3k views

Ethers in testrpc

I am new to Ethereum. I have some questions concerning the use of ethers(in stead of MetaCoins) with truffle and testrpc. 1. By default, do the accounts of testrpc contain the currency in ethers? If ...
7
votes
5answers
2k views

Truffle console doesn't work :Unexpected error: Cannot provision contracts while instantiating the console

when I run truffle compile, truffle migrate successfully and then truffle console gives me the following error. strong text **Enexpected error: Cannot provision contracts while instantiating the ...
7
votes
5answers
3k views

Not enough funds for a transaction example in testrpc

I try to test one of my first Smart Contract in Solidity, a simple sub currency example, as you can see below : pragma solidity ^0.4.0; contract Coin { address public owner; mapping (address =&...
7
votes
1answer
2k views

Truffle : Call that returns contract is returning tx

Using Truffle v3.2.1 and solidity 0.4.4 I have an issue with a Factory contract (that create some kind of contract), to simplify my factory contract look like this : contract HelloFactory { uint ...
7
votes
2answers
2k views

Unhandled rejection Error: Couldn't decode uint256 from ABI

I am working on using a sample Contract using NodeJS, Web3, and Solc but I encountered some error that the given address in the Contract that I've created couldn't decode. Am I doing something wrong? ...
7
votes
0answers
345 views

testrpc 2.0.0 - cannot find module 'memdown'

Trying to get testrpc (2.0.0) working on an ubuntu virtualbox, and getting this error when I run it: mowliv@u4:~$ testrpc module.js:341 throw err; ^ Error: Cannot find module 'memdown' ...
6
votes
4answers
7k views

Getting started: testnet or private? How to get testnet ether? [duplicate]

I have Ethereum Wallet v0.7.3, and was eager to try out my first contract on the testnet, but of course need ether. Is it better to just create a private testnet? Is mining testnet ether feasible? ...
6
votes
1answer
1k views

invalid JUMP after upgrading truffle & testrpc

I have a contract with a method add() where I read the value msg.value and change the contract informations. before upgrading, I was calling this method in my test with return contract.add({from: ...
6
votes
1answer
2k views

Why use filters - eth_getLogs vs eth_newFilter

It seems to me eth_getLogs is much simpler than eth_newFilter + eth_getFilterLogs. eth_getLogs has no need for installation, got same parameters, catches events retrospectively. What are use cases ...
6
votes
3answers
1k views

testrpc, contract creating contract not mined?

I'm trying to develop a contract that creates a contract (factory/worker, faucet pattern). Think my issue may be with the tools I'm using: testrpc (local blockchain) Remix Browser Solidity (connected ...
6
votes
2answers
480 views

Is it possible to use “Oraclize” on a testnets such as “Ropsten” or “Kovan” or “Rinkeby” or even local blockchain such as “TestRPC”?

Is it possible to use Oraclize on a testnet such as "Ropsten" or "Kovan" or "Rinkeby" or even local blockchain such as "TestRPC" ?
6
votes
1answer
246 views

Invalid Jump errors

This is my project and I keep running into Invalid Jump errors whenever trying to call anything other than the Project.getName(). For example, running Project.getAddress(), Project.getAmount(), and ...
5
votes
5answers
4k views

How can I use testrpc as the environment in Remix?

I've installed ethereumjs-testrpc and I'm running it with testrpc in my terminal, which I'm pretty sure is working because it outputs Listening on localhost:8545 after listing all the test accounts' ...
5
votes
2answers
4k views

How to configure Truffle to use the Ganache GUI instead of ganache-cli (TestRPC)?

I'm using Truffle v4.0.1 (core: 4.0.1) with the default configuration (ganache-cli aka TestRPC) on Ubuntu and it works fine, but I'd like to use the Ganache GUI. However, I can't find any ...
5
votes
1answer
2k views

“this._eth.sendTransaction is not a function” when executing method in Web3

I'm using react-web3 (which basically gives me a web3 object back) and I'm trying to make my contract work. This is the code I'm using: const web3 = window.web3; const contract = new web3.eth....
5
votes
1answer
448 views

Oraclize + Testrpc + Truffle. Results aren't updating in contract

In my contract I am just doing a basic query to WolframAlpha function testOracle(){ oraclize_query("WolframAlpha", "random number between 0 and 100");} I also have the __callback function: ...
5
votes
1answer
414 views

How to set a block height with testrpc?

How can one set the block height of testrpc so that a contract can react on the new height. Concrete problem is that I want to write an automated test that shows that after a certain block number ...
5
votes
1answer
1k views

You must deploy and link the following libraries before you can deploy a new version of Contract

I made my custom library and try to using on my own project. Below is the 2_deploy_contracts.js module.exports = async(deployer, netowrk) => { await deployer.deploy(OptionStorage, ownerAddress); ...
5
votes
1answer
1k views

Truffle does not add “networks” to build/contracts/contract.json after migration

Problem Truffle does not add "networks" to build/contracts/contract.json files after migration. Versions running Truffle v4.0.1 (core: 4.0.1) Solidity v0.4.18 (solc-js) EthereumJS TestRPC v6.0.3 (...
5
votes
1answer
1k views

Accessing testrpc addresses from solidity tests

I'm consulting truffle's docs on how to test contracts directly in solidity. http://truffleframework.com/docs/getting_started/solidity-tests I'd like to figure out a way to refer to existing testrpc ...
5
votes
1answer
1k views

How to access test accounts created by TestRPC from a Solidity test with Truffle?

With Javascript tests, it is possible to access the accounts which TestRPC creates using: contract('MetaCoin', function(accounts) { // tests here can access accounts[n] to get the public keys } ...
5
votes
2answers
250 views

Sending ethers with mocha.js and truffle might result in larger sums than intended

Good day, I have a contract General and a library GenLib. library GenLib{ event MoneyIn (address _from, uint256 _amount); function moneyIn() { MoneyIn(msg.sender, msg.value); <- ...
5
votes
2answers
1k views

How to properly simulate mining time with Ganache CLI

I am using the Ganache CLI for testing my smart contracts and frontends. I need a way to incorporate a delay into ganache-cli when performing write transactions in order for it to more closely ...