essentiaone / essentia-bridges-api-ios

Bridges API wrapper for iOS application.
MIT License
10 stars 4 forks source link

another issue about transcation #31

Closed mousehaohao closed 5 years ago

mousehaohao commented 5 years ago

Hi impul, need help again. when send transaction, the response is

sendEthTransaction,value=10000000000000000,from address=0x927244ea76dd2d7c42f85efb86a9333cd2f39a67,toaddress=0xf3cb87c75f7b16c569154da1eec37e40b9aa3b1c, gasprice=3000000000, gaslimit=21000,nonce=6
"🌏 curl https://b3.essentia.network/api/v1/ethereum/wallets/transactions \\\n\t-X POST \\\n\t-H \'Content-Type: application/json\' \\\n\t-d \'{\n  \"data\" : \"0xf86c0684b2d05e0082520894f3cb87c75f7b16c569154da1eec37e40b9aa3b1c872386f26fc1000082307826a0ba350d7ce9ec2d512789f8e08af1375990fa304f73c7fcec29fda4b11dfa26a9a07d32997e314eca6d76abbe263227a8c5ee25469cf4dc8094878df6b810075a3a\"\n}\'"
"⚠️ The data couldn’t be read because it is missing."
"❗️ error(EssentiaNetworkCore.ErrorMessage(error: \"insufficient funds for gas * price + value\"))"

but I think there is enough fund in my account. gas*price+value is less than the balance in my account.

or do you have telegram account? may I add your IM account?

mousehaohao commented 5 years ago

Hi @impul I think the sign should be right the code is the same as in essentiaone

let dataPk = self.essentiaWallet.privateKey.raw
                ewLogger.debug("[ETH][TX] private key=\(dataPk.toHexString()), walletprivatekey=\(self.essentiaWallet.privateKey.get())")
                let signer = EIP155Signer.init(chainId: 1)
                guard let signedTxData = try? signer.sign(transaction, privateKey: dataPk) else {
                    ewLogger.error("[ETH][TX] sign error.")
                    return
                }
                self.ethBridgeWallet.sendTransaction(with: signedTxData.toHexString().addHexPrefix(), result: {
                    switch $0 {
                    case .success(let object):
                        ewLogger.error("[ETH][TX] send trans success, txid=\(object.txId)")
                    case .failure(let error):
                        ewLogger.error("[ETH][TX] send tx error, \(error)")
                    }
                })

Ps: could you please unblock me from the telegram, seems can not send pm to you, my account is @ProcessAlgebra

mousehaohao commented 5 years ago

the root cause is that I passed wrong private key. :(