-
Notifications
You must be signed in to change notification settings - Fork 24
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
Migration script for old LNDhub Redis data #141
Comments
Hey @bumi , I took a look into lndhub.js and redis data can be retrieved with something like:
Then navigate all keys and values and somehow transform them to lndhub.go db structure. I think key_prefix would be a relational db table, and the rest of the key and value should be entries in that table. But, maybe I am missing the purpose of the task here, is this is what you meant? How do you get access to this data from redis db? |
yeah, the idea is to allow installations of the node.js lndhub to migrate to lndhub.go. for this we have to migrate users and transaction data. IF it is complicated to migrate the full transaction history then a first step could be to just get the user's balance and create one incoming transaction in lndhub.go. - the the user does not have the full transaction history in lndhub.go but they have the correct balance and one "migration" incoming transaction. So I think the first goal should be to migrate the users, then the balances and then if possible the transaction history.. |
@bumi keys for users are stored in lndhub.js in following format:
Prefix is Script to read this from redis can be done, but users can not be migrated like this, because lndhub.go is using bcrypt hash for passwords, so it can not work 1:1 to just migrate password hash. Maybe lndhub.go auth code can be updated to support login with sha256 and when user login just swap underlying password hash to bcrypt, or something like that. If that is acceptable to you, migrating users should be straightforward. After that, balances can be moved as well. EDIT: quick googling around actually gave me same solution:
|
Very simple script to migrate users (need
|
thanks @skosito for documenting this!!! |
Can we somehow migrate data from the lndhub.js Redis database to our DB?
This would make migration easier.
Maybe one start could be to just create one initial incoming transaction that the user has the correct balance. This way the user would loose the transaction history, but it is already a first step.
I am not sure how doable this is, or how complicated this is as the data structure in Redis seems quite tricky to me.
(potentially writing this in JS might be easier as we can reuse code from the lndhub.js version?)
The text was updated successfully, but these errors were encountered: