Deploying Your First OP_20 Token on OP_NET

In this guide, you’ll learn how to deploy your first OP_20 token on the OP_NET metaprotocol. OP_20 is a token standard built on top of the Bitcoin network via OP_NET, enabling you to create and manage your own tokens within the OP_NET ecosystem.


Step 1: Clone the OP_20 Template Repository

First, clone the OP_20 template repository to get the contract code.

git clone https://github.com/btc-vision/OP_20.git
cd OP_20

Step 2: Install Dependencies

Install the required dependencies using npm or yarn.

npm install
# or
yarn install

This will install everything needed to build and deploy your token contract.


Step 3: Configure Your Token

Once the dependencies are installed, customize your token by editing key properties such as maxSupply, decimals, name, and symbol in the MyToken.ts file.

Example configuration:

const maxSupply: u256 = u128.fromString('100000000000000000000000000').toU256(); // Your max supply.
const decimals: u8 = 18; // Your decimals.
const name: string = 'Test'; // Your token name.
const symbol: string = 'TEST'; // Your token symbol.

Step 4: Build the Token Contract

After configuring the token details, build the contract:

npm run build
# or
yarn build

This command will generate the compiled contract .wasm file in the build folder, ready for deployment.


Step 5: Deploy the Token Contract

Once the contract is built, you can deploy it using the OP_WALLET extension. Follow these steps:

  • Open OP_WALLET and select the "deploy" option.

  • Load the .wasm file generated in the build folder.

  • Confirm the transaction to deploy the token on OP_NET, which runs on top of the Bitcoin network.


Step 6: Add Liquidity on Motoswap

Now that your tokens are minted, you can make them tradable by adding liquidity on Motoswap:

  1. Copy the token address from your OP_WALLET.

  2. Go to the Motoswap pool creation section and paste your token address into the input field.

  3. Select the other token for the liquidity pair (e.g., wBTC).

  4. Enter the amount of each token you wish to provide as liquidity.

  5. Click "Add Liquidity" and confirm the transaction.

Once liquidity is added, your token will be tradable on Motoswap!

Last updated