blockfrost / blockfrost-js

Node.js SDK for the Blockfrost.io API.
https://blockfrost.io
Apache License 2.0
105 stars 24 forks source link

Could you please share the sample code for Minting NFT by using the Blockfrost-js library? #182

Closed firojalamkhan786 closed 2 years ago

firojalamkhan786 commented 2 years ago

I want to mint NFT by using the Blockfrost-js library, Please provide the complete steps that are required for doing that. Please share the working example code.

  1. How to construct the transaction object and what are mandatory details and what are the optional details.
  2. How to calculate the transaction fees
  3. How to sign the transaction
  4. How to pass the account details to the transaction object
  5. To create the account object what are details required from the frontend application and which format those details - (I am trying to connect the Cardano supported wallet )
  6. If you have any advice on which wallet I can able to use it that will be great, I am currently developing the DApp in the Cardano testnet.
slowbackspace commented 2 years ago

Hello @firojalamkhan786! Blockfrost SDK is a library that provides an access to all the data on the blockchain and allows to push more data via submitting a transaction. The purpose of this library isn't to handle the process of building the transaction itself, which can be quite complex.

For an example, Blockfrost SDK will help you to retrieve UTXOs for your address which are used as inputs in a transaction. Once you have your transaction built then you can use the SDK again to send it to the blockchain.

For building a transaction - adding inputs, outputs, calculating fees and all that you can use Cardano Serialization Lib. Follow its documentation and examples for more info.

If you are fan of CLI tools here is a tutorial for creating a transaction with cardano-cli https://developers.cardano.org/docs/stake-pool-course/handbook/create-simple-transaction/

We are planning to add some basic tutorials in the future. In the meantime these resources should help with building your first transaction!

firojalamkhan786 commented 2 years ago

Thank you for your response.

slowbackspace commented 2 years ago

Hi again @firojalamkhan786, we've just merged an example on how to build a simple transaction and push it to the blockchain. It will not mint an NFT for you, but it should provide the basics for integrating Blockfrost into the process. https://github.com/blockfrost/blockfrost-js/tree/master/examples/simple-transaction

If you don't mind I'll close this issue. If you have any problem while using the SDK don't hesitate to open a new one.