New Feature: A Dividend API

In order to do the REVS snapshot, I decided to just implement a dividends API for iguana. There are now 2 new API calls “snapshot” and “dividends”. “snapshot” is passed in the symbol of the coin and the height for the snapshot, the height must be a multiple of bundle size and the utxoaddrs.<height> file must already exist in the DB/<symbol> folder. It will if you have been maintaining a coin in RT mode. The snapshot API just returns a complete set of { “address”, <amount> } in an array

The dividends API uses internally the snapshot API. it also specifies symbol and height, but there is also a “vals” object, which specifies how to process the snapshot array:

  • “exclude”:[] is an array of addresses to exclude from the dividends processing
  • “dust”:<float> is the smallest amount of dividend that will be sent,it is not the address balance, but rather the calculated dividend amount. Set “dust”:0 to send dividends for any non-zero value.
  • “dividend”:<float> is the total amount that is allocated across all the non-excluded addresses. Using this value and the total of address balances of non-excluded addresses allows a ratio to be calculated. This ratio is applied to the address balances to calculate the dividend amount for each address. If it is less than or equal to the dust amount, it wont be sent. If “dividend” is 0, then it means to use a 1:1 ratio
  • “prefix” and “suffix” are arbitrary strings that are used to construct the action line: <prefix> <address> <amount> <suffix>. prefix/suffix is just the simplest way I came up with to do the REVS snapshot, I can see a need for a more flexible template for the action line, but I prefer to do such things on an as needed basis.
  • “system”:1 will invoke the action line in a system call

Putting it all together:
curl –url “” –data “{\”agent\”:\”iguana\”,\”method\”:\”dividends\”,\”height\”:1486000,\”symbol\”:\”BTCD\”,\”vals\”:{\”exclude\”:[\”RXL3YXG2ceaB6C5hfJcN4fvmLH2C34knhA\”],\”dust\”:0,\”dividend\”:0,\”system\”:0,\”prefix\”:\”fiat/revs sendtoaddress\”,\”suffix\”:\”\”}}”

The above displays the sendtoaddress lines that would be invoked for the REVS snapshot.

What does this mean?
It means that iguana can now issue dividends in any currency (literally) that can run on your system and base the allocation on any iguana supported coin. With clever use of the prefix/suffix commands, maybe even non-dividend actions can be done based on stake of any iguana supported coin

Bitcointalk Topic Entry

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

one × 2 =