bittorrent.org | This is the repository backing www | Stream Processing library
kandi X-RAY | bittorrent.org Summary
kandi X-RAY | bittorrent.org Summary
This is the repository backing www.bittorrent.org. It primarily consists of BitTorrent Extension Proposals (BEPs), documenting various aspects, common practices and proposed standards of the BitTorrent protocol.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of bittorrent.org
bittorrent.org Key Features
bittorrent.org Examples and Code Snippets
Community Discussions
Trending Discussions on bittorrent.org
QUESTION
I've read a BEP 5 specification and get expectation that token value in DHT message always has 20 bytes length. Because:
The BitTorrent implementation uses the SHA1 hash of the IP address concatenated onto a secret that changes every five minutes and tokens up to ten minutes old are accepted.
And SHA1 is 20 bytes.
But on practice I'm getting 8-bytes long token in get_peers
response. Also BEP 5 contains examples where 8-bytes long token is used.
Is that some other type of token? If it so, are there any specification or constraints on its length? Can I assume it <= 20?
UPD: in fact I'm getting also tokens with sizes 20 and 4. Rarely: 2,3,7.
...ANSWER
Answered 2020-Jun-06 at 06:37That sha1 is used to generate a token does not mean that what you're receiving is the sha1 output, i.e. sha1 being used does not rule out additional processing steps. Additionally the previous sentence says
Since the token is merely returned by the querying node to the same node it received the token from, the implementation is not defined
Thus the implementation used by the original bittorrent client is just an example how it can be done in a stateless manner.
The token is an opaque value of implementation-specific length that should be returned to the sender as-is.
QUESTION
I am working on Mainline DHT and I don't understand one nuance.
Here: https://www.bittorrent.org/beps/bep_0005.html writes: "A "distance metric" is used to compare two node IDs or a node ID and an info hash for "closeness."
Also writes: "Announce that the peer, controlling the querying node, is downloading a torrent on a port. announce_peer has four arguments: "id" containing the node ID of the querying node, "info_hash" containing the info hash of the torrent, "port" containing the port as an integer, and the "token" received in response to a previous get_peers query."
So, for example, we have a peer with ID 223456789zxcvbnmasdf which IP is 86.23.145.714 and port is: 7853 I know that this peer downloaded 2 torrent files with info hashes: 023456789zxcvbnmasdf and 123456789zxcvbnmasdf.
So how exactly my k-bucket record should look like? Like this:
...ANSWER
Answered 2019-May-30 at 11:44How you structure your data internally is up to you. All it has to do is fulfill the contract of the specification. In principle one could associate torrents with buckets based on the xor distance – e.g. for resource accounting reasons – but most implementations keep the routing table and the storage separate.
The primary routing table only contains nodes, structural members of the DHT overlay itself. Torrents on the other hand are not part of the overlay. They're data stored on top of the overlay, the hash table abstraction. Hence the name, Distributed Hash Table. I.e. they exist on different abstraction levels.
QUESTION
I need help to understand what does upload_only=3
mean in extended BitTorrent handshake.
I know about http://www.bittorrent.org/beps/bep_0021.html, and according to it extended handshake could be like:
...ANSWER
Answered 2018-Dec-13 at 20:43The upload_only=3
is within the message dictionary in the extension handshake.
This means that a extension message with extension message id=3 is defined as a upload_only
message.
Unfortunately BEP21 doesn't reflect how upload_only is implemented in practise. It should be deprecated and replaced with a better one.
From my answer to another question here:
Addendum:
uTorrent and most other clients implementation of upload_only differs from the 'out of date' specification explained here; alus = Greg Hazel
It's defined as a extension message in the extension handshake were the 1 byte message data means: 0x00 = false or < anything else> = true. This can be verified by using Wireshark.
QUESTION
I read official documetation here and wikipedia article about bittorrent client here but couldn't find how tracker exactly work. As per my understanding tracker should know which peer have which piece of some file. For example client 1 have 5 pieces of file 1 and 10 pieces of file 2. In official documentation I see tracker have fields like peer_id
ip
port
uploaded
downloaded
left
and event
but I don't see where is the information about which file we are tracking. For example if I ask tracker hey I need pieces for linux.torrent file, how tracker would answer me?
ANSWER
Answered 2017-Nov-16 at 14:26A trackers job is, when a peer announces to a specific swarm (identified by the info_hash
),to register that peer as active on that swarm and then send that peer a peer list with other peers active on that swarm.
A tracker does NOT keep track on which pieces or files a peer has.
I recommend you to read the inoffical protocol specification: https://wiki.theory.org/index.php/BitTorrentSpecification
it's bit easier do comprehend than the terse and dense BEP-3.
QUESTION
When using Bittorrent, I saw there are the parameters "numwant
", "corrupt
" and "key
" in URL.
However, I found these paremeters don't be defined in BEP 3 (http://www.bittorrent.org/beps/bep_0003.html), so could someone tell me the meaning of the parameters, and where are the 3 parameters defined?
Also, before asking the questsion, I had searched the keyword "numwant
" in the site www.bittorrent.org, and just found "numwant
" appears in BEP 8, but the definition or explanation of the keyword can't be found.
ANSWER
Answered 2017-Dec-17 at 19:04While BEP3 is official, it's a terse and dense document. I would instead recommend you to use the inofficial: https://wiki.theory.org/index.php/BitTorrentSpecification
It's a lot easier to read and understand. It also document some early extensions to the protocol that you can't find elsewhere.
There you will find:
- numwant: Optional. Number of peers that the client would like to receive from the tracker. This value is permitted to be zero. If omitted, typically defaults to 50 peers.
- key: Optional. An additional identification that is not shared with any other peers. It is intended to allow a client to prove their identity should their IP address change.
Regarding corrupt
, there is afaik no written documentation how it is defined, but it's rather simple; When a piece fails the hash check, that amount of data is accounted on the corrupt
counter instead of the downloaded
counter.
There is also a similar redundant
counter, where data that is discharged because it's redundant is acconuted. This happens, for example, in end game mode, when the same chunk is requested from more than one peer.
Also, there is some additional info in my answer here: Understanding Bittorrent Tracker Request
QUESTION
I read the DHT Protocol in bep_0005 page.
But when I send a ping query or a find_node query, the server response a garbled text (both of router.bittorrent.com:6881 or dht.transmissionbt.com:6881)
Here is the Java source code bellow
...ANSWER
Answered 2017-Jul-26 at 06:49the server response a garbled text
No, the response is bencoded and contains raw binary data.
It CAN NOT be treated as text.
In BEP5, to make the raw binary node_id in the examples printable,
it has cleverly been chosen to consist of only alphanumeric characters.
See:
Bittorrent KRPC - Why are node ID's half the size of an info_hash and use every character a-z?
The ip
key is a extension explained in: BEP42 - DHT Security extension
The received response is fully valid.
QUESTION
Using the package https://github.com/golang/crypto/tree/master/ed25519 i m trying to get a public key for a given private key.
Those data are from http://www.bittorrent.org/beps/bep_0044.html: test 2 (mutable with salt)
Problem is, ed25519.Public() won t return the same public key when i fed it with the given private key. The golang implementation returns the last 32 bytes of the PVK. But in my test data this is unexpected.
The code here https://play.golang.org/p/UJNPCyuGQB
...ANSWER
Answered 2017-Jul-02 at 18:45This is due to different ed25519 private key formats. An ed25519 key starts out as a 32 byte seed. This seed is hashed with SHA512 to produce 64 bytes (a couple of bits are flipped too). The first 32 bytes of these are used to generate the public key (which is also 32 bytes), and the last 32 bytes are used in the generation of the signature.
The Golang private key format is the 32 byte seed concatenated with the 32 byte public key. The private keys in the Bittorrent document you are using are the 64 byte result of the hash (or possibly just 64 random bytes that are used the same way as the hash result).
Since it’s not possible to reverse the hash, you can’t convert the Bittorrent keys to a format that the Golang API will accept.
You can produce a version of the Golang lib based on the existing package.
The following code depends on the internal package golang.org/x/crypto/ed25519/internal/edwards25519
, so if you want to use it you will need to copy that package out so that it is available to you code. It’s also very “rough and ready”, I’ve basically just copied the chunks of code needed from the existing code to get this to work.
Note that the public key and signature formats are the same, so as long as you are not sharing private keys you don’t need to use this code to get a working implementation. You will only need it if you want to check the test vectors.
First generating the public key from a private key:
QUESTION
In my new weekend project I decided to write an bittorrent client from scratch, no ready to use libraries at all. After two days looking for documentation I'm already about to give up :smile:. I know there are the BEPs, but they are far from enough to understand all the specification. After reading a lot more I think the tracker and peer protocols seems to be old and easy to understand/implement (yes, I know, to write a good code with balance, peer selection, optimizations, this is not easy as I just said, but all I want to is to do the basics to learn, not to compete with tens of good clients out there.)
So, I have decided to start by the DHT which seems to the the more complex part and also the less documented. When you stop looking for bittorrent DHT or mainline DHT and start looking for kademlia DHT you have a lot more information but it not so obvious how to put it all together.
Here is what I understand so far (and there are gaps which I hope to fill in):
- I start with my DHT tree empty
- use
find_nodes
on my bootstrap node - add the received nodes to my own tree, so I can then select the ones closer to my own ID
- start issuing
find_nodes
to the selected ones and add their responses to my tree - go back to 3 until I stop receiving unknown/new nodes
- if I receive an
announce_peer
with aninfo_hash
than I should save its information on a local DB (the info_hash and ip/port of the sender) - if a node uses
get_peers
with aninfo_hash
I have in my DB then I send the information otherwise I should send a list of closer nodes I have in my own tree (closest to that info_hash) - when I use
get_peers
on other nodes I will receive peers or nodes, in the later case I think the nodes are closer to theinfo_hash
and not to my ownnodeId
so, should I add these nodes to my tree or start a new tree based on them? - when I want to announce I am interested on an
info_hash
should I useannounce_peer
everywhere or just to the nodes withnodeId
closer to the targetinfo_hash
? How much is closer enough?
At this point I have a lot of nodes which IDs are closer to my own ID, and informations about info_hash'es I am not really interested.
I am afraid that I have a giant stupid question: why I did that?
I mean: my selfish reason to do all this work is to locate peers to the info_hash I'm interested in. I understand that the information of one info_hash is likely to be saved on a node which ID is closer to that info_hash. So my chances to find its information is bigger if I create a tree of nodes closer to the info_hash and not closer to my own ID (at this point, if you know the subject, you already noticed how lost I am).
Should I create multiples trees? One for me (to be there to save the information of info_hashes closer to my nodeID people send me), and other tree closer to each one of my target info_hashes so I can retrieve their information?
Should I create a single tree closer to my node ID and hope for the best when querying this tree for the info_hashes I need?
Should I give up since I have completely misunderstood the idea behind DHT at all?
Well, any real documentation, flowcharts, any thing will be welcome!
...ANSWER
Answered 2017-May-26 at 19:08So, I have decided to start by the DHT which seems to the the more complex part and also the less documented.
The original kademlia paper "Kademlia: A Peer-to-peer Information System Based on the XOR Metric" by Peter Maymounkov and David Mazieres is required reading. It is referenced fairly early in BEP-5
if I receive an announce_peer with an info_hash than I should save its information on a local DB (the info_hash and ip/port of the sender)
You only accept announces when they contain a token previously handed out via get_peers
.
when I use get_peers on other nodes I will receive peers or nodes, in the later case I think the nodes are closer to the info_hash and not to my own nodeId so, should I add these nodes to my tree or start a new tree based on them?
You use a temporary tree - or a list ordered by contact-ID relative to the target ID - for iterative lookups since they are not balanced towards your node ID.
when I want to announce I am interested on an info_hash should I use announce_peer everywhere or just to the nodes with nodeId closer to the target info_hash? How much is closer enough?
You perform a get_peers
lookup and when it is done you announce to the closest nodes set that returned a write token and verify the responses to make sure you actually get . In case of bittorrent = 8.
my selfish reason to do all this work is to locate peers to the info_hash I'm interested in. I understand that the information of one info_hash is likely to be saved on a node which ID is closer to that info_hash. So my chances to find its information is bigger if I create a tree of nodes closer to the info_hash and not closer to my own ID (at this point, if you know the subject, you already noticed how lost I am).
When doing lookups you do not just visit nodes in your routing table, you also visit nodes included in the responses. This makes them iterative. The bias of each node's routing table towards their own ID ensures that the responses include neighbors closer and closer towards the target.
So the deal is that you are responsible for information close to your node ID and other nodes will provide information close to their node IDs that you are interested in. So your routing table layout serves others, their routing table layout serves you.
Note that all the information contained in this answer can be found in the BEP or Kademlia paper.
QUESTION
I'm trying to run the test vector as described in BitTorrent BEP 44 test #1, but I'm not creating the same signature as they do:
305ac8aeb6c9c151fa120f120ea2cfb923564e11552d06a5d856091e5e853cff 1260d3f39e4999684aa92eb73ffd136e6f4f3ecbfda0ce53a1608ecd7ae21f01
Instead, the signature I create using libsodium is:
c44ad65291c2b1087218db8a43e3fa7b73cfa01b585b0ff9e6b962ed50e701a1 6065277417ff5bbae43d9b76e52129d27bf2e33e8b043ea67ace7ff91dae4d02
Using this code:
...ANSWER
Answered 2017-Apr-28 at 21:30As explained here there appear to be (at least) two different formats for private keys. One of them is called ref10
and it is the one used by libsodium. It's composed of 32 bytes of seed concatenated with another 32 bytes of public key.
I couldn't find the name of the other format, but - as also explained in the above link - it's basically the seed hashed with sha512
. More precisely
QUESTION
I am trying to write my own bittorrent client in java, it is a make work project to refresh my java skills. I have been stuck at a certain point in development and although there are forums out there for bittorrent development they don't appear to be very active.
So far I can do the following:
- Get a list of peers from Tracker sites
- Connect to a peer
- Send the 'Handshake' message
- Receive the 'Handshake' message back
- Send the 'Interested' message.
- Receive the 'Unchoke' message back.
The problem I am having is if I try sending extended data (http://www.bittorrent.org/beps/bep_0010.html) to the peer prior to sending the 'Interested' message. The protocol states you must send extended data immediately after receiving the handshake. If I send the extended data to the peer the peer immediately closes the connection, ie, in Wireshark I see a FIN,ACK. I have used Wireshark and uTorrent to see what extended data is being sent and I have tried to copy that data, but to no avail. I have tried all different combinations of extended data parameters but no matter what I do I cannot get past this point.
Here is an example of extended data message that works, copied from Wireshark.
d1:ei0e4:ipv44:czH12:complete_agoi-1e1:md11:upload_onlyi3e11:lt_donthavei7e12:ut_holepunchi4e11:ut_metadatai2e6:ut_pexi1e10:ut_commenti6ee1:pi43276e4:reqqi255e1:v13:Torrent 3.52:ypi48680e6:yourip4:jFe
And here is extended data from my client that doesn't work. btw, I have checked to make sure the ip variables are correct (they are sent as 4 bytes).
d1:ei0e4:ipv44:czH12:complete_agoi-1e1:md11:upload_onlyi3e11:lt_donthavei7e12:ut_holepunchi4e11:ut_metadatai2e6:ut_pexi1e10:ut_commenti6ee1:pi51361e4:reqqi255e1:v15:MyTorrent v0.152:ypi40898e6:yourip4:RO e
Also, once I receive the 'Unchoke' message I am able to successfully retrieve pieces.
Any information would be appreciated.
...ANSWER
Answered 2017-Apr-24 at 11:16Based on your wireshark capture you are only sending the extended handshake payload but not the necessary extension protocol or bittorrent message headers.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install bittorrent.org
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page