yusefnapora / minty Goto Github PK
View Code? Open in Web Editor NEWa minimal NFT minting platform using IPFS
a minimal NFT minting platform using IPFS
Hello there, i get this error, ubuntu 20.04
$ minty deploy
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'fs/promises'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object. (/home/fenix/src/minty/src/index.js:6:12)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
null
After deploying the contract locally the mint command will always return this error message
minty mint ~/ticket.txt --name "Ticket" --description "This document serves as proof-of-ownershp for a ticket"
Error: unable to get token id
at Minty.mintToken (/minty/src/minty.js:272:15)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async Minty.createNFTFromAssetData (/minty/src/minty.js:126:25)
at async Command.createNFT (/minty/src/index.js:84:17)
at async Promise.all (index 0)
at async main (/minty/src/index.js:65:5)
When I try to inspect the incoming receipt from which the events are being read I see, it has an empty events field:
{
"to": "0x5FbDB2315678afecb367f032d93F642f64180aa3",
"from": "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
"contractAddress": null,
"transactionIndex": 0,
"gasUsed": {
"type": "BigNumber",
"hex": "0x59bc"
},
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0x5eb469a830032125e7d960dfa856e9ab1141283694554d14533f03cc6486aed9",
"transactionHash": "0xd5990cb65b8ae6b1c1da583ae6839929065799cb90dd6c96e98116f168b482cd",
"logs": [],
"blockNumber": 5,
"confirmations": 1,
"cumulativeGasUsed": {
"type": "BigNumber",
"hex": "0x59bc"
},
"status": 1,
"byzantium": true,
"events": []
}
Versions:
Node: v15.14.0
npm: 7.9.0
go-ipfs: v0.9.0-dev
Now that we're using CIDv1, we should update the readme examples to show them.
It would be great to have a little web page that you could paste a token ID into and view the token asset and metadata.
This should be pretty simple to wire up using https://nfte.app, a react component that does some nice presentation if you give it info about an NFT. Since our contract won't be deployed on mainnet, we'll need to provide our own endpoint for the viewer to connect to, so this implies a minty serve
command (or similar) that will host an endpoint to supply the data.
We'll also need a simple react app that has a text field for the token ID and updates the NFTE component on changes.
Hi!
Thank you for this project, it's very simple to follow and understand.
I have a question regarding transferring the NFTs. I have minted an NFT (ID 1):
❯ minty show 1
Token ID: 1
Owner Address: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
Metadata Address: ipfs://bafybeidcmv2msyphtmhvbh2q6fegddjqatnqtworntw5wm2iixeecuevvi/metadata.json
Metadata Gateway URL: http://localhost:8080/ipfs/bafybeidcmv2msyphtmhvbh2q6fegddjqatnqtworntw5wm2iixeecuevvi/metadata.json
Asset Address: ipfs://bafybeiaf6l4xlrmdh74zn2g6lakxyiz4r6n4u3fyybksk7enrggcpv4cca/README.md
Asset Gateway URL: http://localhost:8080/ipfs/bafybeiaf6l4xlrmdh74zn2g6lakxyiz4r6n4u3fyybksk7enrggcpv4cca/README.md
NFT Metadata:
{
"name": "Moon Flight #1",
"description": "This ticket serves as proof-of-ownership of a first-class seat on a flight to the moon.",
"image": "ipfs://bafybeiaf6l4xlrmdh74zn2g6lakxyiz4r6n4u3fyybksk7enrggcpv4cca/README.md"
}
then I transfer it to address 0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199
:
❯ minty transfer 1 0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199
🌿 Transferred token 1 to 0x8626f6940e2eb28930efb4cef49b2d1f2c9c1199
and verify that the transfer was correct:
❯ minty show 1
Token ID: 1
Owner Address: 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199
Metadata Address: ipfs://bafybeidcmv2msyphtmhvbh2q6fegddjqatnqtworntw5wm2iixeecuevvi/metadata.json
Metadata Gateway URL: http://localhost:8080/ipfs/bafybeidcmv2msyphtmhvbh2q6fegddjqatnqtworntw5wm2iixeecuevvi/metadata.json
Asset Address: ipfs://bafybeiaf6l4xlrmdh74zn2g6lakxyiz4r6n4u3fyybksk7enrggcpv4cca/README.md
Asset Gateway URL: http://localhost:8080/ipfs/bafybeiaf6l4xlrmdh74zn2g6lakxyiz4r6n4u3fyybksk7enrggcpv4cca/README.md
NFT Metadata:
{
"name": "Moon Flight #1",
"description": "This ticket serves as proof-of-ownership of a first-class seat on a flight to the moon.",
"image": "ipfs://bafybeiaf6l4xlrmdh74zn2g6lakxyiz4r6n4u3fyybksk7enrggcpv4cca/README.md"
}
Then, I am trying to transfer it to another address but I get the following error:
❯ minty transfer 1 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
ProviderError: VM Exception while processing transaction: revert ERC721: transfer caller is not owner nor approved
at HttpProvider.request (/home/jimouris/repos/minty/node_modules/hardhat/internal/core/providers/http.js:50:23)
at GanacheGasMultiplierProvider.request (/home/jimouris/repos/minty/node_modules/hardhat/internal/core/providers/gas-providers.js:139:38)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I see that the error is that "the transfer caller is not the owner" which means that I'm trying to initiate the transfer as 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
instead of 0x8626f6940E2eb28930eFb4CeF49B2d1F2C9C1199
. Is there a way to specify who calls the transfer each time?
Thank you!
The _setBaseURI
function from the OpenZeppelin base contract has been removed and isn't present in versions > 3.4.0 (I think).
It looks like we should override the _baseURI
method instead: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/3dc374ddcf46739185bd12759eaa826b579e5a0a/contracts/token/ERC721/ERC721.sol#L102
This will break if we update the base contract, so worth fixing :)
Currently if you mint with minty, the mint
function is unrestricted, allowing anyone to mint in your collection/series.
Maybe there could be an option that allows making restricted collections?
Mixing in ownable would make it as easy as adding an onlyOwner
modifier to the mint
function.
On a completely new install of Ubuntu & Minty this happens just after running ./start-local-environment.sh
:
./start-local-environment.sh
> ...
> [ipfs] Error: no IPFS repo found in /home/johnny/.ipfs.
> [ipfs] please run: 'ipfs init'
> ...
Can probably fix this by having the script check if ~/.ipfs
exists before trying to run.
This fixes it for now:
npx ipfs init
> generating ED25519 keypair...done
> peer identity: 12D3KooWS3fYDCncLc2tH5L9KY3kLdzBAa5d12BUyXzu4mHroLyt
> initializing IPFS node at /home/johnny/.ipfs
> to get started, enter:
>
> ipfs cat /ipfs/QmQPeNsJPyVWPFDVHb77w8G42Fvo15z4bG2X8D2GhfbSXc/readme
whilst strictly correct to refer to ipfs://
scheme URLs as URIs there is something that doesn't quite sit right with referring to https://<ipfs gateway>
URLs as URLs but ipfs://
scheme URLs as URIs in the minty mint output
🌿 Minted a new NFT:
Token ID: 1
Metadata URI: ipfs://bafybeihadb4iu2qluldbypnt564elwnq7gfhgci7njnqekmnbfuqyncq3e/metadata.json
Metadata Gateway URL: http://localhost:8080/ipfs/bafybeihadb4iu2qluldbypnt564elwnq7gfhgci7njnqekmnbfuqyncq3e/metadata.json
Asset URI: ipfs://bafybeidlyceq3bnf63pxszlxmnqz7jqwr22rirjvxgyxi7nwrlboou5ksa/meat-skeleton.jpg
Asset Gateway URL: http://localhost:8080/ipfs/bafybeidlyceq3bnf63pxszlxmnqz7jqwr22rirjvxgyxi7nwrlboou5ksa/meat-skeleton.jpg
as both forms are URLs and both forms are URIs. It's worth noting that there is a defined URI flavour of ipfs address in this seminal comment The four stages of the upgrade path for path addressing. ipfs/specs#152 (comment) and that looks like dweb:/ipfs/<CID>
and is not commonly seen in the wild, but we should avoid taking it's name in vain.
This issue is for nailing down what the CLI commands and args should be for the "final" version that we'll write the tutorial against.
Most of the functionality described already exists, but the interface isn't the friendliest, and currently the create-nft
command does two operations (add to ipfs and pin to remote service) that we want to split up into separate commands.
This is what I've got in mind right now, but maybe @johnnymatthews has some opinions?
This is currently in a separate shell script, run-devnet.sh
. We could add a minty
command to do this instead though.
minty deploy --name <token-name> --symbol <token-symbol>
Deploys a new instance of the smart contract with the given name and symbol, and writes the details to a json config file (most importantly the address of the deployed contract).
Note that this currently overwrites any existing deployment json file without warning (probably fine for an example app).
minty mint <asset-path> --name <nft-name> --description <nft-description>
Adds the contents of asset-path
to IPFS and mints a new token, returning the token ID, metadata, and metadata CID.
This is implemented now in the create-nft
command, but that command also pins to remote services, which we want to pull out into a separate command.
minty show <token-id>
Returns the metadata for a given token, plus the owner's address and some other blockchain-related info.
minty transfer <token-id> <new-owner-address>
Transfer ownership of an existing token to a new ethereum address. Not yet implemented, and not strictly necessary for the tutorial, but pretty easy to do (less than an hour).
minty pin <token-id>
Looks up the metadata and asset CIDs for the token in our local IPFS repo, and pins to the configured pinning service.
Right now, the config is hard-coded to use Pinata as the pinning service, with API token pulled from an environment variable.
Instead, we should be loading the services from a config file. If we want to get super fancy, we could have minty
commands for managing the services, but it's probably fine to just tell people to edit the config file. This could just be a minty.config.js
file that exports a config, so we could still easily load API keys from environment variables if we want.
For simplicity, we might want to limit to just a single pinning service.
Right now, minty is using an HTTP client I wrote for the remote pinning service API. I've got a PR open for js-ipfs to add support for remote pinning, which is how we'd prefer people actually do things.
Ideally, we'll have at least an experimental release of js-ipfs with the remote pinning API available to depend on sometime next week, so we can use it in the tutorial.
Hello,
Can you please add option for minty to work with entirely onchain NFT, where "Image" is stored in svg format onchain?
With smart contract like: https://github.com/alpha-omega-labs/MoleculeNFT/blob/main/onchain.sol
This would be very much needed for mint of molnft database collcetions and binary files on chain.
Thank you!
Getting this error after running "npm install". I tested using both IPFS versions 0.18.1 and 0.15.0 and received the same error message.
Installation steps for IPFS I used: https://docs.ipfs.tech/install/command-line/#system-requirements
My machine(laptop specs): MacBook Pro Apple Silicon M1 Pro
Please let me know if there is any additional info that I can give to work through this problem (I have little experience with this process). Thanks!
When I try to mint an NFT through minty mint command, I get the following error
TypeError: Cannot destructure property 'cid' of '(intermediate value)' as it is undefined.
at Minty.createNFTFromAssetData (/home/user/Documents/minty/src/minty.js:127:22)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Command.createNFT (/home/user/Documents/minty/src/index.js:84:17)
at async Promise.all (index 0)
at async main (/home/user/Documents/minty/src/index.js:65:5)
And when I inspect the console where start-local-environment.sh is running, I see the following generated after calling the above
eth] web3_clientVersion
[eth] eth_chainId
[eth] eth_accounts
[eth] eth_blockNumber
eth_chainId (2)
eth_estimateGas
[eth] eth_feeHistory
[eth]
[eth] eth_feeHistory is disabled. It only works with the London hardfork or a later one.
[eth]
[eth] eth_gasPrice
[eth] eth_sendTransaction
[eth] Contract deployment: Minty
[eth] Contract address: 0x5fbdb2315678afecb367f032d93f642f64180aa3
[eth] Transaction: 0xd7ed1772329a418d375ec4c5c8fa4fa6d25e0bb2647f16f0c7c9d1a491f33ecd
[eth] From: 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266
[eth] Value: 0 ETH
[eth] Gas used: 2669762 of 2669762
[eth] Block #1: 0x5f91168e0c122ddf9c40054dcd94f0f924c819a2098e86bb136aee1801371b36
[eth]
[eth] eth_chainId
[eth] eth_getTransactionByHash
[eth] eth_chainId
[eth] eth_getTransactionReceipt
[ipfs] npx: command not found: go-ipfs
[ipfs] npx go-ipfs daemon exited with code 127
web3_clientVersion (2)
eth_accounts
[eth] eth_chainId
web3_clientVersion (2)
eth_accounts
[eth] eth_chainId
I'm working on localhost. Any guidance is greatly appreciated
Really enhoed your NFT hack presentation but
Followed readme - please advise
test@ubuntu:/code/ethereum/ARG$ node --version/code/ethereum/ARG$ npm --version
v12.21.0
test@ubuntu:
6.14.11
test@ubuntu:~/code/ethereum/ARG$ minty
internal/modules/cjs/loader.js:818
throw err;
^
Error: Cannot find module 'fs/promises'
Require stack:
The latest version of ipfs-http-client
client is using CIDs from https://www.npmjs.com/package/multiformats but Minty is currently configured to use CIDS from https://www.npmjs.com/package/cids
Which means that the 'pin to remote service' functions like pinTokenData
will fail with TypeError: CID instance expected instead of object.
As far as I can tell, the way to fix this is to use the CID classes that come with the multiformats dependency in ipfs-http-client
such as...
const { CID } = require('multiformats/cid')
and then update the extractCID
helper method to use the multiformats CID.parse method...
function extractCID(cidOrURI) {
// remove the ipfs:// prefix, split on '/' and return first path component (root CID)
const cidString = stripIpfsUriPrefix(cidOrURI).split('/')[0]
return CID.parse(cidString)
}
When I try to pin with pinata config I get error:
Pinning asset data (ipfs://<MYCID>/mynft.jpeg) for token id 2....
HTTPError: reason: "API_KEY_REVOKED", details: "This API Key has been revoked": 403 Forbidden
at Object.errorHandler [as handleError] (Desktop/Code/minty/minty/node_modules/ipfs-http-client/src/lib/core.js:91:15)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Client.fetch (/Desktop/Code/minty/minty/node_modules/ipfs-utils/src/http.js:147:9)
at async Function.ls (Desktop/Code/minty/minty/node_modules/ipfs-http-client/src/pin/remote/index.js:89:22)
at async Minty.isPinned (Desktop/Code/minty/minty/src/minty.js:458:22)
at async Minty.pin (/Desktop/Code/minty/minty/src/minty.js:430:20)
at async Minty.pinTokenData (Desktop/Code/minty/minty/src/minty.js:409:5)
at async Command.pinNFTData (Desktop/Code/minty/minty/src/index.js:151:37)
at async Promise.all (index 0)
at async main (/Desktop/Code/minty/minty/src/index.js:81:3) {
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: { body: [PassThrough], disturbed: true, error: null },
[Symbol(Response internals)]: {
url: 'http://localhost:5001/api/v0/pin/remote/ls?service=pinata&cid=bafybeih5upw7duqwg4s24zbwqkgatwawqr4ayeaspdg5miqxp3t25q2x3e',
status: 500,
statusText: 'Internal Server Error',
headers: [Headers],
counter: 0
}
}
}
I see it says API_KEY_REVOKED, but it happens even if I make a new API key.. I get a similar issue as well when I try to switch to nft.storage.
Also, I see the contract mints Julep Tokens, where does it specify that in the contract? I cannot seem to find it
This probably just needs some tweaking to the "local environment" scripts... everything else should be cross platform.
I cloned the repository, and ran ./start-local-environment.sh
, and I get the following error:
[eth] ...
[eth] ...
[eth] ...
[ipfs] npx: command not found: go-ipfs
[ipfs] npx go-ipfs daemon exited with code 127
Note: I have already downloaded and installed from go-ipfs from the ipfs distributions page. I have also installed via npm npm install -g go-ipfs
Any idea why this is occurring and how I might be able to fix it?
Update: Changing line 17 in the start-local-environment.sh
script from run_ipfs_cmd="npx go-ipfs daemon"
to run_ipfs_cmd="ipfs daemon"
launches the daemon.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.