w3c-ccg / did-hackathon-2018

WORK ITEM: Summer Outreach for DIDs & Verifiable Credentials
Other
4 stars 3 forks source link

MVP Test #2 says the tip is spent, but I can't find the spending transaction #2

Open kulpreet opened 6 years ago

kulpreet commented 6 years ago

@ChristopherA I might be wrong or going down the wrong path, but the MVP Test #2 (https://github.com/w3c-ccg/did-hackathon-2018/blob/master/BTCR-DID-Tests.md) says the DID is revoked because the tip is spent, but I can't find any transaction with an input of txid: 2f1838f481be7b4f4d37542a751aa3a27be7114f798feb24ff0fc764730973d0 and vout: 0.

The output address for that txid/vout is mqkvMtYfTufj3iEXjYHmnopZrsowMFxrKw and both blockcypher and my little btcr-service are both failing to show any spends with txid: 2f1838f481be7b4f4d37542a751aa3a27be7114f798feb24ff0fc764730973d0 and vout: 0.

https://live.blockcypher.com/btc-testnet/address/mqkvMtYfTufj3iEXjYHmnopZrsowMFxrKw/

https://btcr-service.opdup.com/addr/mqkvMtYfTufj3iEXjYHmnopZrsowMFxrKw/spends

I am pretty sure I a missing some key point here. Wanted to check with you as I am sure I must be missing something.

ChristopherA commented 6 years ago

No, it is quite likely I screwed up somewhere — needed better tools to see where.

kulpreet commented 6 years ago

I thought a /tip endpoint might help, so I put together a quick and dirty solution.

/tip by default lists only the chain of spending transaction starting from the txref vout.

But if you want to see the entire set of transacation for the address in the txref vout, then you can pass a spendsOnly=false query string param to /tip.

There is an extra property in the transaction JSON called "InTipChain", and this is set to true if the transaction is part of the spending transactions starting from txref vout.

In case of our MVP examples:

  1. https://btcr-service.opdup.com/txref/txtest1:x705-jzv2-qqaz-7vuz/tip shows that the txref vout transaction has been spent.

  2. https://btcr-service.opdup.com/txref/txtest1:xz35-jzv2-qqs2-9wjt/tip shows the txref vout has not been spent. So you can see all the transactions by invoking the endpoint like so: https://btcr-service.opdup.com/txref/txtest1:xz35-jzv2-qqs2-9wjt/tip?spendsOnly=false

I am going to try and switch to the part about extracting the pubkeyhex, I think I will gain more clarity about the resolving algo by doing that.

Meanwhile I hope the /tip endpoint helps.