-
Notifications
You must be signed in to change notification settings - Fork 35
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
Make more clear how we use the block header to calculate the txs short ids (job declarator) #99
Comments
I recovered the way we are computing it on SRI and I confirm we're currently only using the SHA256( I would go with specifying better the only usage of the Maybe @TheBlueMatt could have some other hints here? |
Yea, there's no reason to want the block header there, I think. We honestly could also skip the SHA256 but given people have already implemented it no reason to drop it. |
Agree about the SHA256, and I would be ok in changing spec. But maybe now is too late |
I would just make this point in specs more clear, without changing too much the way the |
ok with me |
I'm ok with removing the sha cause is computationally very expensive, but also changing the spec at this point is not very nice |
so whatever I don't have a preference |
@jakubtrnka would it be a problem for you to remove the SHA256 from the |
Considering the removal of SHA256, we are still going to need a 128-bit key for the SipHash. |
I would just double the u64. So if you have nonce = 10. You get, key = 10.to_le_bytes() ++ 10.to_le_bytes() |
I liked the DATUM idea of using the two peer's ephemeral noise keys (or some other pet-connection random value which both peers contribute to). |
I prefer having some form of "control" over the nonce. I'm planning to create an extension where pool can tell miners which nonce to use. I want to cache short ids and not having to calculate them for each client. So I nack this proposal. @TheBlueMatt anything wrong in the below proposal?
|
Just to add on my previous comment I want to say that I'm not making this up, I ran several bench tests to the pool and the bootleneck on adding new clients is always calculating short ids. |
Calculating them on a per-client basis shouldn't be too bad if you cache it, no? The current spec requires you calculate them live when you get a new job and I agree that is too conservative. However, having a fixed value for the entire pool makes it trivial for anyone to attack all the pool's connections at once just for the lulz. |
If even that's too much I think we should just send the first 160/192 bits of the txid over the wire instead. |
I don't know how much it save to remove the sha256, maybe is enough. About the attack yes and no, I can always find who is doing it and ban him pretty fast log2(users) steps, this only if I have registered users, if anyone can join would be a problem. So I don't' know. Just to recap here the options:
Personally, I would go with 2 or 3. With 3 you can implement 2. |
also not having to do that live is a great improvement in general |
Sure, but are you really gonna implement that? That's a lot of work and I'm pretty sure most pools won't bother. And, indeed, we don't really want to build a protocol that requires pools not be open to anyone. Fwiw I'm somewhat skeptical that generating short IDs for transactions in the mempool is a huge performance penalty, IIRC Bitcoin Core can do it in a handful of ms IIRC. What are you seeing? |
If you have 1000 clients an handfull of ms are too much. You can calculate them when you find the block lets say that you calculate 1000 * 2000 -> 2_000_000 short ids when you find the block and the rest while the tx arrives. Is 10 seconds. You can use 10 cores and do that in 1 seconds. Is kinda of acceptable but not the best. I also I don't need 10 cpu for 1000 clients. |
maybe you meant mircroseconds? |
If you just calculate once per connection (and then in the background) it's not that crazy? You'd have to authenticate clients somehow (which we should probably do anyway, random connections negotiating a million jobs without any hashpower isn't really acceptable either). A restart is a bit painful, but only for a second or two? That's not crazy. |
demand offer a free solo pool (separated from the actual pool) with job declaration enabled and is completely anonymous so no auth. Btw yes is not crazy. |
I would go with 3, using the |
I'm very afraid of a protocol that enables the pool to select the nonce, as I imagine most pools will use it to simply give every client a static nonce. If we're gonna go that way we should just remove the hashing entirely and send txids/short txids. IOW, I object to 3 on the grounds that it enables dangerous behavior. Thus if we think the performance of 2 is bad, we should just do 1, which honestly isn't that bad. |
assuming that the main goal is simply to save bandwidth on but I don't fully understand what is the rationale behind 160/192 bits:
|
a short id is a lot more short, but is ok with me, don't know if it cost more the bandwidth or the cpu time. In that case maybe bandwidth. But I don't thing that the difference is so big, maybe we should wrote down some number.
I guess we should stick with one? Or you maybe you can require less bit and then more?
is to avoid that forging collision (attacking the pool) become too easy
tradeoff are cpu time vs bandwidth |
Ok so as we agreed on the discord chat we are going to remove short ids from JD protocol, and just send full ids. When needed we can reintroduce short ids trough an extension. @TheBlueMatt @GitGab19 @plebhash do you confirm? |
Yep! |
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
as discussed in stratum-mining#99
In SRI we do not use the block header to calculate the txs short ids (job declarator). This make sense since we do not know the block header yet. So maybe we should change the specification and make it clear, or use the previous block header? I would go with the former since is easier
The text was updated successfully, but these errors were encountered: