monero-lws
monero-lws copied to clipboard
An empty response from REST server
I have read similar issue https://github.com/vtnerd/monero-lws/issues/8 and also having an empty responses from REST. Tried few curl combinations and none giving reasonable response.
Started lws-daemon ` dem@nas:~/Projects/lws$ ./monero-lws-daemon --daemon tcp://127.0.0.1:18082 --db-path /mnt/BOOST/.lws --rest-server https://127.0.0.1:8443 --log-level=2 2024-05-21 21:02:33.680 I Using monerod ZMQ RPC at tcp://127.0.0.1:18082 2024-05-21 21:02:33.680 I Starting blockchain sync with daemon 2024-05-21 21:02:33.681 I [PARSE URI] regex not matched for uri: ^(([^:]?)://)?([(.)](:(\d+))?)(.*)? 2024-05-21 21:02:33.681 I Binding on 127.0.0.1 (IPv4):8443 2024-05-21 21:02:33.681 I Generating SSL certificate 2024-05-21 21:02:35.527 D start accept (IPv4) 2024-05-21 21:02:35.528 D Spawned connection #0 to 0.0.0.0 currently we have sockets count:1 2024-05-21 21:02:35.528 I Run net_service loop( 1 threads)... 2024-05-21 21:02:35.528 D Run server thread name: NET 2024-05-21 21:02:35.528 D Reiniting OK. 2024-05-21 21:02:35.528 I Listening for REST clients at https://127.0.0.1:8443 2024-05-21 21:02:35.528 I Retrieving current active account list 2024-05-21 21:02:35.528 I No active accounts 2024-05-21 21:02:40.864 D handle_accept 2024-05-21 21:02:40.864 D New server for RPC connections, SSL enabled 2024-05-21 21:02:40.865 D Spawned connection #1 to 0.0.0.0 currently we have sockets count:2 2024-05-21 21:02:40.865 D connection type 1 127.0.0.1:8443 <--> 127.0.0.1:42250 (via 127.0.0.1:42250) 2024-05-21 21:02:40.865 D Destructing connection #0 to 0.0.0.0 2024-05-21 21:02:45.528 I Starting blockchain sync with daemon 2024-05-21 21:02:45.529 I Retrieving current active account list 2024-05-21 21:02:45.529 I No active accounts 2024-05-21 21:02:55.529 I Starting blockchain sync with daemon 2024-05-21 21:02:55.529 I Retrieving current active account list 2024-05-21 21:02:55.529 I No active accounts 2024-05-21 21:03:05.529 I Starting blockchain sync with daemon
Sample requests:
$ curl -X POST http://127.0.0.1:8443/json_rpc -d '{"jsonrpc":"2.0","id":"0","method":"getblock","params":{"height":311888}}' -H 'Content-Type: application/json'
curl: (52) Empty reply from server
$ curl --location --header 'Content-type: application/json' --data '{"address":"4AquGD2EZpW4pPFJVDkYHQSTR67rcEd5iJ6dHzcRcen3AgXQxxgmkm3eA9mAHxMqeaLhfGdYM5HMyEPKwKdrttKAHNcUx1d","view_key":"4570af226b5385bfdbdd13525b5b74c6931e9eaafdbd5cca33b4340932ee6d09"}' 'http://127.0.0.1:8443/import_request' curl: (52) Empty reply from server
`
One overall thing - you specified https to LWS which will expect an SSL connection, but curl is given http. You'll want to match them. If you use https, then -k to curl will likely be necessary because it doesn't appear you have a valid signed certificate.
You also might want to pass -v to see any errors that are returned.
Request 1
This is a REST api, not JSON-RPC. It should return a 404 Error, which is what happens on my local tests. Pass -v to curl to see the error code.
Request 2
There's no endpoint /import_request - the endpoint is /import_wallet_request. This also should return a 404 error. And despite the name, it requires an existing account before being called. The first endpoint you want to run is /login, which can register a new wallet. Again, run with -v to see any errors that are returned.
I did some tests of a REST server running on https://api.mymonero.com:8443 and got idea how to send correct request. And after i made similar tests locally.
1. Tests on mymonero.com
% curl --location --request POST 'https://api.mymonero.com:8443/get_address_info' --header 'Content-Type: application/json' --data-raw '{"address":"46Qkcopw1qqF57BNbLUgVaBPuKb2zWSW2Wza6LHinhWrTokGE6vD6rjF4csYdwdtEu6h1LjtCNqin5g7mhHx1BmAAqRM33e","view_key":"923b5e07d2c6104beec0252941527e98990b411214d30ad7ea9344cb4ab9470f"}'
{"total_received":"0","total_sent":"0","locked_funds":"0","scanned_height":36095612,"start_height":35121502,"scanned_block_height":2987966,"blockchain_height":3154696,"transaction_height":44896480,"spent_outputs":[],"rates":{"AUD":208.46,"BRL":714.09,"BTC":0.001971,"CAD":188.73,"CHF":126.49,"CNY":754.9321,"EUR":127.68,"GBP":108.51,"HKD":1093.48,"INR":11536.1,"JPY":21626.34,"KRW":189857.98,"MXN":2298.01,"NOK":1269.6793,"NZD":225,"SEK":1315.9164,"SGD":186.44,"TRY":4447.61,"USD":138.51,"RUB":12603.61,"ZAR":2582.32}}%
% curl --location --request POST 'https://api.mymonero.com:8443/login' --header 'Content-Type: application/json' --data-raw '{"address":"46Qkcopw1qqF57BNbLUgVaBPuKb2zWSW2Wza6LHinhWrTokGE6vD6rjF4csYdwdtEu6h1LjtCNqin5g7mhHx1BmAAqRM33e","view_key":"923b5e07d2c6104beec0252941527e98990b411214d30ad7ea9344cb4ab9470f"}'
{"new_address":false,"start_height":35121502}%
2. Local tests. To match connections of http of the REST and curl i started server as follows:
$ ./monero-lws-daemon --daemon tcp://127.0.0.1:18082 --db-path /mnt/BOOST/.lws --rest-server http://127.0.0.1:8443 --log-level=4
2024-05-22 16:57:02.855 I Using monerod ZMQ RPC at tcp://127.0.0.1:18082
2024-05-22 16:57:02.855 I Starting blockchain sync with daemon
2024-05-22 16:57:02.856 I [PARSE URI] regex not matched for uri: ^(([^:]*?)://)?(\[(.*)\](:(\d+))?)(.*)?
2024-05-22 16:57:02.856 I Binding on 127.0.0.1 (IPv4):8443
2024-05-22 16:57:02.856 D start accept (IPv4)
2024-05-22 16:57:02.856 D Spawned connection #0 to 0.0.0.0 currently we have sockets count:1
2024-05-22 16:57:02.856 I Run net_service loop( 1 threads)...
2024-05-22 16:57:02.857 D Run server thread name: NET
2024-05-22 16:57:02.857 D Reiniting OK.
2024-05-22 16:57:02.857 I Listening for REST clients at http://127.0.0.1:8443
2024-05-22 16:57:02.857 I Retrieving current active account list
2024-05-22 16:57:02.857 I No active accounts
2024-05-22 16:57:12.857 I Starting blockchain sync with daemon
2024-05-22 16:57:12.857 I Retrieving current active account list
2024-05-22 16:57:12.857 I No active accounts
2024-05-22 16:57:22.857 I Starting blockchain sync with daemon
2024-05-22 16:57:22.858 I Retrieving current active account list
2024-05-22 16:57:22.858 I No active accounts
now doing requests to REST and got none response
curl --location --request POST 'http://127.0.0.1:8443/get_address_info' --header 'Content-Type: application/json' --data-raw '{"address":"46Qkcopw1qqF57BNbLUgVaBPuKb2zWSW2Wza6LHinhWrTokGE6vD6rjF4csYdwdtEu6h1LjtCNqin5g7mhHx1BmAAqRM33e","view_key":"923b5e07d2c6104beec0252941527e98990b411214d30ad7ea9344cb4ab9470f"}'
investigating server log and seeing 403 Forbidden:
2024-05-22 16:59:00.274 D New server for RPC connections, SSL disabled
2024-05-22 16:59:00.274 D Spawned connection #1 to 0.0.0.0 currently we have sockets count:2
2024-05-22 16:59:00.274 T New connection from host 127.0.0.1: 0
2024-05-22 16:59:00.274 D connection type 1 127.0.0.1:8443 <--> 127.0.0.1:60726 (via 127.0.0.1:60726)
2024-05-22 16:59:00.274 T Moving counter buffer by 1 second 0 < 943108 (last time 0)
2024-05-22 16:59:00.274 T Throttle throttle_speed_in: packet of ~335b (from 335 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [335 0 0 0 0 0 0 0 0 0 ]
2024-05-22 16:59:00.274 T Moving counter buffer by 1 second 0 < 943108 (last time 0)
2024-05-22 16:59:00.274 T Throttle <<< global-IN: packet of ~335b (from 335 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [335 0 0 0 0 0 0 0 0 0 ]
2024-05-22 16:59:00.275 T HTTP HEAD:
2024-05-22 16:59:00.275 T Host: 127.0.0.1:8443
2024-05-22 16:59:00.275 T User-Agent: curl/7.88.1
2024-05-22 16:59:00.275 T Accept: */*
2024-05-22 16:59:00.275 T Content-Type: application/json
2024-05-22 16:59:00.275 T Content-Length: 187
2024-05-22 16:59:00.275 T
2024-05-22 16:59:00.275 I No account with the specified address exists from 127.0.0.1:60726 on /get_address_info
2024-05-22 16:59:00.275 T HTTP_RESPONSE_HEAD: <<
2024-05-22 16:59:00.275 T HTTP/1.1 403 Forbidden
2024-05-22 16:59:00.275 T Server: Epee-based
2024-05-22 16:59:00.275 T Content-Length: 0
2024-05-22 16:59:00.275 T Content-Type: text/plain
2024-05-22 16:59:00.275 T Last-Modified: Wed, 22 May 2024 16:59:00 GMT
2024-05-22 16:59:00.275 T Accept-Ranges: bytes
2024-05-22 16:59:00.275 T
2024-05-22 16:59:00.275 T Moving counter buffer by 1 second 0 < 943108 (last time 0)
2024-05-22 16:59:00.275 T Throttle throttle_speed_out: packet of ~159b (from 159 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [159 0 0 0 0 0 0 0 0 0 ]
2024-05-22 16:59:00.275 T Moving counter buffer by 1 second 0 < 943108 (last time 0)
2024-05-22 16:59:00.275 T Throttle >>> global-OUT: packet of ~159b (from 159 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [159 0 0 0 0 0 0 0 0 0 ]
2024-05-22 16:59:00.275 T Closed connection from host 127.0.0.1: 1
2024-05-22 16:59:00.275 D Destructing connection #0 to 0.0.0.0
login method also none response
curl --location --request POST 'http://127.0.0.1:8443/login' --header 'Content-Type: application/json' --data-raw '{"address":"46Qkcopw1qqF57BNbLUgVaBPuKb2zWSW2Wza6LHinhWrTokGE6vD6rjF4csYdwdtEu6h1LjtCNqin5g7mhHx1BmAAqRM33e","view_key":"923b5e07d2c6104beec0252941527e98990b411214d30ad7ea9344cb4ab9470f"}'
investigating server log and seeing 500 Internal Server Error
2024-05-22 17:01:34.887 D Spawned connection #2 to 0.0.0.0 currently we have sockets count:2
2024-05-22 17:01:34.887 T New connection from host 127.0.0.1: 0
2024-05-22 17:01:34.887 D connection type 1 127.0.0.1:8443 <--> 127.0.0.1:51346 (via 127.0.0.1:51346)
2024-05-22 17:01:34.887 T Moving counter buffer by 1 second 0 < 943262 (last time 0)
2024-05-22 17:01:34.887 T Throttle throttle_speed_in: packet of ~324b (from 324 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [324 0 0 0 0 0 0 0 0 0 ]
2024-05-22 17:01:34.887 T Moving counter buffer by 1 second 943108 < 943262 (last time 943108)
2024-05-22 17:01:34.887 T Moving counter buffer by 1 second 943109 < 943262 (last time 943109)
..........
2024-05-22 17:01:34.888 T Moving counter buffer by 1 second 943260 < 943262 (last time 943260)
2024-05-22 17:01:34.888 T Moving counter buffer by 1 second 943261 < 943262 (last time 943261)
2024-05-22 17:01:34.888 T Throttle <<< global-IN: packet of ~324b (from 324 b) Speed AVG= 0[w=9.766] 0[w=9.766] / Limit=16 KiB/sec [324 0 0 0 0 0 0 0 0 0 ]
2024-05-22 17:01:34.888 T HTTP HEAD:
2024-05-22 17:01:34.888 T Host: 127.0.0.1:8443
2024-05-22 17:01:34.888 T User-Agent: curl/7.88.1
2024-05-22 17:01:34.888 T Accept: */*
2024-05-22 17:01:34.888 T Content-Type: application/json
2024-05-22 17:01:34.888 T Content-Length: 187
2024-05-22 17:01:34.888 T
2024-05-22 17:01:34.888 D Schema missing required field key: create_account
2024-05-22 17:01:34.902 I Schema missing required field key from 127.0.0.1:51346 on /login
2024-05-22 17:01:34.902 T HTTP_RESPONSE_HEAD: <<
2024-05-22 17:01:34.902 T HTTP/1.1 500 Internal Server Error
2024-05-22 17:01:34.902 T Server: Epee-based
2024-05-22 17:01:34.902 T Content-Length: 0
2024-05-22 17:01:34.902 T Content-Type: text/plain
2024-05-22 17:01:34.902 T Last-Modified: Wed, 22 May 2024 17:01:34 GMT
2024-05-22 17:01:34.902 T Accept-Ranges: bytes
2024-05-22 17:01:34.902 T
2024-05-22 17:01:34.902 T Closed connection from host 127.0.0.1: 1
2024-05-22 17:01:34.902 D Destructing connection #1 to 0.0.0.0
investigating server log and seeing 403 Forbidden:
You got a 403 error because the account was not registered in the database. You must do a /login first to request a new account creation, then use the monero-lws-admin utility to accept the new account creation. Alternatively, there is --auto-accept-creation which automatically accepts new accounts on /login.
Either way the workflow is call /login first.
investigating server log and seeing 500 Internal Server Error
The problem can be seen in the log message you provided:
024-05-22 17:01:34.888 D Schema missing required field key: create_account 2024-05-22 17:01:34.902 I Schema missing required field key from 127.0.0.1:51346 on /login
There are 4 required fields for the login endpoint, the two missing are create_account and generated_locally.
Now i got it. Started daemon with --auto-accept-creation and added missed fields to /login
curl --location --request POST 'http://127.0.0.1:8443/login' --header 'Content-Type: application/json' --data-raw '{"address":"46LE3opQkahMw5yD12tE6sAEqLAe4RnR7i5ocxqVxPoW6hU84QprfwSCHWq7Gm3EMV2qRwnnNJY3rSnonYpCtE9sE2UyRba","view_key":"b09519667ae2d7699af214fd4e4ae82cded36cfc538289fd200e58832118480c","create_account":true,"generated_locally":false}'
2024-05-23 17:14:03.288 T New connection from host 127.0.0.1: 0
2024-05-23 17:14:03.288 D connection type 1 127.0.0.1:8443 <--> 127.0.0.1:60046 (via 127.0.0.1:60046)
2024-05-23 17:14:03.288 T Moving counter buffer by 1 second 0 < 1.03041e+06 (last time 0)
...
024-05-23 17:14:03.289 T Moving counter buffer by 1 second 1.03041e+06 < 1.03041e+06 (last time 1.03041e+06)
2024-05-23 17:14:03.289 T Throttle <<< global-IN: packet of ~372b (from 372 b) Speed AVG= 0[w=9.167] 0[w=9.167] / Limit=16 KiB/sec [372 0 0 0 0 0 0 0 0 0 ]
2024-05-23 17:14:03.289 T HTTP HEAD:
2024-05-23 17:14:03.289 T Host: 127.0.0.1:8443
2024-05-23 17:14:03.289 T User-Agent: curl/7.88.1
2024-05-23 17:14:03.289 T Accept: */*
2024-05-23 17:14:03.289 T Content-Type: application/json
2024-05-23 17:14:03.289 T Content-Length: 235
2024-05-23 17:14:03.289 T
2024-05-23 17:14:03.291 T HTTP_RESPONSE_HEAD: <<
2024-05-23 17:14:03.291 T HTTP/1.1 200 OK
2024-05-23 17:14:03.291 T Server: Epee-based
2024-05-23 17:14:03.291 T Content-Length: 46
2024-05-23 17:14:03.291 T Content-Type: application/json
2024-05-23 17:14:03.291 T Last-Modified: Thu, 23 May 2024 17:14:03 GMT
2024-05-23 17:14:03.291 T Accept-Ranges: bytes
2024-05-23 17:14:03.291 T
2024-05-23 17:14:03.291 T Moving counter buffer by 1 second 0 < 1.03041e+06 (last time 0)
2024-05-23 17:14:03.291 T Throttle throttle_speed_out: packet of ~205b (from 205 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [205 0 0 0 0 0 0 0 0 0 ]
2024-05-23 17:14:03.291 T Moving counter buffer by 1 second 1.03013e+06 < 1.03041e+06 (last time 1.03013e+06)
...
2024-05-23 17:14:03.293 T Throttle >>> global-OUT: packet of ~205b (from 205 b) Speed AVG= 0[w=9.17] 0[w=9.17] / Limit=16 KiB/sec [205 0 0 0 0 0 0 0 0 0 ]
2024-05-23 17:14:03.293 T Closed connection from host 127.0.0.1: 1
2024-05-23 17:14:03.293 D Destructing connection #12 to 0.0.0.0
2024-05-23 17:14:11.896 I Starting blockchain sync with daemon
2024-05-23 17:14:11.897 I Retrieving current active account list
2024-05-23 17:14:11.897 I Starting scan loops on 1 thread(s) with 1 account(s)
curl --location --request POST 'http://127.0.0.1:8443/get_address_info' --header 'Content-Type: application/json' --data-raw '{"address":"46LE3opQkahMw5yD12tE6sAEqLAe4RnR7i5ocxqVxPoW6hU84QprfwSCHWq7Gm3EMV2qRwnnNJY3rSnonYpCtE9sE2UyRba","view_key":"b09519667ae2d7699af214fd4e4ae82cded36cfc538289fd200e58832118480c"}'
2024-05-23 17:17:16.907 D connection type 1 127.0.0.1:8443 <--> 127.0.0.1:43776 (via 127.0.0.1:43776)
2024-05-23 17:17:16.907 T Moving counter buffer by 1 second 0 < 1.0306e+06 (last time 0)
2024-05-23 17:17:16.907 T Throttle throttle_speed_in: packet of ~335b (from 335 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [335 0 0 0 0 0 0 0 0 0 ]
...
2024-05-23 17:17:16.909 T Throttle <<< global-IN: packet of ~335b (from 335 b) Speed AVG= 0[w=9.786] 0[w=9.786] / Limit=16 KiB/sec [335 0 0 0 0 0 0 0 0 0 ]
2024-05-23 17:17:16.909 T HTTP HEAD:
2024-05-23 17:17:16.909 T Host: 127.0.0.1:8443
2024-05-23 17:17:16.909 T User-Agent: curl/7.88.1
2024-05-23 17:17:16.909 T Accept: */*
2024-05-23 17:17:16.909 T Content-Type: application/json
2024-05-23 17:17:16.909 T Content-Length: 187
2024-05-23 17:17:16.909 T
2024-05-23 17:17:16.909 W Unable to retrieve exchange rates: Exchange rates feature is disabled
2024-05-23 17:17:16.909 T HTTP_RESPONSE_HEAD: <<
2024-05-23 17:17:16.909 T HTTP/1.1 200 OK
2024-05-23 17:17:16.909 T Server: Epee-based
2024-05-23 17:17:16.909 T Content-Length: 194
2024-05-23 17:17:16.909 T Content-Type: application/json
2024-05-23 17:17:16.909 T Last-Modified: Thu, 23 May 2024 17:17:16 GMT
2024-05-23 17:17:16.909 T Accept-Ranges: bytes
2024-05-23 17:17:16.909 T
2024-05-23 17:17:16.909 T Moving counter buffer by 1 second 0 < 1.0306e+06 (last time 0)
2024-05-23 17:17:16.909 T Throttle throttle_speed_out: packet of ~354b (from 354 b) Speed AVG= 0[w=1] 0[w=1] / Limit=16 KiB/sec [354 0 0 0 0 0 0 0 0 0 ]
...
2024-05-23 17:17:16.911 T Throttle >>> global-OUT: packet of ~354b (from 354 b) Speed AVG= 0[w=9.788] 0[w=9.788] / Limit=16 KiB/sec [354 0 0 0 0 0 0 0 0 0 ]
2024-05-23 17:17:16.911 T Closed connection from host 127.0.0.1: 1
2024-05-23 17:17:16.911 D Destructing connection #13 to 0.0.0.0
2024-05-23 17:18:52.225 I Processed 1 block(s) against 1 account(s)
All went fine i may now see responses from local REST
And how long it takes to get total_received balance ? I meant when i did requests to api.mymonero.com:8443 it showed non-zero balance immediately. Not for that above walllet, because its zero, other with known balance.
mymonero response:
{'total_received': '4308948505', 'total_sent': '32007804986', 'locked_funds': '0', 'scanned_height': 44935646, 'start_height': 43478108, 'scanned_block_height': 3155375, 'blockchain_height': 3155375, 'transaction_height': 44935646, 'spent_outputs': [{'tx_pub_key': ............
and the same address locally
{"locked_funds":"0","total_received":"0","total_sent":"0","scanned_height":3155442,"scanned_block_height":3155442,"start_height":3155425,"transaction_height":3155442,"blockchain_height":3155442}
And how long it takes to get total_received balance ? I meant when i did requests to api.mymonero.com:8443
There's a small delay when you add new accounts - the DB is polled every 10 seconds for new accounts. The remainder of the delay depends on the single-thread processing speed of your account, and the disk latency of your monerod instance.
Another point - mymonero should have a custom DB for its blockchain, that might be a bit faster in returning results than monerod. There's some improvement that can be done in monerod ZMQ code to accelerate it a bit that hasn't been done.
There's a small delay when you add new accounts - the DB is polled every 10 seconds for new accounts.
So around 20 hours passed since i registered address in lws-daemon and still no balance shown. I suspect i need to "stimulate" blockchain scan to found transaction for that address. Did i miss something? My expectations were as follows - as soon as address added to daemon it will retrieve transactions associated with that address therefore calculate balance. And it will be much faster than monero-wallet-cli or monero-wallet-gui do.
Another point - mymonero should have a custom DB for its blockchain
It might be. I also found that it does not show non-zero balances for some wallets too. Moreover few non-zero address has {"Error":"account not found"}. mymonero works for some addresses only i guess the ones they added to their database.
For sake of comparison i also tried another low active similar project generic-xmr-scanner https://github.com/moneroexamples/generic-xmr-scanner but it failed to build even in docker.
Check the start_height to make sure LWS started at a block before the transactions. Also check scanned_block_height to see if it made to the transaction block.
Check the
start_heightto make sure LWS started at a block before the transactions
Definitely it is behind of transaction height.
monero-wallet-cli shows
Height 2670493, txid <bffbd6cde5dea14f48384341c2b166e6483c0c00589a6815f1791b30bc109006>, 0.000163750000, idx 0/0
I started lws-daemon as:
./monero-lws-daemon --daemon tcp://127.0.0.1:18082 --db-path /mnt/BOOST/.lws --rest-server http://127.0.0.1:8443 --log-level=4 --auto-accept-creation
local REST server output
curl --location --request POST 'http://127.0.0.1:8443/get_address_info' --header 'Content-Type: application/json' --data-raw '{"address":"46qPuYzyGVfX8xaWGh94afR1g1twDdJ4NiW1yNEZytj27Gs3XfWpniuTCNU8T8p4LoP3i4VPAm9FHJQfhv27Ktr83vVSgaE","view_key":"VIEW_KEY_HERE"}'4"}'
{"locked_funds":"0","total_received":"0","total_sent":"0","scanned_height":3156634,"scanned_block_height":3156634,"start_height":3155424,"transaction_height":3156634,"blockchain_height":3156634}
Local monero daemon fully synced
2024-05-24 20:05:24.646 I ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 3156231
2024-05-24 20:05:24.646 I id: <d92e1f9ca6c735d5e13c116f83eacf3f035afb55fb3024618c7b260a7fb88b33>
2024-05-24 20:05:24.646 I PoW: <635aeb699697a3f3d1b4a572a536e011ef05a918a362cf6ea4272c0100000000>
2024-05-24 20:05:24.646 I difficulty: 298269610781
2024-05-24 20:05:24.710 I ###### REORGANIZE on height: 3156231 of 3156231 with cum_difficulty 354383233760596227
2024-05-24 20:05:24.710 I alternative blockchain size: 2 with cum_difficulty 354383531508736765
2024-05-24 20:05:25.265 I ----- BLOCK ADDED AS ALTERNATIVE ON HEIGHT 3156231
2024-05-24 20:05:25.265 I id: <90aa071e2c0c725fff067dbfd33c4c0d6f7272b9f504791d15f4e6e1aca260d9>
2024-05-24 20:05:25.265 I PoW: <f8604b5d7363dae71ed984a76a31608adfd1c29e5b2a3d195b31850100000000>
2024-05-24 20:05:25.265 I difficulty: 298269610781
2024-05-24 20:05:26.254 I REORGANIZE SUCCESS! on height: 3156231, new blockchain size: 3156233
2024-05-24 20:05:26.283 I Synced 3156233/3156233
2024-05-24 20:31:03.510 W No incoming connections - check firewalls/routers allow port 18080
As i understood lws-daemon only listen transactions from the height when it was started, but according to monero-lws-daemon --help there are no such option to start it from exact hight.
local REST server output
What is the CLI output of the daemon/scanner? It should log that it's scanning or doing nothing. My initial thought is that the ZMQ port is somehow wrong (although that is the default port).
As i understood lws-daemon only listen transactions from the height when it was started, but according to monero-lws-daemon --help there are no such option to start it from exact hight.
Use the monero-lws-admin command (in same folder) to adjust scan height for a specific address. This can be done while the scanner is running.
Use the
monero-lws-admin
Well, figured out how to adjust the height. To use lws-admin it is mandatory also define lws-admin rest server before starting lws-daemon.
./monero-lws-daemon --daemon tcp://127.0.0.1:18082 --db-path /mnt/BOOST/.lws --rest-server http://127.0.0.1:8443 --log-level=4 --auto-accept-creation --network=main --admin-rest-server http://127.0.0.1:8444
2024-05-25 16:12:48.436 I Using monerod ZMQ RPC at tcp://127.0.0.1:18082
2024-05-25 16:12:48.436 I Starting blockchain sync with daemon
2024-05-25 16:12:48.438 I [PARSE URI] regex not matched for uri: ^(([^:]*?)://)?(\[(.*)\](:(\d+))?)(.*)?
2024-05-25 16:12:48.438 I [PARSE URI] regex not matched for uri: ^(([^:]*?)://)?(\[(.*)\](:(\d+))?)(.*)?
2024-05-25 16:12:48.438 I Binding on 127.0.0.1 (IPv4):8443
2024-05-25 16:12:48.438 D start accept (IPv4)
2024-05-25 16:12:48.439 D Spawned connection #0 to 0.0.0.0 currently we have sockets count:1
2024-05-25 16:12:48.439 I [PARSE URI] regex not matched for uri: ^(([^:]*?)://)?(\[(.*)\](:(\d+))?)(.*)?
2024-05-25 16:12:48.439 I Binding on 127.0.0.1 (IPv4):8444
2024-05-25 16:12:48.439 D start accept (IPv4)
2024-05-25 16:12:48.439 D Spawned connection #0 to 0.0.0.0 currently we have sockets count:1
2024-05-25 16:12:48.439 I Run net_service loop( 1 threads)...
2024-05-25 16:12:48.439 D Run server thread name: NET
2024-05-25 16:12:48.439 D Reiniting OK.
2024-05-25 16:12:48.439 I Listening for REST clients at http://127.0.0.1:8443
2024-05-25 16:12:48.439 I Listening for REST admin clients at http://127.0.0.1:8444
2024-05-25 16:12:48.439 I Retrieving current active account list
2024-05-25 16:12:48.439 I Starting scan loops on 4 thread(s) with 4 account(s)
2024-05-25 16:12:48.451 I Processed 2 block(s) against 1
then set height in lws-admin
./monero-lws-admin rescan 2670000 46qPuYzyGVfX8xaWGh94afR1g1twDdJ4NiW1yNEZytj27Gs3XfWpniuTCNU8T8p4LoP3i4VPAm9FHJQfhv27Ktr83vVSgaE --network=main --db-path /mnt/BOOST/.lws
{"updated":["46qPuYzyGVfX8xaWGh94afR1g1twDdJ4NiW1yNEZytj27Gs3XfWpniuTCNU8T8p4LoP3i4VPAm9FHJQfhv27Ktr83vVSgaE"]}
then daemon reflects this change and starting processing blocks.
...
2024-05-25 17:50:16.144 I Processed 964 block(s) against 1 account(s)
2024-05-25 17:50:25.842 I Processed 779 block(s) against 1 account(s)
once transaction block scanned i may see balance
{"locked_funds":"0","total_received":"163750000","total_sent":"327500000","scanned_height":2680076,"scanned_block_height":2680076,"start_height":2670000,"transaction_height":3156875,"blockchain_height":3156875,"spent_outputs":[{"amount":"163750000","key_image":"...........}]}
However i haven't noticed any speed improvement compared to monero-wallet-cli I tried to adjust speed by playing with --scan-threads= --rest-threads= and seems no affect and also htop shows that 1 cpu core working with either value.
p.s. on my cpu (i5-13500) with monerod on sata SSD, it takes 11 minutes to scan full blockchain.
./monero-wallet-cli --daemon-address 192.168.1.105:15000 --trusted-daemon --generate-from-view-key wallet0
However i haven't noticed any speed improvement compared to monero-wallet-cli
I wouldn't expect much of an improvement. Multiple threads are for multiple accounts, not a single account being spread to multiple threads.
There are some improvements that can be made to the ZMQ handing (converting from JSON to Msgpack), but the gains will probably be modest.
i've been testing lws with many accounts around 1000 pcs and got this error message
2024-06-06 08:10:08.647 E Failed to retrieve next blocks: Schema expected array size to be smaller. Resetting state and trying again
and it repeated every half of second. It looks like bug.
Yes, you won't be able to make scan progress util this is fixed. I will get my node caught-up today to figure out out which array is causing this.
If you can run this in a debugger, and catch throw, that would tell me where to begin looking. Otherwise we will have to wait for my node to catch up before I can get out a fix.
If you can run this in a debugger, and
catch throw
Well, probably will try to run dbg if i figure out where to put breakpoint.
With gdb you should be able to catch throw which breaks on any exception being thrown. It's possible that multiple exceptions are being thrown, but I doubt it because most exceptions are shutdown conditions (and this is not). Look for a throw with wire::json::from_bytes in the call stack.
Alternatively, if you are using LLDB, then breakpoint set -E c++ should break on any exception throw.
I'm all caught up on main net, but I couldn't reproduce.
@Demontager could you tell me what chain (mainnet, stagenet or testnet), and the current scan_height of the accounts triggering this? You can find/collapse the scan_heights in your DB with:
./monero-lws-admin list_accounts | jq '.active | .[] | .scan_height' | sort -n | uniq
could you tell me what chain
I was on main net. I can't catch error because my monero node running strange now. I have shifted to other pc and bootstrapped new node from blockchain.raw and while i trying to update the wallet, monero daemon suddenly cutting connection.
Background mining not enabled. Set setup-background-mining to 1 to change.
If you are new to Monero, type "welcome" for a brief overview.
Starting refresh...
Error: refresh failed: no connection to daemon. Please make sure daemon is running.. Blocks received: 185814
Background refresh thread started
[wallet 4ACbK9 (out of sync)]: exit
I think i'd better resync local node first to make sure monero daemon works normal.
upd. i got idea why monero daemon dropping connections, it was because self compiled monero was unable to accept connections if ssl enabled, so i added rpc-ssl=disabled to monerod.conf.
Shifted an issue with updating accounts to separate topic https://github.com/vtnerd/monero-lws/issues/122, because it's not related to monero-lws usage