# Overview

Build cross-chain dApps across public and private VM-based chains according to your custom rules

### Introduction

Asterizm is a plug and play blockchain interoperability solution for enterprises, web3 protocols and fintech products with privacy and modularity at the core.

<figure><img src="/files/0tc96HZZ27XjYiXgY9y6" alt=""><figcaption><p>Asterizm infrastructure overview</p></figcaption></figure>

{% hint style="info" %}
Сheck out our [white paper ](https://asterizm.io/files/wp.pdf)to learn how the Asterizm protocol works
{% endhint %}

### Built with privacy and agility at the core

The core of the Asterizm concept is the privacy of payload transmitted between networks and the modularity of the infrastructure.

All data (payload) remains private and accessible only to the owner of the [Client's server](/infrastructure/client-off-chain-module), which serves as a transport layer for data and transaction proofs. [Asterizm Relayer servers](/infrastructure/asterizm-relayer) function solely as a transport layer for proofs of cross-chain transactions in the form of a payload hash and a unique transaction ID (xID).

The [Asterizm Connector](/infrastructure/asterizm-connector) is used for on-chain validation and integrity checks of each cross-chain transaction. It does this by utilizing the payload, hash, and unique transaction ID (xID) received from the [Relayers](/infrastructure/asterizm-relayer) and [Client servers](/infrastructure/client-off-chain-module).

The [Client server module](/infrastructure/client-off-chain-module) is a Docker image, which is easily and quickly implemented in any system and the Client's security loop.

{% hint style="info" %}
Discover the[ transaction flow](/guides/transaction-flow)
{% endhint %}

### Code examples

Learn how to [implement Asterizm](/guides/getting-started) into your contracts, and check out our deployed [Asterizm Connector](/infrastructure/asterizm-connector) smart contracts for use on [Mainnet](/technical-reference/mainnet) and [Testnet](/technical-reference/testnet). \
Visit[ our GitHub](https://github.com/Asterizm-Layer/asterizm-contracts) for more tech guides and examples.


# Architecture

Confidentiality and reliability at the core

The Asterizm technology is based on the principle of on-chain validation and integrity checks for cross-chain transactions, which take place within the [Asterizm Connector](/infrastructure/asterizm-connector) contracts on the destination network, using data received from off-chain entities to provide a confidential cross-chain communication channel that is decentralized, incredibly cost-efficient, and has extremely low cross-chain transaction latency.

Asterizm secures cross-chain transactions with the [Asterizm Connector](/infrastructure/asterizm-connector) as an on-chain module and two independent off-chain entities: [Asterizm Relayers](/infrastructure/asterizm-relayer) and [Client off-chain module](/infrastructure/client-off-chain-module).

## Components

<figure><img src="/files/KBL1fshOxQ0KulixBL5H" alt=""><figcaption><p>Components of Asterizm infrastructure</p></figcaption></figure>

* [Relayer servers ](/infrastructure/asterizm-relayer)- Asterizm or partner servers that function as a transport layer. These servers transmit proofs **(hash, xID)** of cross-chain transactions from one network to another without necessitating consensus between them. Instead, they adhere to rules that entail waiting for the appropriate number of blocks to validate the transaction in each supported network, resulting in a substantial acceleration of cross-chain transactions.
* [Client off-chain module](/infrastructure/client-off-chain-module) - The module for the client-server infrastructure is a Docker image that operates as a cross-chain transaction payload (data) transmitter.
* [Asterizm Connector](/infrastructure/asterizm-connector) - a lightweight on-chain client consisting of [Initializer](/infrastructure/asterizm-connector/initializer-smart-contract) and [Translator](/infrastructure/asterizm-connector/translator-smart-contract) smart contracts deployed on each chain supported by Asterizm to perform cross-chain operations by providing validity and integrity checks for each cross-chain transaction.

## Key Concept

The architecture has been designed to:

* ensure validity and integrity of cross-chain transactions without using any off-chain consensus or centralized approach in EVM and non-EVM networks;
* ensure the privacy of data transferred from one chain to another;
* provide the ability to integrate various products in plug-and-play format to simplify the development of complex cross-chain projects;
* provide flexibility of customization and transparency of use.

<figure><img src="/files/DVr2CQuHwJncbbecSy3k" alt=""><figcaption><p>Asterizm infrastructure</p></figcaption></figure>

The concept of Asterizm is to provide a modular and confidential channel between various public or private chains through a transparent mechanism for on-chain transaction validity and integrity verification, coupled with a unique architecture for the off-chain part. This off-chain part serves as a transport layer for payloads and transaction proofs in the form of **hash** and **xID**.

The **hash** is generated in the source network on the client smart contract based on transaction data, payload, source and destination chain addresses, and several other parameters.

{% hint style="info" %}
Check out the full cross-chain transaction flow on the [Transaction flow page](/guides/transaction-flow)
{% endhint %}

Cross-chain transaction validity and integrity verification is performed in two steps:

1. Upon the initialization of a cross-chain transaction on the client's smart contract in the source network, a hash is computed from the transmitted data, and a unique ID for that transaction is generated. Subsequently, the [Client server](/infrastructure/client-off-chain-module) retrieves the payload, hash, and xID for transmission to the destination network. [Relay servers](/infrastructure/asterizm-relayer), on the other hand, receive only the hash and xID from the client contract for transmission to the destination network.
2. In the destination network, before executing the payload received from the [client contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) via the [Client server](/infrastructure/client-off-chain-module), checks are performed to ensure the validity and integrity of the transaction. This is achieved by calculating a hash from the received payload and comparing it with the hash obtained from [relayer servers](/infrastructure/asterizm-relayer). Additionally, there is a verification of the xID to prevent duplicates and spam transactions.

This approach takes cross-chain messaging to a new enterprise-grade level, marked by extremely low messaging latency, confidentiality at the transport level, and an optimized economic model that reduces the costs of cross-chain transactions.&#x20;

The Asterizm solution concept eliminates the need for a network of validators with its own off-chain consensus since it requires the establishment of an economic model, imposes additional costs on customers, and takes additional time to process each cross-chain transaction due to the need for consensus between validators.

The architecture of our solution allows you to flexibly set up the infrastructure for cross-chain operations and quickly integrate our software, while respecting all internal security policies and not relying on the security of a third party, as seen with other bridges.

The risk of hacking the client's server or relayer servers is mitigated in the destination network by on-chain transaction validation using a hash function from payload and xID. This guarantees transaction validity and integrity in the source and destination networks, thereby eliminating the risk of a 51% attack.


# Benefits

Privacy, security, economic efficiency, scalability

Asterizm was designed as a solution for building cross-chain protocols without compromising on data privacy and reliability of data transmission between EVM and non-EVM public/private networks, respecting the standards for such solutions in the industry:

<figure><img src="/files/NiZt5EYPRjnVU4nuz8R0" alt=""><figcaption><p>Asterizm benefits</p></figcaption></figure>

We believe that the blockchain solutions market will remain fragmented and that governments, corporations, and web3 protocols will operate in multiple ecosystems (networks) simultaneously, using perks and the most beneficial features of each.

The Asterizm concept focuses on privacy and modularity because the lack of privacy in the cross-chain industry greatly reduces the usability of this technology: transmitting financial messages, personal and corporate data, etc. is risky (or even impossible due to the data privacy requirements), especially if we are talking about web2 companies integrating into the web3 market.

### Privacy

Asterizm or any third party does not have any access to the transmitted payload. This is because all data (payload) is exclusively transmitted from Network 1 to Network 2 through the [client's server](/infrastructure/client-off-chain-module), while the proofs of validity and integrity of this data (hash from payload, xID) are transmitted through [relay servers](/infrastructure/asterizm-relayer).

This is especially relevant for cross-chain communication between private networks. In such cases, only the sender and receiver have access to the content of the cross-chain transaction, ensuring a high level of privacy. This is especially relevant for enterprises exchanging data with other companies in various private chains.

{% hint style="info" %}
Learn more about Asterizm and privacy in the [White paper](https://asterizm.io/files/wp.pdf)
{% endhint %}

### High speed - Low cost

Thanks to our [unique on-chain validation-based protocol architecture](/what-is-asterizm/architecture), we do not need to maintain a complex economic system to achieve consensus. \
As a result, all cross-chain transactions flow almost instantly and at one of the lowest fees on the market.

### Scalability

The speed and cost of cross-chain transactions do not depend on their quantity and frequency, so you can develop responsive cross-chain applications without incurring unnecessary expenses.

### Security

Asterizm's approach to cross-chain transaction protection covers not only validity and integrity but also data confidentiality. Verification is performed off-chain and on-chain by two unrelated entities ([Asterizm relayer server](/infrastructure/asterizm-relayer) and [client's server](/infrastructure/client-off-chain-module)) and [Asterizm Connector](/infrastructure/asterizm-connector) as an on-chain module. This design ensures that the infrastructure remains resilient against both external and internal attack vectors.

{% hint style="info" %}
Asterizm Protocol passed the security audit performed by [HashEx](https://hashex.org/)
{% endhint %}


# Supported chains

List of supported chains with smart contract addresses

### Asterizm currently supports 2️⃣9️⃣ chains, 8️⃣ more coming up

<table><thead><tr><th width="94">Status</th><th width="157">Chain</th><th width="111">Type</th><th width="131">Symbol</th><th width="134">Chain ID</th></tr></thead><tbody><tr><td>✅</td><td>Ethereum</td><td>EVM</td><td>ETH</td><td>1</td></tr><tr><td>✅</td><td>Polygon</td><td>EVM</td><td>POL</td><td>137</td></tr><tr><td>✅</td><td>Fantom</td><td>EVM</td><td>FTM</td><td>250</td></tr><tr><td>✅</td><td>BNB Chain</td><td>EVM</td><td>BSC</td><td>56</td></tr><tr><td>✅</td><td>Optimism</td><td>EVM</td><td>OPT</td><td>10</td></tr><tr><td>✅</td><td>Arbitrum</td><td>EVM</td><td>ARB</td><td>42161</td></tr><tr><td>✅</td><td>Avalanche</td><td>EVM</td><td>AVA</td><td>43114</td></tr><tr><td>✅</td><td>Celo</td><td>EVM</td><td>CEL</td><td>42220</td></tr><tr><td>✅</td><td>Boba</td><td>EVM</td><td>BOB</td><td>288</td></tr><tr><td>✅</td><td>Aurora</td><td>EVM</td><td>AUR</td><td>1313161554</td></tr><tr><td>✅</td><td>Venidium</td><td>EVM</td><td>XVM</td><td>4919</td></tr><tr><td>✅</td><td>Bahamut</td><td>EVM</td><td>FSX</td><td>5165</td></tr><tr><td>✅</td><td>Base</td><td>EVM</td><td>BSX</td><td>8453</td></tr><tr><td>✅</td><td>Linea</td><td>EVM</td><td>LNX</td><td>59144</td></tr><tr><td>✅</td><td>Mantle</td><td>EVM</td><td>MTL</td><td>5000</td></tr><tr><td>✅</td><td>Gnosis</td><td>EVM</td><td>GNS</td><td>100</td></tr><tr><td>✅</td><td>Everscale</td><td>Non-EVM</td><td>EVER</td><td>2002</td></tr><tr><td>✅</td><td>Venom</td><td>Non-EVM</td><td>VNM</td><td>3003</td></tr><tr><td>✅</td><td>XDC</td><td>EVM</td><td>XDC</td><td>50</td></tr><tr><td>✅</td><td>TON</td><td>non-EVM</td><td>TON</td><td>40000</td></tr><tr><td>✅</td><td>Solana</td><td>non-EVM</td><td>SOL</td><td>50000</td></tr><tr><td>✅</td><td>LemonChain</td><td>EVM</td><td>LMN</td><td>1006</td></tr><tr><td>✅</td><td>Torus</td><td>EVM</td><td>XVM</td><td>8192</td></tr><tr><td>✅</td><td>Areum</td><td>EVM</td><td>AREA</td><td>463</td></tr><tr><td>✅</td><td>Units</td><td>EVM</td><td>UNT</td><td>88811</td></tr><tr><td>✅</td><td>RedBelley</td><td>EVM</td><td>RDB</td><td>151</td></tr><tr><td>✅</td><td>Supra</td><td>non-EVM</td><td>SUPRA</td><td>60000</td></tr><tr><td>✅</td><td>Stellar</td><td>non-EVM</td><td>XLM</td><td>70000</td></tr><tr><td>✅</td><td>Canton</td><td>non-EVM</td><td>CANTON</td><td>90000</td></tr><tr><td>✅</td><td>Rayls</td><td>EVM</td><td>RLS</td><td>72957</td></tr><tr><td>🔜</td><td>Polygon zkEVM</td><td>EVM</td><td>PZK</td><td>1101</td></tr><tr><td>🔜</td><td>Aptos</td><td>non-EVM</td><td>APS</td><td>-</td></tr><tr><td>🔜</td><td>Cardano</td><td>non-EVM</td><td>CRD</td><td>-</td></tr><tr><td>🔜</td><td>Tron</td><td>non-EVM</td><td>TRN</td><td>-</td></tr><tr><td>🔜</td><td>XRPL</td><td>non-EVM</td><td>XRPL</td><td>-</td></tr><tr><td>🔜</td><td>Plume</td><td>non-EVM</td><td>PLM</td><td>-</td></tr></tbody></table>


# Non-EVM chains integration plan

<mark style="color:blue;">**STELLAR**</mark>

<mark style="color:blue;">**I. Soroban is a key solution for integrating Stellar into the Asterizm protocol**</mark>

Soroban, Stellar's smart contract platform, makes it possible to integrate Stellar into Asterizm by enabling complex programmable logic on Stellar, which was previously focused on fast payments and simple asset transfers. Soroban allows developers to build smart contracts with functionality similar to Ethereum's EVM, making it compatible with cross-chain protocols like Asterizm that rely on programmable contracts to execute secure cross-chain transactions. Here’s how Soroban facilitates this integration:

**1. Support for Programmable Logic**

Asterizm requires two key smart contracts on each chain (Initializer and Translator) to handle cross-chain messaging, validation, and transaction proof generation. With Soroban, Stellar can now support the deployment of such smart contracts.

* **Soroban Initializer:** This smart contract can generate and validate cross-chain messages by creating unique transaction identifiers (xID) and cryptographic hashes. These are essential for ensuring the integrity of the cross-chain message.
* **Soroban Translator:** This contract handles communication with the Asterizm relayer servers, sending and receiving transaction proofs (hash + xID). Soroban provides the ability to send these messages from Stellar to other chains and vice versa.
* **Soroban client smart contract Abstraction:** This is a smart contract abstraction (template) that the client (dApp) must deploy when using Asterizm for cross-chain communication between Stellar, EVM, TON, and Solana.

#### 2. Compatibility with Cross-Chain Protocols

Soroban brings Stellar closer to EVM-compatible environments, which makes it easier for protocols like Asterizm to interact with Stellar. Since Asterizm is designed to work across multiple blockchains, including non-EVM chains, Soroban’s flexibility allows Stellar to support the programmable smart contracts required by Asterizm without relying on third-party solutions.

* Soroban allows Stellar to integrate into Asterizm in a way similar to EVM-based blockchains. This includes handling cross-chain transaction logic, generating unique transaction identifiers, and securely transmitting them via relayers.

**3. Event-Driven Architecture**

Cross-chain protocols like Asterizm rely on emitting events from smart contracts to trigger actions on other blockchains. Soroban's ability to emit events makes it possible to alert Asterizm relayers when a transaction is ready to be transmitted to another blockchain. This event-driven model is critical for synchronizing cross-chain actions.

* When a transaction is initialized on Stellar, Soroban contracts emit the required events (such as xID and hash generation), which are then captured by the Asterizm relayer. This allows Stellar’s transactions to be securely communicated to other blockchains involved in the cross-chain messaging process.

**4. Security and Validation**

Soroban is built to handle the security requirements of cross-chain operations by providing strong cryptographic capabilities. For example, Soroban allows the secure generation of transaction hashes, which can be used to ensure that the correct payload is sent across chains. This is essential for Asterizm's cross-chain protocol, which relies on validating the integrity of messages between chains.

* Soroban can securely store and validate these proofs, ensuring that cross-chain transactions are tamper-proof and adhere to Asterizm's validation requirements.

**5. Stellar’s Low-Cost and High-Speed Transaction Model**

One of Stellar’s key advantages is its fast and low-cost transaction model, which complements Asterizm’s goal of efficient and private cross-chain messaging. Soroban smart contracts can execute these operations at minimal cost compared to other blockchains, making it cost-effective to integrate Stellar into Asterizm's architecture for cross-chain messaging.

**Conclusion**

In summary, Soroban makes it possible to integrate Stellar into Asterizm by providing the necessary programmable smart contracts (Initializer and Translator), enabling cross-chain communication via event-driven logic, and offering secure cryptographic validation. This brings Stellar into the cross-chain ecosystem in a way that supports Asterizm’s privacy-focused and scalable cross-chain transactions. Soroban’s Rust-based development, flexibility, and security features provide all the tools necessary to seamlessly extend Stellar’s capabilities into Asterizm’s cross-chain protocol.

<mark style="color:blue;">**II. Stellar integration into Asterizm protocol (step-by-step plan)**</mark>

To integrate Stellar into Asterizm using Soroban while following Asterizm’s cross-chain messaging architecture, we will need to follow a similar approach to how Asterizm integrates with other EVM-based chains. Here’s a step-by-step breakdown:

#### Asterizm Components and Their Role in Stellar Integration

Asterizm uses two types of smart contracts on both the source and destination chains: Initializer and Translator. These contracts ensure secure and private cross-chain messaging. The relayer software also plays a key role in transmitting proofs of transactions across chains.

1. **Initializer Smart Contract:**

* Source chain role: Initializes cross-chain transactions, generates and stores transaction proofs (xID, hash).
* Destination chain role: Receives the message, validates the proofs, and triggers the execution of the cross-chain transaction.

2. **Translator Smart Contract:**

* Source chain role: Transmits proofs (hash, xID) to Asterizm Relayer Servers.
* Destination chain role: Receives proofs from relayers and forwards them to the Initializer for validation.

3. **Relayer Software:**

* Transmits cross-chain transaction proofs without accessing the actual transaction payload (for privacy and security).

#### Steps to Integrate Stellar via Soroban with Asterizm

**1. Deploy Soroban Smart Contracts**

**Smart Contract Types:**

* **Soroban Initializer:** A smart contract that mimics the Asterizm Initializer’s functions. It will initialize the cross-chain transaction on Stellar, generate the xID and hash, and send the data to the Soroban Translator.
* **Soroban Translator:** Responsible for transmitting transaction proofs (hash and xID) to the relayer software, and receiving them back from the relayer on the destination chain.
* **Soroban client smart contract Abstraction:** This is a smart contract abstraction (template) that the client (dApp) must deploy when using Asterizm for cross-chain communication between Stellar, EVM, TON, and Solana.

Soroban supports the same basic operations required for this integration, such as emitting events, interacting with off-chain systems, and cryptographic hash functions.

**Functionality:**

* On the source chain (Stellar), the Soroban Initializer will generate an xID and hash based on the transaction payload and send it to the Translator.
* The Translator will forward this proof to the relayers via the client’s off-chain module (as detailed in the white paper), ensuring the cross-chain transaction is securely and privately initialized.

**2. Relayer Software Upgrade**

* **Stellar Support:** Asterizm’s relayer software will need to be modified to recognize and process Stellar’s transactions. This involves:
* **Transaction Watching:** The relayer should monitor the Stellar blockchain for specific events emitted by the Soroban Initializer and Translator contracts.
* **Cross-Chain Proof Transmission**: Relayers must handle the hash and xID proof transmission to the destination chain.
* **Transaction Validation:** After transmitting the proofs, the relayer must ensure that the destination chain’s Translator smart contract can successfully receive and validate the proof.

Stellar uses **SCP (Stellar Consensus Protocol)** for its consensus, which is quite different from EVM-based chains using PoS. However, this will not significantly affect the relayer’s role, as it primarily operates based on transaction and block confirmations.

**3. Client Off-Chain Module**

* The client’s off-chain module (described as a Docker image) serves as a secure intermediary that passes the transaction payload between chains. This module should be adapted to handle Stellar’s transaction structure and integrate with Soroban smart contracts.
* Data Handling: The off-chain module will transmit the payload to the destination chain, while the relayer handles the proofs separately to ensure data integrity.

**4. Testing and Validation**

Cross-Chain Messaging Test: After deploying the Soroban smart contracts and upgrading the relayer, we should conduct rigorous testing:

* Sending Messages from Stellar: Verify that the Soroban Initializer on Stellar can successfully initiate a cross-chain transaction and send the xID/hash to the relayer.
* Receiving Messages on Stellar: Ensure that Stellar’s Soroban Initializer can validate incoming cross-chain transactions from other networks, confirming the transaction's integrity via the xID and hash.

Additionally, we should ensure that message verification and execution on the destination chain (whether EVM or Stellar) works seamlessly.

#### <mark style="color:blue;">III. Conclusion</mark>

Integrating Stellar into Asterizm using Soroban will involve deploying customized Soroban Initializer and Translator contracts that align with Asterizm’s architecture. The relayer software must be upgraded to handle Stellar’s SCP-based consensus and transaction structure. This integration will allow cross-chain transactions between Stellar and EVM-based chains, with the same level of privacy and security that Asterizm promises for its EVM integrations. The result is a seamless, confidential cross-chain messaging protocol that leverages Stellar’s low-cost, high-speed network.

<br>


# Frequently asked questions

The most important questions about how Asterizm works

## Is Asterizm a centralazied solution?

**No**, Asterizm is not a centralized solution because cross-chain transaction validation is performed on-chain based on information provided by two independent entities: [Asterizm Relayers](/infrastructure/asterizm-relayer) and [Client off-chain module](/infrastructure/client-off-chain-module).\
Learn more about [how this works](/what-is-asterizm/architecture#key-concept).

## How do you verify the cross-chain transaction validity?

The cross-chain transaction validation process is divided into multiple steps and is based on a unique transaction identifier (xID) generated in the source network within the [client smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction), and a hash function on the client contract in the source and destination network.

1. During the initialization of a cross-chain transaction on the [client's smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) in the source network, a hash is calculated from the transmitted data, and a unique ID for that transaction is generated. Subsequently, the [Client server](/infrastructure/client-off-chain-module) retrieves the payload, hash, and xID for transmission to the destination network, while [relayer servers](/infrastructure/asterizm-relayer) receive only the hash and xID from the client contract for subsequent transmission to the destination network.
2. In the destination network, before executing the payload received from the [client contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) via the [Client server](/infrastructure/client-off-chain-module), validation and integrity checks of the transaction are performed. This is achieved by calculating a hash from the received payload and comparing it with the hash obtained from [relayer servers](/infrastructure/asterizm-relayer). Additionally, there is a verification of the xID to prevent duplicates and spam transactions.

{% hint style="info" %}
[Explore cross-chain transaction flow](/guides/transaction-flow) in detail and Asterizm logic in the [white paper](https://asterizm.io/files/wp.pdf)
{% endhint %}

## Is it mandatory to run a server to use Asterizm?

**Yes.** This is the only way you can be 100% sure that the transmitted data stays private.

## What happens if the client's server or relayer server is hacked?

Asterizm Protocol is designed to mitigate the risk of hacking relayer servers and the client's server responsible for transmitting the payload.

Even if all [relayer](/infrastructure/asterizm-relayer) or [client servers](/infrastructure/client-off-chain-module) are compromised, the business logic of cross-chain transactions performed through Asterizm cannot be compromised because the final check of transaction integrity and validity is performed on smart contracts. It is essential for at least one server to function correctly.

In the worst-case scenario, if the [client's](/infrastructure/client-off-chain-module) or [relayer servers](/infrastructure/asterizm-relayer) have been compromised, the most significant impact could be a temporary reduction in uptime or the suspension of business logic for cross-chain operations, along with a potential loss of gas tokens used to cover fees on behalf of the owner's account.\
To enhance the security of the [Client server](/infrastructure/client-off-chain-module), we recommend utilizing the built-in [Fireblocks module](https://docs.asterizm.io/what-is-asterizm/pages/NYcywYUeorddd3bluFLX#id-4.b.-fireblocks-integration) for storing the [owner account's private key](https://docs.asterizm.io/what-is-asterizm/pages/NYcywYUeorddd3bluFLX#id-4.a.-managing-system-owners) on the [Client server](/infrastructure/client-off-chain-module).

It is important to note that the client is responsible for the business logic of implementing cross-chain transactions in the project. Asterizm offers a reliable and secure solution for confidential cross-chain transactions but is not responsible for the client's business logic.

{% hint style="info" %}
Refer to the [Best practices](/advanced/best-practices) and [Takeoff checklist](/guides/getting-started/3.-important-one-final-pre-flight-check) to ensure that all security measures are met before deploying your project
{% endhint %}

## What happens if one of the networks supported by Asterizm fails / crashes?

The Asterizm approach allows cross-chain transactions between [working blockchains](/what-is-asterizm/supported-chains) regardless of the performance of other connected networks.

Once disconnected networks resume operation, all incoming and outgoing cross-chain transactions will be delivered in accordance with the queuing and block time rules of those networks.


# Overview

Components of Asterizm protocol

Asterizm secures cross-chain transactions with the [Asterizm Connector](/infrastructure/asterizm-connector), an on-chain module responsible for verifying the validity and integrity of cross-chain transactions. Additionally, it involves two independent off-chain entities: [Asterizm Relayers](/infrastructure/asterizm-relayer) and the [Client off-chain module](/infrastructure/client-off-chain-module), which are used for transmitting payloads and proofs.

<figure><img src="/files/fb4Wff4aTRhbYzNzmHKJ" alt=""><figcaption><p>Asterizm components</p></figcaption></figure>

* [Relayer servers](/infrastructure/asterizm-relayer) - transport layer for the cross-chain transaction proofs;
* [Client off-chain module](/infrastructure/client-off-chain-module) - transport layer for the cross-chain transaction data (payload) ensuring confidentiality;
* [Asterizm Connector](/infrastructure/asterizm-connector) - a key module responsible for checking the validity and integrity of cross-chain transactions.

{% hint style="info" %}
Asterizm is designed with the privacy of cross-chain transactions and infrastructure modularity at the core and is aimed to provide reliability, security, and low cost of cross-chain transactions.
{% endhint %}

The [Asterizm architecture](/what-is-asterizm/architecture) eliminates the necessity for maintaining a network of validators with off-chain consensus, which typically demands significantly more time and money to validate a transaction, as validation occurs off-chain.

In Asterizm, cross-chain transaction validation happens on-chain, which significantly speeds up transaction execution and reduces costs.


# Asterizm Connector

An on-chain part of Asterizm infrastructure

A lightweight on-chain client consisting of the [Initializer](/infrastructure/asterizm-connector/initializer-smart-contract) and [Translator](/infrastructure/asterizm-connector/translator-smart-contract) smart contracts, deployed on every Asterizm-[supported chain](/what-is-asterizm/supported-chains) to perform cross-chain operations.

{% hint style="success" %}
See how it works on the [Transaction flow page](/guides/transaction-flow)
{% endhint %}

{% hint style="info" %}
[Create your own smart contract](/guides/getting-started/1.-deploy-your-smart-contracts) that interacts with the Asterizm Connector and performs cross-chain transactions
{% endhint %}


# Client smart contract abstraction

Extend your smart contract with this abstraction

With this abstraction you will be able to implement methods for sending, receiving, additional validation, and cross-chain transaction processing.

Asterizm integration starts with extending this abstraction into the client smart contract.

You can learn more about the smart contract abstraction on our GitHub:

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/base/AsterizmClient.sol>" %}
EVM abstract contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/base/AsterizmClient.tsol>" %}
TVM abstract contract
{% endembed %}


# Initializer smart contract

The key smart contract of Asterizm Connector

This smart contract acts as a validator in the destination network, checking the integrity and validity of the transaction using the hash and xID, and as a validator (checker) on the source network, verifying the sequence and several other parameters of the transaction.

Explore the smart contract on our GitHub:

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/AsterizmInitializer.sol>" %}
EVM initializer contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/AsterizmInitializer.tsol>" %}
TVM initializer contract
{% endembed %}


# Translator smart contract

A part of the transport layer operating with Asterizm relayers

This smart contract works as a transmitter in every[ network supported by Asterizm](/what-is-asterizm/supported-chains). \
The Translator sends and receives encrypted data packets by communicating with [Asterizm Relayer Servers](/infrastructure/asterizm-relayer).

Explore the smart contract on GitHub:

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/AsterizmTranslator.sol>" %}

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/AsterizmTranslator.tsol>" %}


# Client off-chain module

Docker image for your server infrastructure to perform confidential cross-chain transactions

{% hint style="success" %}
IMPORTANT!\
The client’s off-chain module ([Docker image](https://hub.docker.com/r/asterizm/client-server)) in the GO programming language is live in production!
{% endhint %}

The Client off-chain module is a module for the client's server infrastructure (a [Docker image](https://hub.docker.com/r/asterizm/client-server)), functioning as a transmitter of the cross-chain transaction data (payload).&#x20;

This module is responsible for transmitting the payload and proofs of cross-chain transactions across different networks. It also verifies their validity using xID after transmission through the relayer servers, serving as the initial step of verification.

{% hint style="info" %}
Learn how to[ integrate the client off-chain module](/guides/getting-started/2.-implement-off-chain-module) on your server
{% endhint %}


# Asterizm Relayer

The transport layer of the Asterizm protocol

Asterizm or [partner servers](/guides/external-relays) that act as a transport layer.&#x20;

These servers transfer proofs of cross-chain transactions (hash + unique ID) from one network to another without any consensus between them but with rules on waiting for the right number of blocks to validate the transaction in each supported network, which significantly speeds up cross-chain transactions.


# Asterizm Interfaces

Interfaces to the Asterizm contracts

Interfaces for interacting with Asterizm smart contracts, including the [Asterizm Connector](/infrastructure/asterizm-connector).

{% hint style="info" %}
Explore all interfaces at GitHub
{% endhint %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/tree/master/contracts/interfaces>" %}
EVM interfaces
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/tree/master/contracts/interfaces>" %}
TVM interfaces
{% endembed %}


# IAsterizmConfigEnv

The `IAsterizmConfigEnv` interface defines a data structure for configuration settings related to relays and fees.

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IAsterizmConfigEnv.sol>" %}

### Structs

#### ConfigDataResponseDto

Represents configuration data regarding relay and system fees.

**Fields:** `externalRelayExists`, `externalRelayFee`, `systemFee`


# IConfig

The `IConfig` interface extends [IAsterizmConfigEnv](/infrastructure/asterizm-interfaces/iasterizmconfigenv) and provides functionality for managing relay fees.

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IConfig.sol>" %}

### Functions

#### updateTrustedRelayFee

Updates the fee for trusted relays.

**Parameters:** `_fee (uint)`


# IAsterizmEnv

The `IAsterizmEnv` interface defines a set of data transfer objects (DTOs) used to manage cross-chain transactions. These DTOs enable the handling of transaction data, from initialization to validation.

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IAsterizmEnv.sol>" %}

### Structs

#### BaseTransferDirectionDto

Defines source and destination chain details for cross-chain transactions.

**Fields:** `srcChainId`, `srcAddress`, `dstChainId`, `dstAddress`

#### ClInitTransferRequestDto

Represents the client’s request to initiate a transfer.

**Fields:** `dstChainId`, `dstAddress`, `feeAmount`, `txId`, `transferHash`

#### InternalClInitTransferRequestDto

Internal structure for initializing a client transfer.

**Fields:** `dstChainId`, `dstAddress`, `feeAmount`, `payload`

#### IzAsterizmReceiveRequestDto

Used for processing received transfer requests on the initializer's side.

**Fields:** `srcChainId`, `srcAddress`, `dstChainId`, `dstAddress`, `txId`, `transferHash`

#### ClAsterizmReceiveRequestDto

Client-side structure for receiving transfers.

**Fields:** `srcChainId`, `srcAddress`, `dstChainId`, `dstAddress`, `txId`, `transferHash`, `payload`

#### TrSendMessageRequestDto

Structure with details for sending messages between chains using the translator.

**Fields:** `srcAddress`, `dstChainId`, `dstAddress`, `txId`, `transferHash`, `transferResultNotifyFlag`

#### TrTransferMessageRequestDto

Structure that specifies message transfer with gas limits for the translator.

**Fields:** `gasLimit`, `payload`

#### IzInitTransferRequestDto

Defines the initializer's transfer request, including relay details and fees.

**Fields:** `dstChainId`, `dstAddress`, `transferHash`, `txId`, `relay`, `transferResultNotifyFlag`, `feeToken`

#### IzReceivePayloadRequestDto

Used by the initializer to process received payloads.

**Fields:** `srcChainId`, `srcAddress`, `dstChainId`, `dstAddress`, `gasLimit`, `txId`, `transferHash`

#### IzRetryPayloadRequestDto

Handles retrying payload delivery with additional control parameters.

**Fields:** `srcChainId`, `srcAddress`, `dstChainId`, `dstAddress`, `nonce`, `gasLimit`, `forceOrder`, `useEncryption`, `transferHash`, `payload`


# IClientReceiverContract

The `IClientReceiverContract` interface extends [IAsterizmEnv](/infrastructure/asterizm-interfaces/iasterizmenv) interface and facilitates cross-chain communication by receiving payloads and handling transfer results.

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IClientReceiverContract.sol>" %}

### Functions

#### asterizmIzReceive

Receives a payload from the initializer.

**Parameters:** `_dto (`[`IzAsterizmReceiveRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#izasterizmreceiverequestdto)`)`

#### asterizmClReceive

Handles payload reception from the client server.

**Parameters:** `_srcChainId (uint64)`, `_srcAddress (uint)`, `_txId (uint)`, `_transferHash (bytes32)`, `_payload (bytes)`

#### transferSendingResultNotification

Notifies the status of a transfer result.

**Parameters:** `_transferHash (bytes32)`, `_statusCode (uint8)`


# IInitializerReceiver

The `IInitializerReceiver` interface defines methods for receiving payloads from a translator and handling transfer result notifications. It extends [IAsterizmEnv](/infrastructure/asterizm-interfaces/iasterizmenv) and [IConfig](/infrastructure/asterizm-interfaces/iconfig) interfaces.

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IInitializerReceiver.sol>" %}

### Functions

#### receivePayload

Receives a payload from the translator.

**Parameters:** `_dto (`[`IzReceivePayloadRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#izreceivepayloadrequestdto)`)`

#### transferSendingResultNotification

Notifies the result of a transfer to a target client contract.

**Parameters:** `_targetAddress (address)`, `_transferHash (bytes32)`, `_statusCode (uint8)`


# IInitializerSender

The `IInitializerSender` interface extends [IAsterizmEnv](/infrastructure/asterizm-interfaces/iasterizmenv) and defines methods for initiating transfers and managing transfer validation and fees.

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IInitializerSender.sol>" %}

### Functions

#### initTransfer

Initiates a transfer using the provided request data.

**Parameters:** `_dto (`[`IzInitTransferRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#izinittransferrequestdto)`)`

#### validIncomeTransferHash

Validates an incoming transfer by its hash.

**Parameters:** `_transferHash (bytes32)`

**Returns:** `bool`

#### getLocalChainId

Returns the local chain ID.

**Returns:** `uint64`

#### getChainType

Retrieves the type of chain based on its ID.

**Parameters:** `_chainId (uint64)`

**Returns:** `uint8`

#### resendTransfer

Resends a transfer that failed due to insufficient fees.

**Parameters:** `_transferHash (bytes32)`, `_relay (address)`

#### getFeeAmountInTokens

Returns the fee amount in tokens for a specified relay.

**Parameters:** `_relayAddress (address)`, `_dto (`[`IzInitTransferRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#izinittransferrequestdto)`)`

**Returns:** `uint`


# IMultiChainToken

The `IMultiChainToken` interface facilitates cross-chain transfers of tokens between different blockchain networks.

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/IMultiChainToken.sol>" %}

### Functions

#### crossChainTransfer

Initiates a cross-chain transfer of tokens.

**Parameters:**  `_dstChainId (uint64)`, `_fromAddress (address)`, `_toAddress (uint)`, `_amount (uint)`


# INonce

The `INonce` interface provides methods for managing and retrieving nonces associated with cross-chain transactions.

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/INonce.sol>" %}

### Functions

#### increaseNonce

Increases the nonce for a specified chain.

**Parameters:** `_chainId (uint64)`, `_pathData (bytes)`

**Returns:** Updated nonce (`uint`).

#### increaseNonceWithValidation

Increases the nonce with validation against an external nonce.

**Parameters:** `_chainId (uint64)`, `_pathData (bytes)`, `_nonce (uint)`

**Returns:** Updated nonce (`uint`).

#### getNonce

Retrieves the current nonce for a specified chain.

**Parameters:** `_chainId (uint64)`, `_pathData (bytes)`

**Returns:** Current nonce (`uint`).

#### getNonceBase

Returns the base nonce for specified source and destination addresses.

**Parameters:** `_chainId (uint64)`, `_srcAddress (uint)`, `_dstAddress (uint)`

**Returns:** Base nonce (`uint`).


# ITranslator

The `ITranslator` interface extends [IAsterizmEnv](/infrastructure/asterizm-interfaces/iasterizmenv) and provides methods for sending and logging transfer message.

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/interfaces/ITranslator.sol>" %}

### Functions

#### sendMessage

Sends a transfer payload.

**Parameters:** `_dto (`[`TrSendMessageRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#trsendmessagerequestdto)`)`

#### logExternalMessage

Logs an external transfer payload.

**Parameters:** `_externalRelayAddress (address)`, `_dto (`[`TrSendMessageRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#trsendmessagerequestdto)`)`

#### resendMessage

Resends a transfer that failed due to insufficient fees.

**Parameters:** `_transferHash (bytes32)`, `_senderAddress (uint)`

#### getLocalChainId

Returns the local chain ID.

**Returns:** `uint64`

#### getChainType

Retrieves the type of chain based on its ID.

**Parameters:** `_chainId (uint64)`

**Returns:** `uint8`

#### getFeeAmountInTokens

Returns the fee amount in tokens for a specified transfer.

**Parameters:** `_dto (`[`TrSendMessageRequestDto`](/infrastructure/asterizm-interfaces/iasterizmenv#trsendmessagerequestdto)`)`

**Returns:** `uint`


# Transaction flow

Learn how Asterizm Protocol operates

<figure><img src="/files/gLhRr64gz7vM15U6v2FK" alt=""><figcaption><p>Asterizm architecture</p></figcaption></figure>

***packet*** - data packet containing cross-chain transaction content and related parameters;

**payload** - message/data transmitted as part of a cross-chain transaction;

***dst*** - destination network ID;

***xID*** - a unique cross-chain transaction ID generated when the cross-chain transaction is initialized  in the `_initAsterizmTransferEvent()` method;

***p*** - additional parameters of the transaction: address of the source contract, destination contract, timestamp, and other data.

{% hint style="info" %}
Complete information can be found in Section 2 of the [White paper](https://asterizm.io/files/wp.pdf)
{% endhint %}

### Step 1

The client implements a smart contract using an [abstract class from Asterizm](/infrastructure/asterizm-connector/client-smart-contract-abstraction) and deploys it to the required networks. \
The <mark style="color:orange;">`_initAsterizmTransferEvent()`</mark> method is used to initiate a cross-chain transaction on the contract. The data and parameters of the cross-chain transaction are transmitted to it.&#x20;

The transaction can contain arbitrary information and one or more actions (instructions) to be performed on the destination networks.

### Step 2

The [client smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) sends the received data and hash based on the payload generated at that moment **xID**, source chain id, destination chain id, client smart contract address in the source and destination chains.

{% hint style="info" %}
At this step, the key parameters are formed, which will further ensure the security of the cross-chain transaction, namely to confirm its validity and integrity in the destination chain.
{% endhint %}

### Step 3

The [Client off-chain module](/infrastructure/client-off-chain-module) receives the cross-chain transaction payload and initiates the cross-chain transaction by calling `initAsterizmTransfer()` on the client's smart contract in the source network.

### Step 4

Before sending transaction proofs (**hash** and **xID**) to the [Initializer contract](/infrastructure/asterizm-connector/initializer-smart-contract), the [Сlient s smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) performs a validity and integrity check of the transaction by comparing the hash, calculated based on the payload. \
This effectively mitigates the risk of spam and counterfeit transactions in case of compromise of the [Client server](/infrastructure/client-off-chain-module).

{% hint style="success" %}
This step verifies that this exact transaction was initiated on the [client's smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction), which eliminates the possibility of spam from the [client's off-chain module](/infrastructure/client-off-chain-module).
{% endhint %}

### Step 5

The [Initializer smart contract](/infrastructure/asterizm-connector/initializer-smart-contract) checks the transaction nonce to preserve the cross-chain transaction execution sequence and transmits the transaction proofs (**hash** and **xID**) with the unique parameters to the [Translator smart contract](/infrastructure/asterizm-connector/translator-smart-contract).

{% hint style="info" %}
When a data packet is received on the [Initializer smart contract](/infrastructure/asterizm-connector/initializer-smart-contract), the client is identified based on the destination  chain id, the Client smart contract address in the destination chain, and the client smart contract address in the source chain.

After the client (sender) of the cross-chain transaction is determined, the nonce value is incremented for it.
{% endhint %}

### Step 6

[Asterizm Relayer servers](/infrastructure/asterizm-relayer) pull the proofs with the parameters from the [Translator contract](/infrastructure/asterizm-connector/translator-smart-contract) and send them to the [Translator smart contract](/infrastructure/asterizm-connector/translator-smart-contract) in the destination network for further processing.

### Step 7

The [Translator smart contract](/infrastructure/asterizm-connector/translator-smart-contract) on the destination network accepts the encrypted data with the parameters from the [Relayers](/infrastructure/asterizm-relayer) and passes it to the [Initializer smart contract](/infrastructure/asterizm-connector/initializer-smart-contract) for validation.

### Step 8

After receiving the proofs and the parameters, the [Initializer smart contract](/infrastructure/asterizm-connector/initializer-smart-contract) checks the nonce to comply with the transaction sequence, stores the transaction **xID** to validate the transaction at step 10, and transmits the proofs to the [Client’s smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction).

### Step 9

The [Client's smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) in the destination network receives the proofs with the parameters and emits an event to notify the delivery of proofs, which is awaited by the [Client's off-chain module](/infrastructure/client-off-chain-module).

{% hint style="success" %}
At this stage, the first but not the main step of transaction validity check occurs - the hash from the payload and the transaction's xID are compared, mitigating the risk of [relay server](/infrastructure/asterizm-relayer) compromise.
{% endhint %}

### Step 10

After the first step of cross-chain transaction validation, the [client’s server](/infrastructure/client-off-chain-module) initiates the transaction on the [Client’s smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) by calling the <mark style="color:orange;">`asterizmClReceive()`</mark> method in the destination network, sending the **payload** (data) and **xID** to the contract, and validating the transaction on the [Initializer smart contract](/infrastructure/asterizm-connector/initializer-smart-contract) by calculating the hash from received **payload** and checking the **xID**.

{% hint style="success" %}
At this step, the integrity of the data and the trusted addresses is checked before the transaction is executed. This check eliminates the risk of hacking the [client’s server](/infrastructure/client-off-chain-module).
{% endhint %}

{% hint style="info" %}
The verification is performed by calculating and matching the hash from the payload with the hash received from [Relayers](/infrastructure/asterizm-relayer) and the xID that was previously stored on the [Initializer contract](/infrastructure/asterizm-connector/initializer-smart-contract). If the verification succeeds, it means that the [client’s contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) executes exactly the transaction it sent, and does so for the first time. This algorithm eliminates the possibility of spamming transactions and spoofing data on the [client’s server](/infrastructure/client-off-chain-module) (if, for example, the server is compromised).
{% endhint %}

### Step 11

After receiving the confirmation of the validity and integrity of the cross-chain transaction, the [client’s smart contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) executes the **payload** or data sent in the cross-chain transaction, calling methods of other contracts or performing calculations on the client’s contract. \
The logic of this step depends solely on the client’s business logic implemented in the cross-chain transaction.


# Getting started

Implement Asterizm in 3 easy steps

Building your cross-chain app with Asterizm is as simple as it gets - just run the [Client off-chain module](/infrastructure/client-off-chain-module) and implement the <mark style="color:orange;">`_initAsterizmTransferEvent()`</mark> and <mark style="color:orange;">`_asterizmReceive()`</mark> interfaces to run cross-chain operations across EVM and non-EVM chains.

To get started, please check the [first step](/guides/getting-started/1.-deploy-your-smart-contracts) and [the second step](/guides/getting-started/2.-implement-off-chain-module).

{% hint style="info" %}
We recommend you to[ explore the cross-chain transaction flow](/guides/transaction-flow) before integrating Asterizm
{% endhint %}

You can run your first cross-chain dApp with a simple code example [here](/guides/code-examples).

## FAQ

Discover the [frequently asked questions](/what-is-asterizm/frequently-asked-questions).

## Talk to the Team

[Twitter](https://twitter.com/Asterizm_layer)

[Telegram](https://twitter.com/Asterizm_layer)

## Official Website

[https://asterizm.io](https://asterizm.io/)


# 1. Deploy your smart contracts

Logic of Deployment and Configuration of Client Contracts

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemo.sol#L28>" %}
EVM demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/demo/AsterizmDemo.tsol#L21>" %}
TVM demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/contracts/demo/AsterizmDemo.tsol>" %}
TON demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-sol/tree/master/programs/asterizm-value-example>" %}
Solana demo program
{% endembed %}

This section describes the logic of deployment and configuration, as well as the intricacies of client contracts within the protocol.

[AsterizmDemo contract](/guides/getting-started/1.-deploy-your-smart-contracts/asterizmdemo-contract) section describes the process of deploying and configuring demo contracts within the protocol. These contracts are designed to demonstrate the protocol's functionality and test its logic.

[Client contracts implementation logic](/guides/getting-started/1.-deploy-your-smart-contracts/client-contracts-implementation-logic) section outlines the process of deploying, configuring, and addressing nuances related to client contracts. This section serves as a guide for creating real client contracts that will operate on the [mainnet](/what-is-asterizm/supported-chains).


# AsterizmDemo contract

Deployment and Configuration of the Basic Protocol Demo Contract

To demonstrate the functionality of our protocol, our team has developed a demo contract that facilitates the transmission of text data between networks. You can find the contract code in our repositories (both the basic and upgradeable versions for EVM and the basic version for TVM networks):

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemo.sol>" %}
EVM base demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemoUpgradeableV1.sol>" %}
EVM upgradeable demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/demo/AsterizmDemo.tsol>" %}
TVM demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/contracts/demo/AsterizmDemo.tsol>" %}
TON demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-sol/tree/master/programs/asterizm-value-example>" %}
Solana demo program
{% endembed %}

To complete the full configuration, you need to perform the following steps:

1. Deploy the contracts to the required networks and obtain their addresses. This can be done on both [Testnet](/technical-reference/testnet), and [Mainnet](/technical-reference/mainnet)
2. Add the obtained addresses to the list of trusted addresses on each network.
3. Send a message containing text from one network to another.

## Contract deployment

Here are console commands for simplified deployment

#### EVM

{% code overflow="wrap" %}

```bash
npx hardhat demo:deploy {initializerAddress} {relayAddress?} {feeTokenAddress?} --network {networkName}
```

{% endcode %}

The command accepts the following parameters:

* **initializerAddress** - mandatory parameter: the address of the initializer on the network. You can review the list of available addresses on the respective pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **relayAddress** - optional parameter: the address of an external relay. You will be able to review the list of available external relays on the [respective page](/guides/external-relays/list-of-external-relays)
* feeTokenAddress - optional parameter: token address for  transfer commission payment
* **networkName** - mandatory parameter: the name of the network to which the contract is deployed. You can explore the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/hardhat.config.ts#L41).

Upon successful execution, the command will return a response similar to the following (the address of the demo contract will be displayed under the **AsterizmDemo address**):

```bash
Deployment was done.

Total gas limit: 2556349
Owner address: 0xf9E3b4AC4CEFF24464840c426E7e3506dC145c44
Initializer address: 0xFE1B8bc850E34F260A08d41dd034b0fb82EfE45a
AsterizmDemo address: 0x50c7297E385afCC365deD9069a346694107442F0
```

#### TVM

{% code overflow="wrap" %}

```bash
npx locklift run --script ./scripts/demo/demo_deploy_task.ts --initializer {initializerAddress} --externalRelay {relayAddress?} --network {networkName}
```

{% endcode %}

The command accepts the following parameters:

* **initializerAddress** - mandatory parameter: the address of the initializer on the network. You can review the list of available addresses on the respective pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **relayAddress** - optional parameter: the address of an external relay. You will be able to review the list of available external relays on the [respective page](/guides/external-relays/list-of-external-relays)
* **networkName** - mandatory parameter: the name of the network to which the contract is deployed. You can explore the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/locklift.config.ts#L41)

Upon successful execution, the command will return a response similar to the following (the address of the demo contract will be displayed under the **AsterizmDemo address**):

```bash
Deployment was done.

Owner address: 0:68a73acf79fed327d33a1e60503060021cbc2d9e1e8500d073d448d9a74f978f
Initializer address: 0:c100d8e7100822e6e5b9169c1423686bb99eb011eb37798232b3a2cedf4ecf08
AsterizmDemo address: 0:d70fd67d3de5f447b35d79a9c51b9d721c45c9eabdf9cafdd894fa17425bea9f
```

#### TON

***Coming soon***&#x20;

#### Solana

Build programs:

```bash
anchor build
```

Deploy demo program:

```bash
solana program deploy ./target/deploy/asterizm_value_example.so
```

Initialization client config logic (If successful, the command will not output anything. In case of an error, a log will be displayed):

```bash
npx ts-node scripts/settings/6-initialize-client-settings.ts
    Local chain ID: {localChainId}
    Solana Endpoint: {solanaEndpoint}
```

The command accepts the following parameters:

* **localChainId** - mandatory parameter: local chain ID. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **solanaEndpoint** - solana rpc url

Client account creation (If successful, the command will not output anything. In case of an error, a log will be displayed):

```bash
npx ts-node scripts/settings/7-create-client-account.ts
    Solana Endpoint: {solanaEndpoint}
```

The command accepts the following parameters:

* **solanaEndpoint** - solana rpc url

Client sender creation (If successful, the command will not output anything. In case of an error, a log will be displayed), the address created after executing this command will need to be added to the trusted addresses in other networks:

```bash
npx ts-node scripts/settings/9-create-client-sender.ts
    Solana Endpoint: {solanaEndpoint}
```

The command accepts the following parameters:

* **solanaEndpoint** - solana rpc url

Client demo program sender creation (If successful, the command will not output anything. In case of an error, a log will be displayed):

```bash
npx ts-node scripts/settings/10-value-init-create-client.ts
    Solana Endpoint: {solanaEndpoint}
```

The command accepts the following parameters:

* **solanaEndpoint** - solana rpc url

## Adding Trusted Addresses

To simplify the process of adding trusted addresses, console commands have been developed.

{% hint style="info" %}
IMPORTANT!

In each network, it is essential to add the trusted address of those networks to which transfers will be sent. That is if you plan to send such transfers:

* Ethereum -> Polygon
* Ethereum -> BSC
* Polygon -> Ethereum
* BSC -> Ethereum

then you should add a total of 4 trusted addresses as follows:

* In the Ethereum network, add 2 trusted addresses (Polygon and BSC)
* In the Polygon network, add 1 trusted address (Ethereum)
* In the BSC network, add 1 trusted address (Ethereum)&#x20;
  {% endhint %}

#### EVM

{% code overflow="wrap" fullWidth="false" %}

```bash
npx hardhat deploy:addTrustedAddress {trustedChainId} {trustedAddress} {contractAddress} demo --network {networkName}
```

{% endcode %}

The command accepts the following parameters:

* **trustedChainId** - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **trustedAddress** - mandatory parameter: the address of the trusted demo contract. You will be able to review the list of available external relays later on a dedicated page. Please note that this parameter accepts a **uint** value, not **address**. Therefore, you will need to convert the hexadecimal address to decimal
* **contractAddress** - mandatory parameter: the address of the demo contract in the current network
* **networkName** - mandatory parameter: the name of the source network. You can check the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/hardhat.config.ts#L41).

Upon successful execution, the command will return a response similar to the following:

```bash
Added trusted address successfully

Total gas limit: 116817
Target contract address: 0x50c7297E385afCC365deD9069a346694107442F0
Transaction hash: 0x8f131674d51e12a213908a81e969feef4010cbfa2dbcbd1b19310b9c6301880f
```

#### TVM

<pre class="language-bash" data-overflow="wrap"><code class="lang-bash"><strong>npx locklift run --script ./scripts/deploy_singletrustedaddress_task.ts --contractAddress {contractAddress} --trustedChainId {trustedChainId} --trustedAddress {trustedAddress} --network {networkName}
</strong></code></pre>

The command accepts the following parameters:

* **contractAddress** - mandatory parameter: the address of the demo contract in the current network
* **trustedChainId** - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **trustedAddress** - mandatory parameter: the address of the trusted demo contract. You will be able to review the list of available external relays later on a dedicated page. Please note that this parameter accepts a **uint** value, not **address**. Therefore, you will need to convert the hexadecimal address to decimal
* **networkName** - mandatory parameter: the name of the source network. You can check the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/locklift.config.ts#L41).

Upon successful execution, the command will return a response similar to the following:

```bash
Added trusted address successfully

Target contract address: 0:d70fd67d3de5f447b35d79a9c51b9d721c45c9eabdf9cafdd894fa17425bea9f
Transfer hash: e32ee9f05ff5093ec031b831ccd60019f7d1b265f8052843cd5670ad41feb855
```

#### TON

```bash
npx blueprint run
    testnet
    {select your key}
    Chain ID: {trustedChainId}
    Trusted address (uint): {trustedAddress}
```

The command accepts the following parameters:

* **trustedChainId** - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **trustedAddress** - mandatory parameter: the address of the trusted demo contract. You will be able to review the list of available external relays later on a dedicated page. Please note that this parameter accepts a **uint** value, not **address**. Therefore, you will need to convert the hexadecimal address to decimal

Upon successful execution, the command will return a response similar to the following:

```bash
Done!
```

#### Solana

```bash
npx ts-node scripts/settings/8-add-trusted-address.ts
    Trusted chain ID: {trustedChainId}
    Trusted address: {trustedAddress}
    Need to remove old trusted address in chain (0 - not removing, 1 - removing): {needToRemoveFlag}
    Solana Endpoint: {solanaEndpoint}
```

The command accepts the following parameters:

* **trustedChainId** - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **trustedAddress** - mandatory parameter: the address of the trusted demo contract. You will be able to review the list of available external relays later on a dedicated page. Please note that this parameter accepts a **uint** value, not **address**. Therefore, you will need to convert the hexadecimal address to decimal
* **needToRemoveFlag** - flag indicating whether to delete the old trusted address of the specified network
* **solanaEndpoint** - solana rpc url

If successful, the command will not output anything. In case of an error, a log will be displayed.

## Sending cross-chain messages

To simplify the process of sending messages to the demo contract, console commands have also been developed.

#### EVM

{% code overflow="wrap" %}

```bash
npx hardhat demo:sendmessage {contractAddress} {destinationChainId} {message} --network {networkName}
```

{% endcode %}

The command accepts the following parameters:

* **contractAddress** - mandatory parameter: the address of the demo contract in the source network
* **destinationChainId** - mandatory parameter: the ID of the destination network. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **message** - mandatory parameter: the text that will be transmitted from the source network to the destination network
* **networkName** - mandatory parameter: the name of the source network. You can check the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/locklift.config.ts#L41)

Upon successful execution, the command will return a response similar to the following:

```bash
Message sent successfully

Total gas limit: 90759
AsterizmDemo address: 0x50c7297E385afCC365deD9069a346694107442F0
Transaction hash: 0x0f9a07ddaa9915905d5f764d3b68f432e48f39056faa017e6b87c8514b2bfcb5
```

#### TVM

{% code overflow="wrap" %}

```bash
npx locklift run --script ./scripts/demo/demo_sendmessage_tast.ts --contractAddress {contractAddress} --destinationChainId {destinationChainId} --message {message} --network {networkName}
```

{% endcode %}

The command accepts the following parameters:

* **contractAddress** - mandatory parameter: the address of the demo contract in the source network
* **trustedChainId** - mandatory parameter: the ID of the destination network. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **message** - mandatory parameter: the text that will be transmitted from the source network to the destination network
* **networkName** - mandatory parameter: the name of the source network. You can check the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/locklift.config.ts#L41)

Upon successful execution, the command will return a response similar to the following:

```bash
Message sent successfully

Target contract address: 0:d70fd67d3de5f447b35d79a9c51b9d721c45c9eabdf9cafdd894fa17425bea9f
Transfer hash: ba52f4de4b423692e67a361a271f1edd7384f60aaf5e06404a27f7df0257bfdc
```

#### TON

***Coming soon***

#### Solana

```bash
npx ts-node scripts/demo-value/1-value-init-send.ts 
    DST chain id: {dstChainId}
    Amount: {amount}
    SRC address: {srcAddress}
    DST address: {dstAddress}
    Solana Endpoint: {solanaEndpoint}
```

The command accepts the following parameters:

* **dstChainId** - mandatory parameter: destination chain ID. You can review the list of available networks on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **amount** - mandatory parameter: the value that will be sent to the destination network
* **srcAddress** - mandatory parameter: client sender address in source chain
* **dstAddress** - mandatory parameter: cilent contract address in destination chain
* **solanaEndpoint** - solana RPC URL

If successful, the command will not output anything. In case of an error, a log will be displayed.


# Client contracts implementation logic

Send and receive arbitrary messages between EVM and non-EVM chains

To implement a smart contract, you need to extend it from the [abstract class](/infrastructure/asterizm-connector/client-smart-contract-abstraction) made by the Asterizm team.

{% hint style="warning" %}
IMPORTANT! The logic of Solana network integration differs significantly from the logic of integrating other networks, so you can read more in the [Solana integration section](/guides/getting-started/1.-deploy-your-smart-contracts/solana-integration-logic) about this chain.
{% endhint %}

{% hint style="info" %}
Examples of client contract implementation can be found in the official repository - <https://github.com/Asterizm-Protocol/asterizm-contracts-evm/tree/master/contracts/demo>
{% endhint %}

{% hint style="info" %}
**Important!** To support different types of networks we decided to convert all address variables to the uint format. It is necessary to take this into account when integrating the protocol.&#x20;

To simplify the process, we have implemented the following libraries:

* <https://github.com/Asterizm-Protocol/asterizm-contracts-evm/tree/master/contracts/libs> - for **EVM**
* <https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/tree/master/contracts/libs> - for **TVM**
* <https://github.com/Asterizm-Protocol/asterizm-contracts-ton/tree/master/contracts/libs> - for **TON**
  {% endhint %}

The developer of the client contract must follow several steps:

## Add a library

&#x20;You need to add *AsterizmProtocol* library to your *package.json:* `“asterizmprotocol”: “^1.0.1"` and update packages - <mark style="color:orange;">`npm i`</mark>

### Import abstract contract

You need to import an [Asterizm abstract client contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction) into your contract: \
For **EVM**: <mark style="color:orange;">`import "asterizmprotocol/contracts/evm/AsterizmClient.sol"`</mark> (you can also use <mark style="color:orange;">`import "asterizmprotocol/contracts/evm/AsterizmClientUpgradeable.sol"`</mark> for upgradeable client contracts, [example](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemoUpgradeableV1.sol))\
For **TVM** and **TON**: <mark style="color:orange;">`import "asterizmprotocol/contracts/tvm/AsterizmClient.tsol"`</mark>

## Call the class constructor

Call constructor of base client contract setting of necessary parameters: \
For **EVM**: <mark style="color:orange;">`AsterizmClient(IInitializerSender _initializerLib, bool _useForceOrder, bool _disableHashValidation)`</mark>\
For **TVM** and **TON**:  In this network, the constructor does not take any parameters as input, instead static parameters are used  ***initializerLib\_***, ***useForceOrder\_***, ***disableHashValidation\_***\
\
***initializerLib*** - initializer contract address (see the [list of supported networks](/what-is-asterizm/supported-chains)),\
***useForceOrder*** - flag of strict message order (see [Best practices](/advanced/best-practices)), \
***disableHashValidation*** - disable transfer hash validation flag (see [Best practices](/advanced/best-practices))

## Adding trusted addresses

A list of trusted addresses must be populated for the system. This list contains trusted contract addresses for each supported network. This is done by one of two methods:

<mark style="color:orange;">`addTrustedAddress(uint64 _chainId, uint _trusterAddress)`</mark>

<mark style="color:orange;">`addTrustedAddresses(uint64[] _chainId, uint[] _trusterAddress)`</mark>

## Sending messages

To initialize the transfer event you need to call the transfer initialization method:

For **EVM**: <mark style="color:orange;">`_initAsterizmTransferEvent(uint64 _dstChainId, bytes _payload)`</mark>

For **TVM** and **TON**: <mark style="color:orange;">`_initAsterizmTransferEvent(uint64 _dstChainId, TvmCell _payload)`</mark>

***\_dstChainId*** - destination network ID (see the [list of supported networks](/what-is-asterizm/supported-chains)),\
***\_payload*** - instructions encoded in bytes, for example with `abi.encode()` method&#x20;

**Please note:** it is not necessary to specify a contract address in the destination network - it is taken from the list of trusted addresses (read [Adding trusted addresses](#adding-trusted-addresses)).&#x20;

Examples of transfer initialization:

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemo.sol#L28>" %}
EVM contracts
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/demo/AsterizmDemo.tsol#L21>" %}
TVM contracts
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/contracts/demo/AsterizmDemo.tsol#L21>" %}
TON contracts
{% endembed %}

## Receive and execute messages

You need to implement <mark style="color:orange;">`_asterizmReceive()`</mark> method to receive and execute data in the destination network. \
This method accepts one `_dto` parameter type  `ClAsterizmReceiveRequestDto`, which contains all transfer data.&#x20;

To retrieve the transferred instructions, the `_dto.payload` parameter must be decoded into the originally transferred data type, for example using the <mark style="color:orange;">`abi.decode()`</mark>method.

{% hint style="warning" %}
IMPORTANT!&#x20;

For EVM networks only.&#x20;

You need to implement the <mark style="color:orange;">`_buildPackedPayload()`</mark>method. \
This method is necessary for the internal protocol logic to convert your payload from <mark style="color:orange;">`abi.encode()`</mark> format into <mark style="color:orange;">`abi.encodePacked()`</mark>. \
This conversion is necessary to implement cross-chain hashing.
{% endhint %}

## Cross-chain data hashing logic

Asterizm protocol has a universal cross-chain data hashing logic. It is required to check the validity and integrity of the data transferred within a cross-chain transaction.

The protocol currently supports the following network types: [EVM](https://help.coinbase.com/en/coinbase/getting-started/crypto-education/glossary/ethereum-virtual-machine) and [TVM](https://docs.everscale.network/arch/tvm/).\
Asterizm independently selects the hashing method depending on what types the source and destination networks are at the abstraction level of the client smart contract.

#### EVM

[Check out](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/libs/AsterizmHashLib.sol) an example of hashing implementation for EVM networks.

As mentioned above, in EVM networks you need to implement the method <mark style="color:orange;">`_buildPackedPayload()`</mark> - [example](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemo.sol#L41).

#### TVM and TON

In TVM networks there are several versions of the hashing implementation, so you have to choose the version based on your requirements:

* <mark style="color:orange;">`buildCrosschainHashV1()`</mark>- this version of hashing implementation is relatively cheap, but it has a nuance - if your payload involves sending such data types as bytes or string, you should add these data to the very end of the list when packing (<mark style="color:orange;">`abi.encode()`</mark>) otherwise hash validation errors may occur in the destination network. Use this method if you do not need to send a large number of bytes or string parameters, or to save on gas.
* <mark style="color:orange;">`buildCrosschainHashV2()`</mark>- this version of hashing has a much higher gas price but avoids the problem of the first version related to the position of bytes and string data in your payload. Use this version if you need to send bytes or string data types.

Check [this](https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/libs/AsterizmHashLib.tsol) (TVM) and [this](https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/contracts/libs/AsterizmHashLib.tsol) (TON) an example of hashing implementation for TVM and TON networks.

{% hint style="warning" %}
IMPORTANT!&#x20;

In case you perform cross-chain transfer between different types of networks (EVM->TVM/TON, TVM/TON->EVM) it is strongly recommended not to use **`bool`** type in payload parameters. Otherwise, validation of transfer integrity in the destination network will fail.
{% endhint %}

{% hint style="success" %}
Congratulations! The contracts for messaging in the required networks are ready and can be deployed to the [networks supported by Asterizm](/what-is-asterizm/supported-chains)
{% endhint %}

## Estimating message fees

To understand the payment process and the calculation of cross-chain transaction fees, please see the [Fees management section](/guides/fee-management)

## Upgradeable client contracts

The protocol allows for the creation of upgradable client contracts on EVM networks, enabling the separation of system logic and data at the contract level.

To implement an upgradable client contract, you should inherit from<mark style="color:orange;">`"asterizmprotocol/contracts/evm/AsterizmClientUpgradeable.sol"`</mark> [contract abstraction](/infrastructure/asterizm-connector/client-smart-contract-abstraction), and instead of using a contract constructor you should utilize a special initialization function as follows: <mark style="color:orange;">`function initialize(IInitializerSender _initializerLib) initializer public { __AsterizmClientUpgradeable_init(_initializerLib, true, true); }`</mark>

Here is an example of how to implement an upgradable contract:

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemoUpgradeableV1.sol>" %}

## You are almost there!

Get ready to make your transactions confidential using the [Client off-chain module](/infrastructure/client-off-chain-module) -  you will learn how to set it up in the [next section](/guides/getting-started/2.-implement-off-chain-module).


# Solana integration logic

Description of Solana network integration logic

The Solana network has several architectural nuances:

1. There is a limit on contract call depth (a maximum of 4 contracts in a sequential chain).
2. When initiating a transaction, it is necessary to provide a list of all contracts being called in the chain.
3. A rather strict transaction size limit

Due to these architectural nuances, as well as to simplify client integration, the Asterism team had to change their approach to implementing the internal structure of the protocol.

{% hint style="warning" %}
IMPORTANT! Due to the internal architecture of the Solana network and its operational logic, full integration requires modification of the basic client off-chain Asterism module. Contact us for more detailed information.
{% endhint %}

### Basic protocol structure

Unlike the EVM implementation, the Solana network integration includes an additional program - the internal client program of the protocol. This program implements the logic for hashing transfer data, as well as additional internal logic. The client program must send data to this program to initiate the transfer.

The client off-chain module listens not to the client program but specifically to the internal Asterism client program, reacting only to events related to the specific client's logic.

### Integration nuances

There are several aspects that distinguish Solana network integration from the integration of other types of networks:

1. In the Solana network, the trusted address is not the client program itself, but the PDA of the client sender (see more details [here](/guides/getting-started/1.-deploy-your-smart-contracts/asterizmdemo-contract))
2. Due to transaction size limits, it is not possible to send a large amount of data to a program's function at once (e.g. setting up an NFT with a link to an image). It requires splitting the data across multiple transactions
3. It is impossible to bypass the off-chain relay module logic when conducting a transfer within a single network due to the limitation on the depth of the call chain. Keep in mind that such transfers will, in any case, go through the off-chain relay module
4. After deployment, more on-chain configurations are required before sending transfers (see more details [here](/guides/getting-started/1.-deploy-your-smart-contracts/asterizmdemo-contract))
5. The configuration of the client off-chain module differs from the configuration of other types of networks (see more details [here](/guides/getting-started/2.-implement-off-chain-module/default-implementation-manual)). It is necessary to include all the addresses that will participate in the chain (these addresses can be found in the [Testnet](/technical-reference/testnet) and [Mainnet](/technical-reference/mainnet) sections).
6. Keep in mind that implementing custom logic will not be possible without the involvement of the Asterism Protocol team due to the specific characteristics of sending transactions in this network


# 2. Implement off-chain module

Set up the environment

There are 2 ways to deploy a [client off-chain module](/infrastructure/client-off-chain-module):

{% content-ref url="/pages/QFS9VmpdqhQhIcAw5elh" %}
[Simple implementation (shell script)](/guides/getting-started/2.-implement-off-chain-module/simple-implementation-shell-script)
{% endcontent-ref %}

{% content-ref url="/pages/NYcywYUeorddd3bluFLX" %}
[Default implementation (manual)](/guides/getting-started/2.-implement-off-chain-module/default-implementation-manual)
{% endcontent-ref %}


# Simple implementation (shell script)

To simplify the integration of the [client off-chain module](/infrastructure/client-off-chain-module), we developed a [shell script](https://github.com/Asterizm-Protocol/client-module-deploy).&#x20;

The integration process consists of two steps:

1. Setup of the configuration file of the client off-chain module
2. Loading and running the integration shell script

{% hint style="warning" %}
**IMPORTANT:** The script allows to deploy the module only on **Linux**-based servers with <mark style="color:orange;">`apt`</mark> package manager installed (e.g. **Ubuntu**, **Debian**). If you want to deploy the module on other systems (e.g. Windows), you need to manually configure it (see [Default implementation](/guides/getting-started/2.-implement-off-chain-module/default-implementation-manual)).
{% endhint %}

## Configuration file setup

Here is an example of a configuration file:

{% code title="config.yml" %}

```yaml
# Environment Settings Block
Environment:
  # Log level setting; if not provided, the builder will generate it automatically
  # ERROR - Critical error; if found - contact the developers. Script terminates on such errors 
  # WARN - Critical error, but not bad enough to terminate the script; developers should be notified
  # INFO - Informational logs with main details, such as transmission hashes, scanned block numbers, program execution results
  # DEBUG - Debug logs with additional execution details; useful when ERROR or WARN occurs to provide extra information to developers
  # The user sets the LogLevel, below which logs won't be displayed. For instance, if LogLevel is set to WARN, logs of level ERROR and WARN will be displayed.
  # Log level hierarchy: ERROR <- WARN <- INFO <- DEBUG. Recommended setting is INFO, displaying ERROR, WARN, and INFO logs.
  # Optional parameter, default is INFO
  LogLevel: INFO
# Utilities Configuration Block
Utils:
  # Encryption block is mandatory, but the builder will generate it if absent
  Encryption:
    # Whether to encrypt the transmitted information from InitiateTransferEvent on the server side.
    # Recommended to encrypt
    # Optional parameter, default is false
    EncryptPayload: true
    # Encryption key; can be generated on your side or the builder will generate it
    # Mandatory parameter
    Key: key
    # Encryption salt; can be generated on the Client's side or the builder will generate it
    # Mandatory parameter
    Salt: salt
    # Encryption method; available methods: AES-{128/192/256}-{CBC/OFB/CFB/CTR}
    # Recommended method: AES-256-CBC
    # Mandatory parameter
    CipherMethod: "AES-256-CBC"
  # Database configuration block is mandatory, but the builder will generate it if absent
  # PostgreSQL supported
  Db:
    # Database host; mandatory field
    # Note: If 'asterizm-db' is specified, the builder will run it within Docker
    Host: asterizm-db
    # Database port; mandatory field
    Port: 5432
    # Database name; mandatory field
    Name: db
    # Database user; mandatory field
    User: user
    # Database password; mandatory field, the builder will generate it if absent
    Password: password
  # Relay configuration block, mandatory; builder will fail if absent
  AsterizmTranslator:
    # Relay host
    Host: https://tr.asterizm.io
    # Relay API key
    ApiKey: "13b7AYfdKsYqQiQa7Bv9twgeQzLhZAayTXK8MbqQ1d9Kcw49"
# Node Configuration Block
Nodes:
  # Optional field. If true, events will be sent sorted by the Nonce field; default is false
  # If absent, the builder will set a default value
  ForceOrder: false
  # Structure of transmitted ABI information; the structure must match the transmitted information in exact order
  # Field is mandatory only if you're transmitting information between networks with different virtual machines
  # For example, if transmitting from ETH to BSC, the field is optional. But if from ETH to EVER, the field is mandatory.
  # If, for instance, you're transmitting timestamp and name info with abi.encode(1682079822, "John"), specify ["uint16", "string"] in PayloadStruct
  # Supported data types: bool, string, bytes, int{size} (int8, int16, etc), uint{size} (uint8, uint16, etc)
  # Size of int and uint must be 8 to 256 and divisible by 8 without remainder
  # If absent, the builder will leave the array empty
  PayloadStruct: ["uint256", "uint256", "uint256", "uint256", "uint8"]
  List:
    # List of networks where the scanner will run
    # Builder will fail if the list is empty
    # Supported EVM networks: ETH, POL, OPT, AUR, FTM, CEL, AVA, ARB, BOB, BSC, XVM, PZK, BTG
    # Supported TVM networks: EVER, VNM
    ETH:
      # RPC URL, mandatory; builder will fail if absent
      RPC: https://rpc-url
      # Chain Id, mandatory; builder will fail if absent
      ChainId: chainId
      # Deployed client contract address, mandatory; builder will fail if absent
      ContractAddress: contractAddress
      # Address for transmitting information to the blockchain, mandatory; builder will fail if absent
      # Note: The address must be encrypted using the 'utils/encrypt' command (encryption keys and method from Utils.Encryption)
      # Builder will automatically encrypt the address if it's not encrypted
      OwnerAddress: ownerAddress
      # Private key for transmitting information to the blockchain, mandatory; builder will fail if absent
      # Note: The private key must be encrypted using the 'utils/encrypt' command (encryption keys and method from Utils.Encryption)
      # Builder will automatically encrypt the private key if it's not encrypted
      OwnerPrivateKey: ownerPrivateKey
      # Applicable only to TVM networks
      # Public key for transmitting information to the blockchain, mandatory; builder will fail if absent
      # Note: The public key must be encrypted using the 'utils/encrypt' command (encryption keys and method from Utils.Encryption)
      # Builder will automatically encrypt the public key if it's not encrypted
      OwnerPublicKey: ownerPublicKey
      # This field specifies how many times to attempt resending the event transaction to the translator
      # For instance, if the program receives an event with information and sends it to the translator, but gas prices unexpectedly surge at the time of sending, causing the transaction to be stuck in the mempool.
      # If the transaction remains in the mempool for longer than the average transaction confirmation time (e.g., 5 minutes for Ethereum), the program will attempt to resend the transaction.
      # If the field is set to 5, the program will make 5 attempts; if it fails on the 5th attempt, no further retries will be made
      # Optional field, default is 3 attempts
      MaxResendTries: 3
      # This field indicates the percentage increase in the transaction fee.
      # For example, the program calculates a transaction fee for sending to the blockchain, but gas prices surge at the time of sending.
      # You can specify a percentage increase in the fee to account for the potential spike in gas prices
      # The final fee will be calculated using the formula: fee + (fee / 100 * FeeMultiplierPercent)
      # If FeeMultiplierPercent is set to 100, the fee will double; if set to 0, no fee increase will occur
      # Optional field, default is 0; recommended value is 20
      FeeMultiplierPercent: 100
    
```

{% endcode %}

Supported networks:&#x20;

{% content-ref url="/pages/u9j8Amat3UqP1fAxnJPp" %}
[Mainnet](/technical-reference/mainnet)
{% endcontent-ref %}

{% content-ref url="/pages/c8jaZ7xbrvkEYaYaMm0L" %}
[Testnet](/technical-reference/testnet)
{% endcontent-ref %}

### Running a shell script

First, you need to determine your system's architecture (32 or 64 bits). To determine whether your Linux installation is 32-bit or 64-bit, you can use the <mark style="color:orange;">`uname`</mark> command:

```bash
uname -m
```

If the output is `x86_64` or `amd64`, your system is 64-bit. If the output is `i686` or `i386`, your system is 32-bit. Based on that, download and execute the appropriate script:

{% tabs %}
{% tab title="64-bit" %}

```bash
wget https://github.com/Asterizm-Protocol/client-module-deploy/blob/master/bin/lunix_x64
```

After downloading, you need to run it with **sudo** privileges (required for installing Docker), passing the full path to the configuration file as a parameter:

<pre class="language-bash"><code class="lang-bash"><strong>sudo ./lunix_x64 -f /path/to/config.yml
</strong></code></pre>

In case of deploying a test environment ([testnet](/technical-reference/testnet)), you need to add an additional flag: `-test`

<pre class="language-bash"><code class="lang-bash"><strong>sudo ./lunix_x64 -f /path/to/config.yml -test
</strong></code></pre>

{% endtab %}

{% tab title="32-bit" %}

```bash
wget https://github.com/Asterizm-Protocol/client-module-deploy/blob/master/bin/lunix_x32
```

After downloading, you need to run it with **sudo** privileges (required for installing Docker), passing the full path to the configuration file as a parameter:

<pre class="language-bash"><code class="lang-bash"><strong>sudo ./lunix_x32 -f /path/to/config.yml
</strong></code></pre>

In case of deploying a test environment ([testnet](/technical-reference/testnet)), you need to add an additional flag: `-test`

<pre class="language-bash"><code class="lang-bash"><strong>sudo ./lunix_x32 -f /path/to/config.yml -test
</strong></code></pre>

{% endtab %}
{% endtabs %}

After the script executes successfully, your environment will be configured, and the [client's off-chain module](/infrastructure/client-off-chain-module) will be up and running.

If you're interested in the shell script implementation details, you can check it here:

{% @github-files/github-code-block url="<https://github.com/Asterizm-Protocol/client-module-deploy>" %}


# Default implementation (manual)

The [client off-chain module](/infrastructure/client-off-chain-module) is deployed via [Docker image](https://hub.docker.com/r/asterizm/client-server), implemented by the Asterizm team.&#x20;

To deploy the [client off-chain module](/infrastructure/client-off-chain-module), you must first install the [Docker](https://www.docker.com/), which installs together with [Docker Compose](https://docs.docker.com/compose/).

The official installation guide: <https://docs.docker.com/engine/install/>

The image is a node scanner written on GO. It is publicly available at <https://hub.docker.com/>.&#x20;

Download command (in the server console):

```bash
docker pull asterizm/client-server:latest
```

After installing the Docker, please follow these steps:

1. Create a <mark style="color:orange;">`docker-compose.yml`</mark> to automate the deployment of the server;
2. Set up the server environment;
3. Start containers, and place migrations into the database;
4. Add the private keys of contract owners via <mark style="color:orange;">`asterizm-console`</mark> or [Fireblocks](https://www.fireblocks.com/) integration.

## 1. Docker-compose.yml

This file is used to automate the deployment of the client's server using Docker Compose.&#x20;

For example, let's configure the service so that we can send transfers between Ethereum (EVM) and Everscale (TVM) networks.

1. Create a base directory on the server and navigate to it.\
   Let's call it <mark style="color:orange;">`/opt/asterizm`</mark> - in the terminal run <mark style="color:orange;">`mkdir /opt/asterizm && cd /opt/asterizm`</mark> (assign current user permissions to the directory with <mark style="color:orange;">`chown {username} /opt/asterizm`</mark> command)<br>
2. Next, you need to create directories for the system containers to work, run the following commands: \ <mark style="color:orange;">`mkdir -p docker-data/db`</mark>\ <mark style="color:orange;">`mkdir -p docker-data/config`</mark>\
   With these commands, the structure for the Docker containers to work will be created.<br>
3. Now let's create **`docker-compose.yml`** - <mark style="color:orange;">`touch /opt/asterizm/docker-compose.yml`</mark> :

{% code title="/opt/asterizm/docker-compose.yml" %}

```yaml
version: '3.9'
services:

  asterizm-db:
    container_name: asterizm-db
    image: postgres:15-alpine
    restart: always
    volumes:
      - ./docker-data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=database-user # set it to config file
      - POSTGRES_PASSWORD=database-password # set it to config file
    networks:
      - asterizm

  asterizm-console: &console-template
    container_name: asterizm-console
    privileged: true
    image: asterizm/client-server:latest
    working_dir: /app
    restart: always
    depends_on:
      - asterizm-db
    volumes:
      - ./docker-data/config/Project.yml:/app/config.yml:rw
    networks:
      - asterizm

  asterizm-cron:
    <<: *console-template
    container_name: asterizm-cron
    command: ["cron/process"]

  asterizm-eth:
    <<: *console-template
    container_name: asterizm-eth
    command: ["node/scan", "ETH"]

  asterizm-ever:
    <<: *console-template
    container_name: asterizm-ever
    command: ["node/scan", "EVER"]

  asterizm-ton:
    <<: *console-template
    container_name: asterizm-ton
    command: ["node/scan", "TON"]

  asterizm-sol:
    <<: *console-template
    container_name: asterizm-sol
    command: ["node/scan", "SOL"]

networks:
  asterizm:
    driver: bridge
```

{% endcode %}

In this file, you have to specify the database user name, as well as the database passwords.

After creating this file, you can proceed to the next step of configuring the [client off-chain module](/infrastructure/client-off-chain-module).

## 2. Setting up the server environment

For the most part, installing Docker is the main step in setting up the environment, but you should do a few more things to work comfortably with the [client's off-chain module](/infrastructure/client-off-chain-module).

Create a basic server configuration file: <mark style="color:orange;">`touch docker-data/config/Project.yml`</mark>:

{% code title="docker-data/config/Project.yml" %}

```yaml
Environment:
  LogLevel: INFO
Utils:
  Encryption:
    EncryptPayload: true # encryption activation flag (false - transfer data will not be encrypted)
    Key: "encryption-key" #transfer data encryption key
    Salt: "encryption-default-salt" # default data encryption salt
    CipherMethod: "AES-256-CBC" # encryption method
  Db:
    Host: asterizm-db # database host (name of database container docker)
    Port: 5432 # database port
    Name: client_server # database name
    User: "database-user" # database user name
    Password: "database-password" # database user password
  AsterizmTranslator:
    Host: https://tr.asterizm.io # Asterizm host translator
    ApiKey: "13b7AYfdKsYqQiQa7Bv9twgeQzLhZAayTXK8MbqQ1d9Kcw49" # Asterizm translator api key (just copipast it in your config)
Nodes:
  PayloadStruct: ["uint256", "uint256", "uint256", "uint256", "uint8"] # client contract payload types
  List:
    ETH: # Ethereum network (EVM)
      RPC: https://ethereum-rpc.com # RPC nodes
      ContractAddress: "client-contract-address-in-eth-network" # client contract address on Ethereum network
      MaxResendTries: 3 # The maximum number of transaction retry attempts (in case the transaction is stuck due to a sudden gas price spike, for example)
      FeeMultiplierPercent: 20 # The recommended fee multiplier to cover the transfer in the destination network. Recommended value is 20 (20%) 
    POL: # Polygon network (EVM)
      RPC: https://polygon-rpc.com # RPC nodes
      ContractAddress: "client-contract-address-in-pol-network" # client contract address on Polygon network
      MaxResendTries: 3 # The maximum number of transaction retry attempts (in case the transaction is stuck due to a sudden gas price spike, for example)
      FeeMultiplierPercent: 20 # The recommended fee multiplier to cover the transfer in the destination network. Recommended value is 20 (20%) 
    EVER: # Everscale network (TVM)
      RPC: https://everscale-rpc.com # node RPC
      ContractAddress: "client-contract-address-in-everscale-network" # client contract address on Everscale network
      MaxResendTries: 3 # The maximum number of transaction retry attempts (in case the transaction is stuck due to a sudden gas price spike, for example)
      FeeMultiplierPercent: 20 # The recommended fee multiplier to cover the transfer in the destination network. Recommended value is 20 (20%)
    VNM: # Venom network (TVM)
      RPC: https://venom-rpc.com # node RPC
      ContractAddress: "client-contract-address-in-venom-network" # client contract address on Venom network
      MaxResendTries: 3 # The maximum number of transaction retry attempts (in case the transaction is stuck due to a sudden gas price spike, for example)
      FeeMultiplierPercent: 20 # The recommended fee multiplier to cover the transfer in the destination network. Recommended value is 20 (20%)
    TON: # Ton network (TON)
      RPC: https://ton-rpc.com # node RPC
      ContractAddress: "client-contract-address-in-venom-network" # client contract address on Ton network
      MaxResendTries: 3 # The maximum number of transaction retry attempts (in case the transaction is stuck due to a sudden gas price spike, for example)
      FeeMultiplierPercent: 10 # The recommended fee multiplier to cover the transfer in the destination network. Recommended value is 20 (20%)
    SOL: # Solana network (SOL) IMPORTANT! this configuration is for cross-chain tokens only
      RPC: https://solana-rpc.com # node RPC
      TokenProgramId: "token-program-id" # base program address of the cross-chain token
      TokenName: "token-name" # cress-chain token name
      ClientProgramId: "client-program-id" # base client program address
      ClientUserAddress: "client-sender-address" # PDA address of the client sender
      InitializerProgramId: "initinalizer-program-id" # initializer program address
      RelayerProgramId: "relay-program-id" # relay program address
      SystemRelayOwnerAddress: "base-relay-owner-address" # base relay owner address
      RelayOwnerAddress: "external-owner-address" # external relay owner address (if available)
      MaxResendTries: 3 # The maximum number of transaction retry attempts (in case the transaction is stuck due to a sudden gas price spike, for example)
      FeeMultiplierPercent: 10 # The recommended fee multiplier to cover the transfer in the destination network. Recommended value is 20 (20%)
```

{% endcode %}

{% hint style="info" %}
**Important**: Please note that the configuration format for EVM and TVM networks is slightly different: in **TVM** networks the **OwnerPublicKey** parameter is added
{% endhint %}

Supported encryption methods (CipherMethod parameter): AES-{128, 192, 256}-{CBC, OFB, CFB, CTR}. **Recommended: AES-256-CBC**.

In order for the [off-chain module](/infrastructure/client-off-chain-module) to properly extract the payload received from the contract, it is necessary to specify what types of data are stored in it. For this purpose, the **PayloadStruct** parameter is used. You need to specify what types of parameters are stored in your contract. System-supported parameters: **bool, string, bytes, int (all sizes), uint (all sizes).**

You can configure the logging level of the [client off-chain module](/infrastructure/client-off-chain-module). This parameter affects the completeness of the information in the module's logs. Logs are written to stdout, so you can see them in docker container logs (**`docker logs -f {container-name}`**). There are 4 levels:

* **INFO** (logs minimal required information, standard actions),
* **WARN** (includes **INFO** logging level, adds a detailed log of some exceptions),
* **ERROR** (includes **WARN** logging level, adds full system error log),
* **DEBUG** (includes **ERROR** logging level, adds a log of most system actions, used for error detection and debugging, not recommended for product deployment).

Default logging level (if the configuration parameter is not set) is **INFO**.

## 3. Running Docker containers

To start the client's server containers, you need to execute a single command (note the path to the **`docker-compose.yml`** file): \ <mark style="color:orange;">`docker compose -f /opt/asterizm/docker-compose.yml up -d`</mark> \
After running this command, the Docker containers of the [client off-chain module](/infrastructure/client-off-chain-module) will be up and running.

The next step is to create a database and run migrations and fixtures.&#x20;

To do this, run the following commands:

1. <mark style="color:orange;">`docker exec asterizm-db psql -U database-user -c "CREATE DATABASE client_server"`</mark> - This command will create a database in the **asterizm-db** container (note the database user name, it was specified in **`docker-compose.yml`**);
2. <mark style="color:orange;">`docker exec asterizm-console /app/main migrations/up`</mark> - this command extracts migrations to the database;
3. <mark style="color:orange;">`docker exec asterizm-console /app/main db/seed`</mark> - this command extracts fixtures onto the database.  **Important**: you can add <mark style="color:orange;">`-test`</mark> flag for filling database with [testnet](/technical-reference/testnet) networks.

After executing these commands, the client off-chain module's database is ready to work.

It is necessary to restart the client's server containers. To do that, please use this command:  <mark style="color:orange;">`docker compose -f /opt/asterizm/docker-compose.yml restart`</mark>

## 4.a. Managing system owners

To enable operation, it is necessary to add data about[ contract owners](/guides/multi-owner-sender-system) to the system. This can be done using the following console command:

```bash
docker exec asterizm-console /app/main owners/add {netwotk-symbol} {owner-private-key} {?owner-public-key/?address-type}
```

This command adds a contract owner of a specific network. It accepts the following parameters:

* **network-symbol** - mandatory parameter, the network symbol (e.g., ETH, POL, etc.)
* **owner-private-key** - mandatory parameter, the private key of the owner
* **owner-public-key** - optional parameter, the public key of the owner (used in TVM systems only)
  * **address-type** - owner address type (used in TON systems only), available values: *v3r1*, *v3r2*, *highloadv3*, *v4r1*, *v4r2*, *v5r1*

To display a list of owners already added to the system, execute the following command:

```bash
docker exec asterizm-console /app/main owners/list {?network-symbol}
```

To display a list of owners already added to the system, you can execute the following command:

* **network-symbol** - optional parameter, the network symbol (e.g., ETH, POL, etc.)

Added owners cannot be deleted; they can only be deactivated. This is done with the following command:

```bash
docker exec asterizm-console /app/main owners/disable {owner-id}
```

This command deactivates a previously added owner. The command accepts the following parameters:

* **owner-id** - mandatory parameter, the ID of the owner, which can be obtained by executing the console method for listing owners

Deactivated owners can be reactivated. This is achieved by executing the following console command:

```bash
docker exec asterizm-console /app/main owners/enable {owner-id}
```

This command activates a previously deactivated owner. The command accepts the following parameters:

* **owner-id** - mandatory parameter, the ID of the owner, which can be obtained by executing the console method for listing owners.

## 4.b. Fireblocks integration

For the successful operation of the Asterizm Protocol system, it is essential to manage the private keys of contract owners. In certain cases, this may pose a security risk due to potential access by unauthorized parties, such as system developers.

To address this issue we integrated [Fireblocks](https://www.fireblocks.com/). Through this system, the owner of the client server can store private keys within it, configuring specific permissions for each key. This eliminates the need to store private keys of owners on the client server.

To integrate Fireblocks, registration in the system by obtaining an ApiKey and RSA file is required. These details must be added to the configuration file of the client server (<mark style="color:orange;">`Project.yml`</mark>), specifically in the network section:

```yaml
POL:
  RPC: https://polygon-mumbai.blockpi.network/v1/rpc/public
  ContractAddress: "contract-address"
  Fireblocks: # Fireblocks system configuration block
    ApiKey: "fireblocks-apikey" # Fireblocks system ApiKey
    SecretPath: "./fireblocks_secret.rsa" # Path to the Fireblocks system RSA file
    VaultAccountIds: ["1"] # List of Fireblocks vault account IDs in use
```

This configuration block needs to be added to the configuration of each network that will utilize owners stored in the Fireblocks system.

{% hint style="info" %}
**Important!** If the Asterizm Protocol detects the Fireblocks configuration file, along with owners added through the console command, the system will specifically use the Fireblocks owners.
{% endhint %}

After setting up the configuration file, it is necessary to restart the system containers (if they were previously running) with the following command: <mark style="color:orange;">`docker compose -f /opt/asterizm/docker-compose.yml restart`</mark>


# 3. Important! One final pre-flight check

Please check all the items on this list to make sure everything will operate safely, reliably, and effectively

## Validation of transfer hash

For cross-chain validation of the transfer, a hashing method is used. This logic allows to eliminate the network of validators, which significantly speeds up the execution of the transfer.

Between networks of the same type (EVM->EVM, TVM->TVM), a simplified hashing method is used to save gas, while between networks of different types, cross-chain hashing logic is applied. The exception to this rule is the EVM and Solana pair, where simplified hashing logic is also used.

## Flag \_notifyTransferSendingResult

Default value: `false`

This flag enables notifications about the status of transfer deliveries to the destination network by sending notifications from the relay to the source network. You can learn more about the notification logic in the [Source chain notifications](/guides/source-chain-notifications) section for further details.

{% hint style="warning" %}
IMPORTANT!&#x20;

In the event of disabling notifications, the client can save on network fees (the transfer will become slightly cheaper in terms of gas). However, the [client's off-chain module](/infrastructure/client-off-chain-module) will not receive data about the status of the transfer delivery in the destination network. This can impact certain internal logic, such as automatically resending a transfer in case of insufficient fees to cover gas in the destination network.

It's essential to understand this if you plan to disable these notifications.
{% endhint %}

## Flag \_disableHashValidation

Default value: **`false`**

This flag is used to disable automatic validation of the transfer hash before executing its instructions.&#x20;

{% hint style="danger" %}
It is strongly not recommended to set this flag to **`true`**, as it may result in the vulnerability of your cross-chain protocol!
{% endhint %}

However, if you do disable automatic validation, we recommend that you implement this check yourself by calling the <mark style="color:orange;">`_validTransferHash()`</mark> method before executing the transfer instructions.

## Address Whitelist

To make sure that the transfer was sent by a client contract in the source network, a "whitelist" of addresses has been implemented.&#x20;

This is a list of pairs `chainId => address` (network ID => address of the client contract in this network). \
The client fills this list.

If the client contract of the destination network receives a transfer from an invalid address of the source network (the pair is not in the list), the transfer instructions are not executed ([see error](/guides/error-messages/evm/destination-chain#baseasterizmclient-wrong-source-address)).

To add a trusted address to the client contract's owner, one of the following methods must be called:

1. <mark style="color:orange;">`addTrustedAddress(uint64 _chainId, uint _trustedAddress)`</mark> - accepts one trusted pair;
2. <mark style="color:orange;">`addTrustedAddresses(uint64[] calldata _chainIds, uint[] calldata _trustedAddresses)`</mark> - accepts a list of trusted pairs.

{% hint style="warning" %}
We strongly recommend our Clients to enter only trusted pairs into this whitelist otherwise it may lead to a vulnerability in the cross-chain logic.
{% endhint %}

{% hint style="info" %}
**Important:** In the new version of the contracts, this parameter has become mandatory, so it is necessary to fill in the list of trusted addresses for all supported networks.
{% endhint %}

{% hint style="info" %}
For information: Solana network logic uses a slightly different approach to whitelists. Instead of adding the address of the client program itself, the address of the client sender program is added to the whitelist. For more detailed information, see [the demo program setup example](/guides/getting-started/1.-deploy-your-smart-contracts/asterizmdemo-contract) in the Solana network.
{% endhint %}

## Additional configuration of the client's server

The client's server is a critical part of the system. Please make sure that you protect it as responsibly as possible. Here are some basic tips from the Asterizm team to improve its security:

1. Proper SSH configuration on the server:
   1. change the standard port 22 to some other port;
   2. prohibit authentication by the root user;
   3. prohibit authorization with a password (allow SSH keys only).<br>
2. Set up a firewall on the server and close all unnecessary ports;
3. Close the SSH port for everyone except your work network IP, or use VPN;
4. Limit the rights of users added to the server - it is not recommended to give out root rights unthinkingly;
5. Do not disclose the real IP of your server (client's server).

{% hint style="info" %}
Please remember that the security of the client's server is your responsibility!&#x20;

Do not neglect pre-configuring it properly.
{% endhint %}

## Validation of the transfer execution order

The system supports on-chain validation of transfer execution order. In case the previous transfer was not executed in the destination network, all subsequent transfers will not be executed either. This logic is necessary for systems that require strict transfer execution order.

You can activate this validation on a client contract by setting the **useForceOrder** flag to **`true`** when deploying (see the [Deploying Contracts manual](/guides/getting-started/1.-deploy-your-smart-contracts))

{% hint style="info" %}
**Important!** Remember that in case of any kind of transfer execution errors in the destination network, the execution order validator state will not change, as a result of which all subsequent transfers will also be rejected.&#x20;

Use this validation with caution and only if you are absolutely confident in the code of your contract!
{% endhint %}

## Setting the Fee Coverage for the Transfer in the Destination Network

To send a transfer from the relay to the client contract in the destination network, a certain amount of gas in the destination network's native currency is required. For this purpose, the [client's off-chain module](/infrastructure/client-off-chain-module) makes an HTTP request to the relay's API, where the gas amount in the destination network is calculated. The calculation is based on the current prices of native currencies in both the source and destination networks, the volume of transferred data (gas limit), and the current gas price in the destination network.

After receiving the response, the [client's off-chain module](/infrastructure/client-off-chain-module) sends the amount of native currency along with the transaction of the encrypted payload.

Due to the possibility of a sudden increase in gas prices in the destination network (which could result in the sent fee being insufficient for the destination network), it is recommended to set a commission multiplier in the configuration file of the client's off-chain module (see parameter **FeeMultiplierPercent**). This multiplier will increase the received fee amount by the specified percentage.

For example, if the relay's API returns a value of 1000 and the client sets FeeMultiplierPercent: 20, then to cover the fee in the destination network, 1200 coins from the source network will be sent.

## Resending the Transfer Due to Insufficient Fee Coverage Error

In the event that a transfer is declined at the relay due to insufficient fee coverage in the destination network (typically caused by a sudden surge in gas prices in the destination network), there's an option to retry sending the transfer by adding a certain amount of tokens to cover the fee.

There are 3 ways to do that:

1. Calling the <mark style="color:orange;">`resendTransfer()`</mark> method on the initiator contract in the source network, passing the <mark style="color:orange;">`transferHash`</mark> as a parameter, and sending a certain amount of native coins from the source network. This method can be invoked from any address, meaning anyone can send a certain amount of coins to attempt resending the transfer.
2. Calling the <mark style="color:orange;">`resendAsterizmTransfer()`</mark> method on the client contract in the source network, passing the transferHash as a parameter, and sending a certain amount of native coins from the source network. This method can only be invoked by the contract owner.
3. Calling the console method of the client's off-chain module, passing the following parameters: chainSymbol, transferHash, commissionAmount (THIS METHOD IS STILL UNDER DEVELOPMENT, COMING SOON).

After executing one of the methods described above, the relay will attempt to resend the transfer using a fee increased by the amount of coins sent. In this process, the initially sent fee and the fee added with the transfer resend method will be summed up.

If all checks pass, the transfer will be sent to the destination network for further processing.

## RPC requirements

When choosing an RPC for use in the client offchain module, it is important to consider one crucial factor: the RPC must support the <mark style="color:orange;">`txpool_contentFrom`</mark> method. Not all free RPCs support this method, so it's necessary to verify the availability of this method before use.


# External relays

External relay description and integration documentation

The Asterizm Protocol has been designed to allow not only internal off-chain modules but also external services to act as [relays](/infrastructure/asterizm-relayer). These external relays can be trusted services that have undergone protocol audits and have set up the necessary infrastructure.

Each relay has the authority to establish its transfer fee in the native currency of the network. All relay data is stored on-chain, making this information accessible to everyone.

Every client is free to choose which relay they want to use for sending confirmations of their transfers (**`transferHash`**). To do this, the client should invoke the method <mark style="color:orange;">`setExternalRelay(address _externalRelay)`</mark> on their [client contract](/infrastructure/asterizm-connector/client-smart-contract-abstraction).&#x20;

{% hint style="warning" %}
IMPORTANT!&#x20;

A client can only set the address of an external relay once. If they attempt to call the method again, the contract will return an error.

Please exercise caution when configuring this parameter because once set, you cannot change it or revert to the "default" relay. You will need to redeploy contracts if you wish to make changes in this regard.
{% endhint %}


# Relay deployment and configuration

This section describes the process of deploying and configuring an external relay

The deployment and configuration of an external relay closely resemble the process of deploying and configuring the client part of the protocol (client contracts and client off-chain module). The process can be divided into 3 steps:

1. [Deployment of external relay contracts](#deployment-of-external-relay-contracts) to all supported networks
2. [Contacting our support service](#contacting-asterizm-support) to obtain an identification key for the relay's off-chain module and adding the addresses of external relay contracts to the trusted list on the protocol initializer contracts
3. [Configuration](#configuration-settings) and launch of the external relay's off-chain module.

## Deployment of external relay contracts

First, it is essential to deploy the external relay contracts to all supported networks. The contracts are available in the protocol repositories:

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/AsterizmTranslator.tsol>" %}
EVM contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/AsterizmTranslator.tsol>" %}
TVM contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/contracts/AsterizmTranslator.tsol>" %}
TON contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-sol/tree/master/programs/asterizm-relayer>" %}
Solana program
{% endembed %}

The deployment of the relay contract consists of two steps:

1. Deployment of the relay contract
2. Adding the list of supported networks and their types to the contract by invoking the method <mark style="color:orange;">`function addChains(uint64[] calldata _chainIds, uint8[] calldata _chainTypes)`</mark> on the deployed contract.

Additionally, console commands have been developed to simplify the deployment of these contracts.

#### EVM

```bash
npx hardhat relay:deploy {initializerAddress} {testnetFlag?} --network {networkName}
```

The command accepts the following parameters:

* **initializerAddress** - mandatory parameter: the address of the initializer on the network. You can review the list of available initializer addresses on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **testnetFlag** - optional parameter, accepted values **0** or **1**)&#x20;
* **networkName** - mandatory parameter: The name of the network into which the contract is being deployed. You can check the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/hardhat.config.ts#L41)

Upon successful execution, the command will return a response similar to the following (the relay address will be displayed under the **External relay address**):

```bash
Deployment was done

Total gas limit: 684778
Owner address: 0xf9E3b4AC4CEFF24464840c426E7e3506dC145c44
Initializer address: 0x68a0C7aE8557F0477fe985636aE8827eAE7577F1
External relay address: 0xDc6baC9cDF881572f3f77522f74301F429E4Ba87
```

#### TVM

<pre class="language-bash"><code class="lang-bash"><strong>npx locklift run --script ./scripts/relay/relay_deploy_task.ts --initializer {initializerAddress} --network {networkName}
</strong></code></pre>

The command accepts the following parameters:

* **initializerAddress** - mandatory parameter: the address of the initializer on the network. You can review the list of available initializer addresses on the corresponding pages ([Mainnet](/technical-reference/mainnet) or [Testnet](/technical-reference/testnet))
* **networkName** - mandatory parameter: The name of the network into which the contract is being deployed. You can check the list of available networks [here](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/hardhat.config.ts#L41).

Upon successful execution, the command will return a response similar to the following (the relay address will be displayed under the **External relay address**):

```bash
Deployment was done.

Owner address: 0:68a73acf79fed327d33a1e60503060021cbc2d9e1e8500d073d448d9a74f978f
Initializer address: 0:c8693de0c988b5f418db9916b9b43d4613e87a527ba9fbb216136526ea21b191
External relay address: 0:1bfd87c7f21c12c39f6a1eb3bd18eec8503beaae3f91a41ebf3fb1d39e1c3bff
```

#### TON

Coming soon

#### **Solana**

Coming soon

## Contacting Asterizm Support

Asterizm Protocol conducts a personal audit of each connected external relay. Additionally, the protocol retains the right to remove a specific external relay from the protocol system if the relay violates the protocol's rules and agreements.

Furthermore, the protocol has a real-time monitoring system for the status of each external relay. In the event of any issues on the external relay's side, its status will be updated on the corresponding page of the protocol [scanner](https://scan.asterizm.io/).

To execute these protocol logics, the protocol must have the ability to identify each connected external relay. For this purpose, a unique identifier is assigned to each external relay, which needs to be added to the configuration of the off-chain module (see below).

After the relay representative contacts the [Asterizm support service](/guides/getting-started#talk-to-the-team), it requests a list of addresses of relay contracts deployed in all supported networks, conducts its own audit, adds the contract addresses to the trusted relay list on the initializer contract, stores the external relay in the internal database, and issues a unique identifier. After this, you can proceed to the final step - configuring the off-chain module of the external relay.

## Off-chain module configuration

To operate the external relay, in addition to the relay contracts in each network, it is also necessary to configure the off-chain module. The configuration is done on a private server of the external relay and is the responsibility of the external relay's staff. Asterizm Protocol has **no** access to it.

To proceed further, it's necessary to install [Docker](https://www.docker.com/) together with [Docker Compose](https://docs.docker.com/compose/) on the server. You can refer to the official documentation for installation and setup instructions: <https://docs.docker.com/engine/install/>

For these purposes, Asterizm Protocol has developed a Docker image. You should use this image to create Docker containers on your server. To begin, please download the image:

```bash
docker pull asterizm/external-relay:latest
```

After downloading the image, you should follow these steps:

1. Create a <mark style="color:orange;">**`docker-compose.yml`**</mark> file to automate the deployment of the server
2. Configure the configuration parameters for the external relay&#x20;
3. Apply migrations, fixtures, and launch the Docker containers

For example, let's assume that the external relay intends to support two networks - Ethereum (EVM) and Everscale (TVM), with the root directory of the off-chain module being <mark style="color:orange;">`/opt/relay`</mark>. All system configuration files will be based on this example. To add other supported networks, you need to make the necessary changes to the configuration files of the external relay's off-chain module.

### docker-compose.yml file

This file is intended for automating the deployment of Docker containers. To complete this step, follow these instructions:

1. In the terminal, create the root directory and, if necessary, assign the required permissions: <mark style="color:orange;">`mkdir /opt/relay && cd /opt/relay`</mark> (To assign permissions, use the  <mark style="color:orange;">`chown {username} /opt/relay`</mark> command)
2. Next, create directories for the off-chain module data:

   <mark style="color:orange;">`mkdir -p docker-data/db`</mark>

   <mark style="color:orange;">`mkdir -p docker-data/config`</mark>
3. Now, create the <mark style="color:orange;">**`docker-compose.yml`**</mark> file (<mark style="color:orange;">`touch /opt/relay/docker-compose.yml`</mark>). Here's the template structure for this file:

{% code title="/opt/relay/docker-compose.yml" %}

```yaml
version: '3.9'
services:

  relay-db:
    container_name: relay-db
    image: postgres:15-alpine
    restart: always
    volumes:
      - ./docker-data/db:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=database-user # set it to config file
      - POSTGRES_PASSWORD=database-password # set it to config file
    networks:
      - relay
  
  relay-redis:
    container_name: relay-redis
    image: redis:7.0.8-alpine
    command: >
      --requirepass redis-password # set it to config file
    networks:
      - relay

  relay-console: &console-template
    container_name: relay-console
    privileged: true
    image: asterizm/external-relay:latest
    working_dir: /app
    restart: always
    depends_on:
      - relay-db
    volumes:
      - ./docker-data/config/Project.yml:/app/config.yml:rw
    networks:
      - relay

  relay-cron:
    <<: *console-template
    container_name: relay-cron
    command: ["cron/process"]

  relay-eth:
    <<: *console-template
    container_name: relay-eth
    command: ["node/scan", "ETH"]

  relay-ever:
    <<: *console-template
    container_name: relay-ever
    command: ["node/scan", "EVER"]

  relay-ton:
    <<: *console-template
    container_name: relay-ton
    command: ["node/scan", "TON"]

  relay-sol:
    <<: *console-template
    container_name: relay-sol
    command: ["node/scan", "SOL"]

networks:
  relay:
    driver: bridge
```

{% endcode %}

In this file, you need to specify the username and password for the PostgreSQL database and Redis caching service of the off-chain module.

After creating this file, you can proceed to the next step.

### Configuration settings

To set the internal settings of the off-chain module, there is a primary configuration file. You should modify the parameters in this file to suit your needs.

In our example, the configuration file will be located in the directory <mark style="color:orange;">`/opt/relay/docker-data/config/Project.yml`</mark>(<mark style="color:orange;">`touch /opt/relay/docker-data/config/Project.yml`</mark>), however, you can change its name/path according to your preference. If you do so, make sure to update the paths in the <mark style="color:orange;">`docker-compose.yml`</mark> file.

Here is the structure of the configuration file:

{% code title="Project.yml" fullWidth="false" %}

```yaml
Environment:
  LogLevel: INFO # logging level for the off-chain module
  LicenseKey: "license-key" # unique identifier for the off-chain module 
  LicenseHost: https://tr.asterizm.io # for the testent, change this parameter to https://testtr.asterizm.io
Utils:
  Encryption:
    Key: "encryption-key" #transfer data encryption key
    Salt: "encryption-default-salt" # default data encryption salt
    CipherMethod: "AES-256-CBC" # encryption method
  Db:
    Host: relay-db # database host (name of database container docker)
    Port: 5432 # database port
    Name: "relay" # database name
    User: "database-user" # the user name of the database (see the file docker-compose.yml)
    Password: "database-password" # database password (see the file docker-compose.yml)
  Redis:
    Host: relay-redis
    Port: 6379
    Password: "redis-password" # cache service password (see the docker-compose.yml file)
    Db: 0
  Chainspot: # Chainspot service settings. Simply copy this one
    Host: https://rate.chainspot.io
    ApiKey: 38gXgViK7BcQhoB5Sfyj0PBeKyEAn2M3VmqCEfdFhMrydJGEH4G4ZLPKpjLm8tOJ 
Nodes:
  List:
    ETH: # Ethereum network (EVM)
      RPC: https://ethereum-rpc.com # RPC nodes
      ContractAddress: "client-contract-address-in-eth-network" # external relay contract address on Ethereum network
    EVER: # Everscale network (TVM)
      RPC: https://everscale-rpc.com # node RPC
      ContractAddress: "client-contract-address-in-everscale-network" # external relay contract address on Ethereum network
```

{% endcode %}

{% hint style="info" %}
**Important**: Please note that the configuration format for EVM and TVM networks is slightly different: in **TVM** networks the **OwnerPublicKey** parameter is added
{% endhint %}

Supported encryption methods (**CipherMethod** parameter): AES-{128, 192, 256}-{CBC, OFB, CFB, CTR}. **Recommended: AES-256-CBC**.

In order for the off-chain module to properly extract the payload received from the contract, it is necessary to specify what types of data are stored in it. For this purpose, the **PayloadStruct** parameter is used. You need to specify what types of parameters are stored in your contract. System-supported parameters: **bool, string, bytes, int (all sizes), uint (all sizes).**

You can configure the logging level of the client off-chain module. This parameter affects the completeness of the information in the module's logs. Logs are written to stdout, so you can see them in docker container logs (**docker logs -f {container-name}**). There are 4 levels:

* &#x20;**INFO** (logs minimal required information, standard actions),
* **WARN** (includes **INFO** logging level, adds a detailed log of some exceptions),
* **ERROR** (includes **WARN** logging level, adds full system error log),
* **DEBUG** (includes **ERROR** logging level, adds a log of most system actions, used for error detection and debugging, not recommended for product deployment).

Default logging level (if the configuration parameter is not set) is **INFO**.

Personal unique data, such as the private encryption key, the default encryption salt, the RPC addresses of the nodes, the contract addresses of each network (contracts must already be deployed), and the user names, database, and hash service passwords (specified in the <mark style="color:orange;">**`docker-compose.yml`**</mark> file, see the [previous step](#docker-compose.yml-file)) must be entered into this configuration file.

### Running the module

To start the Docker containers for the off-chain module, you can simply execute one command: <mark style="color:orange;">`docker compose -f /opt/relay/docker-compose.yml up -d`</mark>. After executing this command, the module will start.

The next and final step is to configure the off-chain module's database. To do this, follow these steps:

1. <mark style="color:orange;">`docker exec relay-db psql -U database-user -c "CREATE DATABASE relay"`</mark> - This command will create a database in the **relay-db** container (note the database user name, it was specified in <mark style="color:orange;">**`docker-compose.yml`**</mark>);
2. <mark style="color:orange;">`docker exec relay-console /app/main migrations/up`</mark> - this command extracts migrations to the database;
3. <mark style="color:orange;">`docker exec relay-console /app/main db/seed`</mark> - this command extracts fixtures onto the database.  **Important**: you can add <mark style="color:orange;">`-test`</mark> a flag for filling the database with [testnet networks](/technical-reference/testnet).

After successfully executing these commands, the off-chain module's database will be ready for operation. You can then restart the module's containers with the following command: <mark style="color:orange;">`docker compose -f /opt/relay/docker-compose.yml restart`</mark>.

### Managing system owners

To enable operation, it is necessary to add data about contract owners to the system. This can be done using the following console command:

```bash
docker exec relay-console /app/main owners/add {netwotk-symbol} {owner-address} {owner-private-key} {?owner-public-key}
```

This command adds a contract owner of a specific network. It accepts the following parameters:

* **network-symbol** - mandatory parameter, the network symbol (e.g., ETH, POL, etc.)
* **owner-address** - mandatory parameter, the address of the owner
* **owner-private-key** - mandatory parameter, the private key of the owner
* **owner-public-key** - optional parameter, the public key of the owner (used in TVM systems).

To display a list of owners already added to the system, execute the following command:

```bash
docker exec relay-console /app/main owners/list {?network-symbol}
```

To display a list of owners already added to the system, you can execute the following command:

* **network-symbol** - optional parameter, the network symbol (e.g., ETH, POL, etc.)

Added owners cannot be deleted; they can only be deactivated. This is done with the following command:

```bash
docker exec relay-console /app/main owners/disable {owner-id}
```

This command deactivates a previously added owner. The command accepts the following parameters:

* **owner-id** - mandatory parameter, the ID of the owner, which can be obtained by executing the console method for listing owners

Deactivated owners can be reactivated. This is achieved by executing the following console command:

```bash
docker exec relay-console /app/main owners/enable {owner-id}
```

This command activates a previously deactivated owner. The command accepts the following parameters:

* **owner-id** - mandatory parameter, the ID of the owner, which can be obtained by executing the console method for listing owners.

After changing the configuration file, it is necessary to restart the system containers (if they were previously running) with the following command: <mark style="color:orange;">`docker compose -f /opt/relay/docker-compose.yml restart`</mark>

Congratulations! You are now ready to start working with the system.

#### Debug

To check the functionality of the Docker containers, you can use the <mark style="color:orange;">`docker ps`</mark> command,  which will display a list of containers along with their status and other information.

If you want to read the logs of a specific off-chain module container, you can use the <mark style="color:orange;">`docker logs -f relay-eth`</mark> command. This command will display the logs of the Ethereum network container. You can similarly check the logs of other containers by replacing <mark style="color:orange;">`relay-eth`</mark> with the name of the specific container you want to check.

The verbosity level of the logs can be configured in the module's configuration file under the <mark style="color:orange;">`Environment.LogLevel`</mark> parameter.


# List of external relays

This section contains a list of external relays that are trusted, validated and approved by the protocol

{% content-ref url="/pages/Zpq1IgxOua8NkUzi0M0N" %}
[Chainlink](/guides/external-relays/list-of-external-relays/chainlink)
{% endcontent-ref %}


# Chainlink

Integration of Chainlink Relayers

To use this relay, it is necessary to have [LINK](https://docs.chain.link/resources/link-token-contracts) tokens on the client contract, as they are utilized for payment transfers on the Chainlink contract side.

Furthermore, it is necessary to add the token address on the client contract, which will be used for the transfer payment (see the table below). This is done by calling the following method on the client contract:

```solidity
function setFeeToken(IERC20 _feeToken) public onlyOwner
```

The method accepts the following parameters:

* **\_feeToken** - a mandatory parameter, token address for paying the transfer fee.

### Lists of supported networks

{% content-ref url="/pages/wZFtXe6DPFG2bCxCeChC" %}
[Mainnet](/guides/external-relays/list-of-external-relays/chainlink/mainnet)
{% endcontent-ref %}

{% content-ref url="/pages/8nt4xfftZylFv8XoPnxb" %}
[Testnet](/guides/external-relays/list-of-external-relays/chainlink/testnet)
{% endcontent-ref %}


# Mainnet

List of Chainlink relayer addresses on the mainnet

Coming soon


# Testnet

List of Chainlink relayer addresses on the testnet

<table><thead><tr><th width="178">Chain title</th><th>Contract address</th><th>Fee token address</th></tr></thead><tbody><tr><td>Ethereum Sepolia</td><td><strong>0xEE0670D1911eb9Fc7bE8e8Bb19CcA1f7195F6321</strong></td><td><strong>0x779877A7B0D9E8603169DdbD7836e478b4624789</strong></td></tr><tr><td>Polygon Mumbai</td><td><strong>0x2e49c9D452a7065a28C08C5B01aAD4Fe5D66CbC1</strong></td><td><strong>0x326C977E6efc84E512bB9C30f76E30c160eD06FB</strong></td></tr></tbody></table>


# Source chain notifications

The protocol allows for initiating notifications regarding the status of a transfer sent to the destination network by sending notifications from the relay to the source network. In this case, the following event is emitted on the client's contract:

{% code overflow="wrap" %}

```solidity
event TransferSendingResultNotification(bytes32 indexed _transferHash, uint8 _statusCode)
```

{% endcode %}

Event parameters:

* **\_transferHash** - the hash of the transfer that triggered the notification
* **\_statusCode** - the status code of the transfer in the destination network

At the moment, the following list of statuses is supported:

* **0** - the transfer was successfully sent to the destination network
* **1** - the transfer was not sent due to insufficient commission sent to cover the gas in the destination network.

Each client has the ability to enable or disable these notifications at their discretion, depending on the logic built into the client system.

{% hint style="warning" %}
IMPORTANT!&#x20;

In the event of disabling notifications, the client can save on network fees (the transfer will become slightly cheaper in terms of gas). However, the [client's off-chain module](/infrastructure/client-off-chain-module) will not receive data about the status of the transfer delivery in the destination network. This can impact certain internal logic, such as automatically resending a transfer in case of insufficient fees to cover gas in the destination network.

It's essential to understand this if you plan to disable these notifications.
{% endhint %}


# Refund Logic

This describes the refund logic required for certain implementations of client-side logic, such as omnichain tokens.

In some implementations of client-side logic that involve real assets (for example, the Asterizm Omnichain Token), you need the ability to refund locked tokens if a transfer fails at one of the execution stages on the destination network.

### Logic Overview

The Asterizm Protocol team has developed a native refund logic integrated into the client abstraction. Only the user address that initiated the transfer on the source network can initiate a refund; therefore, neither the Asterizm Protocol contract owner nor the client owner can do this independently.

To add a refund request, the client must call the function <mark style="color:orange;">`addRefundRequest(bytes32 _transferHash)`</mark> on the client contract

{% hint style="info" %}
The Asterizm Protocol team has provided a way for the client owner to set a fee for calling the function, covering client expenses involved in processing a user’s refund request. This fee is specified in the native currency of the source network.

By default, the fee is set to 0. However, the client owner can call <mark style="color:orange;">`setRefundFee(uint _fee)`</mark> on the client contract to set the desired fee amount.

You can retrieve the currently set fee value from <mark style="color:orange;">`uint public refundFee`</mark> param on the client contract.
{% endhint %}

After a user address adds a refund request, the client’s off-chain module takes over. This module processes the refund request, checks the current status of the transfer (for instance, whether it has already been executed on the destination network), and if all checks are successful, it sends information to the destination network stating that the transfer has been placed in a refund queue. This information is stored on-chain, so once a refund is approved, it becomes impossible to execute the transfer on the destination network (this check is implemented at the client contract level). Next, the off-chain module calls the function <mark style="color:orange;">`confirmRefund(bytes32 _transferHash)`</mark> on the destination network, waits for the transaction to be mined, and only then sends approval for the refund back to the source network by calling <mark style="color:orange;">`processRefundRequest(bytes32 _transferHash, bool _status)`</mark>  in the source network. As a result, the user is refunded the coins/tokens they sent or burned during the transfer initialization.

If the client’s off-chain module rejects the refund request (for example, if the transfer has already been successfully executed on the destination network), the same function <mark style="color:orange;">`processRefundRequest(bytes32 _transferHash, bool _status)`</mark> is called in the source network, but the value passed to <mark style="color:orange;">`_status`</mark> is `false`. In this case, no coins/tokens are refunded to the user.

### Integration Logic

Refund logic is disabled by default, so to activate it, you need to complete three steps:

1. Enable the refund logic. For this, set the internal parameter <mark style="color:orange;">`refundLogicIsAvailable = true`</mark> (example - <https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/MultichainToken.sol#L19>)
2. When the client initializes a transfer, add a function call to include that transfer in a pool of transfers that support the refund logic (example - <https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/MultichainToken.sol#L37>). This pool is used to validate the transfer at the moment the client creates a refund request.
3. Implement an internal function for refunding native coins (<mark style="color:orange;">`_refundCoins(address _targetAddress, uint _amount)`</mark>) or tokens  (<mark style="color:orange;">`_refundTokens(address _targetAddress, uint _amount, address _tokenAddress)`</mark>), depending on what the user sends during transfer initialization and what needs to be refunded in the event of approval (example - <https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/MultichainToken.sol#L74>). This step is optional, because by default, the refund logic already includes standard functions for sending native coins (<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/base/AsterizmRefund.sol#L164>) and tokens (<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/base/AsterizmRefund.sol#L175>)

After completing these steps, the client contract can work with the refund logic

### Adding Refund Request

Only the user address that initiated the transfer on the source network can add a refund request. Accordingly, to begin a refund, the user’s address must call the function <mark style="color:orange;">`addRefundRequest(bytes32 _transferHash)`</mark> on the client contract. After this action, the client off-chain module will start processing the request.


# Error messages

In the process of transferring cross-chain transaction data, errors may occur that will interrupt further execution of the transaction.&#x20;

The list of possible errors, their description and causes are provided in the subsections.

{% content-ref url="/pages/anEAUPLni7x2ebpe8na6" %}
[EVM](/guides/error-messages/evm)
{% endcontent-ref %}

{% content-ref url="/pages/Tv5HDsyB4lguIYfRMNFx" %}
[TVM and TON](/guides/error-messages/tvm-and-ton)
{% endcontent-ref %}


# EVM

Errors that can occur in the EVM chains

{% content-ref url="/pages/MVAxR7wwFTsXJJY9cluf" %}
[Source chain](/guides/error-messages/evm/source-chain)
{% endcontent-ref %}

{% content-ref url="/pages/ADF6iMcFOkxggzqOAICo" %}
[Destination chain](/guides/error-messages/evm/destination-chain)
{% endcontent-ref %}


# Source chain

Errors that can occur in the source chain EVM network

### **BaseAsterizmClient:** outbound transfer not exists

> An attempt to initialize a cross-chain transaction by a client contract owner that was not pre-registered by the client contract&#x20;

This error occurs if the client's contract owner tries to initiate a transfer bypassing the logic of the client's contract.

### BaseAsterizmClient: outbound transfer executed already

> An attempt to initialize a cross-chain transaction by the owner of a client contract that has already been executed before

This error occurs if the client contract owner tries to re-initiate a transfer that has already been executed before.

### BaseAsterizmClient: contract balance is not enough

There are not enough native tokens on the client's contract to cover the transfer fee in the destination network.

### BaseAsterizmClient: wrong txId param

> The txId parameter (transaction number) is invalid

This error can occur if the client contract owner tries to initiate an invalid cross-chain transaction (spam, duplicate).

### AsterizmInitializer: sender address is blocked

> The client contract address on the source network is blocked

The address of the client contract is blacklisted: darknet, scam, etc.

### AsterizmInitializer: target address is blocked

> The client contract address on the destination network is blocked

### Translator: wrong chain id

> The network ID is not supported by the system

Check the network ID in the [list of supported networks](/what-is-asterizm/supported-chains).

{% hint style="info" %}
If you think that everything is done correctly and should work properly, but you are getting any of the errors above, [please contact our team](/guides/getting-started#talk-to-the-team).
{% endhint %}


# Destination chain

Errors that can occur in the destination chain EVM network

### Translator: wrong chain id

> The destination network ID parameter is invalid

Check the ID in the [list of supported networks](/what-is-asterizm/supported-chains).

### Translator: destination address is non-contract

> The address of a client contract on the destination network is a non-contract

### AsterizmInitializer: wrong nonce

> If the client uses a strict transfer order (flag <mark style="color:orange;">`_useForceOrder = true`</mark>) and this check fails

### AsterizmInitializer: wrong destination address

> Incorrect address of the client contract in the destination network

Make sure you send the message to your client contract. Your contract addresses may be different on different networks.

### BaseAsterizmClient: wrong source address

> Validation error of the source network address (the address is not on the trusted list)

Please check if the address you are trying to receive the message from is in the list of trusted addresses in the client smart contract.

{% hint style="info" %}
Pay attention to [this point](/guides/getting-started/3.-important-one-final-pre-flight-check#doverennyi-spisok-adresov) to prevent this error
{% endhint %}

### BaseAsterizmClient: transfer executed already

> The error occurs if the received message has already been executed before

The check is performed by the hash function (xID), which determines that the message has been linked to another transaction in the source network and has already been executed in the destination network.

### BaseAsterizmClient: transfer not received

> The error occurs if the owner of the client contract tries to execute instructions in a cross-chain message that did not appear on the client contract.

This check allows you to eliminate the possibility of spam and unauthorized actions on behalf of the contract owner in the case of hacking the client's server.

### BaseAsterizmClient: transfer hash is invalid

> The error occurs if the client contract owner attempts to execute transfer instructions that did not go through the Asterizm Initializer contract on the source and destination chains

### BaseAsterizmClient: transfer hash is invalid

> The error occurs if the owner of the client contract tries to execute invalid transfer instructions

Something probably happened on your server during data decryption. Or maybe you are just a hacker trying to execute a malicious message that contained other content on the source network.

{% hint style="info" %}
If you think that everything is done correctly and should work properly, but you are getting any of the errors above, please [contact our Team](/guides/getting-started#talk-to-the-team)
{% endhint %}


# TVM and TON

Error codes that can occur in the TVM chains

### Basic errors

<table><thead><tr><th width="127">Error code</th><th>Error description</th></tr></thead><tbody><tr><td>1001</td><td>The method is not called by the owner</td></tr><tr><td>1002</td><td>Zero Address Error</td></tr></tbody></table>

### Translator errors

<table><thead><tr><th width="127">Error code</th><th>Error description</th></tr></thead><tbody><tr><td>2001</td><td>The method is not called by the initializer</td></tr><tr><td>2002</td><td>The method is not called by the relayer</td></tr><tr><td>2003</td><td>An unsupported network identifier was transmitted</td></tr><tr><td>2004</td><td>Network ID is not supported</td></tr><tr><td>2005</td><td>Invalid network ID</td></tr><tr><td>2006</td><td>Data transfer error</td></tr><tr><td>2007</td><td>Unsupported network type. Supported network types: EVM - 1, TVM - 2</td></tr></tbody></table>

### Initializer errors

<table><thead><tr><th width="127">Error code</th><th>Error description</th></tr></thead><tbody><tr><td>3001</td><td>The method is not called by the translator</td></tr><tr><td>3002</td><td>The sender's address is blocked</td></tr><tr><td>3003</td><td>The recipient's address is blocked</td></tr><tr><td>3004</td><td>Transfer execution validation error</td></tr><tr><td>3005</td><td>Invalid destination address</td></tr><tr><td>3006</td><td>Invalid transfer order validator address</td></tr><tr><td>3007</td><td>Transfer order validator data was not found</td></tr><tr><td>3008</td><td>Transfer order validator value increment error</td></tr><tr><td>3009</td><td>Transfer order validator increment and value check error</td></tr></tbody></table>

### Client contract errors

<table><thead><tr><th width="127">Error code</th><th>Error description</th></tr></thead><tbody><tr><td>4001</td><td>The method is not called by the initializer</td></tr><tr><td>4002</td><td>The method is not called by the initializer or the owner</td></tr><tr><td>4003</td><td>Invalid trusted address</td></tr><tr><td>4004</td><td>Invalid hash</td></tr><tr><td>4005</td><td>Incoming transfer was not received</td></tr><tr><td>4006</td><td>Incoming transfer has already been executed</td></tr><tr><td>4007</td><td>Outgoing transfer not found</td></tr><tr><td>4008</td><td>Outgoing transfer has already been executed</td></tr><tr><td>4009</td><td>Trusted address not found</td></tr><tr><td>4010</td><td>Insufficient balance</td></tr><tr><td>4011</td><td>Invalid parameter txId</td></tr><tr><td>4013</td><td>Callback method is not supported</td></tr><tr><td>4014</td><td>Transfer hash not found</td></tr><tr><td>4015</td><td>Invalid hash (callback error)</td></tr><tr><td>4016</td><td>Outgoing transfer does not exist (callback error)</td></tr><tr><td>4017</td><td>Invalid callback address (callback error)</td></tr><tr><td>4018</td><td>TransferFeeValue value is too low</td></tr></tbody></table>

### Transfer contract errors

<table><thead><tr><th width="127">Error code</th><th>Error description</th></tr></thead><tbody><tr><td>5001</td><td>Non-zero public key error</td></tr><tr><td>5002</td><td>Invalid contract owner</td></tr><tr><td>5003</td><td>Invalid hash</td></tr></tbody></table>

### Transfer order validator contract errors

<table><thead><tr><th width="127">Error code</th><th>Error description</th></tr></thead><tbody><tr><td>6001</td><td>Non-zero public key error</td></tr><tr><td>6002</td><td>Invalid contract owner</td></tr><tr><td>6003</td><td>Invalid transfer serial number</td></tr></tbody></table>


# Solana

Error codes that can occur in the Solana chain

Solana programs do not support custom errors; everything is handled using internal errors.

Example of a trusted address addition error:

```bash
AnchorError: AnchorError caused by account: token_client_account. Error Code: ConstraintSeeds. Error Number: 2006. Error Message: A seeds constraint was violated. {
  errorLogs: [
    'Program log: AnchorError caused by account: token_client_account. Error Code: ConstraintSeeds. Error Number: 2006. Error Message: A seeds constraint was violated.'
  ],
  logs: [
    'Program AsUG3qmKKMjEYZDCTqo4hJEnLmxGj82SDGiXci1hNFBx invoke [1]',
    'Program log: Instruction: CreateClientTrustedAddress',
    'Program log: AnchorError caused by account: token_client_account. Error Code: ConstraintSeeds. Error Number: 2006. Error Message: A seeds constraint was violated.',
    'Program AsUG3qmKKMjEYZDCTqo4hJEnLmxGj82SDGiXci1hNFBx consumed 7607 of 200000 compute units',
    'Program AsUG3qmKKMjEYZDCTqo4hJEnLmxGj82SDGiXci1hNFBx failed: custom program error: 0x7d6'
  ],
  error: {
    errorCode: { code: 'ConstraintSeeds', number: 2006 },
    errorMessage: 'A seeds constraint was violated',
    comparedValues: undefined,
    origin: 'token_client_account'
  }
}
```


# Fee management

Get the number of native gas tokens you have to pay to send a message

The logic of the [Client off-chain module](/infrastructure/client-off-chain-module) includes a mechanism for automatically calculating the amount of gas required for the transfer.&#x20;

At the moment of cross-chain transaction data encryption in the source network, the required amount of source network native currency is calculated to cover the cost of gas for transfer in the destination network.&#x20;

This amount of native currency of the source network is sent along with the encrypted data to initialize the transfer.

{% hint style="warning" %}
There is a possibility of a strong surge in the value of gas in the destination network. In this case, the sent native currency of the source network may not be enough to perform the transaction.

In this case, the transaction will be rejected by the [Translator smart contract](/infrastructure/asterizm-connector/translator-smart-contract).
{% endhint %}

You can adjust the amount of gas you are willing to spend on each message you transmit in the [Client off-chain module configuration](/guides/getting-started/2.-implement-off-chain-module/simple-implementation-shell-script#configuration-file-setup).<br>


# Code examples

Try Asterizm with ready-made examples

You can find all Asterizm implementation examples on GitHub:git

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemo.sol>" %}
EVM demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-tvm/blob/master/contracts/demo/AsterizmDemo.tsol>" %}
TVM demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/contracts/demo/AsterizmDemo.tsol>" %}
TON demo contract
{% endembed %}

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-sol/tree/master/programs/asterizm-value-example>" %}
Solana demo program
{% endembed %}


# Multi-Owner (Sender) System

Description of the multi-owner (sender) system

The Asterizm Protocol can continuously handle a significant volume of on-chain transactions.

EVM systems incorporate nonce logic, determining a precise order for sending transactions from a specific address. This approach has a crucial nuance - if one transaction from the sequence doesn't make it into a block, all subsequent transactions won't be included in a block until the original one is included. Consequently, queues for transaction submission may form on owner addresses.

The Asterizm Protocol has been designed with this nuance in mind, allowing multiple addresses capable of sending requests to be added to contracts. These addresses are referred to as **senders**. In this context, the off-chain part of the system selects the least loaded sender. This approach helps reduce load and avoid transaction queues.

## Sender logic on client contracts

To implement this logic, additional senders need to be added (the first sender is considered the owner who deployed the contract, and it is automatically added to the list of senders during the deployment of the client contract). To achieve this, the following method should be called on the respective contract:

```solidity
function addSender(address _sender) public onlyOwner
```

This method adds the provided address to the list of senders, enabling the specified address to invoke basic methods for sending protocol transfers.

## Sender logic (off-chain part)

After adding a sender to the client contract, it is necessary to include this sender in the off-chain module of the protocol. To achieve this, execute the following console command:

```bash
docker exec asterizm-console /app/main owners/add {netwotk-symbol} {owner-address} {owner-private-key} {?owner-public-key}
```

This command adds a sender to the contract of a specific network. It accepts the following parameters:

* **network-symbol** - mandatory parameter, the network symbol (e.g., ETH, POL, etc.)
* **owner-address** - mandatory parameter, the address of the owner
* **owner-private-key** - mandatory parameter, the private key of the owner
* **owner-public-key** - optional parameter, the public key of the owner (used in TVM systems).

After adding a sender to the off-chain module, it is necessary to restart the system. This is done with the following command: <mark style="color:orange;">`docker compose -f /opt/asterizm/docker-compose.yml restart`</mark>


# Best practices

Coming soon...


# Asset transfer

Use the cross-chain swap module to transfer assets along with messages

Coming soon...


# Debugging

We recommend performing tests of each of your smart contracts. The examples can be found on GitHub:

{% embed url="<https://github.com/Asterizm-Protocol/asterizm-contracts-evm/tree/master/test>" %}


# Mainnet

Asterizm Initializer smart contract addresses in supported mainnets:

| Chain          | Symbol | chainID    | Asterizm Initializer smart contract                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| -------------- | ------ | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum       | ETH    | 1          | [0x699bB625d7b4A205A5ebe06998D797Bc164d391a](https://etherscan.io/address/0x699bB625d7b4A205A5ebe06998D797Bc164d391a)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Polygon        | POL    | 137        | [0xb26FC884362dD0e8891C68B9E974a7872C59E67e](https://polygonscan.com/address/0xb26FC884362dD0e8891C68B9E974a7872C59E67e)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Fantom         | FTM    | 250        | [0x44CeB2CdD0e9891f26Ce5b96D2A7A3017304C25F](https://ftmscan.com/address/0x44CeB2CdD0e9891f26Ce5b96D2A7A3017304C25F)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| BSC            | BSC    | 56         | [0xF10866C198AA05f56697a5b35d165878c22eC08D](https://bscscan.com/address/0xF10866C198AA05f56697a5b35d165878c22eC08D)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Optimism       | OPT    | 10         | [0xc9c54677a96252da797642fBc851523556009Ce0](https://optimistic.etherscan.io/address/0xc9c54677a96252da797642fBc851523556009Ce0)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Arbitrum       | ARB    | 42161      | [0x2aa10870a044C6Ef116ac6A4856DF69C9223f19D](https://arbiscan.io/address/0x2aa10870a044C6Ef116ac6A4856DF69C9223f19D)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Avalanche      | AVA    | 43114      | [0x1478477028f87c9EfDaDbaFD3bEC137Fd7E1445c](https://avascan.info/blockchain/all/address/0x1478477028f87c9EfDaDbaFD3bEC137Fd7E1445c)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Celo           | CEL    | 42220      | [0xe27C3853936810E967824A2ECD43302D28DfE97C](https://celoscan.io/address/0xe27C3853936810E967824A2ECD43302D28DfE97C)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Boba           | BOB    | 288        | [0xb90170b51fB7e654d2421a6e574652E3B67Abf8f](https://bobascan.com/address/0xb90170b51fB7e654d2421a6e574652E3B67Abf8f)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Aurora         | AUR    | 1313161554 | [0xf9B545b5ca77c8B1349510566494AB6E5945624b](https://explorer.mainnet.aurora.dev/address/0xf9B545b5ca77c8B1349510566494AB6E5945624b)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Fastex         | FSX    | 5165       | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://www.ftnscan.com/address/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Base           | BSX    | 8453       | [0xC1A6233450e4C7E1169A62183eE5eBc099Ca242D](https://basescan.org/address/0xC1A6233450e4C7E1169A62183eE5eBc099Ca242D)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Linea          | LNX    | 59144      | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://lineascan.build/address/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Mantle         | MTL    | 5000       | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://mantlescan.info/address/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Gnosis         | GNS    | 100        | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://gnosisscan.io/address/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Areon          | AREA   | 463        | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://areonscan.com/contracts/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| XDC            | XDC    | 50         | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://xdcscan.com/address/xdca55bdd1701d370ce9e2fb66ec0f934f3dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Venom          | VNM    | 1000       | [0:9ad0a923e48963230aa40188743e9b5d0b7ce8682c79065b76bdcb89c581ab46](https://venomscan.com/accounts/0:9ad0a923e48963230aa40188743e9b5d0b7ce8682c79065b76bdcb89c581ab46)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Everscale      | EVER   | 2000       | [0:62686a6a7b90eff9265e42eff7c0454b5060b668365e52b26276f20470d11e67](https://everscan.io/accounts/0:62686a6a7b90eff9265e42eff7c0454b5060b668365e52b26276f20470d11e67)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| CrossFi        | XFI    | 4158       | [0xaA66A0cD4Cab564fA284Ffe4481302a9Df5a5aDb](https://xfiscan.com/address/0xaA66A0cD4Cab564fA284Ffe4481302a9Df5a5aDb)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Units          | UNT    | 88811      | [0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571](https://explorer.unit0.dev/address/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| Ton            | TON    | 40000      | <https://tonscan.org/address/EQCEJ36pKArXEEYh21Bg1bmvGCumKqOCoQRKrFcUJVZwl0Gv>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Solana         | SOL    | 50000      | <p>RelayOwnerAddress: <a href="https://explorer.solana.com/address/FzFFcBizVrx55qmnd1WwLDQwyuWkTwHBodCpBtsiF6PX"><https://explorer.solana.com/address/FzFFcBizVrx55qmnd1WwLDQwyuWkTwHBodCpBtsiF6PX></a></p><p>SystemRelayOwnerAddress: <a href="https://explorer.solana.com/address/FzFFcBizVrx55qmnd1WwLDQwyuWkTwHBodCpBtsiF6PX"><https://explorer.solana.com/address/FzFFcBizVrx55qmnd1WwLDQwyuWkTwHBodCpBtsiF6PX></a></p><p>RelayerProgramId: <a href="https://explorer.solana.com/address/ASYphRUbL2UEdjMQMLm6g2XjU3JfxTikz491TGMuADQk"><https://explorer.solana.com/address/ASYphRUbL2UEdjMQMLm6g2XjU3JfxTikz491TGMuADQk></a></p><p>InitializerProgramId: <a href="https://explorer.solana.com/address/AS8bAxBaWmxdPfigyeo3T6Lua9u68UtGFLWnYRrzG5tQ"><https://explorer.solana.com/address/AS8bAxBaWmxdPfigyeo3T6Lua9u68UtGFLWnYRrzG5tQ></a></p><p>ClientProgramId: <a href="https://explorer.solana.com/address/AS3bpxoN9oWBZ1MusjZKQr9WjuTbG3T3W5fk521wNgb7"><https://explorer.solana.com/address/AS3bpxoN9oWBZ1MusjZKQr9WjuTbG3T3W5fk521wNgb7></a></p><p>TokenProgramId: <a href="https://explorer.solana.com/address/ASWxijC9aT8vjBHm91AED6BjEEeZC5oSRVXwcSTgkd3s"><https://explorer.solana.com/address/ASWxijC9aT8vjBHm91AED6BjEEeZC5oSRVXwcSTgkd3s></a></p> |
| Stellar        | XLM    | 70000      | <https://stellar.expert/explorer/public/contract/CAH4EKSLGLPO7O3QAJDO4U5Q24GCNUE6GCVWG6KDEL5GELS5HPPWPRPQ>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Canton         | CANTON | 90000      | OwnerParty: <https://ccview.io/party/11::122007725fa01ff8d201e87afc2a3c04b8dd67fd65660e9acb68a72ca54a59b5f610/>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Rayls          | RLS    | 72957      | <https://explorer.rayls.com/address/0xA55BDd1701D370cE9E2fb66EC0f934F3Dd981571>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| Polygon ZkEVM: | PZK    | 1101       | -                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |


# Testnet

Asterizm Initializer smart contract addresses in supported testnets

| Chain              | Symbol | chainID  | Asterizm connector smart contract                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ------------------ | ------ | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Ethereum (Sepolia) | ETH    | 11155111 | [0xa84b4464989e76b193d33fD65807F80BBD004A8a](https://sepolia.etherscan.io/address/0xa84b4464989e76b193d33fD65807F80BBD004A8a)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Polygon (Mumbai)   | POL    | 80001    | [0x3EeF3BD23e5a843916EE53A2016aad108Fb20649](https://mumbai.polygonscan.com/address/0x3EeF3BD23e5a843916EE53A2016aad108Fb20649)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| BSC                | BSC    | 97       | [0xE412121479211c3e9c50EC940F50596f293c08F0](https://testnet.bscscan.com/address/0xE412121479211c3e9c50EC940F50596f293c08F0)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Fantom             | FTM    | 4002     | [0x372824586fEe6388208D55021D6eeaE9f88d636B](https://testnet.ftmscan.com/address/0x372824586fEe6388208D55021D6eeaE9f88d636B)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Everscale          | EVER   | 20001    | [0:c9799fd36cb2dc59617d56bca3f4856ba0331be793d4f8f5ba02a589339737ef](https://testnet.everscan.io/accounts/0:c9799fd36cb2dc59617d56bca3f4856ba0331be793d4f8f5ba02a589339737ef)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Venom              | VNM    | 30001    | [0:67c151d9b5afeded8cd31daee6ce08a39f33d9ee55070b5bb29eefd7085ca3bd](https://testnet.venomscan.com/accounts/0:67c151d9b5afeded8cd31daee6ce08a39f33d9ee55070b5bb29eefd7085ca3bd)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| TON                | TON    | 40001    | [EQCvYJFYeJH27ANH-vtbJ8-lnHHrDEDdzB2b3v1wwle8CE48](https://testnet.tonviewer.com/kQCvYJFYeJH27ANH-vtbJ8-lnHHrDEDdzB2b3v1wwle8CPW2)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Solana (devnet)    | SOL    | 50001    | <p>RelayOwnerAddress: <a href="https://explorer.solana.com/address/7whpo6vfw7adGJ67SfZYQeNqTbHRko9M4phJbzWZiqAs?cluster=devnet">7whpo6vfw7adGJ67SfZYQeNqTbHRko9M4phJbzWZiqAs</a><br>SystemRelayOwnerAddress: <a href="https://explorer.solana.com/address/7whpo6vfw7adGJ67SfZYQeNqTbHRko9M4phJbzWZiqAs?cluster=devnet">7whpo6vfw7adGJ67SfZYQeNqTbHRko9M4phJbzWZiqAs</a><br>RelayerProgramId: <a href="https://explorer.solana.com/address/AsXCTmPnyFfxYGrymtL4wa56tk2GTBPu2q2nRAktMWyW?cluster=devnet">AsXCTmPnyFfxYGrymtL4wa56tk2GTBPu2q2nRAktMWyW</a><br>InitializerProgramId: <a href="https://explorer.solana.com/address/AsE15Mep8EJundywoGRs2XbKY28HghJ7HZ4b7qN3uiJc?cluster=devnet">AsE15Mep8EJundywoGRs2XbKY28HghJ7HZ4b7qN3uiJc</a><br>ClientProgramId: <a href="https://explorer.solana.com/address/As34Rx7ZJKc6JETxaYSZ7fHUkmhhBLhLzjMdTXJTuXDS?cluster=devnet">As34Rx7ZJKc6JETxaYSZ7fHUkmhhBLhLzjMdTXJTuXDS</a><br>TokenProgramId: <a href="https://explorer.solana.com/address/AsUG3qmKKMjEYZDCTqo4hJEnLmxGj82SDGiXci1hNFBx?cluster=devnet">AsUG3qmKKMjEYZDCTqo4hJEnLmxGj82SDGiXci1hNFBx</a><br>NFTProgramId: <a href="https://explorer.solana.com/address/AsGHptNAzEa1UXw4mWRy1WXmBsi11CMaZ2RJ9p6cn1SF?cluster=devnet">AsGHptNAzEa1UXw4mWRy1WXmBsi11CMaZ2RJ9p6cn1SF</a><br>DemoProgramId: <a href="https://explorer.solana.com/address/AsWKK9AMhadUi2GX7BptSCqyhLJBeCXoKbytoF28AuKR?cluster=devnet">AsWKK9AMhadUi2GX7BptSCqyhLJBeCXoKbytoF28AuKR</a></p> |
| Stellar            | XLM    | 70001    | <https://stellar.expert/explorer/testnet/search?term=CCTLOMMLI6CM6NQELPWDU7IEZ5J3OM6KQ4WTK4NW3VNRTXHWCVFV3CWE>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Rayls              | RLS    | 7295799  | <https://testnet-explorer.rayls.com/address/0x44DE63c860E961dd6c6f96ec93e4C4f1d9F54653>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |


# Smart contract audits

[HashEx audit report](https://hashex.org/audits/asterizm/)

[Decurity EVM audit report](https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/audits/Decurity-audit_13122024.pdf)

[Decurity TON audit report](https://github.com/Asterizm-Protocol/asterizm-contracts-ton/blob/master/audits/Decurity-audit_06032025.pdf)

[Decurity Solana audit report](https://github.com/Asterizm-Protocol/asterizm-contracts-sol/blob/master/audits/Decurity-audit_20122924.pdf)

[CredShield Canton audit report](https://github.com/Asterizm-Protocol/asterizm-contracts-canton/blob/master/audits/CredShield-audit_19022026.pdf)


# SDK

SDK for web2 developers to easily deploy Asterizm

Coming soon...


