'EOS. Unexpected amount descreasing after generate raw (unsigned) transaction, sign it and broadcast

Account on jungle testnet.

I. Here is attempt to send 95 EOS and also powerup and buy ram while balance is 102 EOS at attempt moment. As result: got error which is about enough amount.

Picture with balance

Transaction content:

{"transaction":{"expiration":"2022-05-16T09:42:23.349+00:00","ref_block_num":140806677,"ref_block_prefix":3316434404,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getName":"transfer"}],"transaction_extensions":[],"signatures":[],"context_free_data":[],"getRefBlockPrefix":3316434404,"getMaxNetUsageWords":0,"getMaxCpuUsageMs":0,"getDelaySec":0,"getContextFreeActions":[],"getActions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6f07e0e000000000004454f530000000000","getName":"transfer"}],"getTransactionExtensions":[],"getExpiration":1652694143349,"getRefBlockNum":140806677},"chainId":"2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"}

When I tried send, I have got error:

Can't broadcast transaction #hex {"signatures":["SIG_K1_Jw6ws6tJWRpy93ySXzv6B8QTotgLadfoaLULPMrSwG8m4skYCi5nVnMBm1RC6qEmUT2fAWqKka37CALgbYVnzEJpF5hdep"],"compression":"none","packed_context_free_data":"","packed_trx":"7f1c8262158ae4c5acc500000000040000000000ea3055000000a0eaab38ad0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32323410420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f530000000000a6823403ea3055000000572d3ccdcd0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32322110420835aa96949a203256b96a4e6bd6f07e0e000000000004454f5300000000000000000000ea3055000000a0eaab38ad0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32323410420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f530000000000a6823403ea3055000000572d3ccdcd0210420835aa96949a00000000a8ed323210420835aa96949a00000000a8ed32322110420835aa96949a203256b96a4e6bd6f07e0e000000000004454f53000000000000"}. com.unitedtraders.luna.crypto.spi.exception.BlockchainDataProviderException: Cannot send eos transaction. Response: ChainError(code=500, message=Internal Service Error, error=Error(code=3050003, name=eosio_assert_message_exception, what=eosio_assert_message assertion failure, details=[Details(message=assertion failure with message: overdrawn balance, method=eosio_assert), Details(message=pending console output: , method=exec_one)])).

II. Here is attempt to send 30 EOS and also powerup and buy ram while balance is 102 EOS at attempt moment. As result: decreasing amount is about 60 EOS. This attempt is successful.

But balance decreased in unexpected amount:

  • before sending it was 102 EOS
  • after sending it was 41.9996 EOS.

Seems like x2 decreasing (transferring is 30, powerup fee is 0.0002).

Transaction content:

{"transaction":{"expiration":"2022-05-16T11:02:44.414+00:00","ref_block_num":140816318,"ref_block_prefix":1732454216,"max_net_usage_words":0,"max_cpu_usage_ms":0,"delay_sec":0,"context_free_actions":[],"actions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getName":"transfer"}],"transaction_extensions":[],"signatures":[],"context_free_data":[],"getRefBlockPrefix":1732454216,"getMaxNetUsageWords":0,"getMaxCpuUsageMs":0,"getDelaySec":0,"getContextFreeActions":[],"getActions":[{"account":"eosio","name":"powerup","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio","getData":"10420835aa96949a10420835aa96949a010000005825450000000000267d000000000000102700000000000004454f5300000000","getName":"powerup"},{"account":"eosio.token","name":"transfer","authorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"data":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getAuthorization":[{"actor":"needhelp1111","permission":"active","getActor":"needhelp1111","getPermission":"active"}],"getAccount":"eosio.token","getData":"10420835aa96949a203256b96a4e6bd6e09304000000000004454f530000000000","getName":"transfer"}],"getTransactionExtensions":[],"getExpiration":1652698964414,"getRefBlockNum":140816318},"chainId":"2a02a0053e5a8cf73a56ba0fda11e4d92e0238a4a2aa74fccf46d5a910746840"}

Can anybody explain what's going wrong and why sending amount is 30, but decreasing amount is 60?

Thx in advance)



Solution 1:[1]

If you are trying to make your audio app use control center (like spotify does) you need to use the MPNowPlayingInfoCenter to set the now playing item data (like:title, rate, duration, elapsedTime,...) it will be something like that:

MPNowPlayingInfoCenter.default().nowPlayingInfo = [
        MPMediaItemPropertyTitle: title,
        MPMediaItemPropertyArtist: artist,
        MPNowPlayingInfoPropertyElapsedPlaybackTime: position,
        MPMediaItemPropertyPlaybackDuration: duration,
        MPNowPlayingInfoPropertyPlaybackRate: rate,
    ]

this will set the data of the played audio item in the media control center now in order to be able to use the controls button need to use the MPRemoteCommandCenter and set the target for each command you want to use for example for play/pause actions it can be done like that:

    MPRemoteCommandCenter.shared().playCommand.addTarget(handler: playActionHandler)
    MPRemoteCommandCenter.shared().pauseCommand.addTarget(handler: pauseActionHandler)

once all of this is done you will need to call the method bellow in order for your app to be able to receive the remote events and execute the needed action

        UIApplication.shared.beginReceivingRemoteControlEvents()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Hach3m