Bitcoin in Bash

Get Bitcoin Price Using Bybit API in Bash

Edited at 2024-04-06 15:17 UTC. With Bybit API v5 [1] it is possible to get public data (price, volume, last trading records) and also place own orders using API Key. All the next examples do not need API Key, because open public data is used here.

First, install jq for read json data and search in it to get only fields we need.

apt install jq

 

Bitcoin price in Spot trading from Bybit API. Ticker BTCUSDT info

This price is from latest finished orders.

Bitcoin Checksum on Bash

Checksum is often used in Bitcoin when generating public key, address. Checksum is a simple method for error-checking data [1].

In Bitcoin blockchain the checksum is generated by running SHA256 function two times in a row.

Important note: need to use sha256 in binary mode for binary data.

 

Bitcoin checksum on Linux Bash: sha256sum

This is an example used on learnmeabitcoin [1] and this bash analogue gives the same result: