LogoLogo
  • Introduction
  • Understanding Rujira History
    • Rujira & Kujira
    • Rujira & THORChain
    • Rujira & Levana
  • Understanding RUJI Token
  • HOW IT WORKS
    • Understanding the App Layer
    • Understanding Secured Assets
    • Understanding App Layer Security
    • Frequently Asked Questions
  • Developers
    • Getting Started
      • API & RPC Endpoints
      • Licenses
    • Development Process
    • Local Deployment Guide
    • Stagenet Deployment Guide
    • Review and Audit Guide
    • Setting Up a THORChain Multisig
    • Mainnet Deployment Guide
  • Products
    • RUJI Trade
    • RUJI Pools
      • Base Layer Arbitrage Strategy
    • RUJI Perps
      • Position size versus locked collateral
    • RUJI Lending
    • RUJI Liquidations
    • RUJI Launchpad
    • RUJI Options
    • RUJI Collections (Gojira)
  • Strategies
  • Resources
    • Branding
    • Audits
    • Discord (for Devs)
Powered by GitBook
On this page
  • Install the thornode daemon (macOS)
  • Connect to Stagenet
  • Store & Instantiate a Contract
  • Get assets on stagenet
  • Get RUNE on THORChain Stagenet from AVAX on Avalance
  • 1. Determine the Avalanche inbound address
  • 2. Construct the correct message data
  • 3. Configure MetaMask
  • 4. Send funds
  • 5. Confirm funds received
Export as PDF
  1. Developers

Stagenet Deployment Guide

PreviousLocal Deployment GuideNextReview and Audit Guide

Last updated 6 days ago

Prior to diving into stagenet deployment, make sure to follow the Local Deployment Guide.

Below is a practical guide on how to get started deploying to THORChain’s stagenet, taking inspiration from our friends at who made a similar .

It covers the steps from installing and setting up the daemon to connecting to different chain environments, gettings funds on stagenet, and provides a broad overview of & .

Install the thornode daemon (macOS)

  1. After brew install golang coreutils binutils diffutils findutils gnu-tar gnu-sed gawk grep make git protobuf you need to prioritize the GNU versions and modify your PATH. You’ll find all the commands needed in the installation log of the command before. An example:

PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH" echo 'export PATH="/opt/homebrew/opt/binutils/bin:$PATH"' >> ~/.zshrc export LDFLAGS="-L/opt/homebrew/opt/binutils/lib" export CPPFLAGS="-I/opt/homebrew/opt/binutils/include" PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/gnu-tar/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/gawk/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH" PATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH" echo 'export PATH="/opt/homebrew/opt/postgresql@16/bin:$PATH"' >> ~/.zshrc export LDFLAGS="-L/opt/homebrew/opt/postgresql@16/lib" export CPPFLAGS="-I/opt/homebrew/opt/postgresql@16/include" // reload your shell source ~/.zshrc

# Verify gawk is available which gawk gawk --version

  1. Install Docker: https://www.docker.com/products/docker-desktop/

  2. Add GOBIN to your PATH.

export GOBIN=$GOPATH/bin

  1. Clone Repo

git clone https://gitlab.com/thorchain/thornode.git cd thornode git checkout app/rc1

  1. Install via make command

TAG=stagenet make go-generate openapi install

  1. Verify the correct installation

thornode help

Connect to Stagenet

The Stagenet is THORChain’s permissionless testnet, allowing you to freely test your contract with real money.

  1. Connection Details (see details in API & RPC Endpoints)

    1. Chain-ID: thorchain-stagenet-2

  2. Example commands:

// Query all tokens thornode query bank total-supply --node https://stagenet-rpc.ninerealms.com/ // Execute a transaction thornode tx wasm execute <contract-addr> <json-msg> --from <account> --chain-id stage-1 --node https://stagenet-rpc.ninerealms.com/

Store & Instantiate a Contract

  1. Store the contract:

thornode tx wasm store <wasm file> --from <account> --chain-id stage-1 --node https://stagenet-rpc.ninerealms.com/

  1. Instantiate it

thornode tx wasm instantiate <code Id> <InstantiateMsg> --from <account> --chain-id stage-1 --node https://stagenet-rpc.ninerealms.com/

Get assets on stagenet

Assets on stagenet are “real money” so to get assets to test, you will need to deposit real money (e.g. ATOM), swap some of it to another asset (e.g. RUNE) if you need a pair of assets to test, and then send by interacting with the different apps / contracts you want to test.

If above doesn't work, you can also get RUNE on THORChain via AVAX using below method:

Get RUNE on THORChain Stagenet from AVAX on Avalance

This covers a manual conversion process from AVAX on the Avalance-C chain to RUNE on THORChain Stagenet.

1. Determine the Avalanche inbound address

Find the relevant section, e.g. AVAX:

Find the address field, e.g. 0xd6a6c0b3bb4150a98a379811934e440989209db6

2. Construct the correct message data

Find your deposit address, e.g.: sthor1e2r98hpf3eer8pfpcrsprmrx5vpfq8jpwt06jw

Construct a message using that address of the form: =:THOR.RUNE:sthor1egxvam70a86jafa8gcg3kqfmfax3s0m2ug8gzt

Hex encode that string, e.g.: 3d3a54484f522e52554e453a7374686f723165677876616d37306138366a61666138676367336b71666d6661783373306d32756738677a74

And finally, prepend 0x to that string to match MetaMask expectations: 0x3d3a54484f522e52554e453a7374686f723165677876616d37306138366a61666138676367336b71666d6661783373306d32756738677a74

3. Configure MetaMask

You need to ensure that the “show data” option is enabled under advanced settings:

4. Send funds

You can use any Avalanche-compatible wallet, but in this example we're using MetaMask. You need to set message data, which can only be done in the full screen mode. Open MetaMask and choose expand view:

Initiate a send, and configure the destination address, token, and amount, plus the hex data from above:

5. Confirm funds received

RPC:

API:

Build and optimize your cosmwasm contract, so you have an artifact. A good starting point is this template:

The easiest way to deposit and swap assets on stagenet is to use , which is connected to stagenet:

Deposit: Go to , connect your wallet (Keplr, Ctrl, Leap or whichever you prefer) and hit the Deposit button. You can find the stagenet thor address (sthor….) in the portfolio page:

Swap: Once you’ve made a deposit, you can swap to e.g. RUNE to get on your sthor address using

Go to this URL:

You can use any tool to hex encode data, for example this site:

Broadcast the transaction above:

Take that transaction hash to:

Search for that transaction hash, and you’ll find:

Nami Protocol
Devnet Deployment Guide
Rujira.JS
Rujira.UI
https://stagenet-rpc.ninerealms.com
https://stagenet-thornode.ninerealms.com
https://github.com/CosmWasm/cw-template/tree/main
preview.rujira.network
preview.rujira.network/portfolio
preview.rujira.network/swap/GAIA.ATOM/THOR.RUNE
https://stagenet-thornode.ninerealms.com/thorchain/inbound_addresses
https://www.hexator.com/
https://snowtrace.io/tx/0xae863bd2b4407421ec0882d7eada20ba12cffeec8e93f7e77e22b946a952641e
https://stagenet.thorchain.net/dashboard
https://stagenet.thorchain.net/tx/0xae863bd2b4407421ec0882d7eada20ba12cffeec8e93f7e77e22b946a952641e