Block Chain AI Kristian Zarb Adami Warm up
Block. Chain & AI Kristian Zarb Adami
Warm up example… • Kf 1 Bg 2 Ke 2 c 5 Rg 8 Ke 7 Re 8 Kd 1 • e 3 d 5 e 4 e 4 Qd 7 Bd 7 Kd 7 c 3 h 6 Qa 4 Kd 8 Qd 4 Ke 8 Qe 4 e 5 Qe 5 Kd 7 Nf 3 Kd 8 Qd 5 Ke 7 Ne 5 Ke 8 Bd 7 Nf 7 c 6 Nh 8 Bh 3 f 3 Bg 2 c 4 Bf 3 Rg 1 Bb 4 Rg 7 Bd 2 Kf 1 Bg 2 Ke 2 c 5 Rg 8 Ke 7 Re 8 Kd 1 Bg 5 B f 4 Nc 6 Bc 7 Rd 8 Bd 6 Rd 6 Nd 2 Bf 3 Kc 2 Rd 2 Kb 1 • We need to agree on the starting position of the board… • We need to agree the historical sequence of moves on the board • Then we can reconstruct the current state of the board
A primer in cryptography… e 4 449777124 b 1466 a 8 ed 667 d 0 dd 4 c 0620993 f 59 e 20 fb 27 b 3 fa 8894 e 957 f 8762353 d 5 25 f 682044 b 5 badaff 8 b 296 bf 6 fd 676214968 b 238 fcff 5559 e 64 f 38 c 88 bb 9790 f • The 256 -bit string is created using what is known as a ‘Hash function’
This Talk is about Chess… • Chess (Shannon Number: 10123 (atoms in the universe: 1080) • 1997 – IBM’s Deep Blue (specifically developed for chess) beats Chess Master Gary Kasparov. • Deep Blue was capable of evaluating 100 million positions a second. • Since then AI has taken over and in 2017, Google’s Deep. Mind learnt all the Chess history in 4 hours, having played 1000’s of games and beating all other algorithms, using the newest ‘reinforcement learning’ algorithms
A Hash function… • A Hash Function is a function that, given a byte-stream (file) as input, will output a fixed length n-bit number. This is called the hash or message digest. • The input file can any digital file – text, image, video, spreadsheet, document, audio, executable, script, etc. • An example: I love Eilieen Montesin 29269 DC 8 A 439 E 3 EC 2 A 834534 B 684 D 66 D 35831 AFBD 4 A 3 C 7 B 8 B 2 C 2963 C 19 CE 1 FAF I love Eilieen Montesin. C 7 A 89639 FADAEE 56 CD 174 FBE 6 F 8 FAE 4132 AC 0 F 1 C 6 BF 975 186506 AB 220 E 14 BD 74
Digitising Assets… • Anything that is capable of being owned or controlled to produce value, is considered an asset • can be tangible or intangible • value can be converted into cash. • Cash also an asset. • Asset examples: • Cars, planes, property (physical) • Bonds, securities, repurchase agreements (intangible) • Licenses, IP, & patents (intangible assets) • Music, video, games (intangible, digital assets)
Public Records • A public record is any information, minutes, files, accounts or other records which a governmental body is required by law to maintain, and which must be accessible to scrutiny by the public. This includes the files of most legal actions. A court will take judicial notice of a public record introduced as evidence. • For example: a recorded deed to show transfer of title or a criminal judgment are both public records.
Digitising Ledgers… • Many ledgers, public or private, today are digital and are stored on centralized databases. • All records and transactions are supported by signed and time-stamped documentation. • These ledgers are: • Trusted • Accessible (public ledgers) Do we trust ledgers that do not have the above attributes?
Centralized Systems • Single Point of Failure • Single Point of Attack • Single Point of Compromise • Single Point of Shutdown • Easy to Control (for Governments and Big Business) In a centralized system, there is a central actor (which could be a single machine or, more generally, a service) to which everyone else talks. Facebook and Dropbox use distributed systems internally, but are considered as centralized services because they are controlled by one entity.
Just imagine… • We could create a digital ledger that: • Does not require signed and timestamped documentation to support records or transactions. • Is Immutable • Is Authoritative • Is Mutual (shared in common or owned by a community) • Is Scalable • Is Secure • Is Interoperable • Is Transparent Such a digital ledger exists. It is called
The Block. Chain • A blockchain is a continuously growing list of records, called blocks, which are linked and secured using cryptography. • A blockchain is, therefore, nothing more than a digital ledger. • A ledger is a book that stores records or transactions of some sort “A blockchain lets mutually distrusting entities agree on history…which lets them agree on the current state of the ‘system’”
Immutability… • If you can't change it, it's immutable. There are many things in life that are immutable; these unchangeable things include death, taxes, the laws of physics, and Blockchain.
What’s the fuss… • Blockchain made it possible, for the first time, to have a distributed, immutable, cryptographically secure, transparent ledger. • This is not easy to do. • Digital data has many problems: • Easy to copy • Can easily be edited, changed, faked, deleted. • Centralized databases can be controlled, hacked, etc. • Some problems, such as the double-spending problem, had seemed insurmountable
Distributed Ledgers • In a ledger (public or otherwise) that does away completely with supporting (signed) documentation then having just reliability, redundancy, and performance is just not enough. • Nobody will trust their assets (money, contracts, property, etc) on a ledger (distributed or centralized) that is not immutable unless each entry has supporting (signed) documentation. • Immutability in a digital ledger proved very difficult to achieve. Digital data is easy to copy. That is, it seems, until Satoshi Nakamoto introduced Blockchain on an unsuspecting World in 2006.
Blockchain – A Functional Perspective • Blockchain solved the immutability problem. In particular, it solved the doublespending problem (for cryptocurrencies). • Blockchain is an example of Distributed Ledger Technology or DLT. • Blockchain is a clever application of cryptographic and distributed database technologies that finally allows us to have a public or private ledger that is Immutable, Authoritative, Mutual, Scalable, Secure, Interoperable, Transparent, Digitally Signed, and Timestamped.
What is the blockchain A Blockchain is a single, shared, long sequential (ordered) chain of blocks. Each block: • Contains hundreds or thousands of viable transactions of any type. • The Blockchain is shared with the thousands of computers called Blockchain nodes on a peer-to-peer network. • Nodes can be set up using a powerful server and downloaded Blockchain software. • Nodes run the Blockchain software. They store, and share, an up-to-date version of the Blockchain (ledger). They also validate and mine blocks and add them to the Blockchain
How (the bitcoin) Block. Chain works… • There are many variations of Blockchain • We will use the structure of the Blockchain used by Bitcoin • This includes the mining algorithms, distributed consensus, and block structure
What is a Block? • A block is a group (bounded number or size) of transactions of any kind that are stored in the Blockchain. • Each transaction is digitally signed (using the Private key) by all the stakeholders in that transaction. • Also every transaction is also hashed using SHA-256. • Also, every Block contains a header containing a number of fields. • The blocks are created, and stored, in a linear sequence in a reverse linked list. Each block points to its predecessor. 0 Genesis Block 1 Block 2 Block 3 Block 4
How does it work? • A Blockchain is an ordered sequence of ‘blocks’. • It is a linked list where the pointer to another node is the hash of the target node. • There is a good reason why the pointers ‘point’ backwards! • The first block is called the Genesis block. This is the first block created in the Blockchain.
Block. Chain Mining • Setting up a Blockchain node is expensive since it requires a server and power (electricity). • Few people would set up a Blockchain node for fun. • The Blockchain cannot function unless there are many (? ) nodes to provide redundancy and distributed consensus. • Persons, or entities, are incentivized to set up Blockchain nodes by a process called ‘mining’. • Node owners use mining to earn tokens (digital currency) and transaction fees to compensate them for the cost and effort of running a Blockchain node.
How Mining Works • Mining is required to sustain the Blockchain P 2 P Network. • Full Nodes (or Miners) earn money (tokens, Bitcoins, etc) by mining blocks. • Broadcast nodes create transactions (of any type). • These are sent to the Relay nodes for broadcasting. • Full nodes (miners) then • First validate the transactions • Build a new block from the transactions received. • If they successfully mine the block they broadcast it to the network and the block is added to the Blockchain. • They get tokens (or Bitcoins) in return. • What happens if two Full Nodes mine a block at the same time? • Can a transaction be in two blocks?
How Mining Works User creates new transaction on a Broadcast node User/s signs transaction using private key/s Transaction is broadcast to miners via relay nodes Miners aggregate transactions into Blocks Each block contains a link to the previous block When two blocks are mined at the same time, the longer chain wins. Miners validate blocks and perform Proof of Work Mined block is broadcast to the network Users listen for new blocks and merge them into ledger
Adding new blocks to the chain • “In a distributed consensus-based on the proof of Work, miners need a lot of energy. One Bitcoin transaction required the same amount of electricity as powering 1. 57 American households for one day” • Experts now argue that bitcoin transactions could consume the same amount of electricity as Denmark by 2020 • There are now new ways of verifying and accepting transactions: • Proof of Stake • Permissioned blockchains • Proof of Storage
Why you can’t cheat the chain… • The older a block is the more computing time is required to hack the Blockchain. • This is because all the blocks from the hacked block (in red) to the end of the chain must be re-mined. • This is computationally very expensive.
Some concerns… • Mining takes too long. It take 10 minutes to mine a block and then more time (at least one hour) to confirm. • Mining, actually Proof of Work, is too compute intensive and uses too much energy. • Normal people can no longer set up Full Nodes – too much computing power is required. • Mining Companies have a vested interest in the price of Bitcoin and other currencies that use a Blockchain as a ledger and Proof of Work for mining. • Proof of Work may be replaced by Proof of Stake. • In the long run, Blockchains, or any other P 2 P network, may have to be supported by transaction fees only.
Block. Chain 2. 0 – the TANGLE • The main innovation behind IOTA is the Tangle. It is a novel new distributed ledger architecture that is based on a DAG (Directed Acyclic Graph). • The Tangle still has the same underlying principles as a Blockchain: it’s still a distributed ledger and it is still a P 2 P Network. It also still relies on a consensus and validation mechanism. • However, it is must faster and far more efficient.
Artificial Intelligence and Machine Learning • Intelligence: “the ability to acquire and apply knowledge and skills” • Learning: “the acquisition of knowledge or skills through study, experience, or being taught”
Growth of AI • In 2016, interest in AI outranked all other technologies. • According to a 2016 Infosys survey of 1, 600 businesses in 7 countries; ◦ • 76% believed that AI would be fundamental to their future; • AI would contribute 39% to their annual revenues by 2020; • 70% believe it will result in positive changes for society, • Many thought leaders compare AI to innovations like electricity and the Internet in terms of the change it is likely to bring. • In 2016, sales of AI were $644 million. By 2025, sales are estimated to be $36 billion
What is the difference between AI and normal computer program… • Traditional Programs: • Manipulate the stored symbols using a set of previously defined instructions. • AI Programs: • Engage in pattern matching and problem solving, where information about the world, presented to the AI program in digital format, is used to solve complex tasks; • Can self-learn, potentially including (down the road) developing its own new algorithms to achieve the objectives for which the program was created.
Back to our chess game… • Chess (Shannon Number: 10123 (atoms in the universe: 1080) • 1997 – IBM’s Deep Blue (specifically developed for chess) beats Chess Master Gary Kasparov. • Deep Blue was capable of evaluating 100 million positions a second • Google’s Deep. Mind division: • Deep. Mind Technologies founded in 2010 in England to “solve intelligence”; • Acquired by Google in 2014 for $500 million; • Unlike IBM’s Deep Blue (designed for single purpose), Deep. Mind uses “reinforcement learning” to start from scratch in self-learning, and then mastering, different games
Three types of AI • Artificial Narrow Intelligence (“ANI”): ability to carry out a specific task (play chess; get information based on voice directions (SIRI or Alexa); spot spam email; driverless cars). • Artificial General Intelligence (“AGI”): ability to carry out different tasks that a human could do. • Artificial Super Intelligence (“ASI”): ability to learn from its experiences and from new data to perform a wide range of actions and to generate new computer code on its own to help achieve its objectives.
AI is traditionally used to… • Classify and Cluster data • Identify spam emails • Identify fraudulent transactions • Identify cancer • classify galaxies • Interpolate and generate functional behaviour • predict stock prices • motion control • autonomous cars
Machine Learning Algorithms • Algorithms and processors that can classify and cluster raw input data and that improve – learn - as they are given more data. ◦ • “Classify”: creating or applying labels to data; • “Cluster”: identifying similarities and differences between data in the classifications
Machine Learning Techniques
Supervised Learning • Split the data into a: • Training set • Validation set • Testing set • Run different kinds of algorithms such as: • Neural Networks • Genetic algorithms • Many more…
Unsupervised Learning • With no labels it uses statistical methods (such as clustering) to discover properties in the data: • Much more powerful and consequently, much harder…
Deep Learning • State of the Art algorithms: “The AI program automatically refines its methods, and improves its results, as it gets more data, using multiple layers of abstraction – the way the mind works”
Back to Chess • Google Deep. Mind learnt the rules of chess by watching thousands of games in just under four hours • It then played against ‘Stockfish 8’ and won or drew its 100 matches • Interestingly, the same algorithm learnt other Games such as ‘Go’ using what is known in the field as ‘reinforcement learning’
Bringing AI to business… • Amazon, Google, and Microsoft are spending billions of dollars to be in a position to provide AI services via the Cloud to all businesses, including small businesses that could otherwise never afford to develop such services themselves. • This could provide small businesses and start-ups with a competitive boost that they have never had in competing for business
Block. Chain and AI • Block. Chain can anonymise data providing rich datasets on which AI algorithms can train • For example, personal medical records can be stored in a ‘medi-chain’, anonymising the data, such that no GDPR are infringed
Joining the dots…
AI in Health. Care • AI will come to dominate many areas of health care because of: • Global shortfall of 4. 3 million doctors and nurses; • AI is beginning to demonstrate superiority over humans in diagnosing medical conditions and in identifying the best treatment. • “Machine learning could be a game-changer in medicine because, unlike humans, computers don’t get tired and have an infinite capacity for learning and memorization. . AI can reduce the burden on doctors and nurses so they can focus on the uniquely human elements of patient care. ” Patients Are About to See a New Doctor: Artificial Intelligence, January 2017
It’s already happening… • By tracking 30, 000 different points on patients’ hearts and 8 years of patient data, AI algorithm was able to predict which patients with pulmonary hypertension would die within a year with 80% accuracy. London Institute of Medical Services • AI was able to analyze 17 different diseases with 86% accuracy on the basis of patients’ breath. American Chemical Society. • In 2017, using the patient’s DNA and its own database of tens of millions of oncological reports and studies, IBM’s Watson diagnosed a Japanese woman’s rare form of cancer in 10 minutes; solving a problem that the entire hospital medical staff could not solve.
Investments and Smart Contracts… • In 2001 IBM published a paper highlighting how several algorithms were able to outperform actual human stock traders. • On October 18, 2017, the first ETF using only AI for stock selection (running on IBM’s Watson platform) began trading. • “In 2000, Goldman Sachs’ cash equities trading desk in New York employed 600 traders. Today, that operation has two equity traders, with machines doing the rest. . . In 10 years, Goldman Sachs will be significantly smaller by head count than it is today. Expect the same to happen on every trading floor at every major financial company. ” -- “Goldman Sacked: How Artificial Intelligence Will Transform Wall Street, ” Newsweek, Feb. 26, 2017
Conclusion – Do’s and Don’t’s • Don’t expect to become a world champion at chess any time soon • Don’t buy a lot of computers to start mining • Do think about a private blockchain for your enterprise – my feeling is that every entity will have a blockchain in the same way as everyone has a facebook page and every company a website • Do think about data that your customers give you and how to turn it into information that is useful for your company – be it through AI algorithms or just standard algorithms • Do send me questions and queries you might have to kza@astro. ox. ac. uk
EXTRA SLIDES
Block. Chain Killer. Apps
Block. Chain Killer. Apps
Commercial Real Estate example…
What does a block look like?
How Proof of Work actually works! • The objective of Proof of Work is to produce a hash for the Block (actually for the header of the block). • This is easy right? • Computing the SHA-256 hash of the header can be done very quickly. • However, Proof of Work makes the miners compete amongst themselves to find the hash with the smallest number of leading zeros.
Don’t do this at home…
- Slides: 60