Closed guotie closed 5 years ago
I change the tx encode from base58 to base64, and the error changed to:
{"reason":"Invalid tx"}
the tx is:
tx_+K0LAfhCuECVAoKRHAA0340xaWjT794Jek19ClmfDIDUn7bZJzXqCFgc6fQQ/ryNNpw0FF/YPXU8JuHVERtCtUnZTdsbPKIKuGX4YwwBoQEZSfC6lpjA3coVQ76+43LwY86L6TBhcQFcMh3xOD2Yr6EBL4SNMItRNjNretVJr40fLGgJQOksMEqmhCFeFzAfg++IRWORgkT0AACGvv5vZyAAgi48iCg1/awAI5AAgBwMi5E=
// SignEncodeTx sign and encode a transaction func SignEncodeTx(kp *Account, txRaw []byte) (signedEncodedTx, signedEncodedTxHash, signature string, err error) { // add the network_id to the transaction msg := append([]byte("ae_mainnet"), txRaw...) // sign the transaction sigRaw := kp.Sign(msg) if err != nil { return } // encode the message using rlp rlpTxRaw, err := createSignedTransaction(txRaw, [][]byte{sigRaw}) // encode the rlp message with the prefix //signedEncodedTx = encodeP(PrefixTx, rlpTxRaw) signedEncodedTx = encodeP64(PrefixTx, rlpTxRaw) // compute the hash rlpTxHashRaw, err := hash(rlpTxRaw) signedEncodedTxHash = encodeP(PrefixTxHash, rlpTxHashRaw) // encode the signature signature = encodeP(PrefixSignature, sigRaw) return } func encodeP64(prefix HashPrefix, data []byte) string { return fmt.Sprint(prefix, encode64(data)) } func encode64(in []byte) interface{} { c := hashSha256(hashSha256(in)) return base64.StdEncoding.EncodeToString(append(in, c[0:4]...)) }
老兄 中国人? 就是一个加密算法用错了 encodeP里面用的是base58 然而tx需要base64
用base58时,报"Invalid api encoding"
改成base64之后报"Invalid tx"
老外的项目真tmd不靠谱
兄弟我的没毛病了 你是不是fee没调大 fee得为17000+
我们交易所都上线了,完全没毛病
只是错误返回不明显 我当初fee也是默认为1 结果也报Invalid tx
fee设置成17000,还是 Invalid tx
thank you very much. @wx-shi
It my fault, I got wrong nonce.
I use the Spend method in helper.go, I got error
The tx and post request is following:
How to solve it