wavesplatform / WavesSDK-android

Waves SDK for Android
https://wavesplatform.com/
MIT License
15 stars 8 forks source link

E/Sign: Can't create bytes for sign in Transfer Transaction #1

Open JiyeonLuda opened 5 years ago

JiyeonLuda commented 5 years ago

hi ! I need your help. I was followed this guide : https://github.com/wavesplatform/WavesSDK-android/wiki/Get-started-with-WavesSDK-for-Android

and at step 6.Signing and sending a transaction: it wasn't working . when i trying to "transferTransaction.sign(seed = SEED)" , got error : E/Sign: Can't create bytes for sign in Transfer Transaction

How can i fix it ?

E/Sign: Can't create bytes for sign in Transfer Transaction com.wavesplatform.sdk.crypto.Base58$InvalidBase58 at com.wavesplatform.sdk.crypto.Base58.decode(Base58.kt:100) at com.wavesplatform.sdk.crypto.WavesCrypto$Companion.base58decode(WavesCrypto.kt:179) at com.wavesplatform.sdk.utils.SignUtil.attachmentBytes(SignUtil.kt:40) at com.wavesplatform.sdk.model.request.node.TransferTransaction.toBytes(TransferTransaction.kt:66) at com.wavesplatform.sdk.model.request.node.BaseTransaction.getSignedBytesWithSeed(BaseTransaction.kt:97) at com.wavesplatform.sdk.model.request.node.BaseTransaction.getSignedStringWithSeed(BaseTransaction.kt:101) at com.wavesplatform.sdk.model.request.node.BaseTransaction.sign(BaseTransaction.kt:91) at com.example.wave_test.MainActivity.transactionsBroadcast(MainActivity.kt:146)

raqeta commented 5 years ago

Hi, it looks like a problem with the signature of bytes attachment. Problem was with empty string. We fixed it in version 0.0.6. Try to upgrade to it. And If after that the problem will be repeated write here. We will see it. Thanks for the comment and sorry for my long reaction :)

JiyeonLuda commented 5 years ago

Hi , raqeta . thanks for reply. I try new version -> implementation com.wavesplatform:android-sdk:0.0.6 (and rebuild) but it is still not working.

E/Sign: Can't create bytes for sign in Transfer Transaction com.wavesplatform.sdk.crypto.Base58$InvalidBase58 at com.wavesplatform.sdk.crypto.Base58.decode(Base58.kt:100) at com.wavesplatform.sdk.crypto.WavesCrypto$Companion.base58decode(WavesCrypto.kt:209) at com.wavesplatform.sdk.utils.SignUtil.textFromBase58(SignUtil.kt:22) at com.wavesplatform.sdk.utils.SignUtil.attachmentBytes(SignUtil.kt:46) at com.wavesplatform.sdk.model.request.node.TransferTransaction.toBytes(TransferTransaction.kt:65) at com.wavesplatform.sdk.model.request.node.BaseTransaction.getSignedBytesWithSeed(BaseTransaction.kt:97) at com.wavesplatform.sdk.model.request.node.BaseTransaction.getSignedStringWithSeed(BaseTransaction.kt:101) at com.wavesplatform.sdk.model.request.node.BaseTransaction.sign(BaseTransaction.kt:91) at com.wavesplatform.sdk.model.request.node.TransferTransaction.sign(TransferTransaction.kt:74)

I use this Library for make , Signing and sending a transaction.

https://wavesplatform.github.io/waves-transactions/index.html

But I hope to use this SDK soon.
Let me know if i need to try something more.

raqeta commented 5 years ago

Could you give me data of your request?

var assetId: String var recipient: String (address or alias) var amount: Long var fee: Long var attachment: String (I guess problem is here :) var feeAssetId: String var type: Byte = 4 var timestamp: Long var fee: Long var version: Byte = 2 var proofs: MutableList (no need) var signature: String (no need) var chainId: Byte = 87

Almirant-fujhitora commented 5 years ago

The probem is a BAD DOCUMENTATION!

in the example you have fee, but to make it work you have to ignore the fee on version 0.0.7

    // Creation Transfer transaction and fill it with parameters
    val transferTransaction = TransferTransaction(
            assetId = WavesConstants.WAVES_ASSET_ID_EMPTY,
            recipient = "3PLvKPDE4h2Tzsd94waEVFLD8tqtkiise4B",
            amount = 100000000,
            attachment = SignUtil.textToBase58("Tip me"),
           // fee = WavesConstants.WAVES_MIN_FEE,
            feeAssetId = WavesConstants.WAVES_ASSET_ID_EMPTY
            )

I just removed the fee, has you can see and it Worked!

Please Wave team, update your Documentation...

Tip: 3PLvKPDE4h2Tzsd94waEVFLD8tqtkiise4B :smile: