Ref: What happens when you type in an URL in the browser
So in a web browser, it's kinda easy to reason the life cycle of an HTTP request, how it moves down the network stack, reach the server, get a response and travel back up to my browser and gets rendered as a web page.
var contractAbi = eth.contract(AbiOfContract);
var myContract = contractAbi.at(contractAddress);
// suppose you want to call a function named myFunction of myContract
var getData = myContract.myFunction.getData(function parameters);
//finally paas this data parameter to send Transaction
web3.eth.sendTransaction({to:Contractaddress, from:Accountaddress, data: getData});
What happens when I type the following code in a geth console of a 2 node private Ethereum network(1 full pair node, 1 mining node)? Let's say we are running a light client.
- The raw request(JSON RPC) would be sent to 1 of the 2 nodes or broadcast to both of the 2 node at the same time?
- How is the p2p module involved in the whole picture? Just maintain the alist of nodes in the entire 2-node network or just a subset?
- What happens when the raws request reach the first Ethereum node or second? Does it differ (first or sencond)?
- How is EVM work in the picture if I treat it as an blackbox? How the interface look like(input, output)?
EDIT 1: Let's assumming we are using POW. But since there is only one single mining node, POA is fine as well?
EDIT 2: In terms of performing the computation of the transaction(eg. 1+1), how do the mining node(say POA) and normal peer full node differ if they do differ?
EDIT 3: This articledid a great job at explaining on a higher level how a transaction get validated by all the nodes and only get "run" by the mining node, and after being included into the mining node, how a block get broadcasted and its transactions get further validated and propagated until the sender pickup the EVM logs. But how exactly EVM "crunch" the transactions and mutate the state? and how the p2p modules maintain all the nodes?
EDIT 4: this is another nice short read summarizing it as : construct->sign->broadcast->mine
found this cool image here