Smart Contracts & API’s
When we dive deeper into technicalities of a Smart Contract, we have to understand what is the source of truth.
Who knows what is correct? and how do we get this data?
To get the data from the world, Smart Contracts cannot connect to the external systems.
Because external data is NOT based on deterministic systems (systems that can determine an output e.g., 2+2 = 4)
External systems are mostly systems such as data feeds, API’s, existing payment systems, weather reports, stock price and so on.
Therefore, blockchain node can do: [Deterministic]
- Proof of work: Compute a mathematical equation such as 1+1 = 2 and all of the block chains can derive the same answer for this equation.
- Proof of stake: Block chain nodes can verify the solution for the equation 1+1 and come to same conclusion that is 2.
And, blockchain node can’t do: [Non-deterministic]
- Nodes cannot run a random function because every time the answer for it is going to be different.
- Nodes also cannot access same API’s because the GET function is going to return different result every time it is called. API’s can also be hacked.
- More than the 2 reasons above, to keep the transparency and independence intact. Layer 1 need to be isolated from political issues and any assumptions about the real world that these API’s depend on. This is also termed as “sybil resistant”.
Oracles: In Greek History, Oracle means, “a priest or priestess acting as a medium through whom advice or prophecy was sought from the gods in classical antiquity.”
However, in information world, term oracle is means the cluster that provides external information to a source including Blockchains. In the blockchain world, oracle is NOT centralized as no one single entity has control or they can flip the switch to take the transparency and freedom away. This undermines the very basis of blockchain philosophy.
Data Source: This has to be always from decentralized sources. More than one single source. For example, the price of Bitcoin is determined by oracle formed by these independent network consisting of more than 1 node. https://data.chain.link/
That’s all for this post. Keep an eye for my future posts. Adios!!