dashed-slug.net › Forums › General discussion › wallet notify
Tagged: mining, POS, rewards, wallet notify
- This topic has 11 replies, 2 voices, and was last updated 6 years ago by alexg.
-
AuthorPosts
-
November 7, 2018 at 5:34 am #5010AnonymousInactive
i am interested in the -walletnotify to ping a webpage
i have a separate coin adapter with same coin but hosted elsewhere, but i want to be notified when a stake comes in
i notice you have something in the json api but not sure how to incorporate it
can you send me in what files i should look for your wallet notifications?
or could you add “category stake” so it will update the DB as well?
November 7, 2018 at 6:36 am #5014alexgKeymasterHello,
The
-walletnotify
mechanism is used with Bitcoin-like RPC wallets to notify the plugin that an incoming deposit exists.The plugin does not distribute POS dividents to users, therefore there is no “stake” category for transactions. Any stake earnings are added to the hot wallet balance of the site, not to any user balance.
In the future there might be a divident-paying plugin extension, but this is not implemented yet.
If you would like to be notified of stake rewards from your wallet, you will probably have to find another way. Having said this, maybe you could implement your own code that binds to the
action_wallets_notify_wallet
action. This will receive transaction IDs. You can then check if these correspond to transactions that are POS rewards using some online service or via communication to a wallet. But this something out of scope of the plugin.with regards
November 8, 2018 at 4:37 am #5016AnonymousInactivei guess i thought since the work is already being done by the plugin to check deposits it could show category -> stake too
i was hope to use your existing framework. what files can i look at that does the work of checking for deposits? maybe i can get it working, but not knowing where to look in your file structure would be tough without knowing where to start
November 8, 2018 at 7:26 am #5017alexgKeymasterHello again.
I am not sure that I made the problem clear enough. It is not a matter of technical implementation. The stakes cannot be assigned to users. A stake amount is dependent on the total staked balance amount, not the balances of individual users. There is no 1-to-1 mapping of address balances and user balances. Hence the need for an investment plugin extension, which I have not yet developed.
Deposit transactions are normally discovered by the coin adapters and are transmitted into a handler
Dashed_Slug_Wallets_TXs->action_wallets_transaction()
via thewallets_transaction
action. But this will not help you insert stake rewards into the DB.hope this is a bit more clear
November 8, 2018 at 7:35 pm #5035AnonymousInactivei understand that i just wanted to be able to do it to a different wallet but alert me that a stake was done and add it to the DB.
it was not mean to be done to several addresses for the users, just one wallet and one user.
so knowing that i am not trying to get it for my users do you see how it should be possible?
i just want informed and added to DB on deposit/ stake and only used by me the admin.
or is that the issue it would be available to all users? can we have a wallet only available to the admin? isnt that what cold storage does?
November 9, 2018 at 10:25 am #5037alexgKeymasterStake rewards are not added to the admin account or any other account. Therefore, nothing needs to be written to the DB.
POS rewards are simply added to your hot wallet. This is why you have an indication of total sum of user balances and hot wallet balance: so that you know what portion of the hot wallet balance is available to you and what part is for the users. It is also there so that you know what percentage you have offloaded to cold storage.
The cold storage is a security feature, it has nothing to do with how much money the admin account has. You can read more about it in the documentation.
I will look into sending an email notification to the admin when you receive POS rewards.
with regards
November 10, 2018 at 6:29 am #5039AnonymousInactivei feel you are misunderstanding me, lol
since a stake can be differentiated from a payment to the wallet.
ex:
stake comes in:
category=stake or category=generatepayment received
category=receiveI am asking that not to ignore the stake or generate when it comes in but rather add that info to the DB and add option for a email alert as you mentioned
and this will be / should be a SEPARATE wallet and adapter used ONLY by admin, if that is possible to still do without making this available to all. not sure that is possible not showing up to all users
i think adding this would be a great way others like me can build more on top of this plugin.
November 12, 2018 at 8:51 am #5043alexgKeymasterHello,
Thank you for the clarification.
It is definitely possible to bind to the
wallets_transaction
action, observe the incoming data, and if the transaction is a stake reward, send an email using wp_mail. You can implement this easily in yourfunctions.php
file or a small separate plugin. Take care, because different wallets implement rewards differently: Some wallets remove all your balance, then add your balance again, plus the reward. In other wallets, the reward amount is added separately in a new transaction. So look at your wallet’slisttransaction
output first.I am not planning to add a feature where POS rewards are added to the admin account. Part of the reason is that due to incompatibilities between POS wallets, this will cause problems.
with regards
November 19, 2018 at 3:46 am #5087AnonymousInactivewell maybe adding it to the DB would be the easiest way and then we can build plugin from there, if you add it then each update the code would not be broken
November 19, 2018 at 12:51 pm #5092alexgKeymasterThanks.
Writing the transaction to the DB would involve a new table, for the reasons discussed above. The
wp_wallets_txs
table is for user transactions.If you are planning to create a plugin to handle and report stake rewards, it is best if you create your own table or structure to store this info.
You can use the existing actions to intercept incoming TXIDs, or use your own mechanism altogether. In any case, this feature is out of scope of this plugin.
with regards
November 19, 2018 at 6:32 pm #5093AnonymousInactivewhat file(s) do we need to look in to make these changes?
add a new DB is not a issue, it is understanding where in your code to find where to intercept these txids
thanks i hop you understand what we mean
November 20, 2018 at 11:11 am #5095alexgKeymasterYes, I understand.
The question actually is not which files to modify:
You should never modify code in a plugin or theme. Whatever changes you do get overwritten on each update. Instead, use the hooks (actions and filters) provided. In this case, simply start a new plugin file, then hook into the
wallets_transaction
action.This will let you intercept all transactions that are discovered by the plugin. This way you can handle them any way you like, without having to communicate with the wallet directly. So, to intercept incoming transaction IDs for coin XYZ you’d do something like:
function handle_transactions( $txid ) { error_log( $txid ); // handle the txid any way you like // you would typically request the transaction data here from a wallet or block explorer // then, maybe store the data to the db, or send an email using wp_mail() } add_action( 'wallets_notify_wallet_XYZ', 'handle_transactions' );
Hope this helps.
with regards
-
AuthorPosts
- You must be logged in to reply to this topic.