A simple and naive project which let me know the current exchange rate in time.
A server script runs on a linux machine (typically a raspberry pi), fetching bitcoin exchange rate periodically and storing in a csv file. A client script runs on any device supporting TCP socket, access the server and get the latest exchange rate. If the server owns a public network IP, the client could access the server from anywhere on earth.
Server parses the json string of market data from localbitcoins.com (which is very long!) and picks out the most interested content (the most attractive price), so that the client device with even less than 20KB RAM could fetch and display the price. I implemented the client device with ESP8266 and an OLED display, without an external MCU.
An AES-ECB encryption is implemented just for fun. Server and client share an AES-128 key.
- client establish the TCP connection
- client send a 16-byte random string encrypted by the pre-shared key
- server decrypts the random string
- server generates the response string
- server encrypts the response string and send the cipher text to client
- client decrypts the response and display it
- server close the TCP connection