This project is a simple Node.js application that generates metadata for Ceylon Crypto Meetup NFTs. The metadata includes details about the event, ticket type, and other relevant information. It also fetches the current block height from Mempool.space and includes it in the metadata.
- Node.js (version 14 or higher)
- An Ethereum network (mainnet or testnet)
- Alchemy API key (for connecting to the Ethereum network)
- Contract ABI (Application Binary Interface)
- Clone the repository: git clone https://github.com/your-username/ceylon-crypto-meetup-nft-metadata-generator.git
Edit Full Screen Copy code
- Navigate to the project directory: cd ceylon-crypto-meetup-nft-metadata-generator
Edit Full Screen Copy code
- Install the dependencies: npm install
Edit Full Screen Copy code
- Create a
.env
file in the project root directory and add the following variables: NETWORK=<your_network> ALCHEMY_API_KEY=<your_alchemy_api_key>
Edit Full Screen Copy code
Replace <your_network>
with the desired Ethereum network (mainnet or testnet) and <your_alchemy_api_key>
with your Alchemy API key.
To start the server, run the following command: npm start
Edit Full Screen Copy code
The server will start on http://localhost:3002
.
The application interacts with a smart contract deployed on the Ethereum network. The contract address and ABI are defined in the generateNFTMetadata
function.
The application exposes two API endpoints:
/create-metadata
: A POST endpoint for creating NFT metadata. It accepts a JSON payload with the following fields:
id
: The unique ticket IDticketType
: The type of ticket (e.g., 'General Admission', 'VIP')userAddress
: The Ethereum address of the ticket holder
The endpoint returns a JSON response with the generated metadata.
/metadata/:id
: A GET endpoint for fetching existing NFT metadata. It accepts a ticket ID as a URL parameter and returns the corresponding metadata as a JSON response.
This project is licensed under the MIT License. See the LICENSE file for details.