Documentation

Create Your First Token

Create Your First Token

Learn how to create and deploy your first blockchain token using MAS Hub.

Token Standards

MAS Hub supports multiple token standards:

- **ERC-20**: Fungible tokens (currencies, utility tokens) - **ERC-721**: Non-fungible tokens (NFTs, unique assets) - **ERC-1155**: Multi-token standard (gaming, mixed assets)

Creating an ERC-20 Token

Let's create a simple ERC-20 token:

```javascript import { MasHubClient } from '@mashub/sdk'

const client = new MasHubClient({ apiKey: process.env.MASHUB_API_KEY, network: 'testnet' })

const token = await client.tokens.create({ name: "My First Token", symbol: "MFT", totalSupply: "1000000", decimals: 18, standard: "ERC-20", metadata: { description: "My first token created with MAS Hub", website: "https://myproject.com", logo: "https://myproject.com/logo.png" } })

console.log('Token created:', token.contractAddress) ```

Creating an NFT Collection

For NFTs, you'll need additional metadata:

1const nftCollection = await client.tokens.create({
2  name: "My NFT Collection",
3  symbol: "MNC",
4  standard: "ERC-721",
5  maxSupply: 10000,
6  baseURI: "https://api.myproject.com/metadata/",
7  royaltyPercentage: 5,
8  royaltyRecipient: "0x742d35Cc6634C0532925a3b8D"
9})

Deployment Process

1. **Validation**: Contract code is validated 2. **Compilation**: Smart contract is compiled 3. **Deployment**: Contract is deployed to blockchain 4. **Verification**: Contract is verified on block explorer

Monitoring Deployment

Track your deployment status:

```javascript const status = await client.tokens.getDeploymentStatus(token.deploymentId)

switch(status.status) { case 'pending': console.log('Deployment in progress...') break case 'completed': console.log('Token deployed at:', status.contractAddress) break case 'failed': console.error('Deployment failed:', status.error) break } ```

Next Steps