Community Articles

Find and share helpful community-sourced technical articles.
Labels (1)
avatar
Master Guru

Working with Infura.io

Calling REST APIs is very easy with Apache NiFi, let's use this to ingest a lot of data about Ethereum blockchains and transactions. We can also ingest and examine network status data.

Infura provides secure, reliable, scalable access to Ethereum and IPFS.

Check out the current status: https://infura.io/status

Apache NiFi Flows to Read From the Ethereum Blockchain via Infura REST APIs

78602-infuraflow3.png

78603-infuraflow2.png

78604-infuraflow1.png

78604-infuraflow1.png

78628-infuraflow5.png

78629-infuraflow4.png

An Example REST Call

78630-infuratickerethbtcfull.png

We rename the file to make it unique and it note that it is from ethbtcfull API call.

Example Data (JSON)

{"base": "ETH", "quote": "BTC", "tickers": [{"bid": 0.0750827, "ask": 0.07530999, "volume": 5159.53235584, "timestamp": 1528924408, "exchange": "bitstamp"}, {"bid": 0.07519, "ask": 0.0752, "volume": 1938.0570499, "timestamp": 1528924408, "exchange": "gemini"}, {"bid": 0.07515, "ask": 0.07516, "volume": 10310.62442822, "timestamp": 1528924408, "exchange": "gdax"}, {"bid": 0.075208, "ask": 0.075226, "volume": 45253.638, "timestamp": 1528924409, "exchange": "hitbtc"}, {"bid": 0.075156, "ask": 0.07517, "volume": 25932.60119467, "timestamp": 1528924409, "exchange": "bitfinex"}, {"bid": 0.07503287, "ask": 0.0751326, "volume": 6713.29011055, "timestamp": 1528924409, "exchange": "exmo"}, {"bid": 0.075141, "ask": 0.075191, "volume": 136176.55, "timestamp": 1528924409, "exchange": "binance"}, {"bid": 0.073687, "ask": 0.07566, "volume": 99.58262408, "timestamp": 1528924409, "exchange": "quoine"}, {"bid": 0.074975, "ask": 0.075251, "volume": 698.857662, "timestamp": 1528924409, "exchange": "cex"}, {"bid": 0.07494, "ask": 0.07517503, "volume": 12079.03438486, "timestamp": 1528924409, "exchange": "livecoin"}, {"bid": 0.07421999, "ask": 0.07574378, "volume": 106.69757, "timestamp": 1528924410, "exchange": "btc_markets"}]}

78631-ethbtcfull.png

78632-infuraethbtc.png

Calling INFURA REST APIs

Note: For most use cases you do not need an API Key. Make sure you keep it under their limits and follow all of their terms of service.

78633-infurasymbols2.png

78634-infuraethereumbtcticket.png

78635-infurablacklist.png

78636-infurablocknumberapi.png


API Calls

https://api.infura.io/v2/blacklist

https://api.infura.io/v1/ticker/ethbtc/full

https://api.infura.io/v1/ticker/ethbtc

https://api.infura.io/v1/ticker/symbols

Format The Files Example Expression Language

${filename:append('infurasymbols.'):append(${now():format('yyyymmddHHMMSS'):append(${md5}):append('.json')})}


References:

2,292 Views