Open kLkA opened 6 years ago
The numbers in "type": 2
and "type": 3
should be replaced with strings which indicate what the "type" actually is. Right now even I'm not sure what these are indicating, without first diving into the implementation.
Since this is the JSON-RPC API, and for this API we prefer to use account names rather than numbers (as the gRPC API does), both the previous and output accounts should be the account name.
How are you determining the input amount for ticket inputs? The first and only input in this transaction doesn't have any previous amount set.
Why is the value for the "address"
field an empty JSON object?
Once again this will run into issues in SPV wallets, where the ticket status might be indeterminable without additional states to report.
Did an update regarding SPV
wallet implementation and applied changes corresponding to your remarks, example below:
Live ticket (default)
{ [17/1334]
"ticket": {
"hash": "05d8f596b59e1612e5ec84fd7ef609c39833cd4d58cdd0630d7731f5ce802911",
"transaction": "010000000171dc859320fdf63f320d439a15029e069ff019c0e1d9817fa581f33c854cc76b0800000000ffffffff03204e00000000000000001aba76a914d8bde14c5ab57ab9d814a8e1e38ed0d33eff895988ac00000000000000000000206a1e2c0f432588b17d3989debb15a5236c7df613fc9b88c20$
00000000000058000000000000000000001abd76a914000000000000000000000000000000000000000088ac00000000000000000188c200000000000000000000ffffffff6b483045022100bd94f8e56f363bb12f463d5a5461809c547a586644d1a3c1bc2be9d33dfe26c3022069d7c2eb853caa854e2f9af823c265ce110a09229$
1d79b3d6c30fbb1c9fee6b012102d4673d664536506cf61e787470dfe5131b0b74f2e410c50877dbf7a98900b340",
"myinputs": [
{
"index": 0,
"previousaccount": "default",
"previousamount": 0.000498
}
],
"myoutputs": [
{
"index": 0,
"account": "default",
"internal": false,
"amount": 0.0002,
"address": "Ssp7J7TUmi5iPhoQnWYNGQbeGhu6V3otJcS",
"outputscript": "ba76a914d8bde14c5ab57ab9d814a8e1e38ed0d33eff895988ac"
}
],
"fee": 0.000298,
"timestamp": 1539110379,
"type": "TICKETPURCHASE"
},
"spender": null,
"status": "LIVE"
}
Live ticket (SPV mode)
{
"ticket": {
"hash": "05d8f596b59e1612e5ec84fd7ef609c39833cd4d58cdd0630d7731f5ce802911",
"transaction": "010000000171dc859320fdf63f320d439a15029e069ff019c0e1d9817fa581f33c854cc76b0800000000ffffffff03204e00000000000000001aba76a914d8bde14c5ab57ab9d814a8e1e38ed0d33eff895988ac00000000000000000000206a1e2c0f432588b17d3989debb15a5236c7df613fc9b88c20$
00000000000058000000000000000000001abd76a914000000000000000000000000000000000000000088ac00000000000000000188c200000000000000000000ffffffff6b483045022100bd94f8e56f363bb12f463d5a5461809c547a586644d1a3c1bc2be9d33dfe26c3022069d7c2eb853caa854e2f9af823c265ce110a09229$
1d79b3d6c30fbb1c9fee6b012102d4673d664536506cf61e787470dfe5131b0b74f2e410c50877dbf7a98900b340",
"myinputs": [
{
"index": 0,
"previousaccount": "default",
"previousamount": 0.000498
}
],
"myoutputs": [
{
"index": 0,
"account": "default",
"internal": false,
"amount": 0.0002,
"address": "Ssp7J7TUmi5iPhoQnWYNGQbeGhu6V3otJcS",
"outputscript": "ba76a914d8bde14c5ab57ab9d814a8e1e38ed0d33eff895988ac"
}
],
"fee": 0.000298,
"timestamp": 1539110380,
"type": "TICKETPURCHASE"
},
"spender": null,
"status": "UNSPENT"
}
Voted ticket (both modes)
{
"ticket": {
"hash": "0957ca2b7c5371598393a565927b1aef91f8763028629e5c7212640557cdb871",
"transaction": "010000000171dc859320fdf63f320d439a15029e069ff019c0e1d9817fa581f33c854cc76b0600000000ffffffff03204e00000000000000001aba76a914d8bde14c5ab57ab9d814a8e1e38ed0d33eff895988ac00000000000000000000206a1e2c2fe049caff028e838ff1a488a18f478c374e8588c20$
00000000000058000000000000000000001abd76a914000000000000000000000000000000000000000088ac00000000000000000188c200000000000000000000ffffffff6b483045022100a8a048e8e80b7546387fad9bb21689e06e088868662d5a7945633f4142b66633022047b6b017e2d5288677d34a03445335d5c1964b963$
ee7b372ccc21b477bf7cdf012102d4673d664536506cf61e787470dfe5131b0b74f2e410c50877dbf7a98900b340",
"myinputs": [
{
"index": 0,
"previousaccount": "default",
"previousamount": 0.000498
}
],
"myoutputs": [
{
"index": 0,
"account": "default",
"internal": false,
"amount": 0.0002,
"address": "Ssp7J7TUmi5iPhoQnWYNGQbeGhu6V3otJcS",
"outputscript": "ba76a914d8bde14c5ab57ab9d814a8e1e38ed0d33eff895988ac"
}
],
"fee": 0.000298,
"timestamp": 1539110380,
"type": "TICKETPURCHASE"
},
"spender": {
"hash": "91ff53aa435f6e3f86e43a9b672a7f8e5bf2459247c5fd21ea67a8b8c2a8167a",
"transaction": "01000000020000000000000000000000000000000000000000000000000000000000000000ffffffff00ffffffff71b8cd57056412725c9e62283076f891ef1a7b9265a593835971537c2bca57090000000001ffffffff0300000000000000000000266a2450289e02f6f50450e26693b0bfd38e9194677$
76a8509ecb3cf41024d17200008f00000000000000000000000000086a06010006000000e5700bb10000000000001abb76a9142c2fe049caff028e838ff1a488a18f478c374e8588ac000000000000000002c5220bb10000000000000000ffffffff04deadbeef204e00000000000000000000ffffffff6b48304502210082c4ad2d1$
76b7a022eefd0837e8be912d9829112c97c5292f8b71d4b48e5c7302203ebcf52cff791a1f63672d6c9e9ab1bbcea92c3753997c1d9f446bdf96023cd40121023d206b0f7171ab012ce3860dc54c7705dd861cb822ac60eff6c1652e6a53e774",
"myinputs": [
{
"index": 1,
"previousaccount": "default",
"previousamount": 0.0002
}
],
"myoutputs": [
{
"index": 2,
"account": "default",
"internal": true,
"amount": 29.70317029,
"address": "SsYNumrZtVR7YkqwLMhcVuNqCb42Rp5qGe3",
"outputscript": "bb76a9142c2fe049caff028e838ff1a488a18f478c374e8588ac"
}
],
"fee": 0,
"timestamp": 1539110487,
"type": "VOTE"
},
"status": "VOTED"
},
Done
I'll like to take this up
listtickets
cmd produces an array of ticket information objects. Example