Ethereum has two type of accounts - Externally owned and Contract accounts.
Anybody can create a contract and put it into the blockchain, and it will have its own address.
Now if I as a node on the same blockchain, want to make use of that contract, I will supply the parameters and gas price of it.
Heres the part I am not sure about - Now just like Mining, the miners will fight for POW/POS puzzle, and whoever wins it, is going to fire the smart contract code and earn the gas reward. Am I right here?
Also what is going to be saved in the blockchain database now? As in whats the proof that the node actually processed the smart contract?
Miners don't really fight for it but yea, that is essentially what happens.
The blockchain isn't a DB. Saved information in the block chain will usually consist of sender address, received address and amount. The contract can input extra information if required.
I don't think the node that "mined" the transaction is actually in the block. But the proof is seen by the fact that the transaction was turned into a hash and completed.
Luke Hedger
Ãeveloper @ JAAK.io
Through the process of mining, a miner produces blocks, which contain transactions - so, miners do not 'mine' individual transactions.
In a Proof-of-Work system, miners compete to solve a cryptographically difficult problem in order to mine new blocks.
Once a block is added to the blockchain, all of the contained transactions are executed (these could include simple value transfers or smart contract functions that modify state) and the miner receives the block reward (say, 3ETH) and all of the transaction fees (gas) in the block.
As well as transactions, a block also contains the hash of the previous block (its 'parent'). This way, blocks can be verified in the context of the entire blockchain. This article explains how the Ethereum blockchain uses Merkle trees/proofs to achieve this.
As for the proof that a miner processed a block, each block contains this publicly-available data in the 'block header'. Have a look at block #4638064 on both Etherscan and Etherchain (two examples of block explorers) and you'll see that an account with the address
0xea674fdde714fd979de3edf0f56aa9716b898ec8(and 'username' ethermine) mined this block.So - your assumptions were definitely along the correct lines! As with any new, seemingly complex technology it is very easy to get lost in the terminology (which is often loosely defined anyway). ð€