Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size...

53
Introduction to Blockchain Technology Current Trends in Artificial Intelligence Volker Strobel PhD student @ IRIDIA 23 February 2017

Transcript of Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size...

Page 1: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Introduction to Blockchain TechnologyCurrent Trends in Artificial Intelligence

Volker Strobel PhD student @ IRIDIA

23 February 2017

Page 2: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Part I:Bitcoin: Idea, Basics, Technology

Part II: Altcoins, Use cases,Blockchain applications

2

Page 3: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Part I:Bitcoin: Idea, Basics, Technology

Part II: Altcoins, Blockchain applications, Use cases

3

Page 4: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Bitcoin is a digital currency without the need of banks and governments

4

Alice Bob

Bank

Peer 1 Peer 2

Government

transaction

Page 5: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Why would you want to remove the bank?

5

save costs

be anonymous

transaction speed

censorship

don’t trust the bank

non-reversible transactions

be able to pay

micropayments

ideological reasons

payments triggered by

eventsflexibility …

Page 6: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Developing a peer-to-peer financial system poses many challenges:

• How to validate transactions?• How to create new money?• How to trust the system?• How to prevent double-spending?• How to reach consensus on who

owns what?• …?

6

Page 7: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

7

Page 8: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

8

Understand the Blockchain in Two Minutes by the Institute for the Future (IFTF) (https://www.youtube.com/watch?v=r43LhSUUGTQ&t=70s&pbjreload=10)

Page 9: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Every participant keeps his/her own copy of the ledger

9

Peer-to-peer network<Financial

Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

https://bitnodes.earn.com/

Page 10: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

To transfer Bitcoin tokens,participants publicly announce transactions

10

Transaction: Send 3 Bitcoins from

Alice to Bob

Is this transaction really from Alice?

Page 11: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Digital SignaturesPublic-key cryptography

private/secret key (sk)

public key (pk)

11

document

signature

sign( , sk) = signature

verify( , pk, signature) = bool

document

document

Page 12: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

A quick example of digital signatures

Distribute public key:gpg --armor --output volker.gpg —export

Import public key (on another machine):gpg --import volker.gpg

Create message:echo "hello blockchain" > msg.txt

Sign message:gpg --clearsign -o sig.gpg msg.txt

Send sig.gpg via emailVerify message (on another machine):gpg --verify sig.gpg

12

Page 13: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

How to ensure that everyone has the same version of <Financial Transactions>?

13

Peer-to-peer network<Financial

Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

Majority consensus?=> Sybil attacks

Page 14: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

You trust the ledger with the highest amount of computational work(often called the longest chain but it’s rather the strongest chain)

14

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

work: 279work: 280

work: 279

work: 275work: 276

Page 15: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

x y

The computational work is calculated based on the expected amount of calculated hashes

15

Hash function: any function that can be used to map data (x) of arbitrary size to data of fixed size (y): hash(x) = y

Cryptographic hash function: “non-reversible” hash function (and ideally some other features): “Given y, very hard to find x”

x y

Page 16: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

https://anders.com/blockchain/hash.html

Page 17: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Find solution to a mathematical puzzle that can only be solved by brute force (trial & error)

17

Mining(Proof of Work):

1. Immutability: Set order of transactions (changing anything requires to “re-mine”)

2. Consensus based on amount of mining work

Page 18: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

https://anders.com/blockchain/block.html

Page 19: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Mining is a race:As a miner you want to be the first to find the solution to get a reward (tx fees and block reward)

19

<Data><coinbase tx> <Data>PoW

“mining”

Page 20: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

The blockchain is build of blocks:chunks of data

20

<Data> <Data> <Data>

Block k - 1 Block k Block k + 1Header

Body

prev Hashhash(<Data>)

prev Hashhash(<Data>)

prev Hashhash(<Data>)

Page 21: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

21

https://anders.com/blockchain/blockchain.html

Changing data in a previous block would require an attacker to redo the Proof-of-Work of all later blocks

Page 22: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

In Bitcoin the average block number is 10 minutes

The target value is dynamically adjusted (every 2016 blocks)

22

Page 23: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

The data in the blocks is created by transactions and sent to peers

23

Transaction: Send 3 Bitcoin from

Alice to Bob

Page 24: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Every node in the network checks if a transaction is valid

24

• Valid signature • No overspending • No double-spending

transaction

sender public key

sender signature

cryptocurrency

receiver address

hash of prev. tx

Page 25: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

How do you ‘own’ a Bitcoin?

25

coinbase

transaction miner address

cryptocurrency

A Bitcoin is a chain of signed transactions (i.e. every coin has a history).The owner of a Bitcoin owns the private key corresponding to an unspent transaction output (UTXO).

UTX

O

transaction

sender public key

sender signature

cryptocurrency

receiver address

hash of prev. tx

transaction

sender public key

sender signature

cryptocurrency

receiver address

hash of prev. tx

Page 26: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

How to cheat/attack?

26

Pool of unconfirmed transactions

transaction

A pays B

transaction

A pays A

Send conflicting transaction

Which own will end up in the blockchain?

Page 27: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Wait for confirmations

27

<Data>

Block k Block k + 1

transaction

1 confirmation 2 confirmations

transaction

0 confirmations

Page 28: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Short summary:The main building blocks of Bitcoin are:

- Peer-to-peer network

- Public ledger

- Digital Signatures

- Proof-of-Work (Mining)

- Blockchain

28

Page 29: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

How to participate in the Bitcoin network?

• Download a wallethttps://bitcoin.org/en/choose-your-wallet

• Get Bitcoins(e.g. from a friend or from an exchange such as kraken.com)

29

Page 30: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Part I:Bitcoin: Idea, Basics, Technology

Part II: Altcoins, Use cases, Blockchain applications

30

Page 31: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Quite early, people realized that Bitcoin is just one application build on blockchain technology

31

Appearance of “Altcoins”

See also https://coinmarketcap.com/

Image source: https://steemit.com/altcoins/@frieswiththat/top-10-sleeper-altcoins

Page 32: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Use cases of Altcoins

• financial records

• domain name registration

• voting

• medical records

• artificial intelligence?

• …

32

Page 33: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Peer-to-peer network

33

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

<Financial Transactions>

Page 34: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

34

<Data>

<Data>

<Data>

<Data>

<Data>

<Data>

<Data>

<Data>

Peer-to-peer network

Page 35: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Image source: https://steemit.com/news/@jesusvmorales/ethereum-eth-the-best-currency-to-buy-and-mine

Page 36: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Ethereum Blockchain 2.0

Bitcoin Blockchain 1.0

Image source: https://bitcoin.org/de/

Arbitrary decentralized applications

Financial transactions

Page 37: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Use case of Ethereum:

Blockchain-based smart contracts:programming code executed via blockchain technology

tamper-proof code “without any possibility of downtime, censorship, fraud or third-party interference” (ethereum.org)

main programming language: Solidity(online IDE at http://remix.ethereum.org)

37

Page 38: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

38

centralized crowdfunding platform (e.g. kickstarter.com)

Project (e.g. smartwatch)

all-or-nothing

“Traditional” crowdfunding

needs trust

- money really send to the project? - transparency - potentially high fees

needs trust

backersImage source:https://www.visa.ca/en_CA/pay-with-visa/cards/credit-cards.html

Page 39: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Ethereum-based crowdfunding(see https://ethereum.org/crowdsale for an implementation in Solidity)

39

decentralized crowdfunding platform

based on Ethereum

backers

Project (e.g. smartwatch)

all-or-nothing

transaction

<Data> <Data> <Data>

Block k - 1 Block k Block k + 1

transaction

transaction

trustless:

- decentralized (no single point of failure) - guaranteed execution of the transfer - transparency - immutable - potentially lower fees

needs trust

Page 40: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Blockchain Technology and AI?

40

Page 41: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

(Very simplified) comparison betweenAI and Blockchain Technology

41

Artificial Intelligence Blockchain Technology

probabilistic deterministic

black box transparent

computationally complex algorithms

lightweight programs

(smart contracts)See also YouTube talk “Blockchain + AI = Decentralized Artificial Intelligence” by Siraj Raval (https://www.youtube.com/watch?v=ogk4DnqXvuA)

Page 42: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

How AI might improve blockchain technologyAI Blockchain

• Scalability

• More useful mining algorithm

• Intelligent interfaces

42

https://medium.com/@Francesco_AI/the-convergence-of-ai-and-blockchain-whats-the-deal-60c618e3accc

Page 43: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

How blockchain technology might improve AIBlockchain AI

• Huge amount of data / easy collection of data

• Transparency(public history of actions — audit trail)

• Increase trust

• Marketplace for data/models

43

https://medium.com/@Francesco_AI/the-convergence-of-ai-and-blockchain-whats-the-deal-60c618e3accc

Page 44: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Example Blockchain AI projects(most of these projects are at an early stage of development)

• Decentralized privacy-preserving machine learning:(openmined.org)

• Identity validation of AI Agents (https://botchain.talla.com/)

• AI as a service (monetarize AI) (https://singularitynet.io/)

44

Page 45: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

My PhD thesis

Blockchain-based smart contracts for the secure coordination of robot swarms

45

Page 46: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

A blockchain is a decentralized database where everyone can participate

46

Peer-to-peer network

Page 47: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

A blockchain is a decentralized database where everyone can participate

47

Robot peer-to-peer network

Page 48: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Byzantine robots show arbitrary faulty or malicious behavior

48

laboratory experiments real-world applications

Motor broken!

Infrared module broken!

Programming code not updated!

GPS connection lost!

Tamper with messages!

Page 49: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

49

Goal:Develop a framework for programming

secure robot swarms For more details, see: V.Strobel, E. Castello Ferrer, M. Dorigo. 2018. Managing Byzantine Robots via Blockchain Technology in a Swarm Robotics Collective Decision Making Scenario. To appear in Proceedings of the 17th Conference on Autonomous Agents and MultiAgent Systems. International Foundation for Autonomous Agents and Multiagent Systems (AAMAS 2018).

Page 50: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Research ideas / open Research questions

• Can the Proof-of-Work be replaced by something more useful (e.g. training of a neural network)?

• What are use cases for blockchain technology?

• Possibilities and limitations of combining AI technologies and blockchain technology?

50

Page 51: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

What could you do?

Build a decentralized (AI?) application with Ethereum

51

Page 52: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

Further material

• Mastering Bitcoin by Andreas M. Antonopoulos(https://github.com/bitcoinbook/bitcoinbook)

• Coursera online course (https://www.coursera.org/learn/cryptocurrency)

• Cryptocurrency news(https://www.coindesk.com)

52

Page 53: Current Trends in Artificial Intelligence · data (x) of arbitrary size to data of fixed size (y): hash(x) = y Cryptographic hash function: “non-reversible” hash function (and

[email protected]

Volker Strobel

Thank you!