WTF is Ganache?
#WTFis presents...
WTF is Ganache?
🍩 Ganache (aka TestRPC) is a Node.js based Ethereum client for testing and development.
WTF is an Ethereum client?
So we know that we have a client (e.g. a web browser) and a server (code running on a computer, either our own computer or someone else's, that is "serving" information to the client when the client makes a request).
A client is simply an application. We install and run them on our computer. The client has an interface that may be a command line interface (e.g. the npm CLI in your command shell--Terminal for MacOS) or a graphical user interface (e.g. web browser GUI). Keybase.io is a good example of an application that has both.
There are many Ethereum clients--these are some that I pulled from ethdocs.org
Client | Environment | Language | Developers |
---|---|---|---|
go-ethereum | production | Go | Ethereum Foundation |
Parity | production | Rust | Ethcore |
cpp-ethereum | production | C++ | Ethereum Foundation |
Ganache | development | JavaScript | Consensys |
AToP ethernodes.org shows Parity as the most used by the nodes in the Ethereum network.
🍩 So an Ethereum client is an application that allows us to download the Ethereum blockchain and participate in the Ethereum network as a node.
However, Ganache is for testing/development (not live production), so it is just a simulation of a real client, and it doesn't actually affect the real Ethereum blockchain.
WTF are nodes?
🍩 Nodes (in this case) are just computers running Ethereum clients.
We can think of nodes as people because people will run the client on their computer (but one person can have multiple clients running from multiple computers too).
Uhh.. ok
We interact with the client using one of the following libraries:
Library | Language | Project Page |
---|---|---|
web3.js | JavaScript | https://github.com/ethereum/web3.js |
web3j | Java | https://github.com/web3j/web3j |
Nethereum | C# .NET | https://github.com/Nethereum/Nethereum |
ethereum-ruby | Ruby | https://github.com/DigixGlobal/ethereum-ruby |
web3.js is probably one of the more popular libraries because JavaScript is a widely used language.
WTF is web3.js?
🍩 web3.js is a JavaScript library for an application programming interface (API) that gives us access to RPC methods using the JSON-RPC protocol. With web3.js we can write a JS application that communicates with a node in the Ethereum network, including our own node.
WTF is JSON-RPC?
🍩 JSON-RPC is a RPC protocol that uses JSON.
http://www.jsonrpc.org/specification
WTF is RPC?
🍩 RPC (remote procedure call) is when we execute a procedure (aka subroutine aka callable unit aka function) that is on a remote computer with a different address space.
WTF is an address space?
🍩 An address space is an isolated environment for a computer to run procedures and store data. You can think of each computer as having its own, personal, isolated address space.
Mmkay mmkay
So we use Ganache to run an Ethereum node, and we use web3.js to communicate with that node and other nodes in the network, and using RPC we can have that node call functions that execute some code on the blockchain.
🍩🍩🍩🍩🍩🍩🍩 Don't take my word for it! Jump down the rabbit hole!
http://truffleframework.com/docs/getting_started/client