Asterizm
  • What is Asterizm
    • Overview
    • Architecture
    • Benefits
    • Supported chains
      • Non-EVM chains integration plan
    • Frequently asked questions
    • White paper
    • GitHub
  • Infrastructure
    • Overview
    • Asterizm Connector
      • Client smart contract abstraction
      • Initializer smart contract
      • Translator smart contract
    • Client off-chain module
    • Asterizm Relayer
    • Asterizm Interfaces
      • IAsterizmConfigEnv
      • IConfig
      • IAsterizmEnv
      • IClientReceiverContract
      • IInitializerReceiver
      • IInitializerSender
      • IMultiChainToken
      • INonce
      • ITranslator
  • Guides
    • Transaction flow
    • Getting started
      • 1. Deploy your smart contracts
        • AsterizmDemo contract
        • Client contracts implementation logic
        • Solana integration logic
      • 2. Implement off-chain module
        • Simple implementation (shell script)
        • Default implementation (manual)
      • 3. Important! One final pre-flight check
    • External relays
      • Relay deployment and configuration
      • List of external relays
        • Chainlink
          • Mainnet
          • Testnet
    • Source chain notifications
    • Refund Logic
    • Error messages
      • EVM
        • Source chain
        • Destination chain
      • TVM and TON
      • Solana
    • Fee management
    • Code examples
    • Multi-Owner (Sender) System
  • Advanced
    • Best practices
    • Asset transfer
    • Debugging
  • Technical reference
    • Mainnet
    • Testnet
    • Smart contract audits
    • SDK
Powered by GitBook
On this page
  • Contract deployment
  • Adding Trusted Addresses
  • Sending cross-chain messages
  1. Guides
  2. Getting started
  3. 1. Deploy your smart contracts

AsterizmDemo contract

Deployment and Configuration of the Basic Protocol Demo Contract

Previous1. Deploy your smart contractsNextClient contracts implementation logic

Last updated 6 months ago

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):

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

  1. Add the obtained addresses to the list of trusted addresses on each network.

  2. Send a message containing text from one network to another.

Contract deployment

Here are console commands for simplified deployment

EVM

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

The command accepts the following parameters:

  • feeTokenAddress - optional parameter: token address for transfer commission payment

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):

Deployment was done.

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

TVM

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

The command accepts the following parameters:

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):

Deployment was done.

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

TON

Coming soon

Solana

Build programs:

anchor build

Deploy demo program:

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):

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

The command accepts the following parameters:

  • 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):

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:

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):

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.

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)

EVM

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

The command accepts the following parameters:

  • contractAddress - mandatory parameter: the address of the demo contract in the current network

  • 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:

Added trusted address successfully

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

TVM

npx locklift run --script ./scripts/deploy_singletrustedaddress_task.ts --contractAddress {contractAddress} --trustedChainId {trustedChainId} --trustedAddress {trustedAddress} --network {networkName}

The command accepts the following parameters:

  • contractAddress - mandatory parameter: the address of the demo contract in the current network

  • 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:

Added trusted address successfully

Target contract address: 0:d70fd67d3de5f447b35d79a9c51b9d721c45c9eabdf9cafdd894fa17425bea9f
Transfer hash: e32ee9f05ff5093ec031b831ccd60019f7d1b265f8052843cd5670ad41feb855

TON

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

The command accepts the following parameters:

  • 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:

Done!

Solana

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:

  • 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

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

The command accepts the following parameters:

  • contractAddress - mandatory parameter: the address of the demo contract in the source network

  • message - mandatory parameter: the text that will be transmitted from the source network to the destination network

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

Message sent successfully

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

TVM

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

The command accepts the following parameters:

  • contractAddress - mandatory parameter: the address of the demo contract in the source network

  • message - mandatory parameter: the text that will be transmitted from the source network to the destination network

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

Message sent successfully

Target contract address: 0:d70fd67d3de5f447b35d79a9c51b9d721c45c9eabdf9cafdd894fa17425bea9f
Transfer hash: ba52f4de4b423692e67a361a271f1edd7384f60aaf5e06404a27f7df0257bfdc

TON

Coming soon

Solana

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:

  • 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.

Deploy the contracts to the required networks and obtain their addresses. This can be done on both , and

initializerAddress - mandatory parameter: the address of the initializer on the network. You can review the list of available addresses on the respective pages ( or )

relayAddress - optional parameter: the address of an external relay. You will be able to review the list of available external relays on the

networkName - mandatory parameter: the name of the network to which the contract is deployed. You can explore the list of available networks .

initializerAddress - mandatory parameter: the address of the initializer on the network. You can review the list of available addresses on the respective pages ( or )

relayAddress - optional parameter: the address of an external relay. You will be able to review the list of available external relays on the

networkName - mandatory parameter: the name of the network to which the contract is deployed. You can explore the list of available networks

localChainId - mandatory parameter: local chain ID. You can review the list of available networks on the corresponding pages ( or )

trustedChainId - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ( or )

networkName - mandatory parameter: the name of the source network. You can check the list of available networks .

trustedChainId - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ( or )

networkName - mandatory parameter: the name of the source network. You can check the list of available networks .

trustedChainId - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ( or )

trustedChainId - mandatory parameter: the ID of the network of the trusted address. You can review the list of available networks on the corresponding pages ( or )

destinationChainId - mandatory parameter: the ID of the destination network. You can review the list of available networks on the corresponding pages ( or )

networkName - mandatory parameter: the name of the source network. You can check the list of available networks

trustedChainId - mandatory parameter: the ID of the destination network. You can review the list of available networks on the corresponding pages ( or )

networkName - mandatory parameter: the name of the source network. You can check the list of available networks

dstChainId - mandatory parameter: destination chain ID. You can review the list of available networks on the corresponding pages ( or )

Testnet
Mainnet
Mainnet
Testnet
respective page
here
Mainnet
Testnet
respective page
here
Mainnet
Testnet
Mainnet
Testnet
here
Mainnet
Testnet
here
Mainnet
Testnet
Mainnet
Testnet
Mainnet
Testnet
here
Mainnet
Testnet
here
Mainnet
Testnet
https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemo.sol
EVM base demo contract
https://github.com/Asterizm-Protocol/asterizm-contracts-evm/blob/master/contracts/demo/AsterizmDemoUpgradeableV1.sol
EVM upgradeable demo contract
asterizm-contracts-tvm/contracts/demo/AsterizmDemo.tsol at master · Asterizm-Protocol/asterizm-contracts-tvmGitHub
TVM demo contract
asterizm-contracts-ton/contracts/demo/AsterizmDemo.tsol at master · Asterizm-Protocol/asterizm-contracts-tonGitHub
TON demo contract
asterizm-contracts-sol/programs/asterizm-value-example at master · Asterizm-Protocol/asterizm-contracts-solGitHub
Solana demo program
Logo
Logo
Logo