GitTorrent - p2p GitHub replacement w/ BNS

“Announcing GitTorrent” blog post

Key section:

We need a method of “distributed consensus” to give out usernames and know who their owners are. The method I find most promising is actually Bitcoin’s blockchain — the shared consensus that makes this cryptocurrency possible.

The deal is that there’s a certain type of Bitcoin transaction, called an OP_RETURN transaction, that instead of transferring money from one wallet to another, leaves a comment as your transaction that gets embedded in the blockchain forever. Until recently you were limited to 40 bytes of comment per transaction, and it’s been raised to 80 bytes per transaction as of Bitcoin Core 0.11. Making any Bitcoin transaction on the blockchain I believe currently costs around $0.08 USD, so you pay your 8 cents to the miners and the network in compensation for polluting the blockchain with your 80 bytes of data.

If we can leave comments on the blockchain, then we can leave a comment saying “Hey, I’d like the username Chris, and the hash of my public key is “, and if multiple people ask for the same username, this time we’ll all agree on which public key asked for it first, because blockchains are an append-only data structure where everyone can see the full history. That’s the real beauty of Bitcoin — this currency stuff is frankly kind of uninteresting to me, but they figured out how to solve distributed consensus in a robust way…

By the way, username registration becomes a little more complicated than I just said, because the miners could see your message, and decide to replace it before adding it to the blockchain, as a registration of your username to them instead of you. This is the equivalent of going to a domain name registrar and typing the domain you want in their search box to see if it’s available — and at that moment of your search the registrar could turn around and register it for themselves, and then tell you to pay them a thousand bucks to give it to you. It’s no good.

If you care about avoiding this, Bitcoin has a way around it, and it works by making registration a two-step process. Your first message would be asking to reserve a username by supplying just the hash of that username. The miners don’t know from the hash what the username is so they can’t beat you to registering it, and once you see that your reservation’s been included in the blockchain and that no-one else got a reservation in first, you can send on a second comment that says “okay, now I want to use my reservation token, and here’s the plain text of that username that I reserved”. Then it’s yours.

(I didn’t invent this scheme. There’s a project called Blockname, from Jeremie Miller, that works in exactly this way, using Bitcoin’s OP_RETURN transaction for DNS registrations on bitcoin’s blockchain. The only difference is that Blockname is performing domain name registrations, and I’m performing a mapping from usernames to hashes of public keys. I’ve also just been pointed at Blockstore, which is extremely similar.)

Blockname from Jeremie Miller adds BNS to Telehash to make communication easier. Very cool stuff happening around blockchain name systems!

1 Like

This is great! Thanks @light for sharing! Going to have to put aside some time to checkout these projects. Decentralized github is definitely needed especially with China’s “Great Cannon” hanging around.

Good idea to bring this up. I just invited Chris Ball of GitTorrent, maybe he can jump in.

1 Like

Jeremie Miller would be good to invite too. He’s working on Blockname for Telehash.

1 Like

Hi! Happy to be here, feel free to ask any questions about GitTorrent. I think the next step for the project is looking into IPFS – the design of BitTorrent means that there’s no chunks shared between a packfile with HEAD at commit N and a packfile with HEAD at commit N+1, which is very wasteful, and IPFS seems able to provide that reuse. I’m also working on porting blockstore from Python to Node at the moment.

1 Like