# Internet Computer

Source: https://developers.bitgo.com/docs/internet-computer

## Overview

Internet Computer (ICP) is the native asset of the Internet Computer blockchain. It utilizes:

- Account model.
- Threshold ECDSA and Ed25519 signature algorithms for cryptographic operations.

Internet Computer is a blockchain platform designed to host canister-based smart contracts that run at web speed while offering infinite scalability and trustless computing. It eliminates the need for traditional cloud services by executing computations directly on the decentralized network. BitGo implements with ICP using the Rosetta API, since full-node hosting isn't feasible for this chain.

## Explorer

<a href="https://www.icpexplorer.org" target="_blank" rel="noreferrer">https://www.icpexplorer.org</a>

## Wallets Types

BitGo enables holding tao in the following wallet types:

| | Multisig Cold | Multisig Hot | MPC Cold | MPC Hot |
|-| ------------- | ------------ | -------- | ------- |
| **Custody** | ❌ | ❌ | ✅ | ❌ |
| **Self-Custody** | ❌ | ❌ | ✅ | ✅ |

## Ticker Symbols

| Mainnet | Testnet |
| ------- | ------- |
| ICP | TICP |

## Units

Internet Computer is divisible by 10<sup>-8</sup> and the base unit is an eights (e8s):

- 1 Internet Computer = 100,000,000 eights
- 1  eights = 0.00000001 Internet Computer

You can pass balances in string or integer format. However, BitGo recommends using string format to ensure values don't exceed the programmable number limit.

## Tokens

Canisters that follow the ICRC standards implement tokens on the Internet Computer. Each token has its own ledger canister to manage balances and transactions, enabling interoperability across decentralized applications and services on the network.

## Fees

Internet Computer fees are **dynamic**, with no fixed minimum or default rates. Instead of traditional gas fees paid by users, the Internet Computer uses a **reverse gas model**, where **canisters (smart contracts)** pay for computation using a resource unit called **cycles**.

**Reverse Gas Model:**
On the Internet Computer, users interact with decentralized apps (dapps) without needing to pay fees. Instead, **developers are responsible for funding their canisters** by converting **ICP tokens into cycles**. This design offers a seamless Web2-like experience for end users, removing the need for tokens, wallets, or manual approvals.

 **1 trillion cycles = 1 XDR** (approx. $1.33 USD)

## Create Wallet

```shell cURL
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>"
export COIN="ticp"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export LABEL="<DESIRED_WALLET_NAME>"
export PASSPHRASE="<YOUR_BITGO_LOGIN_PASSPHRASE>"
export ENTERPRISE_ID="<YOUR_ENTERPRISE_ID>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/generate \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "label": "'"$LABEL"'",
    "passphrase": "'"$PASSPHRASE"'",
    "enterprise": "'"$ENTERPRISE_ID"'",
    "disableTransactionNotifications": true,
    "disableKRSEmail": true
}'
```
```javascript JavaScript
bitgo
  .coin('ticp')
  .wallets()
  .generateWallet({
    label: 'My Test Wallet',
    passphrase: 'secretpassphrase1a5df8380e0e30',
    multisigType: 'tss'
  })
  .then(function (wallet) {
    // print the new wallet
    console.dir(wallet);
  });
```

## Create Address

You can create receive addresses derived from your root key.

```shell cURL
export COIN="ticp"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"

curl -X POST \
  https://app.bitgo-test.com/api/v2/$COIN/wallet/$WALLET_ID/address \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
```javascript JavaScript
bitgo
  .coin('ticp')
  .wallets()
  .getWallet({ id: '<WALLET_ID>' })
  .then(function (wallet) {
    return wallet.createAddress();
  })
  .then(function (newAddress) {
    // print new address details
    console.dir(newAddress);
  });
```

## Consolidate Balance

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

## Estimate Fee

```shell cURL
export COIN="ticp"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"

curl -X GET \
  https://app.bitgo-test.com/api/v2/$COIN/tx/fee \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN"
```
```js JavaScript
const BitGoJS = require('../../../src/index.js');
const bitgo = new BitGoJS.BitGo({ env: 'test' });
const accessToken = '<YOUR_ACCESS_TOKEN>';
const coin = 'ticp';

async function getFeeEstimate() {
  try {
    await bitgo.authenticateWithAccessToken({ accessToken });
    const res = await bitgo.coin(coin).feeEstimate({ numBlocks: 2 });
    console.dir(res);
  } catch (err) {
    console.error('Error fetching fee estimate:', err);
  }
}

getFeeEstimate();
```

## Transact

```shell cURL
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>"
export COIN="ticp"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export ADDRESS="<DESTINATION_ADDRESS>"
export AMOUNT="<AMOUNT_IN_BASE_UNITS>"
export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/$WALLET_ID/sendcoins \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "address": "'"$ADDRESS"'",
    "amount": "'"$AMOUNT"'",
    "walletPassphrase": "'"$WALLET_PASSPHRASE"'"
}'
```
```shell cURL (send to many)
export BITGO_EXPRESS_HOST="<YOUR_LOCALHOST>"
export COIN="ticp"
export WALLET_ID="<YOUR_WALLET_ID>"
export ACCESS_TOKEN="<YOUR_ACCESS_TOKEN>"
export ADDRESS_1="<DESTINATION_ADDRESS_1>"
export ADDRESS_2="<DESTINATION_ADDRESS_2>"
export AMOUNT_1="<AMOUNT_1_IN_BASE_UNITS>"
export AMOUNT_2="<AMOUNT_2_IN_BASE_UNITS>"
export WALLET_PASSPHRASE="<YOUR_WALLET_PASSPHRASE>"

curl -X POST \
  http://$BITGO_EXPRESS_HOST/api/v2/$COIN/wallet/$WALLET_ID/sendmany \
  -H 'Content-Type: application/json' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -d '{
    "recipients": [
    {
      "address": "'"$ADDRESS_1"'",
      "amount": "'"$AMOUNT_1"'"
    },
    {
      "address": "'"$ADDRESS_2"'",
      "amount": "'"$AMOUNT_2"'"
    }
  ],
    "walletPassphrase": "'"$WALLET_PASSPHRASE"'"
}'
```
```js JavaScript
const tx = await fundedWallet.send({
    address: `<DESTINATION_ADDRESS>`,
    amount: `<AMOUNT>`,
    walletPassphrase: process.env.PASSWORD as string,
  });
```
```js JavaScript (send to many)
let params = {
  recipients: [
    {
      amount: "<AMOUNT_1>",
      address: "<DESTINATION_ADDRESS_1>",
    },
    {
      amount: "<AMOUNT_2>",
      address: "<DESTINATION_ADDRESS_2>",
    },
  ],
  walletPassphrase: "<YOUR_WALLET_PASSPHRASE>",
};
wallet.sendMany(params).then(function (transaction) {
  // Print transaction details
  console.dir(transaction);
});
```
