great place to work

NFT

Sports’ Tryst With NFTs

Sports’ Tryst With NFTs ATMECS – Content Team The sports industry is growing rapidly. It is not just about competition in physical sport anymore but also in the digital space. The accelerated growth of partnership between sports and digital technologies over the last few years has spawned changes to the market landscape and sports tech ecosystem that were once thought unfathomable. With the proliferation of e-gaming, betting, and the rise of online broadcasting/streaming (OTT), two major trends are currently emerging in the sports industry: Non-Fungible Tokens (NFTs), which according to Gartner Hype Cycle 2021 is at the Peak of Inflated Expectations, and Blockchain in Sports. A 2022 Sports Industry Outlook Report from Deloitte is optimistic about how blockchain technology will change the way fans interact with their favourite sports and hopes that new types of “collectibles” will lead to new markets for the industry. In this blog, we would like to take you on a journey of how blockchain is redefining the sports industry especially with respect to Fan Engagement and what it means for the future. A Quick Overview Of NFTs Blockchain technology is now widely popular in the sports industry. Most of the time, it is associated with the Initial Coin Offering (ICO), which is a way to encourage transparency and trust in fundraising. But what are NFTs or non-fungible tokens? The basic idea behind an NFT is that a token is used to represent ownership of unique items. The token, in other words, is a non-interchangeable unit of data stored on a blockchain, think of this as a digital ledger which retains history of ownership and value, that can be sold and traded. The NFT data units may be associated with digital files of art, photos, games, videos, and audio. While the Quantum NFT created by digital artist Kevin McCoy in 2014 is credited as the first NFT to be minted as a “monetized graphic”, the CryptoKitties, a blockchain based virtual game, NFTs created the first use case for wider adoption. It allowed people to trade and breed digital cats stored on smart contracts in the Ethereum blockchain. Much of Cryptokitties success is attributed with their ability to conform to the ERC-721 standard, explicitly developed for non-fungible tokens from the start. It allows users to store unique and identifiable data about any item that can be traded or sold in digital space, so ownership and movements are tracked through one smart contract. The Rise Of Fan Tokens The recent rise of fan tokens in the sports industry has also become a new trend as more teams and clubs adopt blockchain technology as a mainstream method for payment or transactions with fans. For example, a few European Soccer Clubs use fan tokens to reward their fans using blockchain technology and cryptocurrencies. Unlike the Non Fungible Token, Fan Tokens are fungible or interchangeable. Owners of Fan tokens can exchange them for services provided by a sports team or club. Fan tokens are digital assets that can interact with club ecosystems, including voting on fan polls and earning rewards. You can also use them off-platform to buy merchandise, match tickets, and other club-related content. Fan tokens are at times referred to as sports cryptocurrencies or utility tokens. Fan tokenization gives sports teams a way to monetize their vast global fan bases while creating a more direct relationship with fans than they’ve ever had before. Current Marketplaces Of NFT In the Sports Industry Now that you’re familiar with the NFT landscape, it’s time to dive right into its heart: marketplaces. These marketplaces are where the majority of NFT transactions happen. They’re one of the most critical puzzle pieces because they’re where all the action happens. When considering buying your first NFT, you should research each marketplace to determine which one is best. Here’s a list of a few top NFT marketplaces: OpenSea.io It features CryptoPunks, Decentraland items, Cryptovoxels assets, Axie Infinity items, etc. OpenSea offers a variety of non-fungible tokens—from art to censorship-resistant domains to virtual worlds to collectibles. It supports ERC721 and ERC1155 assets. Rarible.com This community-owned NFT marketplace rewards users who sell or buy unique digital assets on the market by distributing 75,000 RARI every week to active users. Foundation Foundation is a platform built to help digital artists and crypto-collectors connect and share ideas. It is a place where you can buy and sell artwork from top artists. SuperRare SuperRare is an online marketplace for people to buy and sell authentically created digital artworks, the ownership of which is recorded on the blockchain. It focuses on digital art pieces made by artists they personally select. AsyncArt Asynchronous Art is a way to purchase digital art that evolves. Buyers get to choose how the art is transformed through an app that updates the piece. KnownOrigin A curated gallery of exclusive Digital Artworks ranging from limited collectible editions to open prints and artist editions on blockchain technology using Ethereum smart contracts and ERC721 tokens. Currently, it features work from over 100 artists, including Joe Hargreaves, Quibe, and Ben Giles. Nifty Gateway Nifty Gateway is an NFT marketplace that sells artworks from digital artists, brands, and celebrities. It is a sister company of Gemini (a licensed Cryptocurrency exchange and custodian). NBA Top Shot The National Basketball Association (NBA) in collaboration with Dapper Labs created NBA Top Shot, a blockchain-based platform that allows fans to buy, sell and trade numbered versions of specific, officially-licensed video highlights. The platform allows users to transact with cryptocurrency and conventional credit based payments. Dapper Labs has also forged a partnership with the National Football Association (NFL) to launch a similar platform for NFL content called NFL ALL DAY. Advantage Of Sport NFT Marketplaces Unlike traditional sports memorabilia, digital collectibles are not subject to physical wear and tear. You can store and exchange safely in crypto wallets. The digital nature of NFTs also makes them easier and cheaper to trade. NFTs are unique digital collectibles. They are authenticated on a blockchain, making them effectively impossible to

Sports’ Tryst With NFTs Read More »

Atmecs Blog

Minting NFTs through API using Truffle & Rinkeby

Minting NFTs through API using Truffle & Rinkeby BHANU MOKKALA You need the image / art work / clip to be uploaded to IPFS. You can use any of the IPFS clients that allow you to upload the asset and pin it which will make the asset available for anyone to access through a link. I am using Pinata Cloud for IPFS It is the season of NFTs and DeFi. In case you have been living under a rock then you need read more about NFTs and DeFi using the following links. Non-fungible tokens (NFT) Decentralized finance (DeFi) Now that you understand the terms, let us understand how NFTs are minted. NFT market is definitely moving from a few minters to tools & techniques for content creators to mint NFTs on their own.The following are the key steps in minting a NFT. You need the image / art work / clip to be uploaded to IPFS. You can use any of the IPFS clients that allow you to upload the asset and pin it which will make the asset available for any one to access it through a link. I am using Pinata Cloud for IPFS. You need some test ethers on your Metamask Wallet. Once you installed Metamask Google Extension, load test ethers using the Rinkeby faucet. Also, load some LINK on your Rinkeby testnet address. I built these APIs on top of an existing repo by Patrick Collins. Check out the repo in the below GitHub link. Chainlink Random Character Creation The above example deals with minting a collection of ‘Dungeons and Dragons’ to Rinkeby. It has the following key steps. Step 1: truffle migrate –reset –network rinkeby Step 2: truffle exec scripts/fund-contract.js –network rinkeby Step 3: truffle exec scripts/generate-character.js –network rinkeby Step 4: truffle exec scripts/get-character.js –network rinkeby Step 5: truffle exec scripts/set-token-uri.js –network rinkeby Steps 1 & 2 deal with setting up Rinkeby connection and migrating the contracts related to NFT creation to Rinkeby Testnet. Steps 3, 4 & 5 include executing appropriate functions on the migrated contracts to randomly select characters and setting up metadata URI for the minted NFT. Please go through the README.md of the above repo to understand other set up details. The idea is to build a NodeJS application that will use the above discussed steps. We can a user Node’s Child Process to execute truffle commands on the CLI. Below is an example of wrapping up the first step in the Child Process call. app.get(‘/pushcontract’, async(req, res) => {try {const child = await spawn1(‘truffle migrate –reset –network rinkeby’, [], {shell: true});console.log(child.toString());res.send(‘Migrate contracts’);} catch (e) {console.log(e.stderr.toString())}}) Sample code of executing child process Just like above sample, we can create code to execute the remaining steps mentioned above to complete the minting process. Prior to executing these steps, we need to create the required contract and migrate it to Rinkeby testnet. We can also create contract needed for minting the NFT using file manipulation in NodeJS. We make changes to the ‘template’ contract on the fly using NodeJS fs library and then execute the truffle commands to migrate the contracts. app.post(‘/createcontract’, async(req, res) => { console.log(‘filename’, req.body.filename);files = fs.readdirSync(‘./contracts’);console.log(files);files.forEach(file => {const fileDir = path.join(‘./contracts/’, file);console.log(fileDir);if (file !== ‘Migrations.sol’) {try {fs.unlinkSync(fileDir);} catch (error) {console.log(error);} }})fs.copyFileSync(‘sample.sol’, ‘./contracts/’ + req.body.filename + ‘.sol’);const data = fs.readFileSync(‘./contracts/’ + req.body.filename + ‘.sol’, ‘utf8’);let result = data.replace(/DungeonsAndDragonsCharacter/g, req.body.filename);fs.writeFileSync(‘./contracts/’ + req.body.filename + ‘.sol’, result, ‘utf8’); fs.unlinkSync(‘./migrations/2_mycontract_migration.js’);fs.copyFileSync(‘2_mycontract_migration_backup.js’, ‘./migrations/2_mycontract_migration.js’);const data1 = fs.readFileSync(‘./migrations/2_mycontract_migration.js’, ‘utf8’);let result1 = data1.replace(/DungeonsAndDragonsCharacter/g, req.body.filename);fs.writeFileSync(‘./migrations/2_mycontract_migration.js’, result1, ‘utf8’);res.send(‘created contract’); }) Sample code of creating Contracts from the sample In the above code block, we are copying sample.sol to contracts folder after deleting all the other existing contracts from the contracts folder. After copying sample.sol to contracts folder with desired name, we selectively replace contents of the newly created contract based on the request received in the express API call. The NFTs minted through the above process can be viewed on the opensea Rinkeby testnet gallery. As discussed above, before we get ready with minting, we need to pin the image / art work to IPFS. We can build APIs for uploading and pinning the image to IPFS using Pinata, there are other ways as well. Please go through their docs to identify the APIs for uploading and pinning the image. Once the image is successfully uploaded Pinata APIs return CID which is a unique identifier for the uploaded file / image. https://ipfs.io/ipfs/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?filename=filename.pngThe final URI looks something like above. The ‘XXX’ is where the unique CID will be. We need to embed the image URI inside metadata JSON file before uploading the JSON file to IPFS. Please go through metadata folder in Dungeon & Dragons GitHub repo for more details on how the metadata JSON file should look like. app.post(‘/upload’, upload.single(‘File’),function(req, res) { console.log(req.file); data.append(‘file’, fs.createReadStream(req.file.path));data.append(‘pinataMetadata’, ‘{“name”:”‘ + req.file.filename + ‘”}’); var config = {method: ‘post’,url: ‘https://api.pinata.cloud/pinning/pinFileToIPFS’,headers: { ‘Content-Type’: ‘multipart/form-data’, ‘pinata_api_key’: <pinata api key>, ‘pinata_secret_api_key’: <pinata secret key>, …data.getHeaders()},data : data}; axios(config).then(function (response) {console.log(JSON.stringify(response.data));res.send(JSON.stringify(response.data));}).catch(function (error) {console.log(error);}); }); Sample code of uploading file to IPFS using Pinata Apart from the above, you can also plugin the market place from the opensea using the opensea api. Below is the sample ReactJS code to fetch the NFTs from opensea and display in a NFT Gallery. import React, {useState, useEffect } from ‘react’;import { Container, Row, Col, Card, Button } from ‘react-bootstrap’;import Imgix from ‘react-imgix’; function MarketPlace() {const [isLoading, setIsLoading] = useState(true);const [NFTs, setNFTs] = useState([]); useEffect(() => {setIsLoading(true);var requestOptions = {method: ‘GET’,redirect: ‘follow’}; fetch(“https://testnets-api.opensea.io/api/v1/assets?owner=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&offset=0&limit=50”, requestOptions).then(response => response.json()).then((result) => {console.log(‘Success:’, result);setIsLoading(false);const result1 = result.assets.filter(d => d.image_thumbnail_url !== null)setNFTs(result1);}).catch(error => console.log(‘error’, error));}, []); if (isLoading) {return (<section>Loading….</section>)} return (<div style={{ backgroundColor: ‘#111’}}><Container className=’mt-4′><Row>{NFTs.map(plan => (<Col md={3}><Card bg=”dark” text=”white”><div style={{ textAlign: ‘center’}}>{/* <Card.Img variant=”top” src={plan.image_thumbnail_url} style={{ width: “18rem”, height: “20rem” }} /> */}<Imgix src={plan.image_thumbnail_url} sizes=”800vw” />;</div><Card.Body><Card.Title>{plan.name}</Card.Title><Card.Text>{plan.description.replace(/^(.{20}[^s]*).*/, “$1”)}</Card.Text><Button variant=”primary” onClick={() => window.open(plan.permalink, “_blank”)}>Buy This NFT</Button></Card.Body></Card><Card style={{ backgroundColor: ‘#111’ }}><br></br></Card></Col> ))}</Row></Container></div>); } export default MarketPlace Code to extract minted NFTs from Opensea and display as a NFT Gallery This approach gives a better understanding of what goes into minting

Minting NFTs through API using Truffle & Rinkeby Read More »