Boilertalk / Web3.swift

A pure swift Ethereum Web3 library
MIT License
636 stars 187 forks source link

sendRawTransaction Send a transaction error #146

Open July-Only opened 1 year ago

July-Only commented 1 year ago

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

koraykoska commented 1 year ago

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

urica12 commented 1 year ago

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