Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction ID as Position in Block? #1

Closed
ChristopherA opened this issue Jun 30, 2017 · 9 comments
Closed

Transaction ID as Position in Block? #1

ChristopherA opened this issue Jun 30, 2017 · 9 comments

Comments

@ChristopherA
Copy link
Member

Blockstack was the first to suggest that the DID an index of the transaction within a confirmed block, rather than the transaction ID. The advantage of this is that it is possible to have a transaction id that isn't confirmed, as it is only the hash of the transaction. The disadvantage of it is all of the bitcoin explorer APIs search on transaction id.

The most secure method of confirming a DID:BTCR will be to have a full node with -txindex on, but ideallly we do want to support lighter clients being able to confirm via a online explorer.

We should investigate if any explorer APIs allow us to search for a transaction index within a block, or announce support of @veleslavs & @jonasschnelli proposal for a bech32 transaction id.

cc: @muneeb-ali @shea256 @jcnelson

@jonasschnelli
Copy link

Ideally block explorer support it. But I guess that will take a while.

Much better is, that you actually don't need a tx-indexed blockchain or blockexplorer to grab a Tx-Ref according to the txref BIP.

You can do it on the client side within seconds (by SPV check the block-headers and download a single block).

I'm currently adding support for TxRef's after the BIP above in libbtc.

The power lies in the fact that everyone can fetch a TxRef TX with SPV within seconds from the p2p network (== not trusting anyone). No bloom filters are involved.

@ChristopherA
Copy link
Member Author

@jonasschnelli Very cool ! I didn't quite connect that you didn't need a tx-indexed full node to grab one of your tx-refs!

I look forward to seeing your libbtc implementation of it. If you have it functioning by the start of our virtual hackathon on the week of July 10th, we'll likely base the C-version of our prototype code for DIDs using libbtc.

@jonasschnelli
Copy link

I can add some things to give you a C toolset to worth with txref as well as with the block fetching... most things are already there. Should be done before July 10th.

@ChristopherA
Copy link
Member Author

@jonasschnelli — Thanks! That will be extremely helpful.

BTW, do you have any recommendations for a C library to aid in using JSON-RPC calls to bitcoind? @shannona and I have been using libbitcoinrpc for our tutorial (see drafts at https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line/blob/master/12_2_Accessing_Bitcoind_with_C.md & https://github.com/ChristopherA/Learning-Bitcoin-from-the-Command-Line/blob/master/12_3_Programming_Bitcoind_with_C.md ) and it has been quite painful.

@jonasschnelli
Copy link

Yeah. RPC / JSON is painful in plain C.
I came to the conclusion to only do the core stuff in C (hash / tx / blocks / bip32 / keys / ecdsa / ser-/deser / AES / CPRNG), things that can be use on embedded devices. JSON/RPC as well as the network layer make probably much more sense to do in C++(11).
C++11 is fully portable IMO (all modern smartphone operating system as well as all widely used desktop systems support it).

However, libbtc has a network layer based on libevent written in pure C which is useful for low-memory environments (I guess the same would have been possible with C++).
Doing concurrency (somehow required with p2p networking) is hard in C (or say much simpler in C++).

I if would have to do JSON-PRC against bitcoind, I would probably use UniValue (https://github.com/bitcoin-core/univalue?files=1) and some libevent based http client (see bitcoin-cores bitcoin-cli or an alternative would be using libcurl).

If you want pure C, try libevent & YAJL (or look for a complete JSON RPC C library).

@kimdhamilton
Copy link
Collaborator

We've decided this is a good approach. Close with summary/topic paper. Add links

Point to BIP PR, etc -- note final format may change

@kimdhamilton kimdhamilton self-assigned this Jul 14, 2017
@kimdhamilton
Copy link
Collaborator

Move to RWoT. Some elements not part of BIP may be suitable for W3C

@ChristopherA
Copy link
Member Author

A BIP number has been assigned, BIP 136, but the PR has not been accepted yet — they have asked non-bitcoin references to be deleted.

@kimdhamilton
Copy link
Collaborator

This issue was moved to WebOfTrustInfo/rwot5-boston#26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants