Web3.swift icon indicating copy to clipboard operation
Web3.swift copied to clipboard

sendRawTransaction Send a transaction error

Open July-Only opened this issue 2 years ago • 2 comments

couldn't retrieve sender address ('') from the ethereum transaction: invalid chain id for signer: tx intended signer does not match the given signer: tx intended signer does not match the given signer

July-Only avatar Nov 05 '22 06:11 July-Only

@dengbangquan Please provide an example to reproduce the issue. I heard about this issue multiple times but couldn't reproduce it.

koraykoska avatar Nov 05 '22 09:11 koraykoska

For example: let web3 = Web3.init(rpcURL: "https://rpctest.ic-plaza.org",rpcId: 9000) let from = try! EthereumAddress.init(hex: "0x93B491B844d9e473Fc320F2d9430901F8b35f46B", eip55: false) let to = try! EthereumAddress.init(hex: "0x0ec48ce4af97fd6bb1d0d99d8957bf76fb651dc6", eip55: false) web3.eth.getTransactionCount(address: myPrivateKey.address, block: .latest) { resp in let noce = resp.result let tx = EthereumTransaction( nonce: noce, gasPrice: 21000, gas: 80000, from: from, to: to, value: EthereumQuantity(quantity: 1.eth) ) let signt = try! tx.sign(with: myPrivateKey,chainId: 9000) web3.eth.sendRawTransaction(transaction: signt, response: { resp in

            print("sendRawTransaction === \(resp)")
        })
    }

Okay

urica12 avatar Nov 22 '22 21:11 urica12