Skip to main content

Neutron

Overview​

Neutron (chain ID neutron-1) is one of the two chains Astroport runs on, and the home of the ASTRO token. The tutorials use CosmJS, which works with Neutron's default settings.

SettingValue
Chain IDneutron-1
Address prefixneutron
HD pathm/44'/118'/0'/0/0 (coin type 118, the CosmJS default)
Fee denomuntrn
RPChttps://neutron-rpc.polkachu.com
REST (LCD)https://neutron-api.polkachu.com
Explorerhttps://neutron.celat.one/neutron-1/contracts/<address> (contracts), https://www.mintscan.io/neutron/address/<address> (accounts)

The endpoints are public and run by a third party. For production, run your own node or pick a provider from the Cosmos chain registry. Neutron's minimum gas price changes over time; you can read it from the REST endpoint at /feemarket/v1/gas_price/untrn.

Assets on Neutron​

AssetDenom
NTRNuntrn
ASTROfactory/neutron1ffus553eet978k024lmssw0czsxwr97mggyv85lpcsdkft8v9ufsz3sa07/astro
USDC (Noble)ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81

ASTRO is a tokenfactory denom. Its admin is the ASTRO burner contract, which can only burn, so no new ASTRO can be minted. xASTRO on Neutron is retired and can't be staked or redeemed.

Connecting with CosmJS​


_16
import { CosmWasmClient, SigningCosmWasmClient } from "@cosmjs/cosmwasm-stargate";
_16
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
_16
import { GasPrice } from "@cosmjs/stargate";
_16
_16
const rpc = "https://neutron-rpc.polkachu.com";
_16
_16
// Queries
_16
const client = await CosmWasmClient.connect(rpc);
_16
_16
// Transactions
_16
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(process.env.MNEMONIC, {
_16
prefix: "neutron",
_16
});
_16
const signingClient = await SigningCosmWasmClient.connectWithSigner(rpc, wallet, {
_16
gasPrice: GasPrice.fromString("0.0053untrn"),
_16
});

Querying a Contract​


_4
const router = "neutron1xuh7nqt486gkvkxdwt773fzs5uptxy0ylzehm3spq7rx8r2kaspqzu0hv6"; // Router 2.0.0
_4
_4
const config = await client.queryContractSmart(router, { config: {} });
_4
console.log(config); // { astroport_factory: "neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e" }

Executing a Message​

See Swapping with CosmJS for a complete swap on Neutron. Every execute call has the same shape:


_11
const [{ address: sender }] = await wallet.getAccounts();
_11
_11
// execute(sender, contract, msg, fee, memo, funds)
_11
const result = await signingClient.execute(
_11
sender,
_11
"<contract-address>",
_11
{ some_message: {} },
_11
"auto",
_11
"",
_11
[{ denom: "untrn", amount: "1000000" }] // native coins to attach, if any
_11
);

Some Neutron pools are withdraw-only (exit-only) and refuse swaps and deposits. See Providing/Withdrawing Liquidity for the list.