# Cosmos

Source: https://developers.bitgo.com/docs/cosmos

## Cosmos

Cosmos (Atom) can be accessed with the following coin types:

| Environment         | Coin Type | Faucet                                                                                                                           |
| :------------------ | :-------- | :--------------------------------------------------------------------------------------------------------------------------------|
| Atom Production     | atom      |                                                                                                                                  |
| Atom Testnet        | tatom     | <a href="https://stakely.io/en/faucet/cosmos-atom/" target="_blank" rel="noreferrer">https://stakely.io/en/faucet/cosmos-atom</a>|

### Explorer
<a href="https://www.mintscan.io/cosmos/" target="_blank" rel="noreferrer">https://www.mintscan.io/cosmos/</a>


### Native Asset
The Native asset of Cosmos Hub (the main blockchain in the Cosmos network) is Atom. It's used for staking, governance, and paying transaction fees with Cosmos Hub.

### Generating wallets

To create a Cosmos wallet using BitGoJS:

```javascript
bitgo
  .coin('tatom')
  .wallets()
  .generateWallet({
    label: 'My Test Wallet',
    passphrase: 'secretpassphrase1a5df8380e0e30',
  })
  .then(function (wallet) {
    // print the new wallet
    console.dir(wallet);
  });
```

To create a Cosmos wallet using the platform API:

```shell
LABEL="My Test Wallet"
PASSPHRASE="secretpassphrase1a5df8380e0e30"

curl -X POST \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d "{ \"label\": \"$LABEL\", \"passphrase\": \"$PASSPHRASE\" }" \
http://$BITGO_EXPRESS_HOST/api/v2/tatom/wallet/generate
```

### Creating addresses

```javascript
bitgo
  .coin('tatom')
  .wallets()
  .getWallet({ id: '585c51a5df8380e0e3082e46' })
  .then(function (wallet) {
    return wallet.createAddress();
  })
  .then(function (newAddress) {
    // print new address details
    console.dir(newAddress);
  });
```
```shell
WALLET=585c51a5df8380e0e3082e46

curl -X POST \
-H "Authorization: Bearer $ACCESS_TOKEN" \
https://app.bitgo-test.com/api/v2/tatom/wallet/$WALLET/address
```

### Staking
- Cosmos supports staking. Cosmos uses a delegated proof-of-stake (DPoS) consensus mechanism. Atom holders can stake their tokens to validators.
- Validators participate in consensus to produce new blocks and validate transactions.
- By staking Atoms, holders can earn rewards.

### Balances
Atom is the native asset of Cosmos. The base unit of Atom is `uatom` (microatom).
- 1 Atom = 1,000,000 uatom
- 1 uatom = 0.000001 Atom

To check the balance of a wallet:

```javascript
const address = yield walletInstance.getAddress({ address: 'TTwW9apvyVL9EBqDVeTVDft15hf1Jnkpzy' });
const bal = address.balance;
return bal;
```

### Tokens
Cosmos does not support tokens transactions.

### Consolidation
BitGo supports memo based addresses. Therefore, consolidation is not required.

### Fee rate
The default gas fee is 0.35 uatom
