iquidus / explorer

An open source block explorer
BSD 3-Clause "New" or "Revised" License
747 stars 1.33k forks source link

Raw transaction odd behaviour for POS reward #192

Open iamisti opened 6 years ago

iamisti commented 6 years ago

something is odd in the explorer

https://explorer.myce.world/address/MShXyVpY3GwcVgKsjdsnLHiQeHvBgDWHJG

I have recent transaction: 55d9e6fe95b29de26b2e77b00da0448436c630e9a3e413a891e387a73118228f (https://explorer.myce.world/tx/55d9e6fe95b29de26b2e77b00da0448436c630e9a3e413a891e387a73118228f) On the wallet page it says I've got 20 coins with that transaction, but when I use the explorer api:

it says I've got 16885... lol https://explorer.myce.world/api/getrawtransaction?txid=55d9e6fe95b29de26b2e77b00da0448436c630e9a3e413a891e387a73118228f&decrypt=1

so how that 20 is calculated?

If the amount is calculated differently then in my opinion ot should be somehow reflected in the response. Otherwise it will be impossible to know what is going on.

i want to use the api to fetch all transfers with the amount that the wallet received for each tansactions. How can i achieve that? With this inconsistency im not sure how a simple thing like this could be possible to do.

thanks for the anwers in advance!

Igor-san commented 6 years ago

It is POS from your input https://explorer.myce.world/api/getrawtransaction?txid=fda7c7a230761afa206bacdd626080e11e025d788428307088c7f5e2e3f0fab5&decrypt=1 Its is correct

iamisti commented 6 years ago
  1. where do you see that it's POS? There is no indication in the response or whatsoever (at least i don't see any :P )
  2. why is it correct? It received 20 not 16885. Can you help me understand it?

I really need to get it right and solve this issue, and would be great if you can help me out with that. Thanks!

What is n:1 and n:2 in the response? Is that the indication if it's POS?

Igor-san commented 6 years ago

http://images.devs-on.net/Image/UNdJq4OyRrWTY6pt-.png 16885.0336- 16865.0336 =20 http://images.devs-on.net/Image/4InlvUVtZRij7Jbi-.png Sorry, english not my native language

iamisti commented 6 years ago

thanks but how do i know if a transaction os pos or just a regular transaction?

Igor-san commented 6 years ago

In the wallet it should be displayed as "Minted"

iamisti commented 6 years ago

but thats the point. i dont want to use wallet. i should be able to detect it with using only the api

iamisti commented 6 years ago

anyone?

carlesgrauvila commented 6 years ago

Hello @Igor-san @iamisti , I'm wondering if you could explain to me how to know the exact number of stake. The images are not working anymore.

g1itch commented 3 years ago

It seems related to totally wrong balances here: http://net.altcoinwarz.com/ - it adds transaction vout as newly minted coins on every stake tx.

For example it shows that nJ5gyQyh2YHvsyB8N7UXWE8WSH2J588vZH was generated + 205.78542747 NET in tx 4e78e7d471a4e77afff09858b8c430ec95b18430266f3f96c157e627b6b42bda (http://net.altcoinwarz.com/address/nJ5gyQyh2YHvsyB8N7UXWE8WSH2J588vZH). It's not newly minted coins but the total amount of coins in that address for the date 28th Jan 2020 10:20:23. netcoind wallet shows that transaction as follows

{
    "txid" : "4e78e7d471a4e77afff09858b8c430ec95b18430266f3f96c157e627b6b42bda",
    "version" : 2,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "ef7c4725a78ec6c69f13fd30fd382cfc941613586287093d561ecfd6f19c0ad9",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "30440220391a1ba916d4ef632ec0ee8a074b16258b5d54f63019c9000adeeb713838fbef02206858072737cba31aefecc9baed894ae6f78b9ee66508b39aa56c460b63b61e0201",
                "hex" : "4730440220391a1ba916d4ef632ec0ee8a074b16258b5d54f63019c9000adeeb713838fbef02206858072737cba31aefecc9baed894ae6f78b9ee66508b39aa56c460b63b61e0201"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "",
                "type" : "nonstandard"
            }
        },
        {
            "value" : 205.78542747,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "03f980fcdc373472c2b8cd11d3157eab0c7c0ce9a0eb3031590b4e152c9173ede0 OP_CHECKSIG",
                "reqSigs" : 1,
                "type" : "pubkey",
                "addresses" : [
                    "nJ5gyQyh2YHvsyB8N7UXWE8WSH2J588vZH"
                ]
            }
        }
    ],
    "amount" : 0.00000000,
    "fee" : 0.01557048,
    "confirmations" : 173803,
    "generated" : true,
    "blockhash" : "0c3a356875acf114e7da5c31e7231c7a7a6b99a06369b0f212f64094a30635d1",
    "blockindex" : 1,
    "blocktime" : 1580235623,
    "txid" : "4e78e7d471a4e77afff09858b8c430ec95b18430266f3f96c157e627b6b42bda",
    "time" : 1580235623,
    "timereceived" : 1580235623,
    "details" : [
        {
            "account" : "",
            "address" : "nJ5gyQyh2YHvsyB8N7UXWE8WSH2J588vZH",
            "category" : "generate",
            "amount" : 0.01557048
        }
    ]
}

Newly minted coins are in "fee" field - 0.01557048 NET.

Balance of that addr is not 26359.67584365 as it shown, but 207.88889998.

Raw transaction from the explorer is

{
  "hex": "0200000001d90a9cf1d6cf1e563d09876258131694fc2c38fd30fd139fc6c68ea725477cef01000000484730440220391a1ba916d4ef632ec0ee8a074b16258b5d54f63019c9000adeeb713838fbef02206858072737cba31aefecc9baed894ae6f78b9ee66508b39aa56c460b63b61e0201ffffffff020000000000000000009ba493ca04000000232103f980fcdc373472c2b8cd11d3157eab0c7c0ce9a0eb3031590b4e152c9173ede0ac0000000000",
  "txid": "4e78e7d471a4e77afff09858b8c430ec95b18430266f3f96c157e627b6b42bda",
  "version": 2,
  "locktime": 0,
  "vin": [
    {
      "txid": "ef7c4725a78ec6c69f13fd30fd382cfc941613586287093d561ecfd6f19c0ad9",
      "vout": 1,
      "scriptSig": {
        "asm": "30440220391a1ba916d4ef632ec0ee8a074b16258b5d54f63019c9000adeeb713838fbef02206858072737cba31aefecc9baed894ae6f78b9ee66508b39aa56c460b63b61e0201",
        "hex": "4730440220391a1ba916d4ef632ec0ee8a074b16258b5d54f63019c9000adeeb713838fbef02206858072737cba31aefecc9baed894ae6f78b9ee66508b39aa56c460b63b61e0201"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0,
      "n": 0,
      "scriptPubKey": {
        "asm": "",
        "type": "nonstandard"
      }
    },
    {
      "value": 205.78542747,
      "n": 1,
      "scriptPubKey": {
        "asm": "03f980fcdc373472c2b8cd11d3157eab0c7c0ce9a0eb3031590b4e152c9173ede0 OP_CHECKSIG",
        "reqSigs": 1,
        "type": "pubkey",
        "addresses": [
          "nJ5gyQyh2YHvsyB8N7UXWE8WSH2J588vZH"
        ]
      }
    }
  ],
  "blockhash": "0c3a356875acf114e7da5c31e7231c7a7a6b99a06369b0f212f64094a30635d1",
  "confirmations": 173804,
  "time": 1580235623,
  "blocktime": 1580235623
}