How blockchain startup eFiat solved one of the most promising problems of the Smart Contracts through this integrating approach

eFiat
8 min readJun 11, 2018

--

The Problem of Blockchain and Smart Contracts

The introduction of the smart contracts through the innovation of the Ethereum blockchain has been equally revolutionary as the creation of the Bitcoin, but that does not mean it doesn’t have it’s fair share of growing problems. First of all, driven by its popularities the Ethereum blockchain has slow transaction times compared against centralized systems, relatively expensive transaction fees, and the vastly uneconomical and non-eco-friendly use mining method (POW). The use of smart contracts is not yet popular amongst crypto users because it requires basic programming knowledge to create one. Think DOS before Windows OS.

So we’re working on creating the operating system that is easy to use for the users and also maximize the capabilities of the Ethereum Blockchain features. eFiat has deployed a newly developed blockchain solution to tackle the lack of interoperability of the Ethereum Blockchain, with our platform further enhanced by integrating IPFS and our own proprietary smart contract language based on Python. In the near future, we will introduce a protocol for oracles within our contract language and new mining objectives.

From Proof-of-Work (PoW) to Proof-of-Stake (PoS)

PoS is no longer a new concept within blockchain, here is how it is being defined:

PoW-based Ethereum Mainnet, this is well understood by anyone who works closely with the technology. But over the last year, the ICO-driven hype has exaggerated the current capabilities of the major blockchain networks.

Public, decentralized cryptocurrencies suffer from slow transactions and low transaction volume. Bitcoin can only process 5 transactions per second, Ethereum, which is better, can process roughly 20 per second, not to mention that the time to verify transactions can range from several minutes to several hours depending on volume. It is not yet scalable when it compares to the 24,000 transactions per second processed by Visa today.

Transactions per seconds of Visa, Paypal and Ethereum

PoA is a new consensus algorithm where a trusted set individuals are the miners for transaction processing and verification, which allows transaction processing speed to improve significantly by skipping the PoW hash computation.

Block time in Ethereum’s PoS system is being conservatively targeted at around four seconds. It is believed that the block time will ultimately end up being much lower.

Sharding of Ethereum

In may 2018, Ethereum creator Vitalik Buterin announced Sharding — a scalability solution for the Ethereum blockchain protocol. In Sharding, the Ethereum’s proposed scaling solution is aiming at increasing tps by orders of magnitude. The Sharding approach aims to split ethereum into several concurrent networks, allowing the network as a whole to scale more efficiently. The concept of sharding involves splitting the Ethereum blockchain into potentially myriad smaller sections which are able to process transactions in a parallel manner, thereby speeding up transaction throughput and capacity.

To increase overhead, the solution is to add more shards. The number of shards is linear in the overhead of the top-level chain. If we assume half of the nodes processing at bandwidth capacity is going to validate top-level, and half to processing transactions on the shard, a linear increase in computational power will happen, given that increased block size will lead to a linear increase in the number of shards and a linear increase in the transactions per shards. If this happens, Ethereum can have O(n2) scaling transactions per seconds. According to Vitalik Buterin, Ethereum will eventually support millions of transactions per second.

eFiat goes for PoS, but will closely follow the progress PoC

The eFiat blockchain is based on “Proof of Authority” (PoA). We believe the PoA model would be suitable for our purpose, in the sense that the speed is much faster than Ethereum Mainnet blockchain. We will closely follow the development of Sharding.

Cost of Publishing Smart Contract

Deploying contracts to Ethereum could be an expensive process for many. Deploying a smart contract has a minimum fee of 32,000 gas (equivalent to $0.073 assuming a gas price of 4 Gwei), approximately 20,0000 gas (equivalent $0.458) for 256bit/8 bytes and it can be as much as $50 USD for some complex contracts.

eFiat’s Approach — Integrating with IPFS

We are currently storing Python based smart contracts (see the next section) on a decentralized network called the InterPlanetary File System (“IPFS”). IPFS is a distributed file system that seeks to connect all computing devices with the same system of files.

Python based smart contracts are compiled and encrypted before adding to IPFS, to ensure no one, other than the contract parties, can read the source codes of contracts stored on IPFS. All smart contracts are given a unique fingerprint called a cryptographic hash (IPFS Hash). eFiat’s approach is to store a IPFS Hash as a value in a solidity based smart contract published on eFiat’s Blockchain. You can find and explore smart contracts by providing TxHash or IPFS Hash on eFiat Blockchain Scan. The Ethereum Blockchain serves solely as an indexing service by mapping each Python smart contract and each ethereum / solidity based smart contract storing the IPFS Hash.

If you check a smart contract at eFiat Blockchain Scan, you will notice that a smart contract is stored in binary code. We have encrypted and compiled the smart contract before it is stored in IPFS.

Smart Contract in Python

Other than an Ethereum / solidity based smart contract storing the IPFS Hash, the underlying Python smart contract is not stored on Ethereum. Since we do not store our core smart contracts on Ethereum Blockchain, we are no longer bound by the use of web3.js or Solidity to code and compile our smart contracts. Our language of choice for eFiat smart contract is Python.

This is an example of a sample loan agreement in Python:

P2P Loan Agreement Smart Contract in Python

We believe an average trained programmer can understand the above contract. The Python-based smart contract language that is more intuitive and easier to learn than web3.js.

You may notice that there are lines using function eft.EFTTransfer() in our python smart contracts. These functions are designed for triggering payments. A smart contract will be executed and if the date criteria is met and the signature is valid.

EFTTransfer(from,to,date,signature)

from: sender’s address

to: recipient’s address

date: will be in a string expression describing the date for execution

examples:
“2018–08–01” means a single payment will be executed on August, 1 2018

“2018–07–01 monthly 24” means payments will be made in 24 months since July, 1 2018. In the above example, the string is set at:
repay_schedule = first_repay_date + ‘ ‘ + frequency + ‘ ‘ + str(numberOfRepayments)

Oracles
Ethereum is a closed system and smart contracts cannot connect to the real world. For example, a smart contract cannot hit URLs. This is primarily due to the fact that Ethereum needs everyone to be able to independently validate the outcome of running any given contract, and you can’t guarantee that they would all get the same result from any given URL (due to network disruption, hacking or spoofing activities or human errors). Oracle is designed to get some third-party, or a combination of third-parties, to connect to a source for you and tell you what they found. This could be done by signing the data so that a contract can check the signature, or by number of confirmations.

eFiat Smart Contract in Python decides to allow people to easily create built-in user services: scripts written in Python that run alongside with a smart contract but incorporating a user-decided confirmation in order to verify the result is correct.

This is an example of an eFiat Oracle of getting the closing price Dow Jones Industrial on June,8 2018, requiring 30 confirmations of consensus:

o.getDJIA(‘2018–06–08’,’close’,30)

Mining Notes, not just for transactions verification, but for executions of contracts

Today, when we talk about mining in cryptocurrency,it means the process by which transactions are verified and added to the public ledger. Anyone with access to the internet and suitable hardware can participate in mining. The mining process involves compiling recent transactions into blocks and trying to solve a computationally difficult puzzle. It is a reward system to miners who provide computing power. However, this is not an eco-friendly process. According to IMF chief Christine Lagarde, the amount of power wasted on producing Bitcoin and other cryptocurrencies could soon be equivalent to the yearly energy needs of a large country like Argentina if current trends continue.

eFiat uses PoA, which allows a light energy footprint because we believe computing power can be better used. For example, mining processes can be used for discovering any payment commitments required to be taken place in smart contracts. For example, if you set up a smart contract with your landlord and agree to pay rent at the first day of each month, the miners can compete to check whether today is the date for rental payment. A sample rental agreement in smart contract would be like this:

eFiat’s Rental Agreement written in Python

Assume today is August 1, 2018 and a miner discover the function highlighted in yellow required execution, the miner can confirm this transaction and if a certain number of confirmations is reached, the transaction will be executed. (i.e. payment will be sent from the tenant to the landlord and the miners participating in this transaction will be rewarded by a certain percentage of the amount to be transferred.)

Machine Learning and Smart Contract

Similarly, the same concept can be applied into machine learning. We believe blockchain will eventually enable a decentralized version of the internet. With a fair rewarding system, a huge number of decentralized applications will to be built in the form of smart contracts. Instead of discovering and executing transactions, miners can provide their computing power for training machine learning model and to be rewarded by the blockchain ecosystems.

Our product development roadmap for the next 18 months

  • Design and implement smart contract execution through decentralised nodes mining
  • Enhancement of security standards of our blockchain solution
  • Development of node-operated and blockchain-based Currency Board System, to maintain the price stability of eFiat tokens and ensure an absolute operation transparency
  • Incorporation of “Oracles” into our Python-based Smart Contract Language with confirmation mechanisms, to enhance the integrity of data derived from Oracles
  • Integration of basic machine learning capabilities into smart contracts and a reward system for provision of computing power in data training

To learn more about our blockchain, visit our website: www.efiat.io

--

--