/ForgingBlock-tezos-api-example

ForgingBlock - Tezos API Example for a TQ tezos hackathon

Primary LanguageJavaScriptMIT LicenseMIT

ForgingBlock - Tezos API Example

During TQ tezos hackathon our main idea was to implement Tezos support for ForgingBlock Universal API.

And while the main product is proprietary, in this public repository we show example of how exactly we interact with tezos blockchain using conseiljs. So the tezos community could get and idea how easy to use community provided libraries even in such complex project as ForgingBlock Universal API.

Please see the Press Release from ForgingBlock: FORGINGBLOCK IS PARTICIPATING IN TEZOS ONLINE HACKATHON 2019

Endpoints

We have just two endpoints in this repository.

First shows example how to validate tezos address, and second shows wallet account balance ether for mainnet or alphanet.

  • POST /validate-xtz-address

Request example:

curl 'http://127.0.0.1:3000/validate-xtz-address' -H 'Content-Type: application/x-www-form-urlencoded' --data 'address=tz1isXamBXpTUgbByQ6gXgZQg4GWNW7r6rKE'

Response examples:

{"success":"Correct xtz address provided"}
{"error":"Please provide correct xtz address"}
{"error":"Please provide xtz address"}
  • POST /check-balance

Request examples:

curl 'http://127.0.0.1:3000/check-balance' -H 'Content-Type: application/x-www-form-urlencoded' --data 'address=tz1TaLYBeGZD3yKVHQGBM857CcNnFFNceLYh'
curl 'http://127.0.0.1:3000/check-balance' -H 'Content-Type: application/x-www-form-urlencoded' --data 'address=tz1TaLYBeGZD3yKVHQGBM857CcNnFFNceLYh&network=alphanet'

Response examples:

{"balance":"271971.864666"}
{"error":"Please provide valid xtz address"}

Running

Just clone, npm install and node .

Overall:

git clone https://github.com/forgingblock/tezos-api-example
cd tezos-api-example
npm install
node .