This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Crypto

Crypto Notes/Expirments

Source and code support notes can be found in beverts312/crypto-learning. The UI for expirments is at https://crypto.baileyeverts.com and the apis are at https://crypto.baileyeverts.net.

Resources

  • Coinbase Earn/Learn (free crypto) - Crypto reward stuff is super easy/lite, some blog posts get into good topics
  • Rabbithole (free crypto) - More advanced, really cool
  • Thirdweb - Free tooling (take a cut of what you make), great tutorials even if you dont want to use their tools
  • Messari - Great data/research, strongly reccomend this paper

1 -

Crypto Learning

For learning crypto things

2 - Bitcoin

The OG Cryptocurrency

Random Facts

  • If you bought $100 of gold and $100 btc in December of 2011, the gold would be worth $102, the bitcoin would be worth $1.7 Million (December 2021, Messari)
  • bitcoint does 300k settlements/day vs 800k/day for Fedwire, but bitcoin settlements are often batched so bitcoin network is already probably clearing more transactions (December 2021, Messari)
  • In the US we falir the equivielnt of 150TWh/day, that is over 8x as much energy as the BTC network uses in a year (December 2021, Messari)

Useful Resources

3 - General Crypto Notes

3.1 - Domains

ENS vs UDS

Ethereum Name Service (ENS) and Unstoppable Domain Service (UNS) are 2 different services which surface information from domain records which are stored on the blockchain. Primarily both services make it easier to route payments to addresses but each service has additional capabilities.

Checkout my tool for resolving ENS/UNS domains here.

ENSUNS
BlockchainEthereumPolygon
Sitehttps://app.ens.domains/https://unstoppabledomains.com/
TLD’s.eth.crypto, .nft, .x, .coin, .wallet, .bitcoin, .dao, .888, .blockchain
Registeration TermAnnual (can bundle many yearrs together)Forever
PaymentEthereumFiat, crypto
GasUsed for registration/UpdatesUsed for registration/updates but it is covered by Unstoppable
Other CapabilitiesWhen used with compatible browser/extension can be used as a DNS Services for IPFS sites, Provides login service
My domains (OpenSea Links)everts.etheverts.crypto

3.2 - Myths

Crypto currency is just used by criminals

.34% of cryptocurrency transactions are illicit (Messari, December 2021), that is a smaller percentage than using traditional finance.

3.3 - Terms

TermDefinition
TradFiTraditional Finance
DAODecentralized Autonomous Organization

4 - Hands On

Expirment Notes

4.1 - Login

Login flow using an ethereum wallet

Every ethereum wallet consists of a public key and private key, the private key is only known (or should only be known) by the owner of the wallet. Because of this we can validate wallet ownership by asking the owner to sign a generated message with their key and then validating that the signed message matches what we would expect using the public key.

Tools like Metamask allow us to interact with wallets using javascript. Metamask can manage the private keys itself or the private keys can be managed on a secure hardware wallet such as a ledger and anytime metamask needs to perform an operation that leverages the private key it will offload that part of the flow to the hardware wallet.

For the UI layer I chose to use ethers.js to make it easier to interact with the ethereum blockchain.

This is roughly the ui login code:

Initialize ethers provider/signer

const provider = new ethers.providers.Web3Provider(window.ethereum);    // Initialize ethers
await provider.send("eth_requestAccounts", []);                         // Prompt to connect wallet (if not already connected)
const signer = provider.getSigner();                                    // Initialize signer
const address = await signer.getAddress();                              // Get the connected address (multiple addresses can be managed by metamask)
const challange = await getChallenge(address);                          // Retrieve challenge from api (simple fetch api call)
const signedChallenge = await signer.signMessage(challange);            // Ask to sign message, will prompt user in ui and on hardware wallet if connected
const jwt = await getJwt(address, signedChallenge);                     // Retrieve jwt from api (simple fetch api call)

For the api I chose to use web3.py to make it easier to interact with the etherum block chain. To create the challenge I simlply generate a uuid, the uuid is stored in the db (associated with the user who requested the challenge) and then returned to the user.

This is roughly the code to validate the signature:

Retrieve and validate challenge

stored_challenge = UserChallenge.get_challenge(addr).get("challenge")   # get challenge from db
w3 = Web3()                                                             # initial web3 lib
account = w3.eth.account.recover_message(                               # use stored challenge with signed challenge to retrieve address
    encode_defunct(text=stored_challenge),
    signature=challenge_to_validate,
)
if acct == addr:                                                        # ensure signing address matches challenge address
    return generate_jwt(addr)
else:
    return 401

5 - Helium

The People’s Network

Helium is a decentralized wireless network

Components

  • WHIP - Narrowband wireless protocol, cheap, long range, low power, open source,
  • Hotspots - provide wireless coverage, connect devices and routers
  • Devices - connect to hotspots using WHIP
  • Routers - internet deployed apps, recieve traffic from devices (via hotspots) and route them where they need to go. HA routers provided by the network but you can run your own

Concepts

  • Proof of coverage - For proving hotspots are proving wireless coverage to an area
  • Proof of serialization - To achieve time consensus, used to validate proof of coverage is real
  • Proof of location - For proving hotspots are where they say they are, uses TDoA (whitepaper pg 12)
  • Helium Consensus Protocol - Based off HoneyBadgerBFT, miners submit proofs which translate to scores for miners, best miners get elected to consensus group

Other Concepts

Full Node vs Light Client - full nodes have full history (routers), light clients only have a moving window of history (hotspots)

Useful Resources