Commit Graph

296 Commits

Author SHA1 Message Date
sairajzero
b229b6b3d5 Arranging files
Moved all public/ to docs/ so that github pages can be hosted on docs/ alone

- Moved floGlobals.js, lib.js, floCrypto.js, floBlockchainAPI.js, tokenAPI.js, KBucket.js to docs/scripts/
- Renamed api.js to exchangeAPI.js and moved to docs/scripts/
- Moved index.html to docs/
- Moved css components to docs/css
- Updated all imports for the above changes.
- User pages (index.html) uses floCrypto.js and floBlockchainAPI.js in docs/script dir instead of fetching from cdn
2022-03-16 01:06:59 +05:30
sairajzero
1823a46a98 Transfer transactions now support one-to-many
- receiver parameter now requires an object in the format
{floID1: amount1, floID2: amount2 ...}
- Transaction hash (id) for both trade and transfer transactions are now generated using SHA of JSON-string object
- Updated schema for one-to-many TransferTransactions
2022-03-16 00:33:22 +05:30
sairajzero
f59c6b3f2a Removing need for user registration
- Users can directly login or request without the need for user registration.
- Users can sign the requests either directly with own privateKey or by using a proxy
- Request's timestamp will be checked for Sign expiry.
- Request's sign will be checked for duplication.
- Cash table update will try to insert if record is not there
- Request Log table will also store a boolean value for sign by proxy or not
- Updated the SQL schema for the above changes.
2022-03-15 04:06:43 +05:30
sairajzero
3296b16710 Get transaction details
- Transaction details can be fetched using the following API
/get-transaction?txid=<txid>
- Get rates now accepts parameter 'asset' (optional) to return rate of particular asset.
/get-rates?asset=<asset>
/get-rates
- Get transactions (trade) API is changed to the following
/list-trades
2022-03-12 03:31:01 +05:30
sairajzero
0520791696 Adding transfer token feature
Transfer tokens
- Added transferToken: Users can directly transfer tokens (including FLO) to other registered users.
- Updated schema changes for the above requirement.
- Trade transactions and transfer transactions will generate a txid (using SHA256).

Other changes
- changed all signing type to lowercase
2022-03-12 02:25:31 +05:30
Sai Raj
136ba68b42
Merge pull request #6 from ranchimall/main
UI
2022-03-09 20:46:07 +05:30
Sai Raj
9ae1ea2602
Merge pull request #4 from sairajzero/main
Update floBlockchainAPI.js
2022-03-09 20:45:42 +05:30
sairajzero
e2d8abe347 Update floBlockchainAPI.js 2022-03-08 02:30:21 +05:30
Sai Raj
1097daba9b
Merge branch 'sairajzero:main' into main 2022-02-24 17:59:57 +05:30
sairajzero
f9f89d91d3 BugFix: consumeAsset - not working when using entire coin 2022-02-24 17:59:09 +05:30
sairaj mote
e864018553 UX fix 2022-02-19 18:32:02 +05:30
sairaj mote
9939beb555 UI fixes 2022-02-19 16:36:59 +05:30
sairajzero
2e209372a3 Renaming user-pages
home.html => index.html
fn.js => api.js
2022-02-19 00:36:24 +05:30
sairajzero
04ccf3d762 requests http:// to https:// 2022-02-19 00:32:14 +05:30
sairajzero
456c85c805 Bug fix 2022-02-18 23:09:41 +05:30
sairajzero
6aa5d13cc3 websocket ws:// to wss:// 2022-02-18 23:03:48 +05:30
sairajzero
4434ad6b3e Support for SQL version 5.7 2022-02-18 22:23:17 +05:30
sairajzero
53b47057ff Minor fixes
- Sell requirement checks for respective asset for minimum buy
- Minimum buy is set to 0 (for exchange startup)
- Fixed: buy/sell orders sorted incorrectly by time_placed (should be FCFS. ie, ASC)
2022-02-18 20:11:34 +05:30
sairajzero
af7d4c625d Adding official adminID: FMxYC7gYZhouzqtHZukGnPiQ8nvG4CMzXM 2022-02-18 19:24:58 +05:30
sairajzero
4416ab5ad3 Adding Blockchain refresh interval
- Added blockchain refresh interval
- Updating some constants
- Disabled various console.debug
2022-02-18 19:24:09 +05:30
sairajzero
1fcd62f2e5 Slave: wait before sync on master-change
When Update master event occurs, master needs time to sync its missing data, so slaves should sync only after BACKUP_INTERVAL
2022-02-18 00:11:55 +05:30
sairajzero
15d36eb088 All Constants moved to _constants.js 2022-02-17 23:52:31 +05:30
sairajzero
a2dcfb27ce Bug fixes
- Fixed: Buy/sell order placement not working in UI
- Fixed: Buy order placement not checking the cash balance properly
- Fixed: Re-sync not working properly
  . (Master) Typo in SQL syntax
  . (Master) Incorrect index of data sent by master
  . (Slave) Invalid request send when requesting re-sync
- Removed counts for add, delete packets and total-add (As resync uses diff count)
2022-02-17 22:53:03 +05:30
sairajzero
12e90abe8b Re-sync Improvements
When table data needs resync (ie, when checksum fails), Instead of requesting the entire data, following procedure is done
- row-group (based on id column) hashes is requested from master
- hashes are checked on the DB
- request chunks that have failed hash check
2022-02-17 04:43:05 +05:30
sairajzero
d30603134f Sink threshold fix 2022-02-16 14:07:12 +05:30
sairajzero
2a125eb4d2 Verify backup data integrity
- Backup data integrity is verified using Checksum for each table
- If checksum mismatch is found (for a table) after a backup sync, the table data is cleared and re-synced
- Moved backup sync module to backup/sync.js
- Fixed: checkForRatedSellers not using correct asset when checking for rated sellers
- Others: priceHistory is converted toFixed(3) before storing in DB. (As large/non-terminating decimals cause ambiguity btw nodes during checksum)
2022-02-16 01:55:31 +05:30
sairajzero
0ff3f2a7fb Update Sink key transfer
- Same sink is used across nodes (sink is generated only when exchange starts for the 1st time)
- Shares as encrypted before sending to nodes (also store encrypted share in DB)
- Load share/key from DB (if available) when node starts
- share-threshold is calculated based on number of alive nodes
- Fixed: Shamirs algo fails when threshold is less than 2 (used round-about)
- Fixed: Minor bugs
2022-02-12 05:41:01 +05:30
sairajzero
cab65161ba Bug fix And UI for asset/token selection
- Fixed bugs in deposit and withdrawal
- Added UI select option for token selection on deposit and withdrawal
- Added UI style to buy/sell asset selection
2022-02-08 20:44:55 +05:30
sairajzero
a06c5b4c7b Backup Sync improvements
- Removed: Immutable table-type (Previously immutable tables are now considered as mutable tables in backup feature)
- Backup sync-data from master are temporally cached and then processed after receiving all sync-data
- Backup sync-data from cache are now processed in ordered manner (to prevent foreign key constrain error, repeated data, re-adding a deleted data)
- Updated SQL Schema
2022-02-08 06:26:03 +05:30
Sai Raj
3fb401a226
Merge pull request #5 from ranchimall/main
Readme
2022-02-07 03:43:20 +05:30
Sai Raj
8a967eb9fa
Merge branch 'sairajzero:main' into main 2022-02-07 03:35:51 +05:30
sairajzero
ab3df761b0 Bug fixes
- Fixed: SQL schema asset foreign key incorrectly referenced
- Fixed: initial rate of asset not loading correctly from DB
- Fixed: get-rate API returning [object Object] instead of rates
- Fixed: Bug where transaction-loop happens with 0 quantity
- Improved: spendAsset to use assets NULL/Non-NULL base correctly
- Fixed: minor typos, syntax errors and SQL query errors

User-pages:
- Added: UI fields for assets in Buy/Sell orders
- Updated: UI display of correct asset in listing orders and transactions
- Updated: localStorage keys are prefixed 'exchange-'
- Fixed: Rates and Balance amount not displayed correctly

Others:
- Added: temporary code for tracing output lines in set_globals.js (commented out by default)
2022-02-07 03:12:20 +05:30
sairajzero
048ab0667b Multi asset: initial price and other improvements
- Read blockchain for asset's initial price
- Transfer all tokens to new sink on master transfer

Other Improvements:
- Slave: close existing backup sync when master WS closes
- Updated SQL schema, updated SQL syntax as required
2022-02-05 20:23:36 +05:30
sairajzero
df69ee0f7b Multi-asset: User API 2022-02-04 02:54:05 +05:30
sairajzero
92caef2c37 Multi-asset: coupling process 2022-02-04 02:28:02 +05:30
sairajzero
dbad25044a Multi-asset price.js 2022-02-03 05:46:26 +05:30
sairajzero
67c31d79a9 Multiple asset support
2 types of property:
1. Cash - main/central currency used for trading
2. Asset - (FLO/tokens) Can be brought or sold in the exchange market .

- Allow multiple tokens to act as asset in addition to FLO.
- Changes required for the above in deposits, withdraws, placing orders
- some code optimization in market.js
- Updated SQL schema
2022-02-02 04:17:47 +05:30
sairajzero
512dc3bcbc Automatically reload user page upon incorrect server
- Upon receiving responseError INCORRECT_SERVER_ERROR, reload the client page.
(Triggered mainly when master is changed).
- Fixed some minor syntax bugs
2022-01-26 21:46:19 +05:30
Sai Raj
9fa8c683bc
Merge branch 'sairajzero:main' into main 2022-01-26 16:09:11 +05:30
sairajzero
827bdcd793 Use sinkID for deposits
- Send Sink ID to users on get-account request
- In user page, store sink ID and use it for deposit FLO/Rupee
2022-01-26 16:08:30 +05:30
Sai Raj
c4a5455b41
Update README.md 2022-01-26 02:31:23 +05:30
Sai Raj
d7283fb13b
Merge branch 'sairajzero:main' into main 2022-01-26 02:23:25 +05:30
sairajzero
cdc55dbdc9 Update truncateAll.sql 2022-01-26 02:22:33 +05:30
sairajzero
bf302c3ebc bug fix: backup/sync
- Fixed minor bugs in backup/sync process
- Fixed: Master doesn't sync when it comes back online
- Decreased backup interval time to 1 min.
2022-01-26 02:20:34 +05:30
sairajzero
2c35c545e8 Bug fixes (client side)
Fixed Client page bugs:
- Fixed minor bugs in client side pages
- client page to use floGlobals.js
- moved KBucket.js to public (as its need by client page too).
Fixed Server Bugs:
- Added Access-Control-Allow-Origin to response headers
- Fixed: trustedIDs not loaded
- Fixed minor bugs (syntax errors)
2022-01-25 01:28:22 +05:30
sairajzero
8c1aad3d28 Bug fixes
- Added lastTx table to SQL schema
- setup file 'reset-password' now accepts any private key (node keys)
- Fixed minor SQL syntax
2022-01-23 04:51:15 +05:30
sairajzero
11b99c3e76 Process for exception cases
Case: No other node active when self node is init
- Start the exchange system.
Case: When node becomes master when prev node goes down
- Add self share to collectShare
- collect shares from other node to re-construct sink private key
- Fixed some minor bugs
2022-01-23 04:49:15 +05:30
sairajzero
52a1b3077d multi-node support
- Run multiple nodes in the same directory with diff config files
- pass the env variable 'I' (optional) to run a diff node instance with config file config<I>.json (also uses keys<I>.json)
- Updated setup files
- Fixed bugs in SQL schema
2022-01-23 03:24:27 +05:30
Sai Raj
e1830c3130
Merge branch 'sairajzero:main' into main 2022-01-20 05:39:41 +05:30
sairajzero
7dbe78c1cc User-end update
- updated custom session for distributed system
- Fetch node list and url from blockchain
2022-01-20 05:38:55 +05:30