-
spirobel[m]
selsta: That is good to hear. Maybe I can use this as a template to go by. I am using the monero javascript wasm library.
-
spirobel[m]
maybe there is no better way than doing it periodically because it is probably not a good idea to do such an expensive operation in the event listeners. So it would need to be queued of to a worker saga anyhow. And that is basically the same as doing periodic saves.
-
selsta
The periodic saving was only added because people had issues with crashes and having to rescan.
-
nioc
when I closed the CLI by X-ing out instead of using the exit command when I opened the wallet again it scanned from when I first opened it and showed an incoming transfer that it had already shown when I originally opened it
-
spirobel[m]
selsta: the issue is I never know when the application closes, so in a way there is no way around it. Or maybe there is another way: Every time the wallet is synced completely a save is done. The thing I want to have is a state machine that does not depend on any form of periodicity. In my mind there should be some kind of state that triggers a save. Maybe percentage synced would also be an option.
-
spirobel[m]
nioc: hm...so it seems like in case of the CLI wallet this state is triggered when the user issues the exit command.
-
selsta
nioc: on Windows?
-
nioc
selsta: yes
-
selsta
ok, the problem is X-ing CLI programs by closing the window is the equivalent of killing them.
-
selsta
so you either have to use ctrl+c or type exit
-
selsta
GUI programs can properly close when pressing X.
-
spirobel[m]
could it be more natural if the saving was triggered by the sync process instead of user interaction?
-
selsta
spirobel[m]: is there no event or so that runs on exit? I'm not familiar with web development.
-
selsta
if you have a large wallet cache (hundreds of MB) saving on every block might become an issue
-
spirobel[m]
selsta: yes there is no way to perform an action before the browser closes. But aside from that, from a conceptional perspective: shouldnt this process of saving be triggered by the syncing process instead of the user?
-
spirobel[m]
selsta: how can it become so large? I forgot what kind of data can be in the cache
-
spirobel[m]
I will look it up
-
selsta
if you have thousands of transactions
-
spirobel[m]
selsta: okay so this goes back to the question in the beginning. If that is the case we could use the monerowalletlistener and only save the cache/key data (the wallet data) onOutputSpent and OutputReceived. ( more specifically when there is a new transaction that concerns us) other than that we could just save the new height externally and on wallet reopen call setSyncHeight with this saved height.
-
spirobel[m]
the question that arises then: (async) onOutputReceived(output)
-
spirobel[m]
Invoked 3 times per received output: once when unconfirmed, once when confirmed, and once when unlocked. (async) onOutputSpent(output)
-
spirobel[m]
Invoked twice per spent output: once when confirmed and once when unlocked Do we need to save on all these different states or just on one of them? does it make a difference to the cache if the transaction is unconfirmed, confirmed or unlocked?
-
selsta
all these events are related to a block being scanned, right?
-
selsta
ok, not necessarily
-
spirobel[m]
selsta: yes. The phrasing in the docs is like this: (async) onNewBlock(height)
-
spirobel[m]
Invoked when a new block is added to the chain.
moneroecosystem.org/monero-javascript/MoneroWalletListener.html but it actually is more like: when a new block is being scanned.
-
spirobel[m]
I assume that the onOutput/spent/received listeners get triggered under the same (more specific) circumstances as OnNewBlock. But I'd have to investigate to verify.
-
selsta
if you scan e.g. 50 blocks / second you can't also save 50 times in a second.
-
selsta
onOutput might work, you will have to try it
-
spirobel[m]
<selsta> "onOutput might work, you will..." <- ok thanks for the input so far. I think I will try something like this: onNewBlock -> just save the new height and modifiy the openWallet routine so that after the wallet was opened the standard is to call setSyncHeight with this externally saved height. onNewOutput: actually save the wallet data. The only danger might be that the wallet saving is not successful (for example because the
-
spirobel[m]
browser was close) and the height was already updated to something past where the transaction happened. In this case the transaction would not be in the cache and the height is too high to rescan it automatically. So there would need to be a check to make sure the wallet was saved/ the transaction is rescaned if the height was upgraded and the save was not successful. This adds a bit of complexity. I need to think this through.
-
selsta
All of this sounds way more complex than just saving after every transaction and every x minutes :D
-
spirobel[m]
<selsta> "All of this sounds way more..." <- It might not be all the bad. The onNewBlock handler is reduced to saving a number(the block height). The onOutputReceived and onOutputSpent handlers are reduced to saving a number (the height of the transaction), saving the walletdata, noting down if the saving of the wallet data succeeded. The openWallet Routine is changed to: open the wallet from the saved data, check if there were
-
spirobel[m]
unsuccessfully saved transactions ( if this is the case, pick the height of the one with the lowest height), setSyncHeight to the height saved by the onNewBlock Handler or the unsuccessfully saved transactions (if that was the case), start syncing.
-
selsta
you also have to consider that it handles reorgs correctly
-
selsta
changing setSyncHeight, assuming that's the refresh height, seems a bit like a hack, it should a height that is before the first transaction
-
spirobel[m]
<selsta> "changing setSyncHeight, assuming..." <- what do you mean by first transaction?
-
spirobel[m]
<selsta> "you also have to consider that..." <- what questions do I need to answer to make sure I handle reorgs correctly?
-
selsta
do you mean with setSyncHeight the same that you would set with the refresh-from-block-height option in CLI?
-
-
spirobel[m]
probably. It is the only API that lets me set a sync height for startListening()
-
selsta
right, that should be set to a block height that is before the first transaction in this wallet
-
spirobel[m]
selsta: hm okay so this throws a wrench into all these thoughts. 😄 Do you know why that is? what would happen if I ignored that?
-
selsta
if someone does e.g. rescan_bc (a full wallet rescan) then it needs to know where to start
-
selsta
now if you say your wallet doesn't support rescan then it might work
-
selsta
but it's definitely a hack of a function this isn't supposed to be used that way
-
-
spirobel[m]
I assumed it was essentially the same as doing a sync like this and basically setting the setStartHeight as a global variable. If I recall correctly this sync function is called internally in a webworker when startListening is activated (with the Height that was set via setStartHeight)
-
spirobel[m]
s/setStartHeight/startHeight/
-
selsta
i'm not familiar with the library you are using so it's best if you just try until it works because I might give you wrong advice :D
-
-
spirobel[m]
I have this import wallet screen. And it feeds the info into the createWallet() function. There is a restoreheight in there so that is basically like a rescan.
-
spirobel[m]
selsta: that is a good point.
-
spirobel[m]
I will think about that.
-
spirobel[m]
from the wallet file it wouldnt know that. But the wallet file is in the browser storage so the user does not have access to it. Maybe I will think more about that when I implement an export wallet function
-
spirobel[m]
yeah but you are probably right: it seems like a hack. The question is: is this hack worth it? Does the hack even work?
-
spirobel[m]
yeah it is probably a bad idea. Most likely there is some internal thing that depends on the startheight being lower than transactions that are in the cache. If somebody can chime in and dispel this FUD I would be very glad.
-
spirobel[m]
What could possibly go wrong? Please chime in! 🥺😀
-
spirobel[m]
<selsta> "do you mean with setSyncHeight..." <- okay it seems to be:
github.com/monero-ecosystem/monero-…wallet/monero_wallet_full.cpp#L1364 the same as refresh from blockheight.
-
selsta
right, yes that's always supposed to be lower than the first transaction inside a wallez
-
selsta
wallet
-
spirobel[m]
<selsta> "right, yes that's always..." <- I wish there was a way to update the height the wallet was synced to without rewriting the whole cache. So the implication of this is that we can not just pick and choose which parts of the blockchain to scan, we need to scan from our first transaction? And there is no way around this. ?
-
spirobel[m]
what if this assumption is broken? rescan wouldnt work as expected. Anything else that would break? the old transactions should still be in the cache, right?
-
selsta
the wallet internally saves the last height it scanned to, and it continues from there, but i don't know if that is accessible
-
spirobel[m]
selsta: true. there is a getHeight() API to retrieve it. But there is no way to set it with the monero-javascript library. Maybe wallet2.h has a direct interface to set it.
-
selsta
-
selsta
can you use that to save?
-
spirobel[m]
selsta: You can not really depend on that. especially not to do something expensive like saving the wallet data. I also dont think it is the right way to do this. The saving of the wallet data should be completely decoupled from user interaction. It is something that should be triggered by the syncing process.
-
spirobel[m]
the next best thing is a periodical save
-
selsta
tobtoht: how did you implement saving in feather?
-
spirobel[m]
github.com/monero-ecosystem/monero-…/js/wallet/MoneroWalletFull.js#L680 okay under the hood it looks if getHeight or getSyncHeight is higher and picks the max to sync to. The real question this boils down to is reorgs:
monero.... (full message at
libera.ems.host/_matrix/media/r0/do…0eb8d80401c1cc6474522ded3430fd52494)
-
spirobel[m]
or maybe this is wrong because we need the hashes to detect a reorg when we reopen the wallet after a while. Probably the wallet checks the last hashes of the last blocks it synced to to make sure there was no reorg.
-
spirobel[m]
hm...I was reading the monerd docs not the walletrpc docs. Maybe the information in the stackoverflow answer mislead me. reorg detection happens on the monerod level, not on the wallet level, right?
-
selsta
spirobel[m]: wallet also has to rescan after a reorg
-
selsta
anyway, i would either implement periodical saving, or implement saving after scanning directly in wallet2
-
selsta
but hacking this together from the outside is a bad idea
-
spirobel[m]
-
selsta
no
-
spirobel[m]
selsta: most likely you are right. 😅
-
spirobel[m]
selsta: do you know by chance where I can find it in the codebase?
-
selsta
src/wallet/wallet2.cpp
-
spirobel[m]
<selsta> "src/wallet/wallet2.cpp" <- linenumber? 🥺😀
-
selsta
you'll have to search yourself :D
-
selsta
i don't know myself
-
willshu[m]
Hello, the response from `get_transactions` is this:
-
-
willshu[m]
If I add `"decode_as_json":true` the response is:
-
-
willshu[m]
In the latter case, if you parse the "as_json", you get:... (full message at
libera.ems.host/_matrix/media/r0/do…8661d17666b68a4974258fc57a0546c7955)
-
willshu[m]
How do I calculate the amount and decide if the vout belongs to me? I understand the view-only wallet does this. Where in the code does it do this? Can I use a JS library to do the same?
-
willshu[m]
We need to scan the chain and decide if someone has transferred us XMR.
-
moneromooo
Without using wallet2 ?
-
moneromooo
In that case, you could maybe look at mymonero, which has JS code for this, though a lot of the lower level stuff calls C code converted to... stuff. wasm I think.
-
moneromooo
UkoeHB: looks like some merge error in the multisig code:
paste.debian.net/hidden/75c14ff5
-
moneromooo
Posted in #monero, the poster left already.
-
moneromooo
It does build for me, so probably user error, nvm.
-
drflashd[m]
<moneromooo> "The exporter exports the minimum..." <- howto do incremental exports to update offline node from last week?
-
drflashd[m]
no need to reexport 100gb eh?
-
drflashd[m]
s/?/.../
-
moneromooo
IIRC the exporter does incremental automatically if the output file already exists. Memory's hazy though.
-
hyc
for monero-blockchain-export you can use --start-block and --stop-block to select which range to export
-
mikoto-chan
can monero-wallet-rpc be used to control multiple wallets?
-
moneromooo
Yes. See open_wallet, close_wallet.
-
moneromooo
That'll be slow though.
-
moneromooo
If you have the RAM and need to switch often, you may opt for multiple processes to avoid to save/load.
-
moneromooo
And don't forget to save before closing, otherwise you get to re-scan already scanned blocks on next load.
-
mikoto-chan
moneromooo: I wanted to do some programming with Monero but it seems there's no clear entry point.
-
moneromooo
See HACKING.md
-
moneromooo
Wait, it's docs/CONTRIBUTING.md actually, I checked.
-
moneromooo
Not sure what you mean by "entry point". First guess is "main", which is probably not what you mean...
-
moneromooo
For RPC, the list of RPC is in src/wallet/wallet*defs.h
-
mikoto-chan
moneromooo: isn't that for contributing to the network? I'm looking for an API to use in my program, and it seems like monero-wallet-rpc is the only thing available for that.
-
UkoeHB
mikoto-chan: you can check
moneroecosystem.org
-
mikoto-chan
UkoeHB: thanks.
-
mikoto-chan
yes, this site is indeed what I was looking for :)
-
luigi1111w
.merges
-
xmr-pr
7936 7937 8053 8166 8177 8179 8180 8195 8196 8197 8205 8207 8211 8212 8213 8215 8222 8223
-
bit_thanos[m]
Is there a possibility to have a Monero wallet to use on dumbphones? With increasing surveillance I am more comfortable to leave my android at home, even if it has CalyxOS.
-
bit_thanos[m]
Any thoughts on that?
-
luigi1111
Doesn't sound very dumb phone
-
bit_thanos[m]
luigi1111: My question is can it be done on a dumbphone?
-
luigi1111
That would imply the phone isn't dumb
-
bit_thanos[m]
<luigi1111> "That would imply the phone isn't..." <- Well, that's true lol
-
chesterfield[m]
you could have a photo/screenshot of one of your subaddress QR codes for receiving funds on the go
-
bit_thanos[m]
chesterfield[m]: sure, but I was thinking an old fashioned phone with no app/google store just 3g
-
bit_thanos[m]
maybe some sort of offline signing
-
bit_thanos[m]
I might be asking the wrong questions thoj :D
-
hyc
featurephones with java engines could still run apps of some form
-
selsta
unless you name a specific phone it will be difficult to answer.. possible yes, but it might take work to port monero to such a phone, assuming they have enough resources to even run a monero wallet
-
hyc
but their CPU & RAM resources are tiny
-
hyc
actually they'd have enough resources to run native code, but being forced to use java, pretty much out of the question
-
bit_thanos[m]
I see, it literally just crossed my mind
-
chesterfield[m]
You should just have an out and about wallet on your calyx phone that only has a limited amount of funds on it that you're okay with losing 🤷
-
selsta
ok, now that BP+ is approved I guess we can add it to the merge queue
-
bit_thanos[m]
chesterfield[m]: yes, that's what I am doing now. Thanks for elaborating on the question tho
-
selsta
moneromooo: do you want to squash?
monero-project/monero #7170
-
moneromooo
OK
-
moneromooo
Done. I've put back the waiter.wait call and added another, I commented why.
-
selsta
jberman[m]: UkoeHB: can someone reapprove? ^
-
UkoeHB
selsta: done
-
selsta
UkoeHB: one more thing, it's probably best to close the multisig patches for release-v0.17 right?
-
selsta
i think you still have one open
-
selsta
.merge+ 7170
-
xmr-pr
Added
-
UkoeHB
which one?
-
selsta
ok it got merged already
-
selsta
-
selsta
we still need someone to review
monero-project/monero #8046, it would be a waste to not include this in v0.18
-
selsta
it cuts tx generation time in half
-
sech1
I remember looking at this PR before
-
sech1
so I can review it this week
-
selsta
ty
-
mikoto-chan
is there a no-signup API I can use to retrieve Monero's current price?
-
mikoto-chan
otherwise I'm only left with web scraping ...
-
chesterfield[m]
-
nikg83[m]
-
mikoto-chan
chesterfield[m]: tried coingeko? it looks like they don't require signup either
-
mikoto-chan
nvm your solution is easier :D
-
mikoto-chan
chesterfield[m]: is there a list of supported cryptos for that API?
-
merope
<mikoto-chan> "is there a no-signup API I can..." <- Kraken