Skip to content

Introduction

Stuart Farmer edited this page Aug 5, 2018 · 4 revisions

What is a Smart Contract?

A smart contract is a public piece of code that behaves predictably across all computers. This code is executed on a public distributed network that owners of the code do not have authoritative power over. This predictable nature allows parties that may not otherwise trust each other to engage in complex yet automated business behavior which opens up brand new sectors of efficiency.

Why do I need them?

If you are interested in creating applications that automate things such as identity, ownership, and access control, then you probably are interested in smart contracts. However, it's important to note that smart contracts are a slim subset of the programming sector. You should use them wisely and in specific application instances.

The Seneca Philosophy

We wrote Seneca to be an evolution of software development. Those who already know some programming can reuse the concepts that they know to pick up this new idea of public code. Comparatively, languages such as Solidity and Bitcoin Script require extensive knowledge of blockchain and their limitations to use effectively.

For example, this is how you invoke a method on a smart contract in Ethereum:

0xa9059cbb00000000000000000000000071511814fc09ac85b9d5d0d995e78a48049644c5000000000000000000000000000000000000000000000001f0e0a209aad60000

This payload can be broken up as the following components:

MethodID: 0xa9059cbb
[0]:  00000000000000000000000071511814fc09ac85b9d5d0d995e78a48049644c5
[1]:  000000000000000000000000000000000000000000000001f0e0a209aad60000

For the standard developer, how do you begin to understand what this means? How do you know what the MethodID correlates to? What are the arguments? What are their values? The serialization mechanisms of Ethereum are insanely obtuse.

For Bitcoin Scripts, it's even better. Here is an example of the standard transaction Bitcoin Script (yes, believe it or not, every transaction is actually a smart contract on Bitcoin!):

76a962e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac

Which translates to the Script of:

OP_DUP
OP_HASH160
62e907b15cbf27d5425399ebf6f0fb50ebb88f18
OP_EQUALVERIFY
OP_CHECKSIG

Compare these two methods to Seneca:

import tau
tau.send('stu', 100)

Which of these three makes most sense?

Everything is a Smart Contract

The quickest way to get up to speed with Seneca is to understand that every transaction into the system is actually a smart contract. Some smart contracts live forever on the blockchain for others to use, while others are destroyed after they are done executing. This differs than Solidity or Bitcoin Script where smart contracts are submitted and then acted upon through transactions.

Ethereum only lets you access a single method at a time with a transaction into the system. But with Seneca, because everything is a smart contract, you can do things like this in a single submission to the network:

import contract_1
import contract_2
import token_1
import token_2

contract_1.method('howdy')
contract_2.method('partner')

token_1.send('stu', 50)
token_2.send('carl', 400)

A single smart contract executes four methods on the blockchain. With Ethereum, you will have to submit four separate transactions or pay higher transaction fees by creating and submitting a smart contract that will live forever on the blockchain.

Clone this wiki locally