# Deploy BEP-20 Token on chain

### Configure Truffle for the Memeseco Network

{% hint style="info" %}
Open the `truffle-config.js` file and add the following network configuration:
{% endhint %}

```
// truffle-config.js
const HDWalletProvider = require('@truffle/hdwallet-provider');

const mnemonic = 'your mnemonic phrase here'; // Add your mnemonic phrase for your wallet

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*",
    },
    Memeseco: {
      provider: () => new HDWalletProvider(mnemonic, 'https://rpc.memeseco.com'),
      network_id: 6666,
      gas: 5500000,
      gasPrice: 10000000000,
      confirmations: 2,
      timeoutBlocks: 200,
      skipDryRun: true
    },
  },
  compilers: {
    solc: {
      version: "^0.8.0"
    }
  }
};
```

### Create this contract sample

```
// contracts/CustomToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract CustomToken is ERC20 {
    constructor() ERC20("Memeseco Token", "$MMM") {
        _mint(msg.sender, 1000000 * 10**decimals());
    }
}
```

### Deploy this token

```
truffle migrate --network Memeseco
```

### Configure Hardhat for the Memeseco Network

{% hint style="info" %}
Open the `hardhat.config.js` file and add the following configuration for the custom network:
{% endhint %}

```
// hardhat.config.js
require("@nomiclabs/hardhat-waffle");
require("dotenv").config();

const customRpcUrl = "https://rpc.memeseco.com"; // memeseco custom RPC URL
const customChainId = 6666; // Chain ID for memeseco
module.exports = {
  defaultNetwork: "hardhat",
  networks: {
    hardhat: {},
    Memeseco: {
      url: customRpcUrl,
      chainId: customChainId,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
  solidity: {
    version: "0.8.0",
    settings: {
      optimizer: {
        enabled: true,
        runs: 200,
      },
    },
  },
};

```

### Create this contract sample

```
// contracts/CustomToken.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract CustomToken is ERC20 {
    constructor() ERC20("Memeseco Token", "$MMM") {
        _mint(msg.sender, 1000000 * 10**decimals());
    }
}

```

### Deploy this token

{% hint style="info" %}
Create a new file named `deploy.js` inside the `scripts` directory, and add the following content:
{% endhint %}

```
// scripts/deploy.js
async function main() {
  const [deployer] = await ethers.getSigners();
  console.log("Deploying contracts with the account:", deployer.address);

  const CustomToken = await ethers.getContractFactory("CustomToken");
  const customToken = await CustomToken.deploy();

  console.log("CustomToken contract address:", customToken.address);
}

main()
  .then(() => process.exit(0))
  .catch((error) => {
    console.error(error);
    process.exit(1);
  });

```

```
npx hardhat run scripts/deploy.js --network memeseco
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://memeseco.gitbook.io/memeseco/memeseco-products/deploy-bep-20-token-on-chain.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
