简体   繁体   English

签署交易而不用元掩码广播它(不使用私钥)

[英]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.我已经尝试过 web3js 和 etherjs (eth_signTransaction),但都没有用。 How to do this?这该怎么做?

I think opensea is signing message and then using it for transaction.我认为 opensea 正在签署消息,然后将其用于交易。 How did they do this?他们是怎么做到的?

  1. using web3js.使用 web3js。 I have tried this.我试过这个。 But I get但我明白了

MetaMask - RPC Error: Method not supported MetaMask - RPC 错误:不支持的方法

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错误:不支持签署交易 (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. Metamask 当前不支持用于签署交易的 RPC 方法。 See the GitHub issue discussing why they chose not to implement it: https://github.com/MetaMask/metamask-extension/issues/3475请参阅 GitHub 问题讨论为什么他们选择不实施它: https://github.com/MetaMask/metamask-extension/issues/3475

EDIT:编辑:

I think opensea is signing message and then using it for transaction.我认为 opensea 正在签署消息,然后将其用于交易。 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 允许以无气体方式铸造的方式实际上非常简单:他们不会铸造 NFT,直到有人购买它。 OpenSea then mints the NFT themselves, using an owner 'bypass' present in the contract it deploys. OpenSea 然后使用它部署的合约中存在的所有者“绕过”来自己铸造 NFT。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用REST API Waves使用私钥签署交易? - How can I sign a transaction with a private key using the REST API Waves? 使用私钥创建的钱包实例自动创建和签署交易 - create and sign transaction automatically with wallet instance created with a private key Web3:访问 MetaMask 钱包中的私钥 - Web3: accessing private key in MetaMask wallet 替代元掩码。 谁管理私钥和以太币? - Alternative to metamask. Who manages the private key and the ethers? 使用 web3js 和元掩码的 ERC20 transferFrom() 私钥 - ERC20 transferFrom() private key with web3js and metamask 如何在javascript中使用证书的私钥对消息进行签名 - How to sign a message using private key of the certificate in javascript 在客户端使用私钥签名数据(javascript) - Sign data using private key on client-side (javascript) 使用浏览器的证书(私钥)对javascript中的某些字符串进行签名 - Using browser's certificate (private key) to sign some string in javascript 如何在CryptoJS中使用私钥(pem)签名JWT? - How to sign a JWT with a private key (pem) in CryptoJS? Crypto.sign() function 使用给定的私钥签署消息 - Crypto.sign() function to sign a message with given private key
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM