Closed ControlxFreak closed 1 year ago
Nope, I guess you can't do Option 1 or 2. Makes sense because this would make Ethereum vulnerable to double spend attack.
Traceback (most recent call last):
File "/usr/local/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.10/cProfile.py", line 190, in <module>
main()
File "/usr/local/lib/python3.10/cProfile.py", line 179, in main
runctx(code, globs, None, options.outfile, options.sort)
File "/usr/local/lib/python3.10/cProfile.py", line 19, in runctx
return _pyprofile._Utils(Profile).runctx(statement, globals, locals,
File "/usr/local/lib/python3.10/profile.py", line 62, in runctx
prof.runctx(statement, globals, locals)
File "/usr/local/lib/python3.10/cProfile.py", line 100, in runctx
exec(cmd, globals, locals)
File "test.py", line 239, in <module>
lootbox("aoth")
File "test.py", line 235, in lootbox
mint_nft(user_addr, data_uri)
File "/workspaces/XmasLootBox/src/eth.py", line 80, in mint_nft
txn_hash = w3.eth.send_raw_transaction(signed_txn.rawTransaction)
File "/usr/local/lib/python3.10/site-packages/web3/eth.py", line 831, in send_raw_transaction
return self._send_raw_transaction(transaction)
File "/usr/local/lib/python3.10/site-packages/web3/module.py", line 57, in caller
result = w3.manager.request_blocking(method_str,
File "/usr/local/lib/python3.10/site-packages/web3/manager.py", line 198, in request_blocking
return self.formatted_response(response,
File "/usr/local/lib/python3.10/site-packages/web3/manager.py", line 171, in formatted_response
raise ValueError(response["error"])
ValueError: {'code': -32000, 'message': 'replacement transaction underpriced'}
lol half of the time is spent sleeping...
Viola! Option 3 worked nicely. Dropped from 104s to 7s.
Now time to work on save_nft
Actually - without significant optimization, reducing the filesize (currently 512x512 and anything smaller looks weird), or by moving this off of Ethereum, I think this might be as fast as I can get it for now.
Each run takes about 2 minutes. That is way too long.
By-far, the biggest time-waste is waiting for the transaction receipt (80% of runtime).
Our options are:
Option 1 seems to make a lot of sense, but I think it will make for a bad user experience. This is because when the program returns, it will tell the user "your NFTs are ready!", but they won't be done for another minute or two. Granted... this will now look like it is opensea's fault rather than this program's fault (or Ethereum's fault more accurately)
Option 2 seems obvious as well, but there is no explicit tool in
web3.py
that will allow us to do this natively. I would have to write my own mumbojumbo... which isn't that difficult, but wouldn't be easy necessarily. (IDK, maybe it is now that I think about it a bit...)Option 3 is off the table. Sometimes Dalle makes crappy images so I want a variety to hedge bets.
Option 4 would be great but that is not part of the EIP721 standard. There is the EIP1155 standard which would allow this and is supported by opensea, but (by default) requires a static IPFS hash. Might be able to get around this with some magic though.
Option 5 would be much faster, but would cost real money... and a lot of it...
Option 6 🤮 polygon bad. ethereum good.
Option 7 I don't know if I have a big enough 🧠to do that in time.