Questions tagged [testrpc]

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

Filter by
Sorted by
Tagged with
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 ...
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; ...
9
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 ...
0
votes
1answer
942 views

“UPDATED : ” “VM Exception while processing transaction: revert”

I tested signature verification of the code presented HERE as follows: running testRPC : root@ubuntu:/home/s# testrpc EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2) Available Accounts =============...
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 ...
7
votes
2answers
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 ...
11
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 ...
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 ...
7
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? ...
10
votes
3answers
5k 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 ...
9
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 ...
9
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 ...
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 ...
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' ...
4
votes
2answers
2k views

Unit tests written in Solidity, how to change msg.sender address, msg.value,

I would like to know if it's possible to change the address of the message sender of contract's function call when writing unit tests in solidity. It really should be, I was trying to find out how but ...
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... ... ...
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 ...
3
votes
1answer
260 views

Geth - reading public address[] from contract

After setting up testrpc and attaching geth: testrpc -a 10 geth attach rpc:http://localhost:8545 I initialise the following contract on the geth command line: pragma solidity ^0.4.6; contract ...
1
vote
2answers
1k views

How does Truffle know the address of contracts published via truffle migrate?

In Truffle's documentation, it says DeployedAddresses.sol is how Truffle identifies and stores the addresses of contracts published to the blockchain via truffle migrate. How does this file work, and ...
5
votes
3answers
2k views

A problem with filters and events (web3j/TestRPC). SOS! ;)

Help me, please, with this little simple task! I cannot solve this problem for several days. SOS! ;) I'm trying to write a program for filtering events via web3j. I copied to start (for the test) from ...
2
votes
1answer
335 views

Why cannot catch events retrospectively using filter (eth_newFilter)?

I've put the same filter with eth_newFilter before and after a set of transactions. The one which is installed after transactions catched 0 events. Is it how events work? Is there any other way to ...
2
votes
1answer
1k views

“Error: base fee exceeds gas limit” when using the withdrawal pattern

When I am testing the withdraw() method from "WithdrawalContract" from http://solidity.readthedocs.io/en/develop/common-patterns.html using Remix and testrpc, it reported the following error. Testrpc ...
0
votes
1answer
620 views

web3.js doesn't return all accounts

I'm trying to put together a simple application using Truffle, Metamask and ASP.NET. I've created a bunch of test accounts in Metamask, I then start testrpc explicitly specifying a couple of those ...
0
votes
1answer
1k views

Problem connecting testrpc to remix [duplicate]

Whenever I try to use a Web3 Provider on Remix it says Not possible to connect to the Web3 provider. Make sure the provider is running and a connection is open (via IPC or RPC). I have testrpc ...
0
votes
1answer
427 views

“Updated :” How to see “output” of “web3.personal.sign” in “browser”? (“Method personal_sign not supported”)

Note: I updated the html / JavaScript code according to the answer and I used THIS META MASK sample code for web3 provider. However, I receive the same error. I eventually did not understand that do I ...
0
votes
0answers
130 views

Testrpc some times not returning event after transaction execution

I am using testrpc to test my contract While executing some functions in my contract I have observed some inconstancy in responses from testrpc, Same function call give me 3 different results at ...
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 ...
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(...
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 ...
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.
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? ...
15
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 '../../...
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 -...
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 =&...
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: ...
2
votes
1answer
3k views

testrpc - how to write commands in console?

I have started testrpc with the following command (which should give the account a balance of 1000): testrpc --account="0x0116af719d217c12310c72c27a13509f192588735ae329f7c4cfef0e1518955e,1000" ...
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 ...
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? ...
3
votes
2answers
3k views

Error: Error: [ethjs-rpc] rpc error with payload {“id”:6223335088050,“jsonrpc”:“2.0”,“params”:

I have deployed a smart contract in Remix IDE using MetaMask and test rpc. I got the below error: Error: Error: [ethjs-rpc] rpc error with payload {"id":6223335088050,"jsonrpc":"2.0","params":["...
3
votes
3answers
726 views

now / block.timestamp not working on testrpc?

I'm having problems with testrpc, or at least I think that's the cause. This particular portion of code if (now > info.deadline) { ended = true; refundEnabled = true; return false; } ...
3
votes
1answer
2k views

Truffle Smart Contract Testing does not reset state

I have the following javascript test for a simple ERC 20 token. Which on the call return token.balanceOf.call(accounts[2]); will fetch some old data and fail from a previous test transaction writting ...
2
votes
1answer
552 views

Solidity Truffle React TestRPC: Invalid address error while creating transactions through React app

I am writing a simple contract which is basically a registry. I am using testRPC for my ethereum testing. Following is my contract on Truffle: notary.sol pragma solidity ^0.4.11; contract notary { ...
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 ...
5
votes
2answers
248 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
1answer
257 views

Cannot catch every event (logs) from contract - catch a couple of random events instead

My contract has a transaction which fires an event. I was able to catch every event when I was sending transactions manually. But now I'm sending 100 transactions in cycle and get only 2..5 events. ...
3
votes
2answers
726 views

BigNumber error while trying to call structs

Consider the following contract: contract Test{ uint public id; address public addr; bytes32 public name; struct t { bytes32 name; uint id; address addr; ...
2
votes
1answer
1k views

Transaction to smart contract shows 'invalid address' error message

I'm simply trying to transfer ETHER to a smart contract deployed on testrpc: web3.eth.sendTransaction({to: "0xdbf5c15f21ae03f0e33c9058d3823d4e74a35be3", value: web3.toWei(100, "ether")}); Quering ...
2
votes
1answer
965 views

Function of smart contract returns 0 from Web3j

please help me in this problem. I am successful to compile and deploy my smart contract using web3j on testrpc. But When I call the function that returns uint in this contract from web3j, I always ...
2
votes
1answer
555 views

Can I execute functions within a contract (transact) from multiple accounts?

I have a contract that is deployed on the local test blockchain. I am using testrpc and truffle for testing my contract. However, I wish to execute functions of the contract from multiple accounts (2 ...
2
votes
1answer
876 views

Best way to track block transactions as they happen

I found this repo, which retrieves recent gas prices using web3: https://github.com/ethgasstation/gasstation-express-oracle/blob/master/gasExpress.py I'd like to write a similar script that would ...