I think the title is clear enough Yesterday I tried withdrawreward
RPC which is used to withdraw mining reward from the node. It takes both privatekey
and paymentaddress
as parameters. When I saw this, I thought that I could forward the reward to another account than the node account. So, I set the private key of the node account as privatekey
and a different account’s address as paymentaddress
. I tried twice. In both cases, the reward went to the node account. So, in the existence of privatekey
, why does RPC requires paymentaddress
which already can be generated from privatekey
?
withdrawreward RPC either works incorrectly or has redundant information?
I would let the dev now. But what is the exact withdrawreward RPC you used?
This one:
{"jsonrpc": "1.0", "method": "withdrawreward",
"params": [privateKey, 0, 0, 0,
{
"PaymentAddress": paymentAddress,
"TokenID": "00...000004",
"Version": 1
}
],
"id": 1}
Hi @abduraman,
It’s not redundant. If you notice, there is no fee for the withdrawreward
transactions. Therefore, in this case, the PaymentAddress
field is not necessary, so we do not use it at present.
However, while implementing this RPC, we plan to charge fees for all of the transactions (and it will happen when we upgrade to privacy v2). It is unsure that the node account has enough PRV to pay the fee, so to avoid inconveniences, we add this field to support withdrawing Reward
from any account in the same shard. Remember, although you send withdrawreward
transactions from another address, the Reward
still being sent to the node account.
I have an error: -1003: receivers param is invalid. Invalid parameters
.
[
"<private key>",
0,
0,
0,
{
"PaymentAddress": "<incognito address>",
"TokenID": "0000000000000000000000000000000000000000000000000000000000000004",
"Version": 1
}
]
Can you help me figure out what I did wrong?
No idea. It seems correct.
hey @J053,
i’m checking this, alternately you can you incognito-cli to withdraw reward
incognito-cli -c 1 --net mainnet withdrawreward -p <privatekey>
Your command says: Incorrect Usage. flag provided but not defined: -c
.
I tried using this one, after uploading the OTA key and seeing that balance returned the correct balance:
incognito-cli withdrawreward --net mainnet --privateKey <privatekey>
but it throws an error:
init txver2 error: txHash changes after unmarshalling: 8b71e7f274c63dc5a9a3ff1247592ca2ed51d9cebb485f2bb730953ec708385b, bd1eecd93801d5b30ba9b43ea8c1228f9367f8ce93bf26cfbeb573596a1de16c
The checkrewards
command says I have rewards there.
Edit
I found this topic, and now it worked. I was using the precompiled file available in the releases page.
@J053, you should check out incognito-cli development branch and build from source code
go build -o incognito-cli
option -c 1
will cache your balance/utxo and save to local storage (instead of fullnode memory)
Here is the update for RPC withdraw reward:
{
"jsonrpc":"1.0",
"method":"withdrawreward",
"params":[
"112t8rnXJgKz6wxuvo6s8aFHFN16j9fvh7y3ZLdrQpN1zRZcubmekm7WHc8KjQS3EWeGBCq8L7qQTuVm3QtnEX66WFHP5e7v6UcGGSXXXXXX",
{},
-1,
1,
{
"PaymentAddress": "12sgoxP86kj69KXebevH8Xv7mEprFDLgC6q6yRr57EA2KhQ4LrJELGd6eaxJA8AfxHn2MhDWE236ykqWSB4pRxsnZng3ncLCe21fNxC5fdi17NkxExV42LZE6TdZrKm8robRmKWmdwvk8Nv9VDS2",
"TokenID": "0000000000000000000000000000000000000000000000000000000000000004",
"Version": 1,
"TxVersion": 2
}
],
"id":1
}
I got an error: -1: -4001: -1003: Wrong input transaction Sum of inputs less than outputs: sumInputValue=0 sumOutputValue=0 fee=3.
You (the account of which you entered the private key) should have some PRV to cover the withdrawal fee. The message probably says this. After Privacy v2, the withdrawals are not free anymore.