Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store amounts as strings #716

Closed
4miners opened this issue Aug 11, 2017 · 3 comments
Closed

Store amounts as strings #716

4miners opened this issue Aug 11, 2017 · 3 comments

Comments

@4miners
Copy link
Contributor

4miners commented Aug 11, 2017

All LSK values like balances, fees, amounts in transactions, etc. should be stored as strings in JS and never casted/converted to numbers - in entire application. Calculations should be done via BigNumber, database layer is not affected (we use BIGINT there).

@vitaly-t
Copy link
Contributor

This needs to be updated with the list of cases where such conversion happens, or else the scope of work/problem is unclear.

@ManuGowda
Copy link
Contributor

ManuGowda commented Jun 29, 2018

Reference of all the colum names associated with money in database:
Column | Type | Modifiers

blocks:
 totalAmount          | bigint                | not null
 totalFee             | bigint                | not null
 reward               | bigint                | not null
blocks_list:
 b_totalAmount          | bigint                |
 b_totalFee             | bigint                |
 b_reward               | bigint                |
full_blocks_list:
b_totalAmount          | bigint                 |
 b_totalFee             | bigint                 |
 b_reward               | bigint                 |
 t_amount               | bigint                 |
 t_fee                  | bigint                 |
mem_accounts:
 balance           | bigint                | default 0
 u_balance         | bigint                | default 0
 fees              | bigint                | default 0
 rewards           | bigint                | default 0
mem_round:
 amount   | bigint                |
rounds_rewards:
 fees      | bigint  | not null
 reward    | bigint  | not null
trs:
 amount             | bigint                | not null
 fee                | bigint                | not null
trs_list:
 t_amount             | bigint                |
 t_fee                | bigint                |

@diego-G
Copy link

diego-G commented Jun 29, 2018

FYI @ManuGowda , here it is the database model as a html page. I hang it up in the wall behind my desk since ages.
https://drive.google.com/open?id=1P7Z4oTBI2VJCzY4kDnAiB4C98QISt4Y-

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants