{ "p": "brc-20", "op": "deploy", "tick": "DCTK", "max": "21000000", "lim": "1000000", "dec": "8", "image": "https://openart.ai/share/d3R2Q05HSFg0TkkyTnV4RFFDOTc7aHR0cHM6Ly9jZG4ub3BlbmFydC5haS91cGxvYWRzL2ltYWdlX2k2cl9uamtiXzE3NDM1Mzk2NzIwMzZfNTEyLndlYnA" }{ "p": "brc-20", "op": "deploy", "tick": "DCTK", "max": "21000000", "lim": "1000000", "dec": "8", "creator": "0xe20f34b84b2af4cc1ea8e3f82e4dfa422fd08302" } { "p": "brc-20", "op": "mint", "tick": "DCTK", "amt": "1000000", "to": "0xe20f34b84b2af4cc1ea8e3f82e4dfa422fd08302" } npm install axios form-data const axios = require('axios'); const FormData = require('form-data'); const fs = require('fs'); const path = require('path'); // Replace with your Pinata API credentials const PINATA_API_KEY = 'YOUR_PINATA_API_KEY'; const PINATA_API_SECRET = 'YOUR_PINATA_API_SECRET'; // Function to upload a file to Pinata async function uploadFile(filePath) { const url = `https://api.pinata.cloud/pinning/pinFileToIPFS`; let data = new FormData(); data.append('file', fs.createReadStream(filePath)); const res = await axios.post(url, data, { maxContentLength: 'Infinity', // for large files headers: { 'Content-Type': `multipart/form-data; boundary=${data._boundary}`, pinata_api_key: PINATA_API_KEY, pinata_secret_api_key: PINATA_API_SECRET, }, }); return res.data.IpfsHash; } // Function to upload JSON metadata to Pinata async function uploadJSON(metadata) { const url = `https://api.pinata.cloud/pinning/pinJSONToIPFS`; const res = await axios.post(url, metadata, { headers: { pinata_api_key: PINATA_API_KEY, pinata_secret_api_key: PINATA_API_SECRET, }, }); return res.data.IpfsHash; } async function main() { try { // Path to your token image file const imagePath = path.join(__dirname, 'tokenImage.png'); // change to your file name console.log('Uploading image...'); const imageHash = await uploadFile(imagePath); console.log('Image uploaded. IPFS Hash:', imageHash); const imageURL = `ipfs://${imageHash}`; // Create metadata JSON const metadata = { name: 'Dollar Coin Token (DCTK)', description: 'A Bitcoin-inspired token with a 4D, gold-blockchain necklace imagery. Everything Bitcoin is in terms of value and schematics.', image: imageURL, attributes: [ { trait_type: 'Decimals', value: 8 }, { trait_type: 'Total Supply', value: 21000000 }, { trait_type: 'Creator Reward', value: 1000000 } ] }; console.log('Uploading metadata JSON...'); const metadataHash = await uploadJSON(metadata); console.log('Metadata uploaded. IPFS Hash:', metadataHash); console.log('Metadata URL: ipfs://' + metadataHash); } catch (error) { console.error('Error uploading to Pinata:', error.response ? error.response.data : error.message); } } main(); node uploadMetadata.js