-
parazyd
Hi. In the stratum mining protocol for xmrig, there is a "target" parameter. Is this calculated from the difficulty and then encoded to hex?
-
parazyd
-
parazyd
The difficulty is retrieved from getblocktemplate. So target should be 0xFF...FF (32 bytes) divided by difficulty?
-
parazyd
i.e. for difficulty=1 target=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ?
-
sech1
yes, but it uses 32-bit or 64-bit division to calculate the target
-
parazyd
I'm doing it in Rust and I'm using BigUint from the num-bigint crate so I can do that kind of division
-
parazyd
However when sending target=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff to xmrig, I still get 'login error code: 5', which leads me to think something is wrong
-
parazyd
I see in xmrig::Job::setTarget() there is size==4 else size==8, but I can't understand what the hex target input there should be
-
sech1
32 or 64 bit hex value
-
moneromooo
If you convert to hex yourself, be careful to not mess up endianness.
-
moneromooo
(or from hex)
-
parazyd
I understand that, but what is unclear is where (and how) this 32/64-bit value comes from.
-
parazyd
It doesn't seem to be the hex-encoded difficulty
-
moneromooo
IIRC it's the least significant bits of the value a hash must be below (or equal maybe) to be a valid pow.
-
moneromooo
The other bits are deemed to be 1. It's an optimization.
-
parazyd
oh that seems to work
-
parazyd
moneromooo: So what about endianness, is it known to be big or little?
-
moneromooo
Big endian. 256 will be 00..0100 in hex.
-
parazyd
Thanks
-
m-relay
<keepemup:matrix.org> Quick questions about wallet RPC...
-
m-relay
<keepemup:matrix.org> 1) is it possible to check individual sub address balance ? Another step further is checking individual outputs and their balances too
-
m-relay
<keepemup:matrix.org> 2)how to check which stealth address the xmr was sent to? This can be done by eliminating your change stealth but that only works for a 2 output txn..
-
m-relay
<keepemup:matrix.org> 3) confused about sweep_single.
-
m-relay
<keepemup:matrix.org> Why are multiple subaddress indices allowed if you're sweeping a single output. Same goes for below_amount...
-
m-relay
<keepemup:matrix.org> Quick questions about wallet RPC...
-
m-relay
<keepemup:matrix.org> 1) is it possible to check individual sub address balance ? Another step further is checking individual outputs and their balances too
-
m-relay
<keepemup:matrix.org> 2)how to check which stealth address the xmr was sent to during a transfer? This can be done by eliminating your change stealth but that only works for a 2 output txn..
-
m-relay
<keepemup:matrix.org> 3) confused about sweep_single.
-
m-relay
<keepemup:matrix.org> Why are multiple subaddress indices allowed if you're sweeping a single output. Same goes for below_amount...
-
m-relay
<keepemup:matrix.org> Quick questions about wallet RPC...
-
m-relay
<keepemup:matrix.org> 1) is it possible to check individual sub address balance ? Another step further is checking individual outputs and their balances too
-
m-relay
<keepemup:matrix.org> 2)how to check which stealth address the xmr was sent to during a transfer (per output)? This can be done by eliminating your change stealth but that only works for a 2 output txn..
-
m-relay
<keepemup:matrix.org> 3) confused about sweep_single.
-
m-relay
<keepemup:matrix.org> Why are multiple subaddress indices allowed if you're sweeping a single output. Same goes for below_amount...
-
moneromooo
1: Yes, see wallet2::balance_per_subaddress in src/wallet/wallet2.cpp
-
moneromooo
2: from the chain data, you can't. From your wallet cache, it's saved in m_dests in confirmed_transfer_details (wallet2.h)
-
moneromooo
3: you can have a tx with one input and several outputs
-
moneromooo
And please do not edit large text for trivial changes, the bridge just reposts the entire thing.
-
moneromooo
For 2: obviously, if you nuke your cache and later rescan the chain, that info will have gone
-
moneromooo
Ah, it wasn't trivial changes only. Dunno about 3 then. Maybe just because it uses the same worker function under the hood.
-
m-relay
<keepemup:matrix.org> So the wallet RPC doesn't natively support #1 and #2??
-
moneromooo
I dunno without having to look.
-
moneromooo
I looked. Looks like it does support it (get_balance).
-
moneromooo
(well, for 1)
-
moneromooo
Pretty sure you'd get 2 as well.
-
m-relay
<keepemup:matrix.org> Looks like getmonero and monerodocs differ
-
moneromooo
I looked too, I'm not seeing destinations, so maybe it's not there.
-
moneromooo
Feel free to add destinations to get_transfers btw if it's useful to you.
-
m-relay
<keepemup:matrix.org> If only I knew "how to code"
-
moneromooo
Well, you're posting in -dev.
-
m-relay
<keepemup:matrix.org> This where all the answers are
-
m-relay
<keepemup:matrix.org> Anyway it looks like getmonero docs is more up to date, the other site was entirely confusing