-
Notifications
You must be signed in to change notification settings - Fork 6.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add nft.storage upload option #926
feat: add nft.storage upload option #926
Conversation
@yusefnapora is attempting to deploy a commit to the Metaplex Team on Vercel. A member of the Team first needs to authorize it. |
I would love it if I could merge with nft.storage! Will keep a eye on this, if I have time I will contribute. |
I'm going to mark this PR as ready for review, with the caveat that the backend is only working on staging at the moment. It should be merged to production within a day or two, but in the meantime, see the instructions in the PR description for running against staging |
To follow up on the "path to production" here, before we deploy for to prod we'll need someone from the metaplex team to make an nft.storage account and give us the API token they'd like to use for the integration. That account will be associated with all the uploads made using the |
Since users will be creating their own storefronts would it be possible to allow us to add our own api keys instead of relying on metaplex. |
@Moikapy think the latest plan is to have NFT.Storage have custody of the NFT.Storage account associated with this endpoint rather than Metaplex being able to see all uploads to this endpoint. Moving forward we'll also have solutions using things like delegated uploads via UCAN so that end users can upload data associated with a given marketplaces's account without that marketplace having to share their private keys in the browser. Let us know your thoughts for the short-term and long-term solutions! |
Just a note that I've updated this PR to use the new Here's some example metadata from my manual testing (gateway link): {
"name": "Test NFT.Storage / Metaplex NFT",
"symbol": "PLTEST-1",
"description": "nothing to see here.",
"seller_fee_basis_points": 0,
"image": "https://dweb.link/ipfs/bafybeihqxtn5otahwbxjvkbhloszxrbjmvhf663rtq7sp5i2xzyl35bwtu/0.png",
"properties": {
"files": [
{
"uri": "https://dweb.link/ipfs/bafybeihqxtn5otahwbxjvkbhloszxrbjmvhf663rtq7sp5i2xzyl35bwtu/0.png",
"type": "image/png",
"cdn": true
},
{
"uri": "ipfs://bafybeihqxtn5otahwbxjvkbhloszxrbjmvhf663rtq7sp5i2xzyl35bwtu/0.png",
"type": "image/png",
"cdn": false
}
],
"category": "image",
"creators": [
{
"address": "3eoKfwCQ4jMBD5CEpLM8aCTZVN7wGQ9KTUBHhksmaZNh",
"share": 100
}
]
}
} |
This PR has received no activity for 30 days. We will close it in 2 days, please reopen if you would still like to get this change in. |
Hello to anyone watching this PR 😄 I'm back from holidays and so on and have updated this to work with Candy Machine V2, as well as V1. It ended up being much simpler to squash everything before rebasing, so I've force pushed over the original branch. So far I've done a basic test with a CMv2 config that looks like this: {
"price": 1.0,
"number": 1,
"gatekeeper": null,
"solTreasuryAccount": "3eoKfwCQ4jMBD5CEpLM8aCTZVN7wGQ9KTUBHhksmaZNh",
"splTokenAccount": null,
"splToken": null,
"goLiveDate": "25 Dec 2022 00:00:00 GMT",
"endSettings": null,
"whitelistMintSettings": null,
"hiddenSettings": null,
"storage": "nft.storage",
"ipfsInfuraProjectId": null,
"ipfsInfuraSecret": null,
"awsS3Bucket": null,
"noRetainAuthority": false,
"noMutable": false
} And it uploaded successfully: There seems to be a typescript error in one of the dependencies that CI isn't happy about. I'll chase that down and update here when it seems good to go. |
@yusefnapora rebase please. |
Hey @roederw, thanks for looking at this - I've just rebased to the latest |
Looks like your builds are failing. |
@roederw sorry bout that - I didn't notice locally before pushing it up. Seems like I must have transitively pulled in a version of the |
@roederw I believe I fixed the issue with the I don't get the build failure when building The |
Fix errors. |
There was acleaner pr and it was merged |
Hey @austbot, glad to see that nft.storage support is merged in 👍 I think that the approach taken in this PR may still be valuable, since it allows users to upload to NFT.Storage without needing an NFT.Storage API key first, and it also supports files larger than 100 MiB by chunking them on the client. If those features sound useful, I'd be happy to rework this PR to make the NFT.Storage API key optional and use the signature based auth scheme if the user doesn't have an NFT.Storage key. Either way, I'm also down to add docs for using nft.storage to https://github.com/metaplex-foundation/docs - I'll plan to make a PR there describing how to use the flag added in #1512. Cheers :) |
Hey there, Yusef from Protocol Labs here 😄. I've been working on getting Metaplex and NFT.Storage to play nicely together for a bit, and it seems close enough to get some feedback on. Some things are not yet wired up in our backend, so I'm just opening as a draft for now.
I'm planning to also add this functionality to the new JS SDK, but it seemed easier to test things out here.
The main work of the integration is happening in the metaplex-dotstorage-auth package that I've been writing up. It's not yet published to NPM, so there's currently a github dependency in the package.json for the candy machine cli package. That will be removed before this is converted from a draft PR.
The auth works entirely locally - the user just creates a self-signed JWT using the
EdDSA
algorithm with their private Solana Ed25519 key as the signing key. There's no Solana transaction required, just the signature and a small payload embedded in the JWT that looks like this:The JWT payload includes the Metaplex user's public key (encoded as a DID) in the
iss
field. Thereq
field contains a description of the request, including the root CID of the content being uploaded and some tags to help keep track of things on our end.The CID is calculated on the client by packing files into CAR archives, which are sent to the nft.storage backend in chunks of ~10MB at a time.
Status
There are some remaining pieces needed before this will be functional:
X-Web3-Auth: Metaplex <token>
header supportI'll convert the PR from draft once it's possible to actually test this end to end. In the meantime, if any maintainers here have input on the code or any concerns, let me know and I'll try to address them ASAP.
Update (2021-11-23):
We've now published
@nftstorage/metaplex-auth
to npm, so I've updated this PR to depend on it.The API changes are currently deployed to our staging environment, but not yet in production. To test, you can set the
NFT_STORAGE_ENDPOINT
environment variable tohttps://api-staging.nft.storage
before running thecandy-machine upload
command.For example: