-
Thomas[m]1
Hi, I am looking at writing code to sign a monero transaction myself but I am stuck at _choosing_ key offsets. I had a look at the code of monerod and it looks quite complicated. Too complicated to understand the actual algorithm that is in place.
-
Thomas[m]1
Are there any resources anywhere on how I am meant to choose the keyoffsets?
-
gingeropolous
Thomas[m]1, have you discovered zero-to-monero ?
-
gingeropolous
-
gingeropolous
that may help. But if I understand, choosing key offsets is indeed a tough problem.
-
gingeropolous
because basically you have to choose from all the available outputs in the blockchain which set of 10 will make it look like the real output is in a group of 11 random outputs
-
gingeropolous
so if you choose 10 recent outputs, and your real output is a year ago, then, meh. Ring member selection is an area that warrants more attention, especially with the advent of triptych sigs
-
gingeropolous
but if these offsets are indeed what you're talking about, its important to use the existing selection algorithm. because otherwise your group of ringmembers may look different than others
-
Thomas[m]1
I have read zero to monero yes.
-
Thomas[m]1
Unless I missed it, there is no mention of an algorithm though :/
-
Thomas[m]1
Are the requirements / consideration on choosing key offsets documented somewhere?
-
gingeropolous
i think there was a MRL report on it
-
gingeropolous
-
sarang
Anonymity set selection is highly nontrivial, and the current method is in no way claimed to be optimal
-
gingeropolous
sarang, do you think it should be change for triptych, or if it aint broke ... ?
-
sarang
Anonymity set selection for larger sets should almost certainly use binning at this point IMO
-
gingeropolous
and Thomas[m]1 , i don't think an algorithm is described in that MRL report actually. but if i recall correctly, its a triangular distribution thats heavily weighted to the most recent n blocks
-
gingeropolous
and i forget what n is
-
Thomas[m]1
thanks, those are already good pointers!
-
Thomas[m]1
I'll dig into that and see where I end up.
-
sarang
The current method is not a triangular distribution
-
Thomas[m]1
<gingeropolous "and i forget what n is"> Should be possible to recover that from the implementation I presume
-
sarang
It uses a modification from a preprint/paper by Miller et al. that approximates an expected spend pattern
-
sarang
Weighted to account for non-uniform block densities
-
gingeropolous
aah yes i remember that now
-
Thomas[m]1
Is there any way in how I can leverage an existing monero daemon with that?
-
Thomas[m]1
Possible also an instance of monero-wallet-rpc.
-
Thomas[m]1
My usecase is a PoC where I am having some fun with the actual ring signature algorithm, hence I can't delegate the signing to the actual node. However, given the complexity of this, it would be very useful if I could somehow have monerod chose those keyoffsets for me.
-
sarang
Anonymity set selection is not (with few exceptions) consensus
-
Thomas[m]1
* My usecase is a PoC where I am having some fun with the actual ring signature algorithm, hence I can't delegate the signing to the actual node. However, given the complexity of this, it would be very useful if I could somehow have monerod choose those keyoffsets for me.
-
Thomas[m]1
And hence not implemented in monerod? Or what are you suggesting?
-
gingeropolous
Thomas[m]1, i think he's suggesting its not in monerod, its in the wallet software.
-
Thomas[m]1
okay, let me rephrase my question then :D
-
gingeropolous
wallet2 i think is where its at
-
Thomas[m]1
can I somehow leverage `monero-wallet-rpc` for this?
-
gingeropolous
yeah
-
Thomas[m]1
<gingeropolous "wallet2 i think is where its at"> Been down that rabbithole :D
-
gingeropolous
i mean, monero-wallet-rpc can craft a transaction, so yes
-
Thomas[m]1
I even looked into generated bindings for that thing (I am working in Rust) but failed unfortunately
-
gingeropolous
i don't know if you can make it *just* give you a bunch of offsets ...
-
gingeropolous
mobilecoin has rustified monero code, might have some luck in their repo
-
gingeropolous
but they've taken different turns here and there
-
Thomas[m]1
I had that idea as well but AFAIK they are on ristretto f.e.
-
sarang
Wait, it this a mobilecoin question?
-
Thomas[m]1
no, this is a monero question
-
sarang
nods
-
Thomas[m]1
I am working on XMR-BTC atomic swaps to give some wider context
-
Thomas[m]1
and to have a protocol where XMR moves first, we need an adaptor-signature like construct
-
Thomas[m]1
which implies fiddling with the signing algorithm
-
kayabaNerve
Thomas[m]1: If you need low level wallet ops, I implemented most in Python
-
kayabaNerve
May be easier to read than the C++
-
kayabaNerve
It also directly binds to the gen_ringct_sig C++ function (which I didn't re-implement) instead of Wallet2
-
Thomas[m]1
-
kayabaNerve
That'd be it
-
kayabaNerve
As for XMR first atomic swaps, I wonder if you could generate an adaptor signature off of R...
-
kayabaNerve
... no, that doesn't work; never mind.
-
kayabaNerve
Kinda spoke before I thought that through :P And to think I'm part of Farcaster
-
Thomas[m]1
<kayabaNerve "Kinda spoke before I thought tha"> I know ;)
-
Thomas[m]1
Am I right that here (
github.com/kayabaNerve/cryptonote-l…/classes/wallet/wallet.py#L305-L355) is where you select the other outputs to be used for the key_offsets?
-
Thomas[m]1
More specifically, you are just choosing a random output between the most recent block and the oldest one the wallet knows about?
-
Thomas[m]1
-
Thomas[m]1
I guess that works but might have implications for privacy?
-
kayabaNerve
Thomas[m]1: The README states how it's not optimal and should be improved; it only 'technically' works. I more wanted to refer to how it grabs mixins, not how it uses them
-
kayabaNerve
Because yes, its mixin distribution can be identified thanks to statistical analysis on when the mixins where created.
-
kayabaNerve
Instead of 5 + 5, it'll just be *.
-
kayabaNerve
I wanted to reply to his
-
kayabaNerve
> i don't know if you can make it *just* give you a bunch of offsets ...
-
kayabaNerve
I didn't scroll further up and realized you wanted not only offsets, yet properly chosen offsets.
-
kayabaNerve
Just read up further; definitely not what you're looking for, sorry. Hopefully it at least helps with the bindings
-
kayabaNerve
*I brought up 5 5 because I thought Monero used 5 outputs from 0 .. X, where X is two weeks ago, and then 5 from the last two weeks. Did Monero ever use an algorithm like that?
-
Thomas[m]1
Well, ultimately, I just want to sign a transaction locally. Having to choose offsets is - for my particular usecase - more of an annoying necessity :D
-
Thomas[m]1
Hence my question whether or not I can offload to some other software. But I guess the answer for now is no because that is the job of a wallet and what I am building is essentially a wallet.
-
kayabaNerve
In that case, my work still should be generally applicable ;)
-
kayabaNerve
But yes, it's vulnerable to identification of what wallet it uses and does have concerns for mixin identification depending on how quickly you use inputs.
-
Thomas[m]1
Yes thanks for that!
-
Thomas[m]1
It is a good confirmation that, at least technically, it is possible to choose them randomly if one accepts the privacy implications.
-
kayabaNerve
There is still a threshold
-
kayabaNerve
They have to be within X window. I have a MIN MIXIN constant defined *somewhere* with a comment. I think they have to be, om average, within the last 40% of mixins.
-
Thomas[m]1
Okay, that is good now. I'll keep a look out for that.
-
Thomas[m]1
* Okay, that is good to know. I'll keep a look out for that.
-
feusrtqtvgbu
Howard, you know why all the 'Titanic intelligence Saviour of NASA' posts stopped last year? They know you are an embarrassment. Your arse didn't learn anything new in 25 years, and that includes C++. They just can't say it to your face.
-
moneromooo
There is no wallet RPC for this, but it sounds like a good one to add. There is code you can use though, see tests/unit_tests/output_selection.cpp, which uses tools::gamma_picker.
-
moneromooo
The offsets it takes as input can be obtained from the daemon RPC.
-
Thomas[m]1
Thanks for the pointer! I'll check out the tests.
-
CCosta[m]
<gingeropolous "Thomas, have you discovered zero"> oooh, that's awesome! I wonder if we should have it under `CONTRIBUTING.md`
-
gingeropolous
make a PR :)
-
moneromooo
Daniel[m]13:
monero-project/monero #7662 probably fixes your test case. If not, let me know and give me more info about your setup.
-
selsta
gingeropolous: please update xmrchain.net to " most up to date software for Monero are version: CLI v0.17.2.0, GUI v0.17.2.1"
-
selsta
.merges
-
xmr-pr
7349 7652 7653 7654 7655
-
gingeropolous
aw, its not sync'd anymore?
-
gingeropolous
selsta, done
-
selsta
.merge+ 7002 7016 7136
-
xmr-pr
Added
-
selsta
.merge+ 7384 7641 7642 7648
-
xmr-pr
Added
-
selsta
luigi1111w: merges in the next days? ^-^