-
Powered By Liberty Block, the Byzantine API gateway enables EOS on-chain integration of DEX's, Centralized Exchanges, Wallets and DAPPs, in a secure, scalable and reliable manner, without the need to run mainnet for EOS chain locally
-
Provides a simplified abstraction from individual token contract integrations and transfers while preventing replay attacks, validation of tokens with their respective contract hashes and ensures the transaction is secure and used the least latency route to chain
-
The API gateway runs its own mainnet and also load balances across 21 block producers when the local mainnet blocks are delayed by >100ms
-
For high throughput, the gateway also provides an optional request/response compression using Zstandard
-
Provides access to eos-rpc api, history-api as well as custom api collection to simplify interacting with complex actions such as namebids,rambuys,getAllTokenBalances etc.
-
Provides NPI action, data traceability to transactions made through the API gateway
-
Provides ELK style Kibana Analytics Dashboard for monitoring your transactions, throughput etc
-
Security is enabled through a combination of nonce, a private salt and the api-security-key. Using the latter 2 arguments, the client creates a 256-bit cipher which is used for signature. This prevents both replay attacks as well as a secure exchange of keys for signature
-
Provides an easy abstraction for:
-
- Get Airdrop/Airgrab Tokens with verifiable hashcodes, precision, contracts
-
- Create Account, (Un)Delegate, Vote, RAM price, Buy/Sell RAM, Refunds, Account history
-
- Transfer across any token with/without scatter
-
- A DEX market aggregation data across EOS/Derivative assets
-
- Reduces the complexity of rampup on EOS chain and prevents issues like the following:
The high-level design shown below provides an unified interface for all on-chain EOS operations.
- The key components are the API itself, which encapsulates the EOS-chain rpc/api/table methods and encapsulates the nuances by using eosjs and ecc.
- It uses cryptographic nonce to secure customers from replay attack.
- The design necessitates customers to aquire an API-KEY/SALT which is a one time excercise. The api-key is then used to fetch nonce for signing write-transactions and transmit the "sig" attribute as shown in curl examples.
- Byzantine API Gateway
git clone https://github.com/Byzantine-Works/EOS-API-Gateway.git
npm install
//install elasticsearch
brew install elasticsearch
brew services start elasticsearch
curl http://local.byzanti.ne:9200
//install kibana (needed for design time es crud operations)
brew install kibana
brew services start kibana
localhost:5601
use the 'dev tools' icon to use the query editor and execute estemplates/keys_template.txt
//setup loopback interface
vi ~/etc/hosts (add loopback interface: 127.0.0.1 local.byzanti.ne)
npm start OR nodemon
//test if the api is running
curl http://local.byzanti.ne/8901/info
//to generate salt+apikey use
node -e 'require("./api/controllers/apiKey").keygen()'
- Replace
api
withlocal
andport
with8901
for local dev validation for the following - swagger-ui: http://api.byzanti.ne/8902/docs
- API-Analytics: https://analytics.byzanti.ne/goto/f5e19f3c02731e08a077492d19fd22ad
- Sonar-Analytics: https://analytics.byzanti.ne/goto/b511dbca961bb20fa27f4337c036ad9c
- API-stats: https://api.byzanti.ne/swagger-stats/ui#sws_summary
- swagger-apidocs: https://api.byzanti.ne/api-docs
- swagger-editor: https://editor.swagger.io/
*** The FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N apikey used to illustrate the methods is for test purpose only. If you require a key for industrial-grade calls/low latency please reach out to us with a few bytes on intended purpose at [email protected]
// Curl Examples for Byzanti.ne API Gateway - EOS Mainnet
// Base API Operations
// create EOS key sets - owner and active keys
curl -X GET --header 'Accept: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getKeyset' | json_pp
//create account
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"creator":"gi3dcnjshege","name":"randomgooppy","owner":"EOS7m36vdT6WbE6JA25z9ePGhyWuqMYSLuCxLicMa1eLZ2YqSQqfh","active":"EOS59eusHMqbvJsPsdBKMNbuVHLz8kiif9NW27HQxiuge5iupvZec","sig":"6EF0AEFBFD50850D70366D5B7A6F04346BC81B2BDE0615CED49D803F1C2F042FAA42FF33723ADCC0E73CA4616603D29C4BF544FA515FB4BC1ECD55C9CE6DCF9E"}' https://api.byzanti.ne/createAccount | json_pp
//get info (for testing)
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/info' | json_pp
//get all *legit EOS tokens
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/tokens' | json_pp
//get tokens by account
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/tokensByAccount/gi3dcnjshege' | json_pp
//get tokens by account
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/tokensByAccount/randomgooppy' | json_pp
//get account
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getAccount/gi3dcnjshege' | json_pp
//get account
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getAccount/randomgooppy' | json_pp
//get actions
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getActions?account=gi3dcnjshege' | json_pp
//transfer with pki
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"from":"gi3dcnjshege","to":"randomgooppy","amount":"0.0001 EOS","memo":"random test","sig":"6EF0AEFBFD50850D70366D5B7A6F04346BC81B2BDE0615CED49D803F1C2F042FAA42FF33723ADCC0E73CA4616603D29C4BF544FA515FB4BC1ECD55C9CE6DCF9E"}' https://api.byzanti.ne/transfer | json_pp
//get transaction
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/transaction/5a309398bc60d7f2849080d3b88646a22d8e9f682a5d257f1ac7672d5122688d' | json_pp
//get refunds
curl -X GET --header 'Accept: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getRefunds/gi3dcnjshege' | json_pp
//get name bids
curl -X GET --header 'Accept: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getNameBids/reddy' | json_pp
//Block - Producer operations
//Get EOS producers
curl -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getProducers' | json_pp
//Vote for a producer libertyblock
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"voter":"gi3dcnjshege","producer":"libertyblock","sig":"XFBEk+="}' https://api.byzanti.ne/voteProducer | json_pp
//Vote for a producer eosfishrocks
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"voter":"gi3dcnjshege","producer":"eosfishrocks","sig":"XFBEk+="}' https://api.byzanti.ne/voteProducer | json_pp
/Delegate CPU/BW
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"from":"gi3dcnjshege","receiver":"gi3dcnjshege","net":"0.0001 EOS","cpu":"0.0001 EOS","sig":"6EF0AEFBFD50850D70366D5B7A6F04346BC81B2BDE0615CED49D803F1C2F042FAA42FF33723ADCC0E73CA4616603D29C4BF544FA515FB4BC1ECD55C9CE6DCF9E"}' https://api.byzanti.ne/delegate | json_pp
//Undelegate CPU/BW
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"from":"gi3dcnjshege","receiver":"gi3dcnjshege","net":"0.9188 EOS","cpu":"0.9188 EOS","sig":"XFBEk+="}' https://api.byzanti.ne/undelegate | json_pp
//get bandwidth
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getBandwidth/gi3dcnjshege' | json_pp
//Buy Ram
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"payer":"gi3dcnjshege","receiver":"radomgoopy","quant":"0.0001 EOS","sig":"XFBEk+="}' https://api.byzanti.ne/undelegate | json_pp
//Buy Ram in bytes
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"payer":"gi3dcnjshege","receiver":"gi3dcnjshege","bytes":240,"sig":"XFBEk+="}' https://api.byzanti.ne/buyRamBytes | json_pp
//Sell RAM in bytes
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"account":"gi3dcnjshege","bytes":84,"sig":"XFBEk+="}' https://api.byzanti.ne/sellRamBytes | json_pp
//Get RAM price
curl -X GET --header 'Content-Type: application/json' --header 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' 'https://api.byzanti.ne/getRamPrice' | json_pp
//Scatter based transfer
curl -X POST -H "Content-Type:application/json" -H 'api_key: FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' -d '{"from":"gi3dcnjshege","to":"randomgooppy","amount":"0.0001 EOS","memo":"offline test","sig":"c77ac47879b2a8e622f9f301c98959cce5b97a53e4d42f5038d0d2d7cb78a0c3e3a135728fb5f5969a81f92cb0412727a040b143e12f57b533c7e0cc595ce965a6318cab00710549c3bc8984ec22b1c9c38f2db7e7e4cb6ba3bb48a3211db082c5315913977262004a4b8e0c052a8ee2","transactionHeaders":{"expiration": "2018-09-19T00:20:40", "ref_block_num": 19055, "ref_block_prefix": 4239914415}}' https://api.byzanti.ne/transferWithScatter | json_pp
// DEX Functions
//get active trading symbols
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/symbols?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get ticker (market data + all tokens)
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/ticker?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get ticker (market data for specific token)
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/ticker?symbol=IQ&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get BUY side orders for IQ
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/orders?symbol=IQ&side=BUY&size=10&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get SELL side orders for IQ
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/orders?symbol=IQ&side=SELL&size=10&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get complete order book for IQ with depth =n
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/orderbook?symbol=IQ&size=10&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' |json_pp
//get complete order book for IQ with depth =n and ticksize=0.0000010
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/orderbooktick?symbol=IQ&ticksize=0.0000010&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' |json_pp
//POST create an order [BUY/SELL side ++ MARKET/LIMIT]
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"side": "SELL",
"assetBuy": "EOS",
"assetSell": "IQ",
"amountBuy": 9.056,
"amountSell": 4889.970,
"price": 0.001852,
"expires": "1d",
"type": 2,
"useraccount": "reddy",
"signature": "SIG_K1_REDDdaa26a3f9f7d8d729c562f53b20440e9c0fcdce736cb798c1701fef3a2400b12c32e343e024c0bc3dfcd5c9f44"
}' 'https://api.byzanti.ne/orderMake?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N'
//POST cancel an order
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"orderId": "UELIwWYBkm_1qp0yYnUm",
"orderHash": "somehash"
}' 'https://api.byzanti.ne/orderCancel?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N'
//GET fetch user orders
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/ordersByUser?user=reddy&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//GET orders by orderId
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/orderById?orderId=EPvUwWYBJNEeaSKiZVvG&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' |json_pp
//get trade book for IQ with depth=n
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/tradebook?symbol=IQ&size=10&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get trades by user account
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/tradesByUser?user=taker1&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//deposit into UberDEX exchange contract
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"from":"reddy","amount":"0.0001 EOS","sig":"21E5D718BDF2BC83FEC192116DE6AEBC9B310039D75965076BEA4F1DD0745D7F57794A48D33F4D94F2679F973DC793D63D9E16CE457FDB3F6F2B06836A641480"}' 'https://api.byzanti.ne/exdeposit?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' |json_pp
//get exchange balances for user account
curl -X GET --header 'Accept: application/json' 'http://local.byzanti.ne:8901/exbalance?account=reddy&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get nonce for user account
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/exnonce?account=ideos&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get chain balances for user account
curl -X GET --header 'Accept: application/json' 'https://api.byzanti.ne/balance?account=reddy&api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//get exchanges on LDAR
curl -X GET --header 'Accept: application/json' 'http://local.byzanti.ne:8901/exchanges?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//withdraw from UberDEX exchange contract
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{"from":"reddy","amount":"0.0001 EOS","sig":"4A265092CC236908F99F25247AF94C03F8EB1DB0A05F599235CCC41CB47E6A1220AD91347854AF7417D367771F8E1D93ED4F83075DEBACAB974D4DD01327668B"}' 'https://api.byzanti.ne/exwithdraw?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N'
//withdraw from UberDEX exchange contract with scatter
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"user": "randomgooppy",
"token": "EOS",
"amount": 0.0100,
"nonce": 87,
"headers": {"expiration": "2018-09-26T21:45:47.000","ref_block_num": 21488,"ref_block_prefix": 4283352329},
"signature": "SIG_K1_JyiroHvAkmRPDURQaewCW5FQqpiMazWjtP9yz3XQ5X6FtQtQmDF5NoYoV7xS4kwNQ828JobkMwEMhTxEyyUswp2UJ3h8EF"
}' 'https://api.byzanti.ne/exwithdrawscatter?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N' | json_pp
//trade api for UberDEX exchange contract
curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{
"orderId": "Olp6R2cBKKlqgDKXH7mq",
"assetBuy": "IQ",
"assetSell": "EOS",
"amountBuy": 537.4328,
"amountSell": 0.515,
"price": 0.0009578,
"taker": "reddy",
"takerExchange": "mbaex",
"makerExchange": "mbaex",
"signature": "SIG_K1_REDD8c49760b9a95e05524be36f723e4eba242be073688bf89721158284354599ced1b92c91185decba924b99cb5d0",
"hash": "73688bf89721158284354599ced1b92c91185decba924b99cb5d0"
}' 'https://api.byzanti.ne/orderTake?api_key=FQK0SYR-W4H4NP2-HXZ2PKH-3J8797N'
- Add Synopsis, design aspects esp security, self-service api-key, the inner workings, etc for maintainability & supportability