Flow: How to Create an NFT Marketplace with Filebase + Flow
Learn how to create an NFT marketplace using Filebase and Flow.
What You’ll Learn
Terminology
1. First, we need an image to use as an NFT. We’ll start by uploading an image to Filebase for us to use.
2. Select ‘Buckets’ from the left side bar menu, or navigate to console.filebase.com/buckets.

3. Enter a bucket name and choose the IPFS storage network to create the bucket.

4. Next, select the bucket from your list of buckets, then select ‘Upload’ in the top right corner to upload an image file.

5. Select an image to be uploaded. Once uploaded, it will be listed in the bucket.

6. Click on your uploaded object to display the metadata for the object.

7. Next, open your command prompt. We need to create a new React app with the following command:
8. Add the following lines to the flow.json file to configure the storage location for our contracts and the deployment app information.
flow.json file to configure the storage location for our contracts and the deployment app information. 9. Next we need to create directories for our contracts, scripts, and transactions.
10. Open the contract/nftMarketplace.cdc file in your favorite code editor or IDE.
contract/nftMarketplace.cdc file in your favorite code editor or IDE. 11. Now let’s add the NFTReceiver interface code to define the capabilities of an NFT receiver.
12. Next we’ll create the NFTCollection resource where NFTs will be deposited to or withdrawn from.
NFTCollection resource where NFTs will be deposited to or withdrawn from. 13. Now let’s add the NFTMinter resource. This resource will enable our app to mint the NFT tokens.
NFTMinter resource. This resource will enable our app to mint the NFT tokens. 14. Lastly, we need a constructor method to initialize our contract when it gets deployed.
15. Now let’s deploy the contract. First we’ll need to start the flow emulator in our command prompt:
16. Open another command prompt window and make sure you are in your project directory.
17. Now it’s time to create the transaction responsible for minting tokens.
18. Now let’s send this transaction to the flow emulator that is running and mint a token.
19. Next, we need to create the TransferToken transaction. This transaction allows NFTs to be transferred between different users.
TransferToken transaction. This transaction allows NFTs to be transferred between different users. 20. Then let’s create an account using these keys. Run the following command, but replace PUBLIC_KEY with the public key you just generated.
PUBLIC_KEY with the public key you just generated.21. Now let’s send this transaction with the following command:
22. Create another Cadence file in the transactions directory named transferToken.cdc.
transferToken.cdc. 23. Let’s run this command to test our code.
24. Now that we can send transactions, we need scripts that can query the state of the blockchain.
25. Another script to query the blockchain that we should have is the getTokenMetadata.cdc script.
26. Then execute the script with the following command. This command also requires the TokenID:
Last updated