News for hackers. Stuff that matters.
Re:Exporting image assets from ethereum smart contract with ... by ghayes on Saturday March 27, 2021 @03:47PM (#26605002)
The other common approach here (for non-generative images) is to store the Sha3 hash of an image and then simply require that someone, somewhere has the actual data. You could also pass the image as a LOG message which is significantly cheaper (3 gas per byte, versus 20,000 gas per 32-bytes to store data) which means if you can read older chain blocks, you can ensure you have the underlying data.
Re:Exporting image assets from ethereum smart contract with ... by choxi on Saturday March 27, 2021 @05:27PM (#26605800)
Would this be equivalent to storing the encryption key on the blockchain such that only people with an NFT have the key, and can decrypt the image (wherever the encrypted image is stored)?
Re:Exporting image assets from ethereum smart contract with ... by verdverm on Saturday March 27, 2021 @07:53PM (#26606751)
No, storing the SHA3 means that if you have the image, you can verify that it has not changed
Re:Exporting image assets from ethereum smart contract with ... by nmaleki on Monday March 29, 2021 @10:01AM (#26621663)
Few questions, By "actual data" I'm assuming you mean the image itself? What does a request for the actual data look like, because it is my understanding the actual data wouldn't be stored on the blockchain? The LOG message is built into the Ethereum blockchain?
Re:Exporting image assets from ethereum smart contract with ... by xrd on Sunday March 28, 2021 @12:42AM (#26608002)
Isn't this an interesting example where you could do fun things by writing the image data into a cheap blockchain where the cost isn't high (making it immutable) but then associating it with the SHA or encrypted private key on the blockchain where the item is sold?

The art goes on the dogecoin, the purchase happens on ethereum.

Re:Exporting image assets from ethereum smart contract with ... by chrisco255 on Sunday March 28, 2021 @01:47AM (#26608287)
Typically people will store it somewhere (S3 or otherwise) and generate an IPFS hash of the file and write the hash to the NFT. Doge is just a Bitcoin fork and can't store data any more easily than Ethereum.

File storage protocols exist such as Sia and Filecoin, that are more appropriate for decentralized storage.

Re:Exporting image assets from ethereum smart contract with ... by Animats on Saturday March 27, 2021 @02:06PM (#26604121)
How much "gas" does it cost to store data in the Etherium blockchain? The entire Etherium blockchain is about 180 GB.
Re:Exporting image assets from ethereum smart contract with ... by vmception on Saturday March 27, 2021 @02:58PM (#26604552)
The real answer is that you have to pay attention to the gas limit per block, which is pretty high now

On the Ethereum EVM it is 12,000,000 ether gwei. Most blocks are full. If you are willing to pay 12,000,000 ether gwei at competitive gas prices, it will get mined.

For an image application you can probably use as many blocks as you want to create and store a larger image.

As blocks are already full, this wont change anything, some people will get priced out for the time being or they pay higher gas price, miners get paid 12,000,000 ether gwei * gas price either way.

So gas prices right now are like 135 gwei.

12,000,000 ether gwei is 0.012 ether. 0.012 * 135 = 1.62 ether @ $1,704 per ether = $2760 cost if you want to fill up an entire block

Binance Smart Chain EVM has 30,000,000 binance gwei gas limit. And the binance token is much cheaper to begin with at the moment.

and there are other EVMs, you can find the EVM you want to use. Ethereum mainnet EVM has the highest number of nodes to store it though.

Its economical if you can sell it for a higher price. No different from any other art trade, artist can take the risk or a studio can front capital.

Re:Exporting image assets from ethereum smart contract with ... by carver on Saturday March 27, 2021 @10:48PM (#26607522)
Based on context, you seem to be referring to gas when you say 12 million "ether gwei" (the block limit being 12 million gas, lately). But gas is its own unit, not measured in ether (or in wei, the smallest atomic unit of ether).

The reason the math still works is that 12 million gas priced at 1 gwei/gas would cost 12 million gwei, which is .012 ether. (Since one ether is defined as a billion billion wei) ... Maybe this was all what you meant, but it was hard for me to decipher.

Re:Exporting image assets from ethereum smart contract with ... by vmception on Sunday March 28, 2021 @10:02AM (#26610481)
Yes, gas is its own unit paid in the native token of the blockchain.

The adjective is necessary as other EVMs are proliferating and in heavy use.

But even without that I dont think there is a distinction big enough to worry about it. There are 1 billion gwei in 1 ether, we can go from there and get the same results.

Re:Exporting image assets from ethereum smart contract with ... by vmception on Saturday March 27, 2021 @05:11PM (#26605671)
Sidenote: you should really learn about the EVM and be able to synthesize the same answers as I did

this is unrelated to being a “blockchain skeptic”, a “no-coiner”, a “bitcoin only, Ethereum is too centralized, dont mention any other distributed ledger around me” person, or anything else

The EVM (Ethereum Virtual Machine) concept is as important to be up to speed on as the JVM (Java Virtual Machine) concept

Re:Exporting image assets from ethereum smart contract with ... by c-cube on Sunday March 28, 2021 @11:04AM (#26610929)
Sidenote: you should really learn about homeopathic dilution and how to synthesize the same cancer drug as I did.

This is unrelated to being a "homeopathy sceptic", a "no-diluter" person, or anything else.

---

Really? If you think blockchains are stupid, why should you learn about the details of how exactly the pollution happens and how much real money is used to power each transaction?

Re:Exporting image assets from ethereum smart contract with ... by vmception on Sunday March 28, 2021 @02:36PM (#26612915)
Because I think ad retargeting conglomerates are stupid too but they still use the JVM and I’ll work for san organization or project involved in that which uses Java
Re:Exporting image assets from ethereum smart contract with ... by kfichter on Saturday March 27, 2021 @03:29PM (#26604834)
20,000 gas for 32 bytes of data if you want it to be accessible by other smart contracts. 16 gas per non-zero byte (4 gas per zero byte) of "transaction input data," which is accessible to clients off-chain but is not accessible to smart contracts.
Re:Exporting image assets from ethereum smart contract with ... by Canada on Sunday March 28, 2021 @03:47AM (#26608693)
You are way off. The entire Ethereum blockchain is approximately 6 TB. Even a pruned version is over 400 GB.

There is no specific cost for storage, only gas for execution. For dynamic storage the SSTORE operation stores a word (256 bit). It costs 20,000 gas when the value is set from zero to non-zero, 5,000 gas when the value is set from non-zero to non-zero, and it provides a refund of 15,000 when the value is set from non-zero to zero. This is the only way to make data readable by contracts and thus light clients.

There is also the option of storing as code, which cannot be updated. There's the 32,000 gas paid for the CREATE and then 200 gas per byte for the code. This is much cheaper at 6,400 gas per 32 bytes.

So deploying a 128 byte string assuming a gas price of 100 GWEI and $1700 ETH:

32,000 + (6,400 * 4) = 57,600 gas

57,600 gas * 0.000000001 ETH (1 gwei) * 100 gwei * $1700 = $9.79

This would just store bits, it wouldn't be a valid contract you could actually call.

Or you could write your data as the parameters to a contract call at a price of 4 gas per zero and 16 gas per non-zero..

You would be able to read data stored this way off etherscan.

I'm not including the base 21,000 gas you have to pay for any transaction.

Re:Exporting image assets from ethereum smart contract with ... by saurik on Sunday March 28, 2021 @02:46PM (#26612989)
> You are way off. The entire Ethereum blockchain is approximately 6 TB. Even a pruned version is over 400 GB.

Your 6TB figure includes "store every single historical past state of the system", which is going "above and beyond": it is something that you never need to do for either correctness or operation of the system, whether as a user or as a miner... the only people who use archive nodes are people who are trying to more easily step-by-step debug old transactions.

Re:Exporting image assets from ethereum smart contract with ... by Canada on Monday March 29, 2021 @02:32AM (#26618296)
You need a full fat DB if you want to be able to accurately detect transactions more than 2 days old. You need to do it if you care about more than just the current balance and don't want to rely on a centralized middleman such as etherscan.
Re:Exporting image assets from ethereum smart contract with ... by saurik on Monday March 29, 2021 @04:05PM (#26627487)
I don't understand what you mean by this; you do not need an archival node to either pull transaction receipts or to request transaction logs: you only need an archival node if you want access to all of the starting storage states of all past blocks, which you effectively never need (except for debugging). Notably: a "full node" is not an "archive node", and will not need more than the 400GB of space.
Re:Exporting image assets from ethereum smart contract with ... by dezmou on Saturday March 27, 2021 @02:09PM (#26604139)
The image data is not stored, only the seed needed to generate the bitmap, the image generation is done by a gasless view function when needed
Re:Exporting image assets from ethereum smart contract with ... by jstanley on Saturday March 27, 2021 @02:25PM (#26604278)
That doesn't really help in the general case. If you can compress arbitrary images down to a single small seed, then you have the best image compression algorithm in the world. The applications of good image compression are much broader than NFTs.

It looks like this project doesn't actually store arbitrary pictures.

Re:Exporting image assets from ethereum smart contract with ... by babyshake on Saturday March 27, 2021 @03:06PM (#26604609)
What about the types of sprites that you would find in an Atari 2600 or similar system? Would it be even remotely practical to store these on the Ethereum blockchain?
Re:Exporting image assets from ethereum smart contract with ... by dezmou on Saturday March 27, 2021 @03:24PM (#26604775)
A 64x64 monochrome bitmap would weight 512 bytes, still very expensive to store on blockchain
Re:Exporting image assets from ethereum smart contract with ... by chrisco255 on Sunday March 28, 2021 @01:55AM (#26608324)
Nah, it's not that prohibitive. Your standard Ethereum smart contract has at least a dozen variables stored at any time. About a year ago it was roughly $13 per KB. That price has probably doubled since then.
Re:Exporting image assets from ethereum smart contract with ... by dezmou on Saturday March 27, 2021 @02:34PM (#26604351)
this is why this approach is reserved to on-chain generated NFTs
Re:Exporting image assets from ethereum smart contract with ... by raidicy on Saturday March 27, 2021 @02:05PM (#26604116)
What about storing a base64 string and decoding it in the client? Would an arbitrary base64 string fit in a 256 variable?
Re:Exporting image assets from ethereum smart contract with ... by jstanley on Saturday March 27, 2021 @02:32PM (#26604334)
The amount of image data you can fit in (I assume) 256 bytes is pretty small. That's enough for an uncompressed 8-bit 16x16 pixel bitmap with no header. And you only get 3/4 of that amount of information if it's base64'd. With compression you can do better, but 256 bytes is not going to get you anywhere near the kind of high-resolution artwork that people seem to be using NFTs for.
Re:Exporting image assets from ethereum smart contract with ... by seoaeu on Saturday March 27, 2021 @03:25PM (#26604785)
Image compression will get you way further, but even then you'd probably need 10x the space for anything remotely reasonable