-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f929fc6
commit c90fd98
Showing
1 changed file
with
24 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,109 +1,39 @@ | ||
# Orchestration in Blockchain Ecosystems | ||
# Fundamentals | ||
|
||
Blockchain technology has ushered in an era of decentralized finance, governance, and communication. However, as the ecosystem expands with numerous blockchains specializing in different aspects of decentralized applications, the need for coordination among these disparate networks becomes evident. This is where orchestration plays a vital role. In this blog post, we'll dive deep into what orchestration is, why it's essential, and how it works, especially in the context of the Agoric blockchain. | ||
Blockchain orchestration fundamentally relies on protocols and mechanisms that enable blockchains to communicate and transact with each other securely and efficiently. The primary goals of blockchain orchestration are: | ||
|
||
## What is Orchestration? | ||
- **Interoperability:** Allowing different blockchain networks to interact and transact with each other. | ||
- **Scalability:** Enabling multiple blockchains to work together without compromising performance. | ||
- **Security:** Ensuring that cross-chain transactions are secure and trustworthy. | ||
|
||
Orchestration in the blockchain context refers to the automated coordination and management of interactions between different blockchain networks. Just as an orchestra requires a conductor to synchronize the diverse instruments and players, blockchain networks need orchestration to manage and facilitate inter-chain communication, transactions, and data sharing. | ||
To achieve these goals, several foundational technologies and protocols have been developed, with the **Inter-Blockchain Communication (IBC) protocol** being one of the most prominent. | ||
|
||
Orchestration enables multiple blockchains to work together seamlessly, allowing users to perform actions across different networks without needing to understand the complexities involved. It is a crucial component for building a scalable, interconnected blockchain ecosystem that can leverage the strengths of various networks. | ||
### Inter-Blockchain Communication (IBC) | ||
|
||
## TCP/IP of Blockchains | ||
The Inter-Blockchain Communication (IBC) protocol can be thought of as the TCP/IP of the blockchain world. Just like TCP/IP allows different computer networks to communicate over the internet, IBC enables different blockchains to communicate with each other. | ||
|
||
The idea of orchestration can be likened to the TCP/IP protocol suite in the traditional internet. Just as TCP/IP enables different computers and networks to communicate over the internet, orchestration protocols allow different blockchains to interact. | ||
#### How IBC Works | ||
|
||
In this analogy: | ||
IBC operates on a simple premise: by adhering to a common set of communication protocols, blockchains can securely transfer data and tokens between one another. Here's a high-level overview of how IBC achieves this: | ||
|
||
- **TCP** (Transmission Control Protocol) is responsible for ensuring reliable communication and data transmission between computers, akin to how Inter-Blockchain Communication (IBC) ensures reliable and secure message passing between blockchains. | ||
- **IP** (Internet Protocol) routes and addresses packets of data to ensure they reach the correct destination. Similarly, orchestration mechanisms in blockchain manage the routing and addressing of transactions and messages between networks. | ||
- **Light Client Verification:** Each blockchain maintains a "light client" of the other blockchain. A light client is a simplified version of a blockchain client that only retains enough information to verify transactions and proofs, without needing to store the entire blockchain history. | ||
- **Relayer:** A relayer is an off-chain process or entity that listens for transactions on one blockchain and relays them to another. The relayer facilitates communication between blockchains but does not have any special permissions or abilities; it merely passes messages between chains. | ||
- **IBC Handshake:** Before two blockchains can communicate, they must perform a handshake, establishing a trusted channel between them. This involves verifying each other's consensus state through light clients. | ||
- **Packet Transfer:** Once the connection is established, IBC allows the transfer of packets of data. These packets can represent tokens, smart contract commands, or any other type of data. The receiving blockchain uses the light client verification to ensure that the data packet is valid and hasn't been tampered with. | ||
- **Finality and Acknowledgement:** After a packet is successfully received and processed by the receiving blockchain, an acknowledgment is sent back to the originating blockchain, confirming the completion of the transaction. | ||
|
||
By providing a standardized method for inter-chain communication, orchestration protocols like IBC are often referred to as the "TCP/IP of blockchains," enabling interoperability across different blockchain networks. | ||
The IBC protocol is highly modular, meaning it can be extended and adapted for various use cases and blockchain types. This modularity is what makes IBC a powerful tool for blockchain orchestration, allowing diverse blockchains to participate in a common ecosystem. | ||
|
||
## Motivations | ||
### Interchain Accounts (ICA) | ||
|
||
The motivations for developing robust orchestration solutions in blockchain are numerous: | ||
Interchain Accounts (ICA) is a feature built on top of IBC that allows one blockchain to control an account on another blockchain. This is akin to having a remote account that can be operated from a different blockchain. ICA is a critical component of blockchain orchestration, as it enables seamless cross-chain operations and automation. | ||
|
||
- **Interoperability**: Different blockchains often serve different purposes. For example, Bitcoin focuses on being a decentralized currency, while Ethereum allows for smart contracts. Orchestration enables these different chains to interact and leverage each other's strengths. | ||
- **Scalability**: As more blockchains are created, the need for them to work together smoothly becomes more pressing. Orchestration provides a scalable solution for managing and coordinating inter-chain activities. | ||
#### How ICA Works | ||
|
||
- **User Experience**: Users want seamless experiences. Orchestration hides the complexities of interacting with multiple chains, making it easier for users to engage with blockchain applications without needing to understand the underlying protocols. | ||
- **Account Creation:** One blockchain (let's call it Chain A) creates an account on another blockchain (Chain B) using the IBC protocol. This account is fully owned and controlled by Chain A. | ||
- **Transaction Execution:** Chain A can then send IBC messages to execute transactions on Chain B as if it were a local user. This could include transferring tokens, interacting with smart contracts, or any other blockchain operation. | ||
- **Automation:** By leveraging ICA, Chain A can automate operations on Chain B, creating complex workflows that span multiple blockchains. For example, Chain A could automatically execute a smart contract on Chain B when certain conditions are met. | ||
|
||
- **Security**: Proper orchestration ensures that cross-chain operations are secure and that the integrity of transactions and data is maintained. | ||
ICA greatly enhances the flexibility and capability of blockchain orchestration by enabling direct, programmable interactions between blockchains. This opens up a wide range of possibilities for cross-chain applications, from decentralized finance (DeFi) to supply chain management. | ||
|
||
# Key components | ||
|
||
To understand how orchestration works in a blockchain environment, it's essential to look at its key components: | ||
|
||
## Chain Object | ||
|
||
The chain object is a fundamental building block in orchestration. It represents an abstraction of a blockchain, encapsulating all the necessary details to interact with it, such as its endpoints, account structures, and transaction formats. This abstraction allows developers to interact with the blockchain without needing to understand its internal workings. | ||
|
||
```js | ||
orchestrator.getChain('agoric'); | ||
``` | ||
|
||
In order, to get access to the chain object, we need `orchestrator` object. Using the `orchestrator` object, we can extract a chain(In cosmos ecosystem). | ||
|
||
## Create Chain Accounts | ||
|
||
Creating chain accounts is a fundamental step in interacting with a blockchain. Each blockchain typically requires its own set of credentials or key pairs to authorize transactions and interact with the network. In the context of orchestration, the process of creating chain accounts involves generating the necessary cryptographic keys and associating them with the desired blockchain network through the chain object. | ||
|
||
In the Agoric SDK, for example, creating a chain account might look like this: | ||
|
||
```js | ||
// Code ... | ||
``` | ||
|
||
## Query blockchains | ||
|
||
Querying blockchains is essential for retrieving information such as account balances, transaction history, smart contract state, and more. The orchestration framework must provide a uniform interface for querying different blockchains, despite the underlying differences in their APIs and data formats. | ||
|
||
For instance, querying the balance of an account on a blockchain might look like this: | ||
|
||
```js | ||
// Code ... | ||
``` | ||
|
||
## Send Transactions | ||
|
||
Sending transactions is a critical function of any blockchain orchestration framework. Transactions could be anything from transferring assets, invoking smart contracts, or even triggering cross-chain operations. | ||
|
||
The orchestration layer needs to handle the nuances of each blockchain's transaction format, signature requirements, and broadcasting mechanisms. Here's a basic example of sending a transaction using the chain object: | ||
|
||
```js | ||
// Code ... | ||
``` | ||
|
||
# Examples | ||
|
||
# Under the Hood: How Orchestration Works | ||
|
||
To understand how orchestration frameworks work under the hood, we need to look at the underlying technologies that make cross-chain communication possible. | ||
|
||
## Inter-Blockchain Communication (IBC) | ||
|
||
The IBC protocol is a standardized framework for inter-chain communication, primarily used in the Cosmos ecosystem but applicable to any blockchain that implements the protocol. IBC allows different blockchains to securely send messages and transactions to each other. | ||
|
||
## Relayers | ||
|
||
Relayers are off-chain processes that facilitate the communication between blockchains in the IBC protocol. They monitor the state of the blockchains involved and relay packets of information, such as transaction data, from one blockchain to another. Relayers play a crucial role in maintaining the integrity and security of cross-chain operations. | ||
|
||
## Channels | ||
|
||
Channels are pathways through which blockchains communicate over IBC. Each channel is associated with a pair of blockchains and a specific application logic. For example, one channel might be dedicated to token transfers, while another might handle smart contract invocations. | ||
|
||
## Connections | ||
|
||
Connections are the underlying transport layer in the IBC protocol. They establish the secure, authenticated links between blockchains over which channels operate. Connections ensure that messages are transmitted reliably and securely, preserving the integrity of cross-chain interactions. | ||
|
||
## Asynchronous Flow | ||
|
||
Blockchain transactions and messages are typically asynchronous, meaning they do not require an immediate response and can be processed at different times. Orchestration frameworks must handle this asynchronicity, ensuring that messages are correctly sequenced and that eventual consistency is achieved across different blockchains. | ||
|
||
In practical terms, this might involve tracking transaction confirmations, handling retries in case of failures, and managing state across different networks. The orchestration layer abstracts these complexities, allowing developers to work with an easier, more synchronous-like interface while the framework handles the asynchronous nature of blockchain operations. | ||
|
||
## Vows | ||
|
||
In the Agoric ecosystem, "Vows" are a concept similar to JavaScript's Promises but tailored for distributed systems and smart contracts. Vows represent a commitment to a future result that might depend on asynchronous operations across multiple chains. | ||
|
||
For example, a vow might represent the promise of a token transfer from one blockchain to another. As the operation progresses, the vow gets resolved, updated, or rejected based on the outcome. Vows provide a powerful abstraction for managing asynchronous workflows in a distributed environment. | ||
# AutoStake |