SlideShare a Scribd company logo
Hello Smart Contracts
Dr. Bastian Blankenburg, UTU Technologies Limited



Nairobi, October 2018
Outline
1. Recap: DLTs and d-apps

2. Æternity (online) tools to get started

3. Smart Contract Language Sophia
Recap: DLTs and d-apps
Part 1
Blockchain: a Distributed Ledger Technology
Source: Blockchain technology. Legislative Council of the Hong Kong Special Administrative Region, 2015,

http://www.legco.gov.hk/research-publications/english/essentials-1516ise15-blockchain-technology.htm, original source given: Oliver Wyman (2015)
• Ledger: history of transactions. 

• Examples: Bank account, land registry, Facebook, any classical database
Centralised ledger Distributed ledger
Byzantine Generals Problem
Source: https://medium.com/@sardorislomov/what-is-byzantine-generals-problem-1f436b49bc23
Byzantine Generals Problem
Source: https://medium.com/@sardorislomov/what-is-byzantine-generals-problem-1f436b49bc23
Decentralised Application (d-app)
Source: A Decentralised Sharing App running a Smart Contract on the Ethereum Blockchain, Bogner et al., IOT, 2016
Æternity (online) tools to get started
Part 2
Æternity Local Test Net (1)
1. Prerequisites: 

1. git

2. Docker: http://docker.com/

3. node.js (for Python see https://github.com/aeternity/aepp-sdk-python, https://
forum.aeternity.com/t/tutorial-for-the-test-network-step-by-step-and-improvement/864)

2. Clone Epoch v0.22.0: https://github.com/aeternity/epoch/tree/v0.22.0

3. Install the JS SDK: in a new project directory: npm install aeternity/aepp-sdk#develop

4. In the epoch directory, start local test net: docker-compose up —build
Æternity Local Test Net (2)
1. Create a wallet: 

node node_modules/.bin/aecli account -f -H http://localhost:3001 create ./wallet

( if this gives an error, try cd ‘node_modules/@aeternity/aepp-sdk’; npm install )
2. In the epoch directory,

1. docker-compose down
2. Copy+paste the public key (“ak_…”) from your wallet in the project directory to the
“mining: beneficiary:” setting in docker/epoch_node?_mean16 

3. docker-compose up —build
3. In the project directory, check your balance: 

node node_modules/.bin/aecli account -f -H http://localhost:3001 balance ./wallet 

Æternity Local Test Net (3)
1. Copy + paste the example contract from https://contracts.aepps.com into test.sophia in your
project directory.

2. Deploy the contract: 

node node_modules/.bin/aecli contract --host http://localhost:3001 deploy ./wallet test.sophia

3. Review the deploy descriptor

4. Get contract code from the chain: 

curl -v http://localhost:3001/v2/contracts/<address>/code
5. Locally compile the contract again to verify it’s the same: 

node node_modules/.bin/aecli contract --host http://localhost:3001 compile test.sophia
Smart Contract Language Sophia
Part 3
Imperative vs Functional
Source: http://happihacking.com/aeternity/webinar20180822/
Sophia Example
Source: http://happihacking.com/aeternity/webinar20180822/
The Sophia Language
1. https://github.com/aeternity/protocol/blob/master/contracts/sophia.md

2. Example: free-for-all account:

contract Test =

record state = {balance : int}
public function init() : state = {balance = 0}
public stateful function add(amount: int) = put(state{balance @ b = b + amount})
public function getBalance() = state.balance
public stateful function withdraw(amount: int) =
if(amount < state.balance)
put(state{balance @ b = b - amount})
amount
else
0

The Sophia Language
Exercise: 

1. Use actual tokens transfer instead of just assigning ints

2. Everybody has their own balance and add, getBalance and withdraw
work only for the caller’s balance.
More Æternity Resources
1. Online tools

1. https://contracts.aepps.com

2. https://explorer.aepps.com

3. See also https://blog.aeternity.com/aepps-update-smart-contract-
development-96241f65b07d

2. Developer resources

1. For an overview: aepps.com

2. Hands on: dev.aepps.com

3. Safe time & collaborate: https://github.com/aeternity/aepp-components

4. Support: forum.aeternity.com

5. aeternity.com

Thank you!

More Related Content

PPTX
01 what is blockchain
PDF
Blockchain overview, use cases, implementations and challenges
PPTX
Blockchain Tutorial For Beginners - 2 | Blockchain Technology | Blockchain Tu...
PPTX
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
PDF
Blockchain fundamentals based on bas w_v1.1.pptx
PDF
Blockchain Fundamentals
PDF
14 Jan17- Nullmeets -Blockchain concept decoded by Ninad Sarang
PDF
Bitcoin, Banking and the Blockchain
01 what is blockchain
Blockchain overview, use cases, implementations and challenges
Blockchain Tutorial For Beginners - 2 | Blockchain Technology | Blockchain Tu...
INTRO TO BLOCKCHAINS AND CRYPTOCURRENCY
Blockchain fundamentals based on bas w_v1.1.pptx
Blockchain Fundamentals
14 Jan17- Nullmeets -Blockchain concept decoded by Ninad Sarang
Bitcoin, Banking and the Blockchain

What's hot (20)

PDF
Blockchain and Cryptography - A Primer
PDF
PPTX
Blockchain Interview Questions And Answers | Blockchain Technology Interview ...
PPTX
Understanding blockchain
PPTX
Blockchain, Ethereum and Business Applications
PDF
PPTX
Overview of Blockchain Consensus Mechanisms
PDF
Blockchain Interview Questions and Answers | Blockchain Technology | Blockcha...
PDF
Security in the blockchain
PPTX
Build your own block chain
PDF
Blockchain intro: The end of the middleman
PPTX
The Blockchain, Bitcoin and other Cryptocurrencies
PPTX
Structured approach to blockchain and consensus techniques
PPTX
Introduction to Blockchain and Recordkeeping
PDF
Blockchain bootcamp for boards
PDF
IDC - Blockchain Threat Model
PPTX
Blockchains 101
PDF
Basic blockchain
PDF
Blockchain Scalability - Architectures and Algorithms
PDF
Vilnius blockchain club 20170413 consensus
Blockchain and Cryptography - A Primer
Blockchain Interview Questions And Answers | Blockchain Technology Interview ...
Understanding blockchain
Blockchain, Ethereum and Business Applications
Overview of Blockchain Consensus Mechanisms
Blockchain Interview Questions and Answers | Blockchain Technology | Blockcha...
Security in the blockchain
Build your own block chain
Blockchain intro: The end of the middleman
The Blockchain, Bitcoin and other Cryptocurrencies
Structured approach to blockchain and consensus techniques
Introduction to Blockchain and Recordkeeping
Blockchain bootcamp for boards
IDC - Blockchain Threat Model
Blockchains 101
Basic blockchain
Blockchain Scalability - Architectures and Algorithms
Vilnius blockchain club 20170413 consensus
Ad

Similar to 02 hello smart contracts (20)

PPTX
Block chain application is explained in detail
PPTX
CCS339 Unit V BLOCKCHAIN APPLICATIONS .pptx
PPTX
Deploying A Proof Of Stake App On IBM Cloud Using Tendermint
PPTX
The journey of an innovative and disruptive technology in a big and organized...
PDF
An architectural approach for decentralized applications
PDF
BlockchainLAB Hackathon
PDF
Alchemy: The Web3 Development Platform
PDF
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
PPTX
Hyperledger
ODP
Hyperledger Fabric and Tools
PPTX
Ethereum Devcon1 Report (summary writing)
PPTX
RTP Bluemix Meetup April 20th 2016
PDF
An introduction to blockchain and hyperledger v ru
PDF
EOSIO Distributed Application Use Cases
PDF
Blockchains and Adult Education
PDF
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
PDF
Aztec Labs - Digital Pound Consultation Response.pdf
PPTX
IBM presents: Hyperledger Fabric Hands On Workshop - part 1
PPTX
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
PDF
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Block chain application is explained in detail
CCS339 Unit V BLOCKCHAIN APPLICATIONS .pptx
Deploying A Proof Of Stake App On IBM Cloud Using Tendermint
The journey of an innovative and disruptive technology in a big and organized...
An architectural approach for decentralized applications
BlockchainLAB Hackathon
Alchemy: The Web3 Development Platform
IBM Cloud Côte D'Azur Meetup - 20181004 - Blockchain Hyperledger Workshop
Hyperledger
Hyperledger Fabric and Tools
Ethereum Devcon1 Report (summary writing)
RTP Bluemix Meetup April 20th 2016
An introduction to blockchain and hyperledger v ru
EOSIO Distributed Application Use Cases
Blockchains and Adult Education
[Call for code] IBM 블록체인을 활용하여 투명하게 구호기금 관리하기 - Hyperledger Fabric v1.1 by 맹개발
Aztec Labs - Digital Pound Consultation Response.pdf
IBM presents: Hyperledger Fabric Hands On Workshop - part 1
Deploy a blockchain web-app with Hyperledger Fabric 1.4 - Concepts & Code
Deployablockchainwebappwithhyperledgerfabricpresentation 190820170703
Ad

Recently uploaded (20)

PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Machine learning based COVID-19 study performance prediction
PDF
Encapsulation theory and applications.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
NewMind AI Monthly Chronicles - July 2025
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Digital-Transformation-Roadmap-for-Companies.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
The Rise and Fall of 3GPP – Time for a Sabbatical?
Review of recent advances in non-invasive hemoglobin estimation
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Dropbox Q2 2025 Financial Results & Investor Presentation
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Spectral efficient network and resource selection model in 5G networks
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Diabetes mellitus diagnosis method based random forest with bat algorithm
Machine learning based COVID-19 study performance prediction
Encapsulation theory and applications.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...

02 hello smart contracts

  • 1. Hello Smart Contracts Dr. Bastian Blankenburg, UTU Technologies Limited
 
 Nairobi, October 2018
  • 2. Outline 1. Recap: DLTs and d-apps 2. Æternity (online) tools to get started 3. Smart Contract Language Sophia
  • 3. Recap: DLTs and d-apps Part 1
  • 4. Blockchain: a Distributed Ledger Technology Source: Blockchain technology. Legislative Council of the Hong Kong Special Administrative Region, 2015,
 http://www.legco.gov.hk/research-publications/english/essentials-1516ise15-blockchain-technology.htm, original source given: Oliver Wyman (2015) • Ledger: history of transactions. • Examples: Bank account, land registry, Facebook, any classical database Centralised ledger Distributed ledger
  • 5. Byzantine Generals Problem Source: https://medium.com/@sardorislomov/what-is-byzantine-generals-problem-1f436b49bc23
  • 6. Byzantine Generals Problem Source: https://medium.com/@sardorislomov/what-is-byzantine-generals-problem-1f436b49bc23
  • 7. Decentralised Application (d-app) Source: A Decentralised Sharing App running a Smart Contract on the Ethereum Blockchain, Bogner et al., IOT, 2016
  • 8. Æternity (online) tools to get started Part 2
  • 9. Æternity Local Test Net (1) 1. Prerequisites: 1. git 2. Docker: http://docker.com/ 3. node.js (for Python see https://github.com/aeternity/aepp-sdk-python, https:// forum.aeternity.com/t/tutorial-for-the-test-network-step-by-step-and-improvement/864) 2. Clone Epoch v0.22.0: https://github.com/aeternity/epoch/tree/v0.22.0 3. Install the JS SDK: in a new project directory: npm install aeternity/aepp-sdk#develop 4. In the epoch directory, start local test net: docker-compose up —build
  • 10. Æternity Local Test Net (2) 1. Create a wallet: 
 node node_modules/.bin/aecli account -f -H http://localhost:3001 create ./wallet
 ( if this gives an error, try cd ‘node_modules/@aeternity/aepp-sdk’; npm install ) 2. In the epoch directory, 1. docker-compose down 2. Copy+paste the public key (“ak_…”) from your wallet in the project directory to the “mining: beneficiary:” setting in docker/epoch_node?_mean16 3. docker-compose up —build 3. In the project directory, check your balance: 
 node node_modules/.bin/aecli account -f -H http://localhost:3001 balance ./wallet 

  • 11. Æternity Local Test Net (3) 1. Copy + paste the example contract from https://contracts.aepps.com into test.sophia in your project directory. 2. Deploy the contract: 
 node node_modules/.bin/aecli contract --host http://localhost:3001 deploy ./wallet test.sophia 3. Review the deploy descriptor 4. Get contract code from the chain: 
 curl -v http://localhost:3001/v2/contracts/<address>/code 5. Locally compile the contract again to verify it’s the same: 
 node node_modules/.bin/aecli contract --host http://localhost:3001 compile test.sophia
  • 12. Smart Contract Language Sophia Part 3
  • 13. Imperative vs Functional Source: http://happihacking.com/aeternity/webinar20180822/
  • 15. The Sophia Language 1. https://github.com/aeternity/protocol/blob/master/contracts/sophia.md 2. Example: free-for-all account: contract Test = record state = {balance : int} public function init() : state = {balance = 0} public stateful function add(amount: int) = put(state{balance @ b = b + amount}) public function getBalance() = state.balance public stateful function withdraw(amount: int) = if(amount < state.balance) put(state{balance @ b = b - amount}) amount else 0

  • 16. The Sophia Language Exercise: 1. Use actual tokens transfer instead of just assigning ints 2. Everybody has their own balance and add, getBalance and withdraw work only for the caller’s balance.
  • 17. More Æternity Resources 1. Online tools 1. https://contracts.aepps.com 2. https://explorer.aepps.com 3. See also https://blog.aeternity.com/aepps-update-smart-contract- development-96241f65b07d 2. Developer resources 1. For an overview: aepps.com 2. Hands on: dev.aepps.com 3. Safe time & collaborate: https://github.com/aeternity/aepp-components 4. Support: forum.aeternity.com 5. aeternity.com