2023 Jan 06
Watched this podcast. Some takeaways/thoughts:
Bitcoin doesn’t just help monetize on unused energy, it ultimately is pushing towards clean/renewable energy because it happens to be the cheapest, and so miners on clean energy will beat out the others, and capital/resources will accumulate towards clean energy infrastructure. Bitcoin in the long-term will only get cleaner, and bring in lots of capital towards clean energy infra.
More on flaring: while extracting oil, natural gas is released, and so they actually burn it because it’s better for the environment than just releasing it into the atmosphere.
- How does natural gas work? It needs to be used immediately?
Blockstream was created as a way to let people do bitcoin full-time (because at the time everyone had full-time jobs and were hobbyists/enthusiasts)
I forget that being a funded open-source contributor has only been around for maybe the past 5 years or so.
Deep care is needed when people’s money is on the line, things move slowly.
No technical reason to not decentralize mining/negotiating transaction sets within a pool, just less convenient; the protocol(s) needed to be invented.
He mentioned he lately was working on some rust tooling for integrating lightning into existing wallets. Was cool to hear about the humble beginnings of LDK!
Surfed https://bitcoin.ninja/. Will return.
Noticed both jb55 and TheBlueMatt don’t use Github for their personal repositories. Decided to look into this. Didn’t realize there have actually been several instances of GitHub censorship. I wonder what more bitcoiners think about this, and what other solutions are for the sort of mass collaboration that happens on something like Bitcoin Core. Also, everything is trending towards me getting better at using VPSs in order to self-host things and just build more stuff.
Ran my own nostr relay locally to better test my greg bot. Tried to get it up on AWS EC2 but was sort of struggling. I am currently weak at configuring instances for exposing ports in particular ways and more importantly debugging errors in these situations.
Got the main implementation of my greg bot working. I can set a stream rule to only receive tweets from a user and run my bot to repost a tweet whenever it comes in. Next steps are to refactor, clean things up, and deploy it on some server so I can leave it running.
Not sure why you’d ever want to, but I realized you could actually have a function with a mutable variable of type immutable reference:
fn function(mut x: &String)
Learned you cannot implement a trait on a type from another crate. You must make a wrapped type. I was trying to implement
Clone
onnostr_types::PrivateKey
, which is a tuple struct of two clonable types, but I couldn’t. Had to make a wrapped type.Finally learning asynchronous programming in Rust. For a while now I’ve been exposed to async in Javascript, but the few times I tried to read about it I never really understood it. I recognize how to use async/await syntax but didn’t understood what was going on under the hood. Now I’m finally reading more.
- Async functions are another tool for concurrent programming, like threads. However for situations where you have tons of smaller tasks, spinning up threads for each task takes memory/CPU overhead. Async functions allow you to execute more tasks than available threads at one time.
- In the chapter where they essentially build an async runtime (Futures + Executor), they have the
TimerFuture
spawn a thread when it’s created. I feel like this makes the example sort of confusing, because it seems they’re spinning up a thread for each task, which is seems like a situation where you wouldn’t need async programming. I think a better example would just have it make an HTTP request or something. Will revisit sometime. Otherwise, it was a really cool chapter! - Basic summary of how an async runtime works: futures implement a
poll()
function that will return a result or that it’s pending. They’re giving awake()
function to call when they should be polled again. This wake function sends a message on a queue of tasks. An executor waits for tasks from this queue and continuously polls them to check if they are done. I probably fudged certain details—will come back to this. - Extra review: difference between a thread and a process is that threads share memory space while processes don’t.