dashed-slug.net › Forums › Full Node Multi Coin Adapter extension support › Deposit notification not working for Bitcoin wallet
Tagged: bitcoin, deposit, walletnotify
- This topic has 6 replies, 2 voices, and was last updated 3 years, 3 months ago by alexg.
-
AuthorPosts
-
September 9, 2021 at 6:18 pm #10994sagejyoungMember
Hi There,
wondering if you could help me. After a few months of trying (on and off), I have successfully got the full BTC node to connect to the coin adapter. This is amazing news and I now in a position to move onto the next phase of my private project.
I have all the necessary details and the plugin says its connected but am having trouble seeing the balances against the users. I have checked the wallet balance on the node and also blockchain.com and can see a balance on the users address.
do you have any tips on how to get the balances to show up?
Things I have tried:
– sent to most user wallets.
– Activated and deactivated the plugin (all still works).
– Switched node on and off.Kind regards
SageSeptember 10, 2021 at 8:11 am #10996alexgKeymasterHello and welcome!
First, understand that there is no 1-to-1 correlation between wallet addresses and users. The user balances are the sum of user transactions. Each user is assigned a deposit address. When you send funds to that address, the plugin must first detect this deposit and create a corresponding deposit entry into the plugin’s ledger. For Bitcoin-like wallets this is done via the
walletnotify
wallet argument.Having said this, please tell me the following:
1. When you go to Wallets -> Adapters, do you see the correct hot wallet balance? (i.e. the balance of the wallet backing the site’s funds)
2. When you go to Wallets -> Addresses, do you see BTC addresses assigned to users? There should be addresses for all users who have already logged in after you installed the plugin.
3. When you go to Wallets -> Transactions, do you see any deposits? This is the critical part. If this is not working, it’s possible that you haven’t set up walletnotify correctly.
If the problem is with walletnotify, please check this guide: https://www.dashed-slug.net/howto-debug-an-incoming-deposit-full-node-wallet/ Everything is explained there.
If possible, show me what you found in steps 5 and 6 of the HOWTO guide, so I can help.
with regards
September 10, 2021 at 9:54 am #10997sagejyoungMemberHi Alex,
thanks for coming back to me on this. I have responded to each:
1. When you go to Wallets -> Adapters, do you see the correct hot wallet balance? (i.e. the balance of the wallet backing the site’s funds)
Yes, I see the balances for both doge and btc.2. When you go to Wallets -> Addresses, do you see BTC addresses assigned to users? There should be addresses for all users who have already logged in after you installed the plugin.
Yes, I see both Doge and BTC addresses for each user (i have three, one admin and two subscribers all with ability to use wallets etc etc in the settings area).3. When you go to Wallets -> Transactions, do you see any deposits? This is the critical part. If this is not working, it’s possible that you haven’t set up walletnotify correctly.
This is probably the issue.On Step 5 I am able to see the success marker. When making the call. = {“result”:”success”}
on step 6 as i am using apache server with XAMPP – I can see cURL activated in the php.ini file but am a little lost on the rest?
Do you have any help at this step? This must be something to do with walletnotify but I cant seem to work it out.my sql data base with wallet_txs is also empty so there must be one final thing i am missing.
Kind Regards
SageSeptember 10, 2021 at 10:47 am #10998alexgKeymasterHello,
OK, sounds like you’re already half way there.
You should now check to see if the walletnotify command works:
Let’s say user 1 has BTC address
1SOMEADDRESS
. And let’s say also you have sent a deposit to that address, with a TXID of0123456789ABCDEF
. Finally, let’s say your site’s hostname isexample.com
.You can check to see if the transaction is known by your wallet, by issuing the following shell command in the machine where the wallet is running:
bitcoin-cli gettransaction 01234567890ABCDEF
You should see the transaction data in JSON form. If not, then the wallet may not be fully synced yet.
To notify the plugin about this transaction, the notification URL would be:
https://www.example.com/wallets/api3/notify/BTC/wallet/01234567890ABCDEF
When you visit this URL in your browser, the plugin should now go ask the wallet about that transaction. If the transaction is found, the plugin will create a deposit for this user. The deposit will be shown in the admin screens in “Wallets” -> “Transactions”. You will get a
{"result":"success"}
even if the transaction is not found.Once you determine that the transaction is known by the wallet, and that the above notify URL creates the deposit in the plugin, then it’s time to check the automation of the above:
You should be able to achieve the same effect by issuing the following curl command:
curl -k https://www.example.com/wallets/api3/notify/BTC/wallet/01234567890ABCDEF
If you get
command not found
, you must install curl. If you get some other error, let me know.Once you determine that this works, finally it’s time to set the walletnotify argument in your
bitcoin.conf
file:walletnotify=curl -sk https://www.example.com/wallets/api3/notify/BTC/wallet/%s >/dev/null
(The
%s
part is replaced with the TXID by the bitcoin wallet).Check the above and let me know how far you got.
with regards
September 10, 2021 at 2:30 pm #11003sagejyoungMemberI have responded but seems links stop the replies going through.
September 12, 2021 at 8:28 am #11006sagejyoungMemberHi Alex,
not to worry I have it working now. There were a few assumptions that i had made that were not correct about the functionality of the plugin. These are them:
I has assumed that should I ‘seed’ Joe’s address with some BTC BEFORE going to transaction history that the BTC balance of Joe’s account would show up. This is not the case as the plugin doesn’t retrospectively pull All account transactions from the ‘listtransactions’ command in the Bitcoin core wallet. When running this command i can see all Tx’s with metadata in thejson field and had assumed the plugin would load all of that information. this is not the case.
I had also assumed that the hotwallet balance would also show up should the admin have an account with a balance automatically – this is not the case. So… what i did was ‘seed’ the admin account with the same balance as the hot wallet balance in the myphpadmim/SQL table. this meant that the balance on the hot wallet and the balance of the admin account would then correlate.
on to testing:
i then initiated an internal transfer to Joe which worked like a charm! Along with all its meta data (none of the old TX’s were there, which is fine).
I was also able to transfer from Joes balance to an external wallet to test whether the withdrawal feature would work as well, worked like a charm!
Thanks once again for a great plugin. I am considering a premium subscription to unlock the trading features – do you have a demo that i can see?
Kind Regards
SageSeptember 13, 2021 at 7:50 am #11009alexgKeymasterHello,
Good to hear that you got everything working now. You should also test with a live deposit to ensure that the notification mechanism is correctly setup.
The plugin does try to retroactively query user deposit addresses for incoming transactions. However this only works if the cron jobs are running on your system. Since you accomplished an internal transfer, they should be running. But it’s worth checking. See Dashboard -> Bitcoin and Altcoin Wallets -> Debug -> “Cron jobs last ran on” and “Cron jobs last runtime”. Last ran on should be recent (a few minutes ago) and last runtime should be less than your max PHP execution time.
Unfortunately I don’t have a demo for the exchange at the moment. I may set up one after I finish with wallets6 and the ERC-20 adapter. Some users have set up exchanges, you may find some here: https://www.dashed-slug.net/forums/topic/live-sites-powered-by-the-bitcoin-and-altcoin-wallets-wordpress-plugin/
with regards
-
AuthorPosts
- You must be logged in to reply to this topic.