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):
To complete the full configuration, you need to perform the following steps:
Add the obtained addresses to the list of trusted addresses on each network.
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:
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
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.
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:
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
networkName - mandatory parameter: the name of the network to which the contract is deployed. You can explore the list of available networks here
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.
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
networkName - mandatory parameter: the name of the source network. You can check the list of available networks here.
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
networkName - mandatory parameter: the name of the source network. You can check the list of available networks here.
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
networkName - mandatory parameter: the name of the source network. You can check the list of available networks here
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
networkName - mandatory parameter: the name of the source network. You can check the list of available networks here
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.
Last updated