CRYPTO NEWS

Have metamask user pay minting fee, but owner sign transaction. onlyOwner and payable

I want to allow a user to mint an NFT through my React app to a payable function, but I also want to control the URI and Token ID sent to the contract because we use many different folders on IPFS. Is this possible? If I have a payable function that is also onlyOwner, the owner’s contract pays the minting fee, but I want the user to pay the minting fee. For example, in my React.js minting file

const mintBug = async (e, nextId) => {     e.preventDefault();        try {       await provider.send("eth_requestAccounts", []);        // If I use owner metamask private key owner has to pay       // const { REACT_APP_METAMASK_PRIVATE_KEY } = process.env;       // const signer = new ethers.Wallet(       //    REACT_APP_METAMASK_PRIVATE_KEY,       //    provider       //  );        // if I use this signer, the user pays       const signer = provider?.getSigner();        if (ContractAddress && signer) {         const NFTContract = new ethers.Contract(           ContractAddress,           abi,           signer         );          // payable amount from contract         const value = await NFTContract.MINT_PRICE();          const overrides = { value };          // where userAddress is the address to send it to         // and tokenURI is IPFS url         await NFTContract.payableMintNFT(userAddress, nextId, tokenURI, overrides);       }     } catch (err) {       console.error(err);      }   };  

And in the contract, for example

function mintNFT(address _toAddress, uint _tokenId, string memory _tokenURI) public payable onlyOwner {         _safeMint(_toAddress, _tokenId);         _setTokenURI(_tokenId, _tokenURI);          _numTokensMinted.increment();     } 

Is this even possible? Does anyone have any suggestions for other patterns to follow, like perhaps a payable function to reserve a token ID mapped to an address and then a separate minting function?

What does it mean to break non-invertible stream cipher?

Let’s consider for simplicity Middle-Square Weyl Sequence RNG: https://arxiv.org/pdf/1704.00358.pdf We can choose there parameter for independent stream generation, we can call it key. Let’s consider we would use it as a stream cipher, so stream is xored with plaintext. But what it mean to broke such a cipher? Even if we hack the key, we::Listen

Let’s consider for simplicity Middle-Square Weyl Sequence RNG:

https://arxiv.org/pdf/1704.00358.pdf

We can choose there parameter for independent stream generation, we can call it key. Let’s consider we would use it as a stream cipher, so stream is xored with plaintext.

But what it mean to broke such a cipher? Even if we hack the key, we can’t compute the seed in invertible way, beacuse regardless of the fact that minimal period of that PRNG is guaranteed, there is non-invertible transformation. We are loosing some bits after every step.

In that case it is not enough to find a key. When we would say that this cipher is broken? Does there have to be a seed recovery, to conclude that cipher is broken? Or maybe we could be talking about varying degrees of breaking such cipher? Because on one hand if we break the key, we can usually generate next bits of the stream. But so what if we can’t read the strem backwards until we get the seed back.

What is more important in such a case for the victim, that the attacker does not learn the key or the seed?

Have metamask user pay minting fee, but owner sign transaction. onlyOwner and payable

Shopping cart
There are no products in the cart!
Continue shopping
0