What is the exact difference between gas price and gas limit ? And what should be their value? I am reading about smart contracts and these two words are used alot.. need to know what they are and how are they used.
Smart Contracts are written in solidity (a programming language). In smart contracts there is a price of executing each line of code. suppose you wrote 1000 lines of code that code ran and you used 1500 lines (because of loops and conditions) then the gas price will be 1500 whereas gas limit is a limit after which contract will stop executing.
We use gas limit so that if anyhow our contract goes in infinite then it will stop after gas limit reached so that it wont cost us too many ethers.
Gas Price - Cost of executing each line of code , everytime your code or part of code runs.
Gas Limit - A limit which is set so that you never have to high amount of ethers due to any errors or exceptions which made you code run infinitely.
How they are used - you can define them by yourself , i generally use gas price - 5000000 and gas limit 2000000000 which works fine for me.