slimcoin-project / pacli

Simple CLI PeerAssets client (extended version).
GNU General Public License v3.0
0 stars 0 forks source link

0.01 tSLMs missing #104

Closed buhtignew closed 5 months ago

buhtignew commented 5 months ago

I've been testing token transfer command and thus I've done many different transactions today:

208c48c3376a67fe9e72d8aeef7134a397250aff9b38916760d905a493d6428e
f8045efacdffe7ac25361d1593b40f7890efbe922b043a9c17a98c1e0579e827
d53104a4e30ce9f3d29611596b3a80b936ffbf50c63a8c2c809466877ac8b4b6
d7a704cb4fc0e88defab7a16aa2c1b09c6fca0c5bc5a8c2dde28a28d4888c3e8
9eae44438718d1fc252802735f93493eeed3ad457fe5cf1052425092079919c0
b271e41ca3075981f97d6a73f278c7535c31f68700ee65b7890b3acdf8f6c96c
49cabb53871e588561a46daf2e2427b01adaaca70a7cb44fcf0ed3316ff9a811

They all have something in common - if I check them with transaction show -s command it seems like each time a 0.01 of tSLMs disappears. For instance the output of transaction show 49cabb53871e588561a46daf2e2427b01adaaca70a7cb44fcf0ed3316ff9a811 -s is:

{
    'inputs': [
        {'sender': ['mtMGkB2mVxzPNZCWHruRmG1SmsSJBtyCUD'], 'value': 89.96}
    ],
    'outputs': [
        {'receivers': ['mkwJijAwqXNFcEBxuC93j3Kni43wzXVuik'], 'value': 0.01},
        {'receivers': [], 'value': 0.01},
        {'receivers': ['mtMGkB2mVxzPNZCWHruRmG1SmsSJBtyCUD'], 'value': 0.01},
        {'receivers': ['mx5MdsenFDZufFuwT9ND7BKQBzS4Hy9YUP'], 'value': 89.92}
    ],
    'blockheight': 447628
}

The value sent is 89.96, but the sum of the received tSLMs is 89.95. I don't know whether the issue appears for other type of transactions as well. _ By the way are you able to see which tokens has been moved with each transaction? Is there a command to see the structure of the transaction also in terms of tokens?

d5000 commented 5 months ago

The 0.01 tSLM "missing" are the transaction fee. This is similar to Bitcoin by the way.

Is there a command to see the structure of the transaction also in terms of tokens?

Yes. There is the command token parse_transfer DECKID TXID / card parse. It will show you all elements of the transfer (senders, receivers, token etc.). It's an original vanilla command so it's not as user friendly as the newer commands though, so normally I'd recommend to simpy use token transfers / card list.

A nice idea would be to filter token transfers by address. If it's an easy addition I'll add it.

Edit: Done, was indeed an easy addition and I think it's very useful (commit 308e5fe):

token transfers -a ADDRESS shows transfers involving address ADDRESS, and token transfers -a without an address will show those on the current main address.

buhtignew commented 5 months ago

The 0.01 tSLM "missing" are the transaction fee. This is similar to Bitcoin by the way.

I thought this line was representing the system fee:

{'receivers': [], 'value': 0.01},

If not what does it represent? Would it make sense/be possible to display the system fee payment in the transaction show -s output?

token transfers -a ADDRESS shows transfers involving address ADDRESS, and token transfers -a without an address will show those on the current main address.

After upgraded pacli I haven't found the -a flag implemented for the token transfers command yet.

d5000 commented 5 months ago

I thought this line was representing the system fee:

This is the OP_RETURN output, where the data is stored. The fee is technically not part of the transaction, so it would not make sense to add it in the -s mode. There could be a future ultra-userfriendly mode showing also the fee, the opcodes (like OP_RETURN) etc., but that's outside the scope of the initial version. The idea of the "structure" was mainly to show the senders, which are not present in the normal transaction JSON. It was first a debugging option but I included it because seeing the senders directly are also useful for normal users.

After upgraded pacli I haven't found the -a flag implemented for the token transfers command yet.

Oh, I'm sorry. I only implemented it for the card class and had to add the option to the token class too. Fixed in commit 29fb4ac.

buhtignew commented 5 months ago

Oh, I'm sorry. I only implemented it for the card class and had to add the option to the token class too. Fixed in commit https://github.com/slimcoin-project/pacli/commit/29fb4acf22d1ea11a9037506e6825f4f2f016e8b.

I've tested token transfers -a, token transfers -a mzP9BNtqjSNq2rJ58w8GpQNnez38NGagsU, card list -a and card list -a mzP9BNtqjSNq2rJ58w8GpQNnez38NGagsU and got:

ERROR: The function received no value for the required argument: idstr
Usage: pacli card list IDSTR <flags>
  optional flags:        --address | --quiet | --valid | --debug

For detailed information on this command, run:
  pacli card list --help

(my pacli is up to date)

d5000 commented 5 months ago

Deck (token) as positional argument is still necessary.

Complete command thus is token transfers TOKEN -a [ADDRESS]

buhtignew commented 5 months ago

I think this issue is solved. We can close it.