Damian Nolan
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Agoric ↔ Pooltoy IBC Testnet [WIP] ## Hardware Requirements Two new virtual machines are required in order to create a validator node for the Agoric Devnet and a Hermes Relayer to enable interoperability with the existing Pooltoy application. VMs can be hosted via DigitalOcean Droplets. The following specifications are recommended: - 2vCPU - 4GB Memory - 80GB SSD Storage - Region AMS3 **NOTE:** Region AMS3 is not a requirement however to make use of an existing VPC network this was chosen. ## Agoric Validator Guide for Devnet https://github.com/Agoric/agoric-sdk/wiki/Validator-Guide-for-Devnet Following the documentation above an Agoric Validator node can be created and synced with the network. The link provides extensive steps on configuring a system with all prerequisite dependencies required to get up and running. **Caveat**: When running the `create-validator` transaction command the `--pubkey` option arg should be replaced with `$(ag-chain-cosmos tendermint show-validator)` For example: ``` # Set the chainName value chainName=`curl https://devnet.agoric.net/network-config | jq -r .chainName` ag-cosmos-helper tx staking create-validator \ --amount=50000000ubld \ --broadcast-mode=block \ --pubkey=$(ag-chain-cosmos tendermint show-validator) \ --moniker=ibc-dev-sandbox \ --commission-rate="0.10" \ --commission-max-rate="0.20" \ --commission-max-change-rate="0.01" \ --min-self-delegation="1" \ --from=ibc-dev-sandbox \ --chain-id=$chainName \ --gas=auto \ --gas-adjustment=1.4 ``` #### Exposing RPC endpoints for Relayers Open and edit the application `config.toml` for `agoricdev-3` and update the RPC listen address from `127.0.0.1:26657` to `0.0.0.0:26657`. The `config.toml` can be found at the following path: `~/.ag-chain-cosmos/config/config.toml` This can also be achieved with the following `sed` command. ``` sed -i -e 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.ag-chain-cosmos/config/config.toml ``` #### Streaming logs ``` journalctl -f -u ag-chain-cosmos.service ``` ## Hermes Relayer ### Prerequisites Here you can find installation instructions to prepare your DigitalOcean Droplet for the Hermes Relayer. #### Install Rust Following the [official Rust documentation](https://www.rust-lang.org/tools/install) install Rust using `rustup`. ``` curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ``` #### Install other dependencies A number of other dependencies are required in order to build and install the Hermes Relayer. For example, a C linker is required for some dependencies of Hermes which can be obtained via `build-essentials` on Ubuntu 20.04. ``` sudo apt install build-essentials libssl-dev pkg-config ``` #### Install Hermes via Cargo Here you can install the Hermes Relayer using `cargo`, the default Rust package manager. ``` cargo install ibc-relayer-cli --bin hermes --locked ``` #### Install specific version of Hermes from source **NOTE:** When using the latest version of Hermes: `v0.7.0`, a number of warning logs are displayed, expressing potential compatibility issues with Cosmos SDK versions. This can be avoided by using an older version of Hermes. Build from source by cloning the repository and checking out your desired release version. ``` git clone https://github.com/informalsystems/ibc-rs && cd ibc-rs/relayer-cli git checkout v0.5.0 cargo build ``` It may be desirable to create an alias for alternative binaries, for example: `hermesv0.5.0` ### Configuring Hermes Some intro words... [Hermes](https://hermes.informal.systems/) is a Rust implementation of a relayer for the [Inter-Blockchain Communication (IBC)](https://ibcprotocol.org/) protocol. > The Inter-Blockchain Communication protocol is an end-to-end, connection-oriented, stateful protocol for reliable, ordered, and authenticated communication between modules on separate distributed ledgers. In order to establish connectivity between two different blockchains or zones we must first restore keys for wallets on both networks. Any wallet can be used as long as it contains sufficient funds. #### Restoring Keys In order to restore keys for Agoric wallets a key derivation path option must be specified when using Hermes. This can be done using `-p` or `--hd-path` flag with Hermes in the format: `m/44'/118'/0'/0/0` ##### Key Derivation Paths As specified in [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki) an appropriate Key Derivation Path must be used in order to reproduce a deterministic HD wallet address. The following format is employed: ``` m / purpose' / coin_type' / account' / change / address_index ``` [Click here for a synopsis](https://ethereum.stackexchange.com/a/70029) The Agoric network uses a CoinType of `564` whereas above, the default being used by Hermes is `118` (atom). For a detailed list of CoinType: [SLIP-0044 : Registered coin types for BIP-0044 ](https://github.com/satoshilabs/slips/blob/master/slip-0044.md) Restore keys for relayer wallet on `agoricdev-3`: ``` hermes keys restore agoricdev-3 -p "m/44'/564'/0'/0/0" -m $MNEMONIC ``` Restore keys for relayer wallet on `pooltoy-6`: ``` hermes keys restore pooltoy-6 -m $MNEMONIC ``` Hermes Configuration: *Note the use of private IP addresses for connectivity as all nodes are in the `default-ams3` VPC.* ``` [global] strategy = 'all' filter = false log_level = 'trace' clear_packets_interval = 100 [telemetry] enabled = false host = '127.0.0.1' port = 3001 [[chains]] id = 'agoricdev-3' rpc_addr = 'http://10.110.0.3:26657' grpc_addr = 'http://10.110.0.3:9090' websocket_addr = 'ws://10.110.0.3:26657/websocket' rpc_timeout = '10s' account_prefix = 'agoric' key_name = 'testkey' store_prefix = 'ibc' max_gas = 3000000 gas_price = { price = 0.001, denom = 'urun' } gas_adjustment = 0.1 clock_drift = '5s' trusting_period = '14days' [chains.trust_threshold] numerator = '1' denominator = '3' [[chains]] id = 'pooltoy-6' rpc_addr = 'http://10.110.0.2:26657' grpc_addr = 'http://10.110.0.2:9090' websocket_addr = 'ws://10.110.0.2:26657/websocket' rpc_timeout = '10s' account_prefix = 'cosmos' key_name = 'testkey' store_prefix = 'ibc' max_gas = 3000000 gas_price = { price = 0.001, denom = 'stake' } gas_adjustment = 0.1 clock_drift = '5s' trusting_period = '14days' [chains.trust_threshold] numerator = '1' denominator = '3' ``` ### Clients, Connections & Channels - Enabling IBC In order to enable IBC transfer functionality between two chains we must create the associated IBC entities that enable the protocol semantics of the IBC transport authetication and ordering layer (TAO), and subsequently enable the transfer application via it's associated port identifier. [Read more about the IBC protocol specification](https://github.com/cosmos/ibc) - Creation of IBC clients, for example: [Tendermint Lightclient](https://medium.com/tendermint/everything-you-need-to-know-about-the-tendermint-light-client-f80d03856f98) - Establishing IBC connections between zones - Configuring channels with the associated port identifiers **Caveat**: The Agoric platform provides a javascript VM for smart contracts and binds the `transfer` port identifier to a handler that uses the "Pegasus" JS transfer protocol. To enable generic IBC transfer functionality Agoric binds to `cosmos-transfer`. [Hermes CLI Documentation](https://hermes.informal.systems/index.html) ``` # create new clients hermesv0.5.0 create client agoricdev-3 pooltoy-6 # creates a new connection using new clients hermesv0.5.0 create connection agoricdev-3 pooltoy-6 # creates a new connection using existing clients hermesv0.5.0 create connection ibc-0 --client-a 07-tendermint-0 --client-b 07-tendermint-0 # create a new ics20 transfer channel to agoric using an existing connection # note: cosmos-transfer as the port identifier hermesv0.5.0 create channel agoricdev-3 --connection-a connection-4 --port-a cosmos-transfer --port-b transfer -o unordered -v "ics20-1" # start hermes in the background a redirect to ~/.hermes/hermes.log # note: would be nice to run with systemctl hermesv0.5.0 start > ~/.hermes/hermes.log 2>&1 & ``` ### IBC Transfers ``` - TODO: Add example CLI commands, transfer emojis, slackbot integration...etc ``` ![](https://i.imgur.com/CjLwRVB.png) --- ### Troubleshooting Notes Networking and dealing with pain and anguish... When debugging gRPC connectivity grpcurl is recommended as it can be used to query the reflection service and describe available grpc endpoints: ``` grpcurl -plaintext $HOSTNAME:$PORT list ``` Exposing port 9090 for gRPC via iptables ``` iptables -A INPUT -p tcp --dport 9090 -j ACCEPT ``` --- ### Current Path Topology | Chain ID | Client ID | Connection ID | Channel ID | | -------- | -------- | -------- | -------- | | pooltoy-6 | 07-tendermint-2 | connection-0 | channel-1 | agoricdev-3 | 07-tendermint-4 | connection-4 | channel-4 ``` Success: Channel { ordering: Unordered, a_side: ChannelSide { chain: ProdChainHandle { chain_id: ChainId { id: "agoricdev-3", version: 3, }, runtime_sender: Sender { .. }, }, client_id: ClientId( "07-tendermint-4", ), connection_id: ConnectionId( "connection-4", ), port_id: PortId( "cosmos-transfer", ), channel_id: Some( ChannelId( "channel-4", ), ), }, b_side: ChannelSide { chain: ProdChainHandle { chain_id: ChainId { id: "pooltoy-6", version: 6, }, runtime_sender: Sender { .. }, }, client_id: ClientId( "07-tendermint-2", ), connection_id: ConnectionId( "connection-0", ), port_id: PortId( "transfer", ), channel_id: Some( ChannelId( "channel-1", ), ), }, connection_delay: 0ns, version: Some( "ics20-1", ), } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully