Introduction

What Is EOSIO?

EOSIO is a new approach to executing decentralized smart contracts on a blockchain.

EOSIO uses some of the same concepts that shaped earlier blockchains such as Graphene, the engine that powers popular sites such as SteemIt and Bitshares. Like Graphene, EOSIO is Free Open Source Software (FOSS) and released under the MIT License.

The EOSIO design recognizes the difficulty and expense related to a so-called "hard fork," where an existing blockchain must be abandoned and its contents ported to a new chain in order to enable new features or correct some major software deficiency. It is designed to avoid the necessity as much as possible.

How EOSIO Improves Upon Graphene and Other Cryptocurrencies

Blockchain-based technologies and cryptocurrencies frequently make the mainstream news because they have a number of deficiencies; the EOSIO design has features that address each of these concerns, as follows.

Issue: Account Recovery

The first issue commonly encountered with other blockchain-based technologies is the inability to reverse transactions, even in the short-term.

With EOSIO, a sophisticated and extensible permissions system makes it possible to recover an account in the event that private keys are lost or stolen.

Issue: Scaling Problems

Interchain communication among multiple instances of EOSIO allows for unbounded horizontal scaling, while also maintaining the traditional attributes of a blockchain.

Issue: Security Expenses

Another common problem with standard blockchain technologies is the sheer expense related to securing the chain using proof-of-work

Existing blockchain-based, distributed application frameworks, such as Graphene, also have a number of shortcomings. The EOSIO design has features that address each of these concerns as well.

Issue: A Lack of Turing Completeness

This drawback significantly restricts the types and features of applications that can be deployed using the technology.

EOSIO achieves the Turing completeness lacking in Graphene by including deferred transactions, which can be scheduled (and rescheduled) automatically by code.

Issue: High Usage Expense

EOSIO has a sophisticated resource allocation scheme through which bandwidth, computation, and storage for distributed applications are allocated independently by staking tokens rather than paying a fee. These staked tokens are recoverable, making application usage free, and block producers are compensated through other means than per-transaction fees.

Issue: Weak Security

Other frameworks experience similar security weaknesses to those that plague other cryptocurrencies in the real world.

The previously mentioned EOSIO permissions system allows for account recovery, and together with deferred transactions, makes it possible to claw back unauthorized transactions without disrupting the integrity of the blockchain.

What Are Smart Contracts?

Unlike standard legal contracts, which are drafted by lawyers and enforced within the court system, smart contracts are made (and enforced) through cryptographic code.

Nick Szabo, a legal scholar and cryptographer, created "smart contracts" so that strangers could engage in electronic commerce safely and securely.

Decentralized ledgers manage blockchain contracts that are:

Stored and replicated on the system

Trackable and visible to all users within the blockchain

Supervised by the network of computers that runs the blockchain

EOSIO Features as Contracts

Many EOSIO features are implemented as contracts on their own chains. Contracts are important because they can be amended and updated within the chain itself, maintaining chain continuity while also adding new features, addressing bugs, or managing the network.

EOSIO is designed with features intended to make it easier to manage a blockchain among participants with non-chain contractual obligations to one another.

The blockchain serves as the ledger for staked tokens, and token stakeholders vote on-chain for such things as:

Which accounts are block producers

When software upgrades must be performed

Resource limits within the system

Use Case: A Smart Contract for a Farmers' Co-op

Here is a simple use case that will help you better understand the benefits of EOSIO smart contracts. To focus on the important interactions, we have kept both the scenario and the logic simple.

Let's say that a co-op has several farmers who have agreed to sell bushels of wheat at the same price; they create a smart contract to facilitate these transactions. Traders then come to the co-op to buy (and later resell) the wheat.

trader1 fills in his quantity and the farmer's account and opens up his wallet app, so the co-op's:

App can sign the purchase action (on a transaction)

Server can sign the transaction, having performed its own validation by verifying that trader1 is a valid user with his public key signature

The fill action is processed in an eosiod by the impl::on(const coop::fill& ) method in the contract.

Then the purchased table is searched for the appropriate transaction and updated with an entry stating the order is filled.

Two signatures are required for the transaction because of the two require_auth function calls that appear at the beginning of the on method.

Likewise, the farmer can use his co-op app to verify that the trader has marked the purchase fulfilled. (As outlined above, behind the scenes the application will use the get table call on the purchases table.)

Finally, the farmer opens his property gate and the trader's trucking company leaves.

The sales transaction is complete.

Looking Ahead

EOSIO smart contracts have many applications and use cases, from financial transactions to healthcare to supply-chain management and beyond.

OCI is a leader in providing educational resources and consulting services for EOSIO blockchain solutions. We regularly host EOSIO Meetups (if you're in the St. Louis area, come join us!), and we offer training workshops on building distributed apps using the technology. Check out our on-demand webinar on Building DApps on EOS to get a started.