# Setting Up Environment

You need an environment to run contracts. You can either run your node locally or connect to an existing network. For easy testing, long living coral network is online, you can use it to deploy and run your contracts. If you want to setup and run against a local blockchain, click here

To verify testnet is currently running, make sure the following URLs are all working for you:

We have set up two native tokens - REEF (ureef) for being a validator and SHELL (ushell) for paying fees. Available frontends:

You can use these to explore txs, addresses, validators and contracts feel free to deploy one pointing to our rpc/lcd servers and we will list it.

You can find more information about other testnets: CosmWasm/testnets (opens new window) and Testnet section.

When interacting with network, you can either use coral which is a Go client or Node REPL. Altough Node REPL is recommended for contract operations, since JSON manipulation is not intuitive with the Shell/Go client.

# Setup Go CLI

Let's configure coral exec, point it to testnets, create wallet and ask tokens from faucet:

First source the coral network configurations to the shell:

Copy source <(curl -sSL https://raw.githubusercontent.com/CosmWasm/testnets/master/coralnet/defaults.env)

Setup the client:

Copy coral config chain-id $CHAIN_ID coral config trust-node true # if connecting to local node: coral config node http://localhost:26657 coral config node $RPC coral config output json coral config indent true # this is important, so the cli returns after the tx is in a block, # and subsequent queries return the proper results coral config broadcast-mode block # check you can connect coral query supply total coral query staking validators coral query wasm list-code # add more wallets for testing coral keys add fred > { "name": "fred", "type": "local", "address": "coral1avdvl5aje3zt0uay40uj6l9xtqtlqhduu84nql", "pubkey": "coralpub1addwnpepqvcjveqepq34x59fnmygdy58ag7zwu8gefgsprq9th38nxzptpgszc3rkve", "mnemonic": "hobby bunker rotate piano satoshi planet network verify else market spring toward pledge turkey tip slim word jaguar congress thumb flag project chalk inspire" } coral keys add bob coral keys add thief

You need some tokens in your address to interact. If you are using local node you can skip this step. Requesting tokens from faucet:

Copy JSON=$(jq -n --arg addr $(coral keys show -a fred) '{"ticker":"SHELL","address":$addr}') && curl -X POST --header "Content-Type: application/json" --data "$JSON" https://faucet.coralnet.cosmwasm.com/credit JSON=$(jq -n --arg addr $(coral keys show -a thief) '{"ticker":"SHELL","address":$addr}') && curl -X POST --header "Content-Type: application/json" --data "$JSON" https://faucet.coralnet.cosmwasm.com/credit

# Setup Node REPL

Beyond the standard CLI tooling, we have also produced a flexible TypeScript library CosmJS (opens new window), which runs in Node.js as well as in modern browsers and handles queries and submitting transactions. Along with this library, we produced @cosmjs/cli (opens new window), which is a super-charged Node console. It supports await, does type checking for helpful error messages, and preloads many CosmJS utilities. If you are comfortable with the Node console, you will probably find this easier and more powerful than the CLI tooling.

Full usage and installation instructions are on the README (opens new window), also here are the source codes prepacked with network configurations you can use on-the-fly:

Copy ## CORALNET npx @cosmjs/cli@^0.22 --init https://raw.githubusercontent.com/CosmWasm/testnets/master/coralnet/cli_helper.ts

Using the REPL:

Copy // Create or load account const mnemonic = loadOrCreateMnemonic('fred.key') mnemonicToAddress('coral', mnemonic) const { address, client } = await connect(mnemonic, {}) address client.getAccount() // if empty - this only works with CosmWasm hitFaucet(defaultFaucetUrl, address, 'SHELL') client.getAccount()

# Run Local Node (optional)

If you are interested in running your local network you can use the script below:

Copy # default home is ~/.wasmd # if you want to setup multiple apps on your local make sure to change this value APP_HOME="~/.wasmd" CLI_HOME="~/.wasmcli" # initialize wasmd configuration files wasmd init localnet --chain-id localnet --home ${APP_HOME} # add minimum gas prices config to app configuration file sed -i -r 's/minimum-gas-prices = ""/minimum-gas-prices = "0.025ucosm"/' ${APP_HOME}/config/app.toml # setup client wasmcli config chain-id localnet --home ${CLI_HOME} wasmcli config trust-node true --home ${CLI_HOME} wasmcli config node http://localhost:26657 --home ${CLI_HOME} wasmcli config output json --home ${CLI_HOME} # add your wallet addresses to genesis wasmd add-genesis-account $(wasmcli keys show -a fred) 10000000000ucosm,10000000000stake --home ${APP_HOME} wasmd add-genesis-account $(wasmcli keys show -a thief) 10000000000ucosm,10000000000stake --home ${APP_HOME} # add fred's address as validator's address wasmd gentx --name fred --home ${APP_HOME} # collect gentxs to genesis wasmd collect-gentxs --home ${APP_HOME} # validate the genesis file wasmd validate-genesis --home ${APP_HOME} # run the node wasmd start --home ${APP_HOME}