在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:cjb/GitTorrent开源软件地址:https://github.com/cjb/GitTorrent开源编程语言:JavaScript 100.0%开源软件介绍:GitTorrentThe Decentralization of GitHubGitTorrent is a peer-to-peer network of Git repositories being shared over BitTorrent. You can read more about the project at this blog post. To get started:
(You can avoid After that, you can clone a repo with:
Or serve your own repos with:
Note that GitTorrent is not affiliated with the git project. DesignThe design of GitTorrent has five components:
1. Git Transport HelperWhen Git is asked to perform a network operation with a URL that starts with e.g. In GitTorrent's case, we could be asked for three styles of URL:
2. Distributed hash tableThe bootstrap server for this DHT runs at 3. Protocol extensionOnce a client has connected to another node, it sends a request for the SHA1 it's looking for as bencoded JSON:
The node providing the packfile returns:
4. Key/value storeBEP 44 adds support for mutable and immutable keys. Immutable keys are addressed by the hash of their content, but mutable keys are addressed by the hash of a crypto keypair's public key. The owner of that keypair publishes signed updates to their public key's hash, with a sequence number to ensure the latest value is always propagated by peers. The hash of the public key here is a GitTorrent user ID, and the value associated with that key is a JSON object describing the user's repositories in a User Profile. User Profile JSON format
Mutable key file JSON format
Bitcoin username registrationThis feature is not going to work on the live Bitcoin network until the OP_RETURN length is increased from 40 to 80 bytes, which will happen in Bitcoin Core v0.11, currently scheduled for release on July 1 2015. Until then, we'll use the Bitcoin testnet, but username registrations will be discarded when the move to the live network happens. Our DHT can't resolve arguments over which mutable key owns a given username -- we need something capable of distributed consensus (like a blockchain) for that. The idea of using OP_RETURN comes from telehash's blockname project, but while blockname registers domain names on the blockchain, we're registering username<->key mappings instead. The format is:
e.g.
Note that OP_RETURN transactions are limited to 80 bytes, which limits usernames in this scheme to 27 bytes. As a convenience, this repository will include a database of registered usernames that is updated regularly. This doesn't make GitTorrent any more centralized -- you can run the same scripts yourself on a downloaded blockchain to make sure that this repository does not lie. This is just to save everyone from downloading tens of gigabytes of blockchain to process. By the way, storing full Bitcoin history is not necessary. We just need to scan every transaction once, and can discard each transaction after we've scanned it once and determined whether it contained a valid username registration that we record. We just need to scan through all unprocessed blockchain transactions once, and record where we got up to so that we don't have to look at them again after that. ContributingPlease send pull requests! Even changes to the design of GitTorrent are welcome and encouraged; nothing is set in stone. JavaScript Standard StyleGitTorrent uses JavaScript Standard Style. Enable debug logsIn node, enable debug logs by setting the LicenseMIT. Copyright (c) Chris Ball. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论