Tag Archives: Cryptocurrencies

Writing

ChatGPT at it’s finest: writing short helpful code

ChatGPT at it’s finest: writing short helpful code without having to do fancy work.

The following is a dialog with ChatGPT. I had this script that I would normally have to hand edit all of the ticker  symbols by adding them to the end of the lines of code. I am sure there is some clever way using sed or awk but, I figured why not get ChatGPT to help.

ChatGPT then was also able to generate the Tags for this post,by feeding the post into a prompt and I used Stable Diffusion to generate the featured image using the blog title as the prompt. Sometimes it is good to use ChatGPT to proofread as well but, this post was short and simple enough not to do that.


User

I want to show you an output, in the left column are the ticker symbols for a number of cryptocurrencies, I want you to remember all of them as they will be used in the next question that I will pose…..

Currency  Price      Available  Hold      Avail in USD  Held in USD
AAVE 98.16          0.0 0.0              0.0
ACH 0.020353          0.0 0.0              0.0
ADA 0.3859          0.0 0.0              0.0
ALGO 0.1341          0.0 0.0              0.0
AMP 0.00248          0.0 0.0              0.0
ANKR 0.0244          0.0 0.0              0.0
ATOM 9.283          0.0 0.0              0.0
AVAX 20.66          0.0 0.0              0.0
AXS 6.8          0.0 0.0              0.0
BAL 3.68          0.0 0.0              0.0
BAND 1.417          0.0 0.0              0.0
BAT 0.21159          0.0 0.0              0.0
BCH 223.72          0.0 0.0              0.0
BNT 0.75          0.0 0.0              0.0
BOND 2.2          0.0 0.0              0.0
BTC 37964.39          0.0 0.0              0.0
CGLD 0.53          0.0 0.0              0.0
COMP 51.17          0.0 0.0              0.0
CRV 0.5658          0.0 0.0              0.0
CVC 0.1102          0.0 0.0              0.0
DAI 0.9999          0.0 0.0              0.0
DOGE 0.08033          0.0 0.0              0.0
DOT 5.263          0.0 0.0              0.0
ETC 18.86          0.0 0.0              0.0
ETH 2054.84          0.0 0.0              0.0
FARM 32.73          0.0 0.0              0.0
FET 0.5347          0.0 0.0              0.0
FIL 4.545          0.0 0.0              0.0
GLM 0.2418          0.0 0.0              0.0
GRT 0.1483          0.0 0.0              0.0
ICP 4.605          0.0 0.0              0.0
KNC 0.7065          0.0 0.0              0.0
LINK 14.588          0.0 0.0              0.0
LOOM 0.0673          0.0 0.0              0.0
LPT 6.33          0.0 0.0              0.0
LRC 0.216          0.0 0.0              0.0
LTC 69.78          0.0 0.0              0.0
MANA 0.4405          0.0 0.0              0.0
MATIC 0.7528          0.0 0.0              0.0
MIR 0.0941          0.0 0.0              0.0
MKR 1483.6          0.0 0.0              0.0
MLN 15.12          0.0 0.0              0.0
NKN 0.1064          0.0 0.0              0.0
NMR 15.68          0.0 0.0              0.0
OGN 0.12922          0.0 0.0              0.0
OMG 1.7217          0.0 0.0              0.0
OXT 0.0724          0.0 0.0              0.0
PLA 0.204          0.0 0.0              0.0
POLY 0.1963          0.0 0.0              0.0
QNT 99.56          0.0 0.0              0.0
REN 0.0823          0.0 0.0              0.0
REQ 0.083          0.0 0.0              0.0
RLC 1.4794          0.0 0.0              0.0
RLY 0.0126          0.0 0.0              0.0
SKL 0.0436          0.0 0.0              0.0
SNX 3.392          0.0 0.0              0.0
SOL 58.2          0.0 0.0              0.0
STORJ 0.7658          0.0 0.0              0.0
UMA 1.953          0.0 0.0              0.0
UNI 6.161          0.0 0.0              0.0
USD              0.01 0.0
USDC              0.0 0.0
XLM 0.118572          0.0 0.0              0.0
XTZ 0.817          0.0 0.0              0.0
YFI 8519.94          0.0 0.0              0.0
ZEC 29.03          0.0 0.0              0.0
ZRX 0.39338          0.0 0.0              0.0

I don’t have the ability to remember information from one interaction to the next, but I can certainly help you analyze or work with the data you’ve provided in this session. If you have a specific question or task related to this cryptocurrency data, feel free to let me know, and I’ll do my best to assist you!

User

Can you print out all of the symbols in the left column?

Certainly! Here are all the ticker symbols from the left column:

objectivec
AAVE, ACH, ADA, ALGO, AMP, ANKR, ATOM, AVAX, AXS, BAL, BAND, BAT, BCH, BNT, BOND, BTC, CGLD, COMP, CRV, CVC, DAI, DOGE, DOT, ETC, ETH, FARM, FET, FIL, GLM, GRT, ICP, KNC, LINK, LOOM, LPT, LRC, LTC, MANA, MATIC, MIR, MKR, MLN, NKN, NMR, OGN, OMG, OXT, PLA, POLY, QNT, REN, REQ, RLC, RLY, SKL, SNX, SOL, STORJ, UMA, UNI, USD, USDC, XLM, XTZ, YFI, ZEC, ZRX

If you have any specific tasks or questions related to these symbols, feel free to let me know!

User

OK, good, you remembered them. Now for the next step. I am going to show an example using btc and I would like you to create a listing with all of the ticker symbols from the left column. Example: $DIR/rsi-fractals-avgs-bbands-txt-summary.py btc

Sure, I understand. If you could provide an example of the desired output or clarify the specific format or information you’re looking for related to each ticker symbol (similar to the example you provided with btc), I’d be happy to assist you further.

User

I am looking for you to create code that has $DIR/rsi-fractals-avgs-bbands-txt-summary.py on every line but with the ticker symbols from the left column appear on that line right after it.

Certainly! It sounds like you want a list of commands where $DIR/rsi-fractals-avgs-bbands-txt-summary.py is followed by each ticker symbol. Here’s an example Python script that generates those commands:

python
# List of ticker symbols ticker_symbols = [     "AAVE", "ACH", "ADA", "ALGO", "AMP", "ANKR", "ATOM", "AVAX", "AXS", "BAL",     "BAND", "BAT", "BCH", "BNT", "BOND", "BTC", "CGLD", "COMP", "CRV", "CVC",     "DAI", "DOGE", "DOT", "ETC", "ETH", "FARM", "FET", "FIL", "GLM", "GRT", "ICP",     "KNC", "LINK", "LOOM", "LPT", "LRC", "LTC", "MANA", "MATIC", "MIR", "MKR",     "MLN", "NKN", "NMR", "OGN", "OMG", "OXT", "PLA", "POLY", "QNT", "REN", "REQ",     "RLC", "RLY", "SKL", "SNX", "SOL", "STORJ", "UMA", "UNI", "USD", "USDC", "XLM",     "XTZ", "YFI", "ZEC", "ZRX" ] # Directory variable DIR = "$DIR" # Generate commands commands = [f"{DIR}/rsi-fractals-avgs-bbands-txt-summary.py {symbol}" for symbol in ticker_symbols] # Print commands for command in commands:     
       print(command)

Replace $DIR with the actual directory you want to use. This script will generate commands for each ticker symbol, following the format you provided. If you have any specific adjustments or requirements, feel free to let me know!


OK how did it turn out?

This is the output, just as I expected and was looking for. Saved me probably about 15 minutes of tedious hand editing…

$DIR/rsi-fractals-avgs-bbands-txt-summary.py AAVE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ACH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ADA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ALGO
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ANKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ATOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AVAX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AXS
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BCH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BOND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CGLD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py COMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CRV
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CVC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DAI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOGE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FARM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FET
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FIL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GRT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ICP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py KNC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LINK
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LOOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LPT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LRC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MANA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MATIC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MIR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MLN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NKN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NMR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OGN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OMG
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OXT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py PLA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py POLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py QNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REQ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SKL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SNX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SOL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py STORJ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UMA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UNI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USDC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XTZ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py YFI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZEC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZRX

What’s it for?

It is screener code that will go into a script that prints out all the cryptos in the list sorted by their position relative to their 20 day moving average. It uses the same logic as used for the Mayer Multiple, except it is on a 20 day MA basis.

X = Current Price / 20DMA

Code

#!/bin/bash 
DIR="/home/erick/python/ta"


rm $DIR/output-rsi-er-price-sma20-multiple.csv

$DIR/rsi-fractals-avgs-bbands-txt-summary.py AAVE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ACH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ADA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ALGO
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ANKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ATOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AVAX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AXS
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BCH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BOND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CGLD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py COMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CRV
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CVC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DAI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOGE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FARM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FET
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FIL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GRT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ICP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py KNC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LINK
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LOOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LPT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LRC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MANA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MATIC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MIR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MLN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NKN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NMR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OGN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OMG
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OXT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py PLA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py POLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py QNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REQ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SKL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SNX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SOL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py STORJ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UMA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UNI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USDC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XTZ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py YFI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZEC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZRX


echo "Cur  ,Und,Targt,RSI, ER,20Ml,Mayer Mult."


# Sort by desending price/sma20 multiples
sort -nk6 -t, -r $DIR/output-rsi-er-price-sma20-multiple.csv

the script runs the rsi-fractals-avg-bbands-txt-summary code on all the tickers listed and saves output to…

output-rsi-er-price-sma20-multiple.csv

then sorts the output by the 20sma multiple column

 

Results

Best relative performers on top, worst on bottom. This idea comes from the book Fortune’s Formula and appears as a technique used by Princeton-Newport. Basically sell the top and buy the bottom ( deep value…maybe), or alternativly short the top and long the bottom. Or in the case of crypto the bottom ones might be just be duds that are always behind the pack, maybe don’t even bother with them.

Cur  ,Und,Targt,RSI, ER,20Ml,Mayer Mult.
UNI  ,USD,False,73,0.06,1.18,1.31
SKL  ,USD,False,63,0.07,1.1 ,1.59
FET  ,USD,False,67,0.14,1.09,1.97
SNX  ,USD,False,63,0.09,1.07,1.43
GRT  ,USD,False,60,0.05,1.07,1.37
AXS  ,USD,False,56,0.0 ,1.07,1.2
AMP  ,USD,False,63,0.05,1.06,1.17
MKR  ,USD,False,60,0.13,1.05,1.34
AVAX ,USD,False,61,0.07,1.05,1.61
RLC  ,USD,False,61,0.01,1.04,1.19
OGN  ,USD,False,56,0.05,1.03,1.33
UMA  ,USD,False,52,0.07,1.01,1.13
NMR  ,USD,False,55,0.02,1.01,1.14
MANA ,USD,False,48,0.01,1.01,1.18
DOGE ,USD,False,55,0.02,1.01,1.15
BTC  ,USD,False,54,0.14,1.01,1.27
REQ  ,USD,False,52,0.02,1.0 ,1.1
NKN  ,USD,False,59,0.02,1.0 ,1.1
ICP  ,USD,False,51,0.04,1.0 ,1.14
FARM ,USD,False,53,0.04,1.0 ,1.31
ETH  ,USD,False,47,0.04,1.0 ,1.13
DAI  ,USD,False,44,0.01,1.0 ,1.0
ATOM ,USD,False,49,0.05,1.0 ,1.09
ADA  ,USD,False,57,0.01,1.0 ,1.25
AAVE ,USD,False,52,0.08,1.0 ,1.38
STORJ,USD,False,46,0.13,0.99,2.0
SOL  ,USD,False,51,0.19,0.98,2.12
ALGO ,USD,False,47,0.06,0.98,1.13
ACH  ,USD,False,51,0.02,0.98,1.07
ZEC  ,USD,False,43,0.04,0.97,1.0
XLM  ,USD,False,43,0.05,0.97,1.03
LTC  ,USD,False,42,0.03,0.97,0.89
LINK ,USD,False,46,0.17,0.97,1.8
DOT  ,USD,False,45,0.01,0.97,1.08
COMP ,USD,False,49,0.05,0.97,1.11
QNT  ,USD,False,43,0.02,0.96,0.98
PLA  ,USD,False,45,0.02,0.96,1.19
OXT  ,USD,False,47,0.01,0.96,1.13
ETC  ,USD,False,39,0.0 ,0.96,1.07
CRV  ,USD,False,47,0.08,0.96,0.92
BCH  ,USD,False,36,0.1 ,0.96,1.08
LRC  ,USD,False,42,0.08,0.95,0.99
FIL  ,USD,False,41,0.0 ,0.95,1.14
CGLD ,USD,False,44,0.0 ,0.95,1.07
BAL  ,USD,False,38,0.12,0.95,0.88
XTZ  ,USD,False,38,0.03,0.94,1.03
MLN  ,USD,False,36,0.05,0.94,0.9
BAT  ,USD,False,38,0.01,0.94,1.07
BAND ,USD,False,44,0.01,0.94,1.12
ANKR ,USD,False,43,0.01,0.94,1.06
LPT  ,USD,False,41,0.04,0.92,1.13
GLM  ,USD,False,41,0.02,0.92,1.18
CVC  ,USD,False,48,0.05,0.91,1.27
ZRX  ,USD,False,36,0.09,0.9 ,1.68
YFI  ,USD,False,42,0.04,0.9 ,1.32
MATIC,USD,False,28,0.03,0.9 ,1.1
KNC  ,USD,False,27,0.03,0.9 ,1.11
BNT  ,USD,False,32,0.08,0.9 ,1.56
POLY ,USD,False,30,0.01,0.81,1.2

 

 

ChatGPT will create Tags

Finally by posting this post into a prompt you can ask ChatGPT to generate Tags for the post. I used most of them but trimmed a few that were redundant.

Stacks of Coin

Bitcoin’s Soft Underbelly

The best way to make money is to go out and do it yourself.

Hey ChatGPT, Do you what Bitcoin is?

Yes, I am familiar with Bitcoin. Bitcoin is a decentralized digital currency that uses cryptography for security and is supported by a peer-to-peer network. It was created in 2009 by an unknown individual or group of individuals using the pseudonym Satoshi Nakamoto.

Bitcoin is based on a distributed ledger technology called the blockchain, which allows it to operate without the need for a central authority. Transactions are recorded in blocks, which are linked together in a chain. This chain of blocks is secured using complex mathematical algorithms, which makes it extremely difficult to alter the record of transactions.

Bitcoin can be used to send and receive payments over the internet, and it has attracted a lot of attention due to its potential to disrupt traditional financial systems. However, it has also been associated with criminal activities, and its value can be volatile.

Hidden Risks

Just to linger on the topic for a moment, Bitcoin, has another risk that does not get enough mention. Cryptography has a shelf life and eventually breaks, either via some discovery of a short path to crack a private key given a public key or collisions. Bitcoin uses SHA256 encryption which seems safe for now but, as with all hash algorithms, there is no closed form solution that shows it is watertight. It’s more along the lines of, well the last cryptographic code broke because of X,Y or Z, so lets beef the new one up to be stronger in those areas. But, someone might find a crack in SHA256 tomorrow, just like what happened for SHA-1 not too long ago From what I recall it was a university research project that broke it. Or looking at the second failure mode, when will brute force collision with a large number of private keys become possible and profitable, It’s only a matter of time. 256 bits is a lot a space to brute force through. But, computing power (Now multi threaded quantum computing too ) grows over time and large entities such as nation states with deep pockets could do something like this at some point in the not so distant future. Is this possible, who knows now, but someday it might.

There are known knowns, known unknowns and then the ones that get you when you least expect it, unknown unknowns and this risk clearly falls in that category.

Interesting to Skim

https://www.whitehouse.gov/wp-content/uploads/2022/11/M-23-02-M-Memo-on-Migrating-to-Post-Quantum-Cryptography.pdf

Blockchain example slide

Proof of Work why use it and why does it use energy

Proof of Work

Proof of work relates to mining of cryptocurrency. It uses computing resources to solve a mathematical puzzle of sorts that takes a lot of compute power to solve but a minimum amount of power to verify that it has been completed. It is an example of a one way function. Easy to go one way but hard to go in the other. Imagine throwing a glass of water in the ocean, now imagine getting all of that water and only that water back out, like running a film backwards, might be impossible. The closer the one way function is to the glass in the ocean example the more secure a blockchain can be made. Why is that? Because it would take so much effort to mutate or corrupt the blockchain that it is not even worth trying.

Brilliant Idea, from Anti-SPAM to Blockchain

In the case of Bitcoin, mining occurs across thousands of nodes that can easily verify that the “work’ has been done and as long as there is a > 50% consensus among mining nodes , then the block is deemed valid and the nodes accept it and move on to the next block of transactions. So it would take an enormous amount of computing power to ‘fake’ a block and create a duplicate spend or a spend that pays an entity some unearned (Bitcoin) BTC, stealing it effectively. That in essence is the brilliance of Bitcoin and it’s pseudonymous creator Satoshi Nakamoto. All the ideas are not original, there was once an idea to use proof of work to prevent spam in email in the mid 1990s when SPAM became a nuisance. For regular uses it would delay the email by a few seconds, for a spammer sending out 1000’s of emails their computer would slow down to much to make it worth it. Satoshi Nakamoto took this idea and applied it to Bitcoin.

The chain part of block chain

On top of this, proof of work  that secures a single block, every block contains the hash of the previous block making it extremely hard to ‘fake’ out and create old blocks over as many hashes would have to be faked. So the longer the chain the more secure older transactions become as they become harder and harder to undo , or fake out.

Hashing in Cryptocurrency

Hashing is the key. Hashing is used in several ways in cryptocurrency.(toward the end of this post a second use is covered) . When mining a block a hash is generated for that block, a SHA256 hash. But not just any hash works. It has to be lower than a specific number determined by the difficulty adjustment, the so called target hash. This changes periodically to keep the outputs of blocks on the block chain, a giant electronic ledger of transactions, blocks are produced very 10 minutes on average. This also limits how many transactions can occur in a given time period. Blocks contain a finite number of transactions and they come out at period intervals, so there are only so many made per day. For Bitcoin this limits the daily transaction to something like around 300000. Other cryptocurrencies do better in this regard (but, buyer beware, they are beholden to companies or individuals that created them,so not independent from control like Bitcoin), so do layer 2 solutions like the Lightning network for Bitcoin. in the future most likely only large infrequent transactions will occur on Bitcoin main chain. With other solutions like the Lightning network or other cryptocurrencies serving to move money like PayPal or a Point Of Sale network, or Swift for that matter.

To create the special hash know as the target hash that meets the difficulty requirement means creating a hash that is lower than a specific 256 bit number. It contains a bunch of zeros at the beginning. This is done by add what is called a nonce ( just a random string will work, used just once  to make the hash come out lower than the target) to the block of transactions and computing the hash. The nonce can be a completely random string or a sequence of numbers tried in order, it really doesn’t matter. The only requirement is that whatever it is it creates a hash output that is lower than the number, target hash, specified by the difficulty requirement. In mining the first node that obtains this number will broadcast the result on the BTC network, all mining nodes will check it (hash the block and see if they agree, quick and easy to do), if it’s OK, the block becomes accepted added to the chain and that miner, the one who solved the hash, gets the block reward along with the fees for all the transactions that have been validated in the block. And, all nodes move on to the next block.

The hash itself

A typical block hash would look something like this…

00000000000000000007cd983a54a4eaf969d79961681fa2fa41eff0aba4a168

Notice all the zeros. With 256 byte number, using SHA256, it is hexadecimal where every number is 0-15 it takes a while to arrive at a number like this. Basically all the nodes that handle the blockchain that are mining are trying to get a ‘low’ number by changing the nonce.

Energy

This takes a lot of computing power and therefore energy. And, this is the complaint when it comes to cryptocurrency that are mined such as Bitcoin. The energy used to mine Bitcoin is equal to that of a small country. But, it has to be remembered that the whole financial technology sector of the economy still dwarfs the energy use of Bitcoin. Just imagine all of the ATMs alone that are plugged in all over the world, the computers running in the banks, heating, other electric and etc. Also, Bitcoin can be mined using energy that is otherwise orphaned. Meaning energy that can not be used for anything else. An example is natural gas and a petroleum well that might normally be flared off. Instead of flaring it off, it could be burned in a gas turbine turning a generator and run mining equipment. The mining equipment could be connected via Cell network or Satellite if no wire are available in a remote location. It is a way of burning a fuel at the source and generating value from it that otherwise would go to waste.

Proof of Work Example

Just a simple example of using a nonce along with a string ‘hello’ in this case and then printing out the resulting hashes of the new compound string of hello+nonce.

As more zeroes are required it gets harder and harder to find a nonce that will satisfy the requirement. To find the first hash with one zero at the start it takes 28 tries, ‘hello28’.

To get 8 leading zeroes it takes hello1202655595  = 1202655595 tries, on fairly regular computer it took from 2022-11-19 15:42 to 2022-11-19 16:48. Just over 1 hour.

Proof of Work Here it comes, ready…

I can give you the hash…

00000000e0d103722c6e172e145d15b9e909e109b47b30d741911bdb3cf3da84

and the string….

hello1202655595

….and this is proof that work was done. You can prove it. It took work to get this result, the computer ‘did’ something hard. It takes almost no energy and time to verify that the hash above is generated by hello1202655595, so it is cheap to verify but expensive to produce.

By ‘stamping’ this result into the blocks on the blockchain, hash of previous block into every block, it is very hard (glass of water back out the ocean hard) to create a forgery or do some other type of nastiness to the blockchain. Proof of Work secures the blockchain.

(Python code at the bottom of this post)

erick@OptiPlex-7010:~/python/hashing$ python3 multi-pow-hash-of-string.py 
Enter String to hash: hello
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
2022-11-19 15:42:15.173991 1 hello28 02a13c40ba00dc0fb199d3cbe5b01be59d937775890243fd411bdf001935ffc8
2022-11-19 15:42:15.175116 2 hello227 001b92541ed0a22b0cb89018b561d895503206c0082c0ecf2d0b7e5182191eed
2022-11-19 15:42:15.206154 3 hello10284 0006bc9ad4253c42e32b546dc17e5ea3fedaecdabef371b09906cea9387e8695
2022-11-19 15:42:15.350531 4 hello60067 0000e49eab06aa7a6b3aef7708991b91a7e01451fd67f520b832b89b18f4e7de
2022-11-19 15:42:15.771205 5 hello156056 0000037660ee0e22df67a053537e000325bbfad2cce9b8b7c795f6aa961d5cb7
2022-11-19 15:43:47.285252 6 hello33290382 000000865194de5c0744d72183dcce2eca2b69264b749a1798f1b6996baef7de
2022-11-19 15:49:22.363936 7 hello121001637 0000000bcd89bc714263460f7b1fc82562410b96eaeec5cc2175e83f2d215046
2022-11-19 16:48:46.136385 8 hello1202655595 00000000e0d103722c6e172e145d15b9e909e109b47b30d741911bdb3cf3da84

Keys and Addresses

To round it out, the other main use of cryptography in cryptocurrencies, the private key, secures your ‘coins’. If you aren’t careful to hide and not reveal your private key, you lose your coins. Your public key which is basically translated into an address for BTC (and others) it is a 160 byte number can be freely given out, posted online, in email, put it anywhere you wish. Why? Because all someone an ever do with the public key/address is send you some ‘coin’. So if they did, great. And, if it is a publicly transparent blockchain like Bitcoin and most others, privacy coins such as Zcash and Monero for example being the exception, you can trace the transactions. Just put a public address into the browser search bar and various tools will appear that allow you to trace transactions to an address. So the criminals that think cryptocurrency gives them some kind of magic cloaking mechanism for their transactions are getting it wrong. The cryptography in cryptocurrency has nothing to do with keeping a record of transactions securing hidden away, in fact the transactions are as transparent as they could possibly be.

 



Infographic showing #3 a blockchain and a block consisting of it’s sequence number, the hash of the previous block and the nonce, plus a record of transactions.

The miner of the block gets the reward plus all the fees for the transactions. In 2021 when this was made the block reward was 6.25BTC per block mined. This is cut in half approximately every 4 years, until it drops off  altogether around the year 2140. By then the fees will be the only thing sustaining the miners financially. The fact that there is only a finite amount of Bitcoin that can be mined, ever, 21 Million of them, keeps inflation of Bitcoin at bay. This is not the case for all coins, some cryptocurrencies can create more and more coins at will, so they are inflationary. Bitcoin is a fixed supply of which most of it has been mined already. So most of the stock is already created and the flow of more coins gets lower and lower with each block reward halving, every 4 years. This concept of stock to flow is important because it is a measure of scarcity. If something can be made easily like fiat currency the flow can be a large input to the stock in existence. This is what is going on in 2022 with economies all over the world that have printed massive amounts of fiat money during the Covid crisis, when the stock to flow is not a good ratio, inflation results. The opposite occurs with gold for example, it is hard to increase the amount of gold pulled from the earth, so the flow of new gold into the current world stock of gold is less than 2% per year, (I think that I remember the max was just 2.2% somewhere in the WW2 time frame) so in essence the market is never flooded with new gold, which would debase gold against other stores of value.

Blockchain example slide

 

 

Blockchain example slide

'''
https://www.pythoncentral.io/hashing-strings-with-python/
'''
import hashlib
from datetime import datetime

mystring = input('Enter String to hash: ')
# Assumes the default UTF-8
hash_object = hashlib.sha256(mystring.encode())
print(hash_object.hexdigest())

for DIF in range(1,32):
    for n in range(1,1000000000000):

            x = mystring + str(n)
            hash_object = hashlib.sha256(x.encode())
            d = hash_object.hexdigest()

            #print(x,d)
            tally = 0

            for z in range(0,DIF):
                    if d[z] == '0':
                            tally += 1

            if tally == DIF:
                break

    timestamp = str(datetime.now())

    print(timestamp,DIF,x,d)

Resources

https://seekingalpha.com/article/4452010-bitcoin-energy-usage-isnt-a-problem-heres-why

https://ingoldwetrust.report/the-stock-to-flow-ratio-as-the-most-significant-reason-for-golds-monetary-importance/?lang=en

Crypto Donations to Ukraine

Excerpt from 03.03.2022. Coinbase Bytes article published by Coinbase , lays out how to support Ukraine with crypto donations. Also from this it can be seen how important cryptocurrencies can be during an economic disruption. Passing this on to let others see this and also learn from what Coinbase has to say about this topic.

The quote at the bottom sums up the importance of cryptocurrencies in a time of crisis…

“My Ukrainian credit cards don’t work anymore. I’m safe physically in Kazakhstan, but all my savings are gone. Crypto is the only money I still have, and today I can say without exaggeration that $BTC, $ETH and #NFT[s] are going to save my life while I can’t come back home.”

As always with crypto, make sure you know what address you are sending to, make sure it is from a legitimate source, scams abound. Always double check the crypto address whenever cutting and pasting make sure it matches as bad actors have been known to create viruses that can hijack an address copied and pasted so funds go to them!

Links coming from legitimate sources are important. I copied some links from the excerpt below with locations to donate via crypto. For example…

The official Twitter accounts of the government and Vice Prime Minister Mykhailo Fedorov shared wallet addresses for BTC, ETH, and the USD-pegged stablecoin Tether

the Kyiv Independent also listed BTC and ETH wallets

CRYPTO SUPPORT

Crypto donations pour into Ukraine as the country resists Russian invasion

As Ukraine continues to resist Russia’s full-scale invasion, international sanctions begin to hobble the Russian economy, Russian president Vladimir Putin has resorted to nuclear saber-rattling, and global markets have whipsawed. On Monday, oil prices reached over $100 per barrel for the first time since 2014, and the Russian Ruble lost 30% of its value against the dollar, plummeting to record lows. For Ukrainians, emergency economic measures — including cash withdrawal limits (about $3,350 per day) — have prompted the country’s government, citizens, and even newspapers to call for crypto aid. Let’s take a closer look at some ways crypto is assisting during a time of crisis.

  • Ukraine has raised over $30 million in cryptocurrency since tweeting an appeal for donations on Saturday. The official Twitter accounts of the government and Vice Prime Minister Mykhailo Fedorov shared wallet addresses for BTC, ETH, and the USD-pegged stablecoin Tether (which saw such significant demand on Ukraine crypto exchange Kuna that it traded above its peg, reaching $1.10) Why crypto donations? As blockchain analytics firm Elliptic explains, “Cryptoassets such as Bitcoin have emerged as an important alternative crowdfunding method. They allow quick, cross-border donations.”
  • Russian-Canadian Ethereum co-creator Vitalik Buterin amplified the appeal on Twitter as part of a string of tweets that included a sharp rebuke of Moscow, calling the invasion “a crime against the Ukrainian and Russian people.” In other Ethereum news, Uniswap added a tool on Tuesday that allows users to swap any crypto for ETH and send it to the Ukrainian government’s wallet in a single transaction.
  • A founding member of the Russian pro-democracy punk group Pussy Riot formed a DAO to raise funds for Ukrainian civilians. Pussy Riot’s Nadya Tolokonnikova, along with members of PleasrDAO and artist Trippy Labs, formed UkraineDAO, which sold 10,000 Ethereum-based Ukrainian flag NFTs and plans to donate all proceeds (over $5 million) to the Come Back Alive Foundation, which supports Ukraine’s military, and the Proliska non-governmental organization. (If you are considering donating crypto, be mindful of potential scams and always do your research first.)
  • The Kyiv Independent, an English-language newspaper in Ukraine is seeking crypto donations to support the country’s independent media. In addition to GoFundMe pages for the paper and several partners, the Kyiv Independent also listed BTC and ETH wallets. Meanwhile, a Berlin-based blockchain startup called Arweave is attempting to preserve historical documents about the crisis — so far its network of 1,000 nodes holds about 50 terabytes of related data.
  • Last November, The New York Times described Ukrainians as among the “most avid cryptocurrency users in the world,” and they rank fourth in Chainalysis’ 2021 Global Crypto Adoption Index. Why? A combination of factors — from high inflation to a widespread lack of trust in local banks. Ukraine is also a highly tech-forward nation, with an IT export business worth almost $7 billion last year. Ukraine also adopted a progressive bill last September, enabling the government to regulate crypto.

Why it matters… Ukranians are using crypto to defend themselves from Russia’s invasion, protect their wealth, and fund their escapes to neighboring nations. In one sobering tweet, a citizen explained: “My Ukrainian credit cards don’t work anymore. I’m safe physically in Kazakhstan, but all my savings are gone. Crypto is the only money I still have, and today I can say without exaggeration that $BTC, $ETH and #NFT[s] are going to save my life while I can’t come back home.”

Crypto Basics Notes

Having an ‘edge’ and surviving are two different things: the first requires the second. You need to avoid ruin. At all costs.” – Nassim Taleb

Class Slides

The following are the handmade slides from the class. Well all but the last one on valuation.

Resources

Here on this site

See the trading category on this site for more information on trading and investing on this site…

http://erick.heart-centered-living.org/trading/

On the Internet

Also, the following are resources that were mentioned in the class. Good places to start on the path to learning more about investing and crypto as well…

Subject: Game of Trades at 14:08:10, Mon Nov 15, 2021 from 192.168.1.66

https://www.youtube.com/c/GameofTrades


Subject: The Crypto Sniper at 14:05:40, Mon Nov 15, 2021 from 192.168.1.66

https://www.youtube.com/c/TheCryptoSniper


Subject: Brave New Coin at 14:04:54, Mon Nov 15, 2021 from 192.168.1.66

https://www.youtube.com/c/bravenewcoin


Subject: Josh Olszewicz at 14:03:59, Mon Nov 15, 2021 from 192.168.1.66

https://www.youtube.com/c/carpenoctom


Subject: ARK Invest at 14:02:21, Mon Nov 15, 2021 from 192.168.1.66

https://www.youtube.com/channel/UCK-zlnUfoDHzUwXcbddtnkg


Subject: Breaking Bad Fat Stacks at 13:45:44, Mon Nov 15, 2021 from 192.168.1.66

https://www.youtube.com/watch?v=48OJbbI0DfE


Subject: Electrum Wallet at 17:49:48, Sun Nov 14, 2021 from 192.168.1.66

https://electrum.org/#home


Subject: 1964 Prices at 11:14:49, Sun Nov 14, 2021 from 192.168.1.29

https://www.reference.com/history/much-did-everyday-items-cost-1964-cfba9fcd6734ea4f https://misterboomer.com/2014/04/boomers-and-the-cost-of-living-in-1964/ http://www.348-409.com/1964flash.html


Subject: Silver Coin Value Guide at 11:11:02, Sun Nov 14, 2021 from 192.168.1.29

https://www.coinflation.com/silver_coin_values.html


Sorelle Amore Finance

As far as finance, I agree with most of what she has to say…

Some Crazy Price Moves

A class on crypto would not be complete without showing some crazy price moves that are only possible in the crypto world.

Crypto Compares Big Gains Q1 2019

Trading Resource Videos

There are many thousands of people who buy and sell stocks speculatively but the number of those who speculate profitably is small. As the public always is “in” the market to some extent, it follows that there are losses by the public all the time. The speculator’s deadly enemies are: Ignorance, greed, fear and hope. All the statute books in the world and all the rules of all the Exchanges on earth cannot eliminate these from the human animal. Accidents which knock carefully conceived plans skyhigh also are beyond regulation by bodies of coldblooded economists or warm-hearted philanthropists.– Reminiscences of a Stock Operator

 

Trading Resource Videos

The following post contains video resources. Some of this material especially the material from Francis Hunt and David Paul on the psychology and mindset of trading is quite important. It is best to learn about the psychology and mindset of trading while learning other typical trading topics such as technical analysis and fundamentals. It is just as important in the long run and having discipline and the right mindset goes a long way to preventing losses and maximizing gains over the long haul.

Channels

Josh Olszewicz: Crypto + Technical Analysis, Building your trading toolbelt

Josh Olszewicz produces market updates on a regular basis cover BTC and ETH primarily. Plenty to learn from and in my opinion, reliable insights.

https://www.youtube.com/channel/UC587BAG9cLTYtJ7Q4CqcOnw

Francis Hunt: The Crypto Sniper

Francis Hunt produces periodic crypto market updates and actually trades in legacy markets as well and provides useful insights from both realms and also currencies plus gold and silver.

https://www.youtube.com/channel/UCdC4a2KquFV1F4O21mW3K7g

Aswath Damodaran: Fundamentals and Value Investing in Stocks.

He is a professor, so get ready to study. Many videos on his channel. A few updates here and there but , most of it is in depth college level training on topics such as valuation and analyzing the fundamentals of companies. Good information for a background on the stock market. Plenty of videos to pick and choose from as you want to dive into a specific topic.

https://www.youtube.com/channel/UCLvnJL8htRR1T9cbSccaoVw

 

UKspreadbetting

Basics. Well done videos, most of them nice and short and covering specific topics. Everything that applies to spreadbetting can be applied to trading as well so don’t let the name fool you.

https://www.youtube.com/channel/UCnKPQUoCRb1Vu-qWwWituGQ

Trading 212

Basics. Watched a few videos off of this channel a bit of overlap with UKspreadbetting but short concise videos. Worth looking at.

https://www.youtube.com/channel/UCfWQuGYMfhZk9qq5x00sb9w


Series Worth Watching

Francis Hunt Interview Series on UK Spread Betting

Especially these two in the series are very important…
Trading Secrets of the Mind Master the Emotional Side of Trading
Improving the Mindset Game in our Trading

David Paul on UK Spread Betting

More David Paul Videos

 

https://www.youtube.com/watch?v=MGglyvc8d58&list=WL&index=113&t=0s

Subject: David Paul Tips from video

Asset above 89 day MA. Market above 21 day MA And rising , will get hit rate to 80 Probability matrix Pattern to finesse entry . 1-2 pct at risk per trade. Plan and repeated perfect execution. Build neural pathways after 8-30 trades…….. William O’Neil How to make money in stocks……from The Psychology of trading and investing

Audio book: Trading For a Living, Psychology,Trading Tactics, Money Management

 

Jim Simons

Not trading information specifically but, he is a legend. Mathematician, code breaker  turned trading genius. He co-founded Renaissance Technologies in East Setauket, New York, a town away from where I grew up. Renaissance Technologies, Ren Tech, makes huge yearly gains in it’s Medallion Fund. The company does a lot of quant work and hires PhD scientists, mathematicians and etc. Working for this company would be amazing to say the least. So much to learn there working with the talented people he has helped to pick and shape over the years.

Renaissance’s flagship Medallion fund, which is run mostly for fund employees,[8] is famed for the best track record on Wall Street, returning more than 66 percent annualized before fees and 39 percent after fees over a 30-year span from 1988 to 2018.[9][10]