Contract APIs

The Contract API provides a comprehensive suite of tools and features for developers to streamline the creation, management, and distribution of NFTs.

The Alpha Engine Contract API offers you a set of endpoints that allows you to manage your own collection of standardized blockchain NFTs. You can create collections (contracts) and create cool NFTs with pictures and animations on different blockchains. Plus, you can send these NFTs straight to your users' wallets.

You also have the ability to mint dynamic NFTs. Gone are the days of static, unchanging digital assets; now, creators can infuse their NFTs with dynamic elements that evolve, respond to external triggers, and provide an entirely new level of engagement for collectors and end-users.

Key features that the Wallet API provides include:

FeaturesDescription
Minting ServiceIt offers the functionality to instantly mint and transfer NFTs directly to your users' wallets. This streamlines the NFT distribution process.
Token StandardFor Smart Contract (Collection) creation we support ERC-721 standard.
Customized NFTsYou can specify metadata and attributes for each NFT, enabling you to provide additional information and customization for your NFTs.
Integration with other MarketplacesThe NFTs minted through this API can be seamlessly integrated with various NFT marketplaces, decentralized applications (dApps), and other blockchain-based services, thanks to adherence to established token standards (ERC-721).

To get started, you need an API key, which serves as your access token to Alpha Engine's APIs.

What we cover in this guide

In this guide we will explain how to creating your first NFT. We will walk you through several endpoints to help you get started. We will cover the following topics:

  • How to create a contract
  • How to upload token image
  • How to create token
  • How to batch mint tokens ( 🎉 ) state-of-art tech

Prerequisites:

You need an API key, which serves as your access token to Alpha Engine's APIs.

1. Creating a Smart Contract

Let's start by defining your first contract. This contract will represent a collection for the NFTs. We will create a contract on the Polygon (MATIC) testnet chain.

Request Endpoint:

1POST {{BASE_URL}}/contracts

Request Body:

ParameterDescriptionTypeRequired
nameThe name of your NFT collection / contractStringYES
symbolUnique short-key assigned to a contract on blockchainStringYES
chainThis is the blockchain on which you want to create the contract onStringYES

Example:

1{
2    "name": "Alpha Launch",
3    "symbol" : "ATL",
4    "chain" : "polygonMumbai"
5}

After creating your first contract, save the id we will use it later in the guide.

Note: Smart contract deployment notifications will be sent through a webhook which includes the contract address.

2. Upload Token Image

Now, you will need to upload the token image to alpha-vault that will be used to store the asset images just like an IPFS storage.

Request Endpoint:

1POST {{BASE_URL}}/files

Request Body ( form-data ):

ParameterDescriptionTypeRequired
fileimage / png that will serve as an asset.FileYES

Response:

1{
2    "success": true,
3    "responseStatus": "OK",
4    "message": "Request processed successfully.",
5    "data": {
6        "key": "nft-origin/1702547453128-01HHKVRX68Y737T08F0EW69XXD.png",
7        "mimetype": "image/png",
8        "src": "https://alphatrend-marketplace-development.s3.us-east-2.amazonaws.com/nft-origin/1702547453128-01HHKVRX68Y737T08F0EW69XXD.png",
9        "size": 953470,
10        "organization": "your_organization_id",
11        "_id": "657acffd3c98dbaed41d5816",
12        "createdAt": "2023-10-10T09:50:53.286Z",
13        "updatedAt": "2023-10-10T09:50:53.286Z",
14        "__v": 0
15    }
16}

3. Create Token template

Now let's create the token for the image you just uploaded.

To create new token, use the following endpoint. Enter the id (image_id) of your asset image and execute the request. This will create a new token in draft mode.

Note: Tokens get listed on the blockchain upon minting not before so you can safely able to delete as well.

Request Endpoint:

1POST {{BASE_URL}}/tokens

Request Body:

ParameterDescriptionTypeRequired
nameThe name of the token-typeStringYES
descriptionThe description of the token-typeStringYES
imageThe file id for the token image asset uploadedStringYES
contractContract ID for which this token is createdStringYES
attributesarray with json pair of ( trait_type, value )ArrayNO
creator_nameName of the token creatorStringNO
creator_image_urlCreator Image File IDStringNO

Example Request:

1{
2    "name": "Legend #12",
3    "description": "legend token description",
4    "image": "{{file}}",
5    "attributes": [
6        {
7            "trait_type": "Popularity",
8            "value": "85%"
9        }
10    ],
11    "contract": "{{contract}}"
12}

4. Minting Token

The last step is the actual minting of the tokens. These create a token on the blockchain, using the template (token-type) defined in the previous step.

When minting a token, you can immediately provide a destination. The freshly created tokens will be immediately sent to the requested destination.

( 🎉 ) state-of-art tech our batch-mint endpoint

Request Endpoint:

1{{BASE_URL}}/tokens/batch-mint
ParameterDescriptionTypeRequired
contractContract ID for which this token is createdStringYES
wallet_addressdestination wallet address for mintingStringYES
tokensSet of Token IDSArrayYES

Request Body:

1{
2    "contract": "{{contract}}",
3    "wallet_address": "{{destination_wallet_Address}}",
4    "tokens": [
5        "{{token_id_1}}",
6        "{{token_id_2}}"
7    ]
8}

Happy Coding !!