Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

support generative art creative coding libs (p5js etc) #1545

Closed
punk3700 opened this issue Feb 7, 2023 · 7 comments
Closed

support generative art creative coding libs (p5js etc) #1545

punk3700 opened this issue Feb 7, 2023 · 7 comments

Comments

@punk3700
Copy link

punk3700 commented Feb 7, 2023

gm. i created a few gen art inscriptions. they use some external creative coding libraries.

the inscriptions are done. the data is on-chain. just that the ordinals explorer couldn't render them, because the site doesn't allow external libraries.

can you guys please support external creative libraries? my code is using 2 popular libs hosted on cloudflare and 2 less popular libs hosted on our website (generative.xyz)

here is the inscription: https://ordinals.com/content/da2cde167d67f136d47ef78735f2f5a09c526c4e6574bfc172a1f0d6ee8f45a9i0

here is the error:

Refused to load the script 'https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.5.0/p5.min.js' because it violates the following Content Security Policy directive: "default-src 'unsafe-eval' 'unsafe-inline' data:". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

da2cde167d67f136d47ef78735f2f5a09c526c4e6574bfc172a1f0d6ee8f45a9i0:1 Refused to load the script 'https://cdn.generative.xyz/ajax/libs/c2/1.0.0/c2.min.js' because it violates the following Content Security Policy directive: "default-src 'unsafe-eval' 'unsafe-inline' data:". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

da2cde167d67f136d47ef78735f2f5a09c526c4e6574bfc172a1f0d6ee8f45a9i0:1 Refused to load the script 'https://cdnjs.cloudflare.com/ajax/libs/chroma-js/2.4.2/chroma.min.js' because it violates the following Content Security Policy directive: "default-src 'unsafe-eval' 'unsafe-inline' data:". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

da2cde167d67f136d47ef78735f2f5a09c526c4e6574bfc172a1f0d6ee8f45a9i0:1 Refused to load the script 'https://cdn.generative.xyz/ajax/libs/p5.grain/0.6.1/p5.grain.min.js' because it violates the following Content Security Policy directive: "default-src 'unsafe-eval' 'unsafe-inline' data:". Note that 'script-src-elem' was not explicitly set, so 'default-src' is used as a fallback.

thanks!!

@rot13maxi
Copy link
Contributor

practically speaking, punching holes in the sandbox is something we'll have to do very carefully to not open the door to things like XSS.

philosophically speaking, I think one of the things that people like about inscriptions is that all the data is on-chain and there isn't a view-time dependency on external servers. If you download an inscription in 100 years (and have the right rendering lib), it'll still look how it is today. Having external dependencies on third party CDNs breaks that -- if that CDN goes away or changes the URL, your inscription is no longer viewable.

If you're going to take a dependency on a third-party hosting service, I think a better route to take would be to just embed a link to off-chain content (as most ERC721-style NFTs do today). It would be MUCH more efficient use of blockspace and the main tradeoff (content hosted offchain) is something you're already signing up for.

@punk3700
Copy link
Author

punk3700 commented Feb 7, 2023

that makes sense. what if we inscribe these popular libs? and then reference these libs from the art inscription?

re-usable too. other people can also reference these "on-chain" libs for their work.

@rot13maxi
Copy link
Contributor

I think that's a great idea and probably the way to go. Check out https://github.com/casey/ord/issues/1082. I think that's the intent there.

There's also an issue https://github.com/casey/ord/issues/801 for off-chain content. I think for what you want to do, the former is what we'll want

@punk3700
Copy link
Author

punk3700 commented Feb 7, 2023

do you know when #1082 will be ready?

also.. p5.js lib is 900K. is it possible to create an inscription lib this big?

@rot13maxi
Copy link
Contributor

Contributions welcome! :-)

You could inscribe a library that large, but you wouldn't want to. I suspect that people will either write new libs for inscriptions, or cull existing libs down to the bits that are most useful in inscriptions.

@punk3700
Copy link
Author

punk3700 commented Feb 7, 2023

i think the benefit of inscribing a popular lib like p5.js is that we inscribed it once but many people can reuse it many times.

so one time cost but the benefit is tremendous as we can onboard thousands of generative artists onto ordinals.

@casey
Copy link
Collaborator

casey commented Feb 7, 2023

This is a great discussion, and thank you both for such great questions and answers! I think this is covered by multi-file inscriptions, and inscribing popular libraries for reuse, so I'm going to convert this to a discussion.

@ordinals ordinals locked and limited conversation to collaborators Feb 7, 2023
@casey casey converted this issue into discussion #1561 Feb 7, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants