HZ assets - how to pay dividendsI am sharing my learning, with trying out the new
dividendPayment function.
Now, with the new HZ 5.4, we can finally send ("type": 2, "subtype": 6) = dividends transactions.
I am using
http://localhost:7776/test?requestTag=AE --> dividendPayment
These fields must be filled in - otherwise it won't get accepted:
* asset:
* height:
* amountNQTPerQNT:
* secretPhrase:
* feeNQT:
* deadline:
( for the meaning of those, read the
NXT wiki API chapter 'Dividend_Payment' )
I have chosen to also fill in these fields:
* message:
* messageIsText:
* messageIsPrunable:
When submitting, this message appeared:
nxt.NxtException$NotValidException: Invalid dividend payment sender or amount
I suppose the only sender that is allowed to send dividends - is the issuer herself?
I had tried to send from a different account. Good to know.
So ... from here on using the issuer's secretPhrase ...
For the fun of it, I've tried to send more than I had on that account, and I got this message:
"Double spending or insufficient balance"
Then finally, the real payment, the form looks like this

Note the
amountNQTPerQNT = 20000.
That is my decision how much dividends I'd like to share. NQT and QNT are the smallest possible amounts of HZ, and the asset.
The maths goes like this:
As this is an asset with ("decimals": 4), so
1.0000 asset = 10000 QNT
and always
1.00000000 HZ = 100000000 NQT
the decision
20000 NQT per 1 QNT
means that per 1.0000 asset the shareholder will get
20000 NQT * 10000 QNTper1Asset 100000000 NQTperHZ = 2.00000000 HZ
so
2 HZ per 1 asset

... I know ...

I suggest you make a spreadsheet for yourself, to grasp that fully.
And for the future, it is probably the easiest to only issue assets with ("decimals": 0)

(If you are unsure, first making a test payment of amountNQTPerQNT=1 might be a good idea too).
Anyways, now I got this result:
{
"signatureHash": "f24c3f25f630e49156e262470e5ff4efb77875bab2a58235a4a1337c59542ddb",
"transactionJSON": {
"senderPublicKey": "2f57ed957453207b926c8466944856d9e32f89142f327d9e25fb9dbf9788f512",
"signature": "a17646e2513cc4660b17c6033d57d61a41983d636890f156d72590645bda5101ecc7d9f1a2b958cda5271f9dd240ea1b7dc0f9ef419bd911f74cf7a153826531",
"feeNQT": "400000000",
"type": 2,
"fullHash": "03dd878056de5181499ce33431183c50901b87c7548d0dc421472d6cf475345f",
"version": 1,
"phased": false,
"ecBlockId": "3918513165099572430",
"signatureHash": "f24c3f25f630e49156e262470e5ff4efb77875bab2a58235a4a1337c59542ddb",
"attachment": {
"version.Message": 1,
"version.DividendPayment": 1,
"amountNQTPerQNT": "20000",
"messageIsText": true,
"asset": "5903523947573024709",
"message": "testing dividendPayment",
"height": 580366
},
"senderRS": "NHZ-VJ23-6K9N-33Z2-4DHQV",
"subtype": 6,
"amountNQT": "0",
"sender": "3303930342834814977",
"ecBlockHeight": 580364,
"deadline": 60,
"transaction": "9318473567111208195",
"timestamp": 60655008,
"height": 2147483647
},
"unsignedTransactionBytes": "---LONG HEX STRING---",
"broadcasted": true,
"requestProcessingTime": 38,
"transactionBytes": ""---LONG HEX STRING---",
"fullHash": "03dd878056de5181499ce33431183c50901b87c7548d0dc421472d6cf475345f",
"transaction": "9318473567111208195"
}
which is the
transaction 9318473567111208195.
As I had extracted the balances of all accounts
before the dividends payment,
and
after ... I can show you the effects in this final picture:

As all 3 shareholders together are holding (green columns)
28.8609 assets (= 288609 QNT), with our above calculation we would expect that
2 HZ * 28.8609 = 57.7218 HZ are paid out (difference of the red columns before/after)
- and that is really the case (see orange column); plus
4 HZ chosen manually for the fees.
After the payment, the issuer account's balance is
61.7218 HZ lower.
And now, comparing the quantityQNT and the amountNQT that was paid,
we are getting the purple colum ... and there is the
20000 again.
I think I've understood it. Explaining it to others ... is a good way to go.
And you? :-)Feel free to link to this "
How to pay dividends" from your website the OP#1.
Published under my
giveback license v05 = free, but please give, if you like this.
EDIT:
retweet - thx.