How to store each NFT image in a ERC721 contract? [closed] - ethereum

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 10 months ago.
Improve this question
When creating a ERC721 contract that manages thousands of image NFTs, saving these image byte pixels in arrays on the contract doesn't seem very scalable.
What is the standard way of doing this?
For eg. CryptoKitties, are they storing each image bytes on the contract itself, or they are a URI pointing to an external resource?
On the other hand, having an URI seems to beat the point of NFTs, because if the URI gets broken (eg. the server with the image goes offline), then as a owner of that NFT, you now only own a URI reference to what would be an image, and not the image itself.

There are a handful of variables here. But, you can store images onchain as base64 encoded strings. Depending on the complexity of the images, you might want to use multiple contracts.
hot-chain-svg - A toolkit for building on-chain SVG projects.
BOOTCAMP2021 - Example of how to store SVG data in multiple contracts.

You can probably use third party services such as: https://www.pinata.cloud/
I am in no way affiliated with them, but if you decide to use them, please let us know how it works out. You're basically looking for an IPFS.

Owning an url is indeed useless because the owner of the website may change the content behind the url or even take it down. You could however store the hash of the image. For example if you have store a SHA-256 of the image, that can never change.

Related

How do I prevent downloading media on the website? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a website where I put music, but I do not want anyone downloading it, or it gets harder and just listening online, like YouTube.
Unfortunately, no. It is a bit like trying to prevent someone from recording an on-air broadcast. When you send video data over the internet to someone's player, they can simply store the information being sent to the player unless you obfuscate it and make it so that the player will only work under certain circumstances and will not share the data. This, by definition, is DRM.
What DRM attempts to do is control the reading of the data entirely, so that it can not be copied. This has varying degrees of success and rarely, if ever, works particularly well. It may keep honest people honest, but if you are sending someone data in a way that they can access it, measures to try to stop them from copying it are... difficult. The most advanced systems use special display drivers and encrypt the data right up to the point it is being displayed on the screen (HDCP), that way other software on the computer can't directly pull the information off the frame buffer being prepared for the screen.
There may be some ways you can mildly obfuscate the access to your video, but ultimately, if you send it in the clear, it is trivial for a knowledgeable viewer to store the datastream. If you use DRM, it is substantially harder, but still likely to be able to be worked around by a dedicated attacker.

SAS Google Map Generator, safe on secure data? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to use the SAS Google Map Generator but I am not sure if I can on proprietary data. I don't want any of the data to be placed anywhere but my own server, even when interacting with Google.
Ideally what I want is to download the map of my choice (state of Wyoming for example) and all of the locations of that area are in a zip file or shape file for me to be able to pin the dataset locations onto, in my own computer. I was reading this.
But it seems a bit confusing to me. Has anyone used it and know that I wouldn't be sending any of my information back to Google?
I've never done this before so I just want to be sure I won't get in trouble for any data leaks.
Thanks!
If you're using the Google Maps API, as it seems you are, then yes, you are sending some information to Google - namely, the center of the map that you're displaying, plus possibly other information depending on what exactly you are displaying.
If you want to do everything client-side, the easiest way is likely to use SAS's built-in map files. This won't display a Google Maps style map, and will give up quite a bit of detail, but it will allow you to display the state borders, counties, and major cities.
You also could use OpenStreetMaps or a similar product, which is locally downloadable more or less as you describe. However, you wouldn't be able to use the Google Maps API; you'd have to do the projecting in SAS still.

Can I use HTML geolocation to update a website with where I am located? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Instead of the the location presented is based on the user I want it to update automatically based on where I am.
I could obviously hard-code it but I want it to be automated. I travel quite a bit: when I am in Egypt I want it to say something like "working in Egypt" or when I am home in NYC "working at homebase" etc.
I am not sure how to go about this, I am assuming it can be done with HTML5 and some more but I may be wrong any suggestions welcome.
There are a lot of ways, but they all have in common you have to send your location to somewhere, and that somewhere has to inform that location to your website visitors (or the place where you want to display it).
You can use HTML5 location api to determine your approximate location. For example, you set up a page (not the index page, but one you can authenticate to) that whenever you visit it, you inform your location to it. That's done with a simple
navigator.geolocation.getCurrentPosition(function (location) {
console.log(location);
});
For the second step, you have several ways to go:
Use a backend server to persist that data in somewhere that's not just your notebook. That server can, in turn, store that location in a Database. Then, anyone visiting your website public page could see from where did you updated your location the last time.
Instead of Databases, you can also use websockets to just relay your updates to whomever is visiting your website at a given moment. But that might be just too far fetched for what you need to do.
Use a webservice API to inform others about your location. Automated foursquare checkins? Tweets, Facebook statuses? All of those approaches is unique to the given API, but most social networks allow you to build simple apps to do that.
TL / DR
Yes, you can use HTML5 to guess your approximate location. Nope, with HTML5 alone you can't tell other people where you are.

Any way to know the absolute path of a resource in a web site when I load it in the browser? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Any way to know the absolute path of a resource (an image for example) in a web site when I load it in the browser?
For example, if an image is in /var/www/project/web/images/foo.jgp I want to get that path.
In localhost I mean.
Regards
Javier
If you're talking about trying to get the path for an image on a public website (where you don't have access to the web server), you're not likely to find it. Think about this for a minute. It's a security issue. Nobody wants the actual address on their web server to become public information. That would make it much easier for a hacker to gain access. You already know the IP address, so all you need is the drive name and root folder name, and you're in.
This doesn't take into account that the images may be stored on a different server(s), such as a CDN, which would store the images on multiple servers around the world for rapid retrieval. For larger websites these days, that would be quite common. It speeds up website performance.
No there is no way to get that information in a browser.

Twitter xAuth vs open source [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am developing an open source desktop twitter client. I would like to take advantage on the new xAuth authentication method, however my app is open source which means that if I put the keys directly into the source file, it may be a vulnerability (am I correct? The twitter support guy told me).
On the other hand, putting the key directly into a binary also doesn't make sense. I am writing my application in python, so if I just supply the pyc files, it is one more seconds to get the keys, thanks to the excellent reflection capatibilities of Python. If I create a small .so file with the keys, it is also trivial to obtain the key by looking at the raw binary (keys has fixed length and character set).
What is your opinion? Is it really a secutiry hole to expose the API keys?
Security hole? In broad terms, yes. Realistically though, these aren't nuclear launch codes we're talking about.
About the worst thing that could happen is that someone could take and use your app's keys to do something against Twitter's TOS that will end up getting the keys banned. No user data would be vulnerable since you're not distributing the user tokens (that would be much worse from a security standpoint). Since anyone can register an app in 2 seconds at no cost, the only reason to do that kind of impersonation would be specifically to besmirch the reputation of you or your app.
One thing you could do is leave them out of the source code but make it clear that user's compiling from source need to obtain their own keys and put them in the appropriate place, but leave them in the binary version that you distribute. Not 100% secure, but makes it that little bit harder that will deter a certain number of n'er-do-wells.