简体   繁体   中英

Sign transaction without broadcasting it with metamask (not using private key)

I'm trying to sign a transaction without broadcast using metamask. I have tried web3js and etherjs (eth_signTransaction) but neither worked. How to do this?

I think opensea is signing message and then using it for transaction. How did they do this?

  1. using web3js. I have tried this. But I get

MetaMask - RPC Error: Method not supported

const signedTx = await web3.eth.signTransaction(tx, accounts[0])
  1. using etherjs. I have tried this. But I get

Error: signing transactions is unsupported (operation="signTransaction", code=UNSUPPORTED_OPERATION

const signedTx = await signer.signTransaction(tx)

Metamask currently does not support the RPC method that is used to sign transactions. See the GitHub issue discussing why they chose not to implement it: https://github.com/MetaMask/metamask-extension/issues/3475

EDIT:

I think opensea is signing message and then using it for transaction. How did they do this?

The way that OpenSea allows minting in a gasless manner is actually quite simple: they don't mint the NFT until it is purchased by somebody. OpenSea then mints the NFT themselves, using an owner 'bypass' present in the contract it deploys.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM