A gentle introduction to the Fetch.ai framework
11月 29, 2019
I’m Josh, Application Lead at Fetch.ai. I prototype and oversee a lot of the internal applications built at the company. This article is written to provide an overview of blockchains and Fetch.ai and will be updated over time.
Blockchains are in their infancy, but their gargantuan technical progress isn’t to be belittled. They’re fundamental to the digital future. Blockchains enabled decentralised trust, and traceable receipt.
Let me give you an example:
Voting fraud happens, and blockchains can stop that. With a blockchain we are able to show which ID voted on which day. Blockchains give us a sense of trust that we cannot have for a centralised entity. Entities using a blockchain can be accountable — blockchains give a history of all transactions.
Then we have multi-company systems and business where data has to be shared, and controlled. Agreements have to be made. This is all expensive, and an old way of doing things. With a blockchain you can do all of that, and the costs can be much less.
To understand what we’re doing at Fetch.ai, you first need to know a bit about blockchain technology:
Without trying to bore you, this is the quickest, lightest introduction to blockchains I could write!
A blockchain is a decentralised receipt. Decentralisation is when something is controlled by delegation to more than one party. It’s similar to having multiple owners.
A blockchain comprises of nodes. A node is a computer. These nodes can be spread all over the globe – or office – connected to other nodes by the internet. On many blockchains you can use a computer to be part of a blockchain as a node.
Most blockchains have their own digital currency, Bitcoin and Ethereum are two of the most well known examples. Transactions made with these currencies are kept on their own blockchains indefinitely.
Just think of each dot in this graph as a node:
Some nodes are miners, a special type of node which validate and build ‘blocks’.
Blocks are a collection of transactions that have not yet been added to the blockchain. Blocks may contain no transactions — or lots of them. A blockchain is a long ordered list of blocks. When transactions are made, a miner confirms the transaction and adds it to a block which the miners are mining. These blocks are then sent throughout the network to other nodes, and are almost always readily accepted – every node has a copy of the entire blockchain. Miners are in a race to mine blocks, as they receive a reward for each mined block.
There is a small issue with a decentralised network, namely that synchronisation can be difficult. Every time a block is created, all nodes around the world need to add this to their local copy. All nodes need to be up to date with one another. Sometimes they’re not.
As all blocks are not always up to date with each other, sometimes we get conflicting blocks. For this we introduce “consensus”. Consensus is a mathematical algorithm for choosing which block would be added to the blockchain. Nodes can use any number of consensus mechanisms, the most common of which is Proof of Work. Consensus allows nodes to reach agreement on which blocks to accept. However, Proof of Work is computationally expensive and requires a lot of electricity.
Some blockchains allow for smart contracts. Smart contracts are designed so that we can have a digital, decentralised agreements. Think of a smart contract as a piece of code, which contains rules and references that can be computed by a node. These contracts are forever stored on a blockchain and can be viewed and visited in the blockchain’s history. Generally, smart contract implementations are simple. Few do any real computation, and even fewer can connect to anything outside of their Virtual Machine. They’re limited.
To run smart contracts a node requires a Virtual Machine; this is a tiny program inside of the node that can run the very specific language of the smart contract. In fact, just think of this as a very simple virtual computer inside of each node. Few blockchains are sophisticated enough to run a Virtual Machine.
I think that covers it. Blockchains are comprised of nodes. Blockchains are all trying to keep in sync with each other and some nodes named miners are in a race to mine the next block. Some blockchains allow for smart contracts, which, in reality, aren’t that smart. Blockchains really are that simple, kind of.
Let me reintroduce Fetch.ai.
There has been a lot of progress in blockchain technology, including Bitcoin, Ethereum and the introduction of new technologies. We see a lot of promise in what blockchains enable, but we don’t necessarily agree with every direction. We started Fetch.ai from scratch. There wasn’t any blockchain out there that we could rely on for our vision.
We’re not just a transaction platform, nor do we consider smart contracts to be the most important part of our platform; we’re a platform for all.
There are billions of devices, processes and pipelines around the world that are desperate for automation and communication. No other blockchain is built to handle all of that data, and none offer a real solution for autonomous learning from this data. At our core, this is what Fetch.ai was built to solve. We connect devices and we bring value to data — we are the platform for autonomy to happen.
Let’s start at the bottom; we’ve got the Fetch.ai node. This is our decentralised receipt. It’s a new protocol written to enable a vast number of transactions. The nodes on the network keep track of all transactions, but we also introduce sharded states, Proof of Stake consensus and AI-powered smart contracts.
Sharded State is an interesting concept, and separates us from other blockchain technologies. Blockchains have a scalability issue, as they’re a single chain — all new transactions must be processed in a specific order.
A good way to think about this is by imagining cars travelling along a road. Traditional blockchains can be thought of as having a single lane road. With sharding we introduce the concept of multiple lanes. This means with Fetch.ai we can handle a lot more transactions (or in this case, cars). The principal benefit of these additional lanes is the ability for the blockchain to execute transactions in parallel, something that is not possible with only a single lane.
It does however mean that smart contract developers must make careful decisions about how they will distribute the data that they want to store in the network. Do they leave all the data on a single shard, or do they spread the data around the network across all the shards? The Fetch.ai ledger will ensure that each transaction only uses a certain amount of resources, and allows smart contracts to execute concurrently (smart contracts can be called on multiple nodes).
Proof of Stake is how we solve the consensus problem. Proof of Work uses far too much wasted energy and Proof of Stake does not have that issue. Proof of Stake with Fetch.ai is a mechanism where miners (or miner owners) can deposit tokens to enter a group. A random miner from this group of depositors is chosen to produce the next block. This mechanism means that no one person on the network has complete control.
AI-powered smart contracts are another game-changing technology that can’t be found on any other blockchain. AI, or machine learning, means learning from data the smart way, just like humans do, and is undergoing a modern revolution. In the past, a computer programmer would write a program that encodes a few simple rules, and these would be applied in all situations. This top-down processing is useful for managing simple scenarios; like transacting money out of my bank account into yours when I purchase a product. AI flips this on its head. Instead of writing down the rules, we observe the real life data, and update our rules to match what happens. This bottom-up (aka data-driven) processing, allows computers to solve messy, real-world problems, like understanding English grammar with all of its exceptions, generating totally invented photographic quality images, and identifying fraudulent transactions.
Sophisticated AI requires sophisticated mathematics under-the-hood. With Fetch.ai this sophisticated mathematics is baked into the library, and can be easily invoked from a smart contract. No other blockchain technology can do this. This means that with Fetch.ai you can write a few lines of code and get a sophisticated AI model to train on data in the blockchain.
Of course, if you don’t need the AI to be running on every node of the network you can take this one step further with a synergetic contract that performs the expensive computations outside of the node, and shares the results on the network; but that’s diving into more detail than we need here.
Smart contracts with Fetch.ai are better. Etch, our smart contract programming language, is a real joy to develop with. We have had the opportunity to see what decisions other projects have taken and learnt from them. There is gratitude to these projects, Etch isn’t built in an ad-hoc way. We’ll go into more detail about Etch in the future, if you’d like to take a look at programming with Etch visit build.fetch.ai.
On top of the ledger sits our decentralised search; this is a directory of agents and services. In a similar manner to the ledger, access to the decentralised search sits on top of every node. A bit like Google, just no single entity owns all your data.
At each decentralised search node, you’ll see millions of Autonomous Economic Agents (AEAs) connected. Autonomous Economic Agents are Fetch.ai’s idea of small, sometimes very clever, pieces of code interacting with other agents, external services and people. An Autonomous Economic Agent could be an agent in any sensor in a car, sending information to a car manufacturer’s diagnostic agents for economic reward. An autonomous agent could be sitting on your phone, ordering for you at a cafe. An autonomous agent will definitely be at home on your smart meter device too.
Autonomous Economic Agents need to be able to find other agents, and the services they provide, through decentralised search, and the results or costs from this are recorded by the Fetch.ai ledger.
This is just a fraction of what Fetch.ai enables. We utilise nodes for collective machine learning, we introduce a decentralised search system and finally we introduce agents, whose purpose can be as simple as monitoring your phones battery level, or tiny pieces of code on components communicating with one another on a spaceship.
That’s the simple introduction. Hopefully you now understand what a blockchain is, and how Fetch.ai is building something different. We utilise the new blockchain protocol we’ve built from scratch. Clearly though, we are more than just a blockchain company.
Do visit our 网站 and see our YouTube videos to see how we create value from data and actions. Find out more about how we’re creating an entire new ecosystem using Fetch.ai by reaching out to us on 推特, Slack 或邮件至 [email protected].
Finally, note this article will be updated in the future, so please do come back soon!