PIP: PIP-23 Title: JSON RPC PASCURRENCY format Type: Backend, Documentation Impact: API | Mobile Author: Benjamin Ansbach <[email protected]> Comments-URI: Status: Draft Created: 2018-07-19
It is proposed to change the JSON RPC API so that all delivered and received currency values follow a common standard.
Handling large numbers and especially floating point numbers is a common task in the cryptocurrency world. To make the communication through an interface to the currencies functionalities more consistent and less error prone, it is advised to make sure that:
In the JSON RPC API of PascalCoin we have a mixup of 2 different formats: Prices are formated as PASC with 4 decimals. But the information about the price of an account that is for sale is delivered as an integer in the smallest available denomination.
This inconsistency as well as the possible problems that come along with the current way of formatting PascalCoin currency values are motivation enough to change the implementation.
Each currency value will be returned in molinas (smallest denominator) and as a string. The following Objects and JSON RPC parameters need to be adjusted.
Account Object
balancepriceBlock Object
rewardfeeOperation Object
amountfeebalancesenders.*.amountreceivers.*.amountchangers.*.account_pricechangers.*.fee
MultiOperation Object
amountfeesenders.*.amountreceivers.*.amountRawOperations Object
amountfee
resultparams.amountparams.feeparams.feeparams.feeparams.priceparams.feeparams.amountparams.feeparams.feeparams.senders.*.amountparams.receivers.*.amountresult.amountresult.feeThe documentation of the PASCURRENCY value in the JSON RPC specification will be changed to:
Pascal Coin currency is a string representing the PascalCoin value in the smallest available denomination (1/10000th) which is called Molina.
We need to specify the lesser known denomination Molina somewhere on the homepage. This will be discussed.
We never know what kind of client works with the JSON-RPC API and how he handles floating point numbers or so called "Big Numbers". This change will make sure that no client will ever face a problem with currencies.
This change is not backwards compatible and will require a new major version.
{
"fee": "1",
"amount": "2147483648"
}