Tuesday, June 21, 2022

My 2013 DVCon Paper and Poster

I just noticed that my 2013 DVCon paper and poster are no longer archived on the DVCon website.  So, for my records at least, here they are:

The poster: Poster: ASIC-Strength Verification in a Fast-Moving FPGA World

The paper: ASIC-Strength Verification in a Fast-Moving FPGA World

Apologies for the PDF of the paper, but converting it to html requires more time than I have at the moment.

Thursday, April 21, 2022

Zmodem File Transfer With GNU Screen

I've been using screen as my serial terminal (as opposed to minicom or picocom) for a long time now.  Today I had the need to transfer a file from my PC to the embedded device I was connected to with screen.  Networking was not working, and a co-worker reminded me that zmodem was a way to transfer a file over the serial port.  I googled for instructions on exactly how to use zmodem and I found stack overflow answers and blog entries all mentioning GNU screen for doing so, but none of them really explained it right.  Here's what worked for me today.

To transfer a file from my PC to the embedded device:

  1. in screen hit ctrl-a : zmodem catch
  2. in screen, at the linux command-line on your device type: rz
  3. screen will prompt with an sz command, just append the filename to that command and hit enter

Note that this works best if the file is in the same directory as you ran screen from.

  To send a file from the embedded device to your PC:

  1. in screen hit ctrl-a : zmodem catch
  2. in screen, at the linux command-line on your device type: sz <filename>
  3. screen will prompt with an rz command, just hit enter

You only need to run the zmodem catch command once in your screen session.  In fact, you can just put this at the end of your .screenrc and then you will never have to do step 1 at all:

zmodem catch

Saturday, April 16, 2022

Giving Bitcoin as a Gift

 If you've been following along, you know I was considering giving bitcoin as a Christmas gift.  I did end up giving bitcoin to friends and family for Christmas.  I'm pretty happy with how it turned out.  I went with the HD Paper Wallet solution, and so I wrote some python code to generate paper wallets.  The code is open source, and instructions are in the README there on github.  You'll probably want to tweak the template to customize it for you instead of me.  Hopefully someday I can modify the code to make that easy, but I'm pretty new at generating images and PDFs.  The code I write for my day job doesn't involve pretty pictures, or words even :-)

Friday, December 3, 2021

Giving Bitcoin as a Gift, Initial Thoughts

 'Tis the season and I'm thinking about how to give bitcoin as a gift, to non-technical people, without requiring them to do anything like create an account or download software in order to accept it.

Paper Wallet

Bitcoin paper wallets have been around a long time.  The concept is simple.  Generate a send/receive address pair (private/public key pair) and print them on a piece of paper.  Basic operations:

  • To add bitcoin to the wallet, send some bitcoin to the receive address
  • To check your balance, type or scan the public key into any blockchain explorer 
  • To gift that bitcoin, just hand over the piece of paper
  • To send the bitcoin on the blockchain, type or scan the private key into the bitcoin wallet software of your choice

Pros:

  • simple, no fancy hardware or software required for them to receive the bitcoin
Cons:
  • No guarantee that the giver didn't keep a copy of the private key
  • Private key could be easy for someone else to see/copy
  • Private key could be easily lost
  • If you want to add more funds, you have to reuse the same receive address, which is bad for privacy

Hardware "paper" Wallet

There is a hardware solution to the first problem, the Opendime. It's essentially the same thing as the paper wallet, except it generates the key pair and keeps the private key hidden until you mechanically alter the device.  If someone gives you an Opendime, it's easy to see that they have not altered the device and seen the private key.  It has the same address re-use downside of the paper wallet.  It's also pretty expensive if you just want to give a kid $5 worth of bitcoin.  Even more so if you want to give a bunch of nieces and nephews bitcoin!

I thought more about keeping the private key private and realized that some niece or nephew is likely to lose either a piece of paper or an Opendime and then come to me and ask what they can do to recover their bitcoin.  I think that in this scenario of mine, it would be best if I did keep a copy of the private key someplace safe.  That turns the first con into a pro!

Full Hardware Wallet

For my own private keys, I use a Trezor hardware wallet.  It generates the private key on the device and never lets anyone see it, except once at setup time in the form of a backup seed phrase.  It uses the Hierarchical Deterministic Wallet (HD Wallet) structure, which is really cool.  You can generate a sequence of private keys and corresponding public keys from the main private key that comes from the seed phrase.  You can also generate a sequence of keys under each of those keys, making them parent keys of a bunch of other keys (thus, hierarchical).  But the really cool part is you can generate just the sequence of public keys from a given public key, no private keys have to be involved in that calculation.

A practical example of why this is great.  I use Swan Bitcoin (affiliate link, we each get $10 if you sign up with it) to buy my bitcoin.  Swan automatically transfers the bitcoin from their account to mine on a regular basis.  I could give them a single public-key (address) that they always use for those transfers, or, I can give them a public-key from my hierarchical wallet and they can generate a series of public keys to send the bitcoin to, using a new key each time.  This eliminates address reuse and I don't have to manually give them a new key for each transaction.  If I keep that public key private between me and them, then nobody knows that each of those transactions from Swan are going to me.

Back to giving bitcoin as a gift.  I could give each person a parent public key from my Trezor.  There is a nice bitcoin wallet app called BlueWallet that also knows how to do the HD Wallet thing that they can use to manage the public keys.  That would keep the private keys totally safe.  I could still print the master public key onto a piece of paper.  The basic operations become:

  • To add bitcoin to the wallet, type or scan the main public key into BlueWallet, get the next public key (receive address), send some bitcoin to the receive address
  • To check your balance, type or scan the public key into BlueWallet
  • If you want to gift that bitcoin, just hand over the piece of paper
  • To send the bitcoin on the blockchain, they have to call me up and I have to use the Trezor to send it

Pros:

  • Simple, no fancy hardware or software required for them to receive the bitcoin
  • No address reuse
  • Private key is safely backed up with me

The downsides to this are:

  • They have no control over the private key

That is a pretty big downside, they really don't own the bitcoin.

HD Paper Wallet

Once I figured out this whole seed phrase and HD wallet thing, I came up with another idea.  I could generate a seed phrase and the corresponding master public and private key pairs and give them those.  I'd keep a copy of the seed phrase myself just in case they lose it.  Now the operations become:
  • To add bitcoin to the wallet, type or scan the main public key into BlueWallet, get the next public key (receive address), send some bitcoin to the receive address
  • To check your balance, type or scan the public key into BlueWallet
  • If you want to gift that bitcoin, just hand over the piece of paper
  • To send the bitcoin on the blockchain, type or scan the main private key into BlueWallet

Pros:

  • Simple, no fancy hardware or software required for them to receive the bitcoin
  • No address reuse
  • Private key is backed up with me

The downsides to this are:

  • Private key could be easy for someone else to see/copy
  • Private key could be easily lost

I feel like this is the best compromise.  There is one more downside.  No websites or tools exist to make a pretty paper wallet out of HD wallet master public and private keys.  I'm going to have to make that on my own.

Any thoughts?  Please let me know in the comments.  I sometimes think I'm over complicating this with the HD wallet.  Who cares that much about a little address reuse?  I like the tech (math, really) of the HD wallet though.  Or maybe the Trezor is the best way?  That keeps the private keys safest.  They can check their balance with their public keys and feel like they own it.  Is that good enough?

Wednesday, June 30, 2021

Traffic in Little Cottonwood Canyon

This is my comment on the Utah Department of Transportation's plans to "to provide an integrated transportation system that improves the reliability, mobility and safety for residents, visitors, and commuters who use S.R. 210."

This is long, but I have tried to order it in such a way that the most important points come first, so don't give up now.  At least read the first 3 paragraphs, please.

First and foremost I'd like to ask, what problem are we really trying to solve?  Roughly 355 days a year there are no reliability, mobility, or safety problems on S.R. 210.  The weather is good, the roads are clean and clear, and traffic flows at or above the speed limit of the road.  We all need to understand that the problems with reliability, mobility, and safety only happen about 10 days a year, if the skiers are lucky and we get that many big snow storms.

Mobility

Congestion on roads is annoying, but we need to seek to understand it before we try to fix it.  Congestion on a road happens because it leads to a popular place.  Lot's of people want to get to that place, so they get on that road.  The road gets congested and nobody can get to the popular place as fast as they could if there was no congestion.  This is what bothers us.  We have a road that could allow travel at a given speed, but because of the over crowding on the road, we all have to go slower than that speed.

Solutions to congestion are all temporary.  When a road is congested, there are some number of people that will simply choose not to go to the popular destination.  If you widen the road or add alternative means to get to the popular destination, at first the congestion will be alleviated, but before too long the people that were avoiding the popular place because of congestion will see that there is no congestion and they will start traveling to the popular place again.  Before too long you will have congestion again.  Anyone who has seen the progression of I-15 over the years here in Utah can understand this.  There will be more people getting to the popular destination than there were before, but there will still be congestion.

Understanding all that, we can better talk about what we are really doing.  We are not alleviating congestion (increasing mobility) long-term.  We are alleviating it short-term only, and we are providing the means for more people to reach the popular destination.  Is that really what we want in Little Cottonwood Canyon?  Can the ski resorts, hiking trails, picnic areas, climbing routes, etc. handle more people?  Or will they become congested too?

Reliability and Safety

These are essentially the same concern.  When it snows, cars and busses are less reliable because they might get stuck or slide off the road.  In extreme cases they might slide into each other or off the road which is a safety issue.  This is where I would like to point out how strange it is that UDOT has recently stopped talking about these concerns in Big Cottonwood Canyon (S.R. 190) and is now only talking about Little Cottonwood Canyon (S.R. 210).  I would really like to see data on reliability and safety in both canyons because in my following of the two it appears that S.R. 190 has far more accidents and slide offs than S.R. 210.  S.R. 190 is a much longer, windier road with areas of very steep drop-offs down to the creek.  I have noticed that S.R. 190 gets closed to deal with accidents (stranding skiers on the road or at the resorts for hours on end) far, far more often than S.R. 210.  Is any of this plan really concerned with reliability and safety?  If so, it should consider both canyons.

Bus Lanes vs. Gondola

Now, all that being said, let's address this specific plan which seems to assume that yes, the canyon can and should accommodate more people and is in dire need of more reliability and safety.  Considering all the above, I believe neither solution is a good idea.  Both will be incredibly costly and have very real negative impacts on the environment.  Neither will make a difference on the 355 good traffic days a year, and in the long run, neither will solve the congestion problems on the 10 bad days a year.  The one thing the gondola plan has going for it is the increased reliability and safety on those 10 bad days, but I see no data that justifies the extreme cost for what is likely to be only very small increase in reliability in safety in the one canyon that doesn't have that big of a reliability and safety problem anyway, while we ignore the other canyon that does have real reliability and safety problems (on those 10 days a year).

My belief is we should look for more cost effective ways to address the reliability and safety issues only, in both canyons(!), and not proceed with either a road widening or gondola project.