Remix supports accessing various Ethereum networks. Here we introduce TestRPC, the most common Ethereum networks for Solidity contract and DApp development. No difference on Remix side, but TestRPC gives us a better picture. There is a screen capture video at the end of the deck.
How to Troubleshoot Apps for the Modern Connected Worker
Use TestRPC in Remix
1. 5. TestRPC and Remix
KC Tam
Reach KC on LinkedIn: https://www.linkedin.com/in/ktam1/
2. Objective
TestRPC is a more common in-memory Ethereum
Environment for Solidity Contract Development. Here we will
explore how to start TestRPC and to access TestRPC from
Remix.
4. Remix Ethereum Environment
JavaScript VM Injected Web3 Web3 Provider
Remix in-memory Ethereum
Network, running inside
Remix.
Working with injected Web3
such as Mist and Metamask
Interacting with localhost
through RPC
Mainnet
Testnet(s)
TestRPCPrivate Net
If localhost provides RPC interface, Remix can
connect to these Ethereum networks.
Here we focus on TestRPC.
The most common RPC interface is on
http://localhost:8545, but is configurable.
5. Local host
TestRPC
Remix
http://localhost:8545
A common in-memory Ethereum
environment for contract and DApp
development
Comes with 10 accounts with 100 ethers
predeposited
Mnemonic hierarchical deterministic
wallet
Note: It is renamed to ganache-cli recently by Truffle, the maintainer, but we keep
using TestRPC in this deck.
TestRPC
6. After running TestRPC, 10 accounts are
created, with both address and private
key.
$ testrpc
New set of 10 accounts are created
when running TestRPC next time.
To keep the same set of address, use
the mnemonic
$ testrpc -m "<mnemonic>"
TestRPC is listening on localhost:8545
8. Remix requests the Web3 Provider Endpoint, which is the rpc interface on
the Ethereum Network. As we notice, TestRPC is already "Listening on
localhost: 8545". Click OK to continue.
9. Environment is set to Web3 Provider, and from Accounts we see the 10 accounts from TestRPC.
10. Now we can use Remix as before: deploying contract and executing
functions. The difference is that now we are acting on TestRPC Ethereum
Network.
Note the output on TestRPC terminal and we start understanding what
happens when contract is deployed and functions are executed.
11. When create a contract, we see a transaction is issued to TestRPC. The Contract created matches the
contract address shown in Remix 0xbd5…eb764.
12. When set function is executed, it is another transaction Remix issues on TestRPC.
13. Summary
TestRPC is a more commonly used Ethereum environment
for contract and DApp development. While there is no
difference on Remix side, with TestRPC we can see what
happens when contract is deployed and function is executed.