BTC#: Big Numbers Are Big


Series: BTC# – Learning to Program Bitcoin in C#

« Previous: Modular Arithmetic

Why We Use Big Numbers

The private keys we use to secure our funds or our communications are 256-bit numbers chosen at random and then kept secret. What happens if two people randomly choose the same number? Or if you guess someone else’s number?

That’s very bad. If you somehow get hold of someone else’s secret number, you have the keys to their funds.

How likely is that to happen?

Vastly hugely mindbogglingly unlikely.

How Big Are These Numbers?

A 256-bit key has 2256 possible values. Expanded into its decimal format that’s 1.15 x 1077. 115,​792,​089,​237,​316,​195,​423,​570,​985,​008,​687,​907,​853,​269,​984,​664,​640,​564,​039,​457,​584,​007,​913,​129,​639,​939. 115 quattuorvigintillion. A number so big you’ve never even heard the word before.

Roughly the number of atoms in the universe.


At the end of Chapter One of Applied Cryptography, Bruce Schneier provides a table of large numbers. He lists things like the odds of being killed by lightning (1 in 9 billion per day) and the odds of winning a state lottery (1 in 4 million), which we can compare to the odds of randomly selecting two identical 256-bit private keys.

The odds of getting killed by lightning the day you win the lottery are 1 in

9 x 109 x 4 x 106 = 3.6 x 1016

i.e. 1 in 36 million billion, 36 with 15 zeroes after it, which doesn’t even touch the sides of crypto-maths-sized numbers. We’re still gonna need some bigger numbers to multiply by if we want to get close.

Now imagine that instead of guessing the numbered balls that will tumble out of the Powerball machine that you have a much bigger machine tumbling the entire Sahara Desert and you have to guess which grain of sand will come out. There are 1.5 x 1024 grains of sand in the Sahara Desert, according to BBC Earth.

The odds of you winning this Sahara lottery, correctly guessing which grain of sand will pop out of the machine and simultaneously getting struck by lighting are 1 in.

9 x 109 x 1.5 x 1024 = 1.35 x 1034

If the Sahara lottery was just the qualifying round and to win you had to then do the same thing but pick the correct grain of sand from the Gobi desert the odds would be 1 in

9 x 109 x 1.5 x 1024 x 1 x 1023 = 1.35 x 1057

which is still only one hundred-quintillionth of 115 quattuorvigintillion but I’ll stop here because it’s getting silly.


The chance of a random collision of 2 256-bit numbers is a hundred quintillion times lower than the odds of the ridiculous Sahara-lightning-lottery thing. It’s not gonna happen.

« Previous: Modular Arithmetic

BTC#: Modular Arithmetic


Series: BTC# – Learning to Program Bitcoin in C#

« Previous: Start at the Very Beginning

Next: Big Numbers Are Big »

Clock Arithmetic

It was a bright cold day in April, and the clocks were striking thirteen.

Clocks striking thirteen signify a world gone mad. The opening line of George Orwell’s 1984 is unsettling because in the familiar world, clocks have circular faces; they go round to twelve and then loop back to one again.


Continue reading “BTC#: Modular Arithmetic”

BTC#: Start at the Very Beginning


Series: BTC# – Learning to Program Bitcoin in C#

Next: Modular Arithmetic »

When you read you begin with A-B-C
When you sing you being with DO-RE-MI

When you learn to program Bitcoin, according to Jimmy Song in his new book Programming Bitcoin, you begin with Finite Fields and Elliptic Curve Cryptography.

Let’s get ourselves singing from the same Song sheet and start with the maths that underlies the public key cryptography used to build Bitcoin transactions.

As Jimmy says in the first paragraph of Chapter 1:

One of the most difficult things about learning how to program Bitcoin is knowing where to start.  There are so many components that depend on each other that learning one thing may lead you to have to learn another, which in turn may lead you to learn something else before you can understand the original thing.


Going down the rabbit-hole of dependencies is certainly something I experienced when first looking at how Bitcoin works. And although he describes the maths-first approach as “eating vegetables” I kinda like knowing how it all works behind the scenes so, to me, these are some tasty, tasty vegetables.

In this BTC# series of posts I’m going to work my way through Programming Bitcoin. I’ve been programming professionally in C# since 2001. It’s my native tongue and I’ll be translating the book’s Python into C# as I go.

Get the book: O’Reilly / Amazon / GitHub.

Next: Modular Arithmetic »

Waking Up to Excellence

Excellence Is the Next Five Minutes

“Excellence is the next five minutes”. So says Tom Peters, author of innumerable management books from 1982’s In Search of Excellence to 2018’s The Excellence Dividend.

This excellence thesis says that excellence is not some grand strategic thing. It’s a decision about how to approach each moment. Excellence is the next email. It’s how you say, “thank you”. It’s how you respond to a mistake.

If you’re supposed to be giving someone feedback on a presentation, genuinely pay attention and frame what you say with the presenter’s objectives in mind. If you’re supposed to be playing Bananagrams with your children, play the game well, engage with your kids, and try not to worry about dinner, or work, or the effects of loose monetary policy.

Excellence is not something you aspire to; it’s something you do. “Forget vision,” Peters says. “Forget dreams. Do the best you can right now.”

In The Excellence Dividend, he quotes former IBM chairman Thomas Watson. When asked how long it took to achieve excellence, he replied, “One minute. You make up your mind to never again consciously do something that is less than excellent.”

“Then,” Peters says in The Pursuit of WOW!, “you work like hell for the rest of your life to stay on the wagon.”

On the one hand, this is a relief. There’s no need to torment yourself coming up with a 25-year Excellence Strategy – just make sure that you do a good job of that next email. Consider the person on the other end. Be thoughtful and helpful. That much, we can all do.

It also kills dead the number one fault with grand resolutions, the idea that once they’re broken it’s all over. You don’t need to wait until the next big reset to try again. If you didn’t make it to the gym on the 3rd of January, the rest of 2019 can still be fine.

On the other hand, the idea can be intimidating. There are 288 five-minuteses in a day. That’s a lot of excellence to live up to. Even if I take the heat off when I’m asleep, that’s still 192 times I need to be on top of my game.

I just spent ten minutes idling around on Google image search pretending to look for pictures to illustrate this post. That wasn’t excellence. That was my brain switching into power-saving mode. Now it’s nearly lunch time and I’ve only got 132 chances left today to be excellent.

Worrying about every five minutes is just another version of the grand resolution fallacy. It’s just being smuggled in in five-minute chunks. Forget what’s been and what’s still to come. Just think about the one thing at hand.

Lessons from Meditation

There’s an analogy with meditation that I think is useful here. The first myth of meditation is that you need to empty your brain and if you have thoughts, fantasies, and all the other monkeys-of-the-mind popping up and distracting you, then you’re doing it wrong.

The opposite is true. The whole point of mindfulness is to notice the noise – which is going on the whole time regardless – and to return your attention to your breath or whatever your point of focus is.

As Dan Harris says in Meditation for Fidgety Skeptics, “Meditation is unlike anything else you do in life, in that here, ‘failing’ – that is, noticing you’ve gotten distracted and starting again – is succeeding.”

Meditators call the moment of noticing that you’ve been distracted, that flash of alertness, “waking up”. Noticing the distraction and refocusing isn’t getting it wrong; it’s exactly the thing that you’re practicing.

A similar “waking up” can be applied to the pursuit of excellence. You won’t be excellent, whatever standard you hold yourself to, every minute of every day. The point is to notice when you’ve drifted off, when you’re half-assing it, when you’re phoning it in, accept that calmly, and then recommit to doing a better job. And when you inevitably drift off again, repeat.

It doesn’t matter what’s happened in the last five minutes or the last twenty-five years. You can always “wake up” to excellence.

You don’t have to do anything fancy.

Excellence is the next five minutes.

Informative to Persuasive: Pathos

Part one of this post is here. Read it first if you haven’t already. There are a couple of exercises in there too, which I’ll continue with, so have your notes ready if you want to take part.



In part one, I talked about how facts by themselves aren’t very persuasive because we have a mental immune system that protects us from changing our minds.

In Rhetoric, Aristotle described three main modes of persuasion: logos (reasoning, words, and logic), ethos (the speaker’s credibility), and pathos (the emotions and psychology of the audience).

Last time, we looked at ethos. To convince your audience, you not only need to get your facts straight, but you need to gain their trust. You need to look credible and help them believe that you have something in common; that you have their best interests at heart.

Unfortunately, showing that you’re credible and that you have the audience’s best interests at heart still isn’t enough. Even then, facts aren’t that persuasive. We often decide what to believe first and then add the facts on later, to support our decision.


How do we decide? Emotionally. And that’s where pathos comes in. Pathos is the emotional appeal of your speech. You need the logos – the facts – to act as decision support but the pathos is what does the work.

When you present, do you want to bring your audience along with you? To see eager eyes and receptive faces? Do you dream of standing in the centre of the red circle at TED and getting to the climax of your speech, knowing that the audience is right there with you? You need feeling, pictures, stories.


Make Me Feel it

My wife came home from the supermarket one day with a picture of a little girl from Guatemala. I can 100% guarantee that if World Vision had been handing out spreadsheets detailing third-world poverty instead of photographs of cute but undernourished children there would have been no deal. World Vision and Joseph Stalin agree on one thing: One death is a tragedy; a million deaths is a statistic.

A statistician will tell you that anecdotes don’t prove anything. But statistics are paralysing. A marketer will tell you that a single child’s face – a tragedy you can avert – will arouse more feeling and compel more action than any number of spreadsheets.


How can you take your data and distill it into an emotionally compelling focus? World Vision takes a problem that seems too difficult to tackle – world poverty – and reduces it to a single child. No, you can’t solve world poverty, but you can help this one child. For just a dollar a day …

Make Me See It

What was Donald Trump’s number one policy during his 2016 presidential campaign? Every time I ask this question in a group, everyone calls out in unison, “Build a wall”.

Of course, it’s not a fully fleshed out policy. Will it be a wall or a fence? Will it run the entire length of the border? Will there even be a wall – is it just a metaphor for enhanced border security, whatever that means? It doesn’t matter. The point is that the wall is a physical object you can picture. Adding details to the policy would have detracted from the picture firmly cemented in your mind.


What was Hillary Clinton’s number one policy during the campaign? It’s very rare that anyone can answer this question with any confidence. Nobody doubts that she had policies, and that they were probably well-researched and well-developed, but nobody can remember any of them. There’s literally nothing to see here.

Pictures are powerful. Is there a concrete manifestation of your idea that you make me see? What image can you bring to my mind?

Tell Me a Story

Stories are memory glue. We’re far better at remembering stories that we are at remembering facts. We’re social creatures and we use a lot of brain power working out who did what to whom and why.

In the previous article on ethos, I told you that I had my mortgage with the same bank as Richie McCaw. A moment ago, I told you about my wife bringing home the picture of the Guatemalan girl. In the previous two sentences I didn’t tell you to use stories, I told you how I had used stories.

Stories, especially personal stories, illustrate the point you’re trying to make. They’re also far easier to remember. Since long before Call of Duty: Black Ops 4, or Survivor: Borneo, or the invention of writing, people have been sitting round campfires after dark telling stories. It’s part of who we are. How can you wrap your point up into a simple story to help it stick in my mind?


» Exercise

Look back at the questions you answered in part one of this article: what do you want me to believe and why should I like, trust, and believe you?

Now that you know what you’re going to say and you can help me think that you’re worth listening too, think about how you can make is stick with feeling, pictures, and stories.

What shared emotions can you arouse?

What visual elements can you make me see in my mind?

How can you make it personal? What stories can you tell?

The answers to these questions, along with the logical argument and personal credibility from part one, will give your writing or speaking a powerful boost.

Give Your Ideas a Chance

Saying that facts aren’t persuasive is not the same as saying that facts don’t matter. The point is that if you want your ideas to survive, they need to be nurtured with your credibility and your emotions. We need to hear and understand your ideas, but we also need to see them and feel them.

Use Aristotle’s three modes of persuasion to go from informative to persuasive and give your ideas the chance at life they deserve.

Informative to Persuasive: Ethos


Making the Mind Jump

Ideas are the most valuable things we have but those ideas are worth nothing if they don’t make the leap from your mind to someone else’s mind.

It’s not only a matter of launching your ideas out into the world. They need to be packaged in a way that makes them memorable.

This post is derived from a persuasion workshop I ran in person at a public speaking group in my home town of Christchurch in New Zealand. It includes exercises you can do to make your speaking or writing more persuasive.

What Doesn’t Work

I was trained as a scientist – I have a physics degree – and I work as a software developer. My natural inclination is to regard facts and logic as the only things that matter.

I’ve also dabbled in politics. Years ago, I stood for Parliament for a tiny party you’ve never heard of. I went to meet-the-candidates meetings and did interviews and argued my points rationally. It had no discernible impact.

For many years I’ve been involved in Toastmasters and have given speeches on all sorts of things. My favourite presentation style is the informative speech – taking a complex or technical topic and presenting it for a general audience. Making things simple is good as far as it goes but simple doesn’t always mean interesting.


No doubt many of you have been in similar situations. You’ve had something important to say, you’ve had all your facts together, but … it’s flopped. It’s disheartening. What can we do about it?

From the Other Side

Think about it from the audience’s point of view. When was the last time you changed you mind? I mean, really. We like to think that we’re open-minded but we don’t often change our mind. When we do it’s often not because of new facts.

In school we’re taught debating, with it’s point scoring and rebuttals. We’re taught to write essays with a set logical structure. We’re taught that arguments made of premises and conclusions are the way to persuade someone that something is true.

» Exercise

You can play along at home. Think of a topic that you’d like to tell me about. Think of a fact or an opinion that you’d like to convince me of. Write it down:

What do you want me to know or believe?

And then put down some supporting arguments.

What facts or data do you have to support your conclusions?

If you were going into a debate or writing a high-school essay, you could probably stop there. Let’s be honest: it would probably be dull and unconvincing.

Why We Resist New Information

We have a mental immune system that protects our minds from new information. When new information does get past, we try and fit it to the beliefs we already have.

We’ve had this mental immune system for hundreds of thousands of years, ever since we lived in tribes on the savanna. In those days, the tribe – possibly the only thirty to a hundred people you’d meet in your life – was everything. You lived with them, you ate with them, you slept with them. Changing your mind risked making you the odd one out. And if you were out, you were out. You’d have no shelter, no food, and no mate. For your survival, being right was less important that being part of the group.

When you have Christmas dinner with your family and someone says something you disagree with, do you correct them? Chances are you just keep quiet. Harmony beats truth.

Standing out from the group is scary. If you stand out from the group, your stone age brain reminds you, you might freeze, you might starve, you might be shunned by potential mates and die childless.


It’s no wonder that persuasion is hard. If we’re going to be persuaded, we need to be confident that these catastrophes won’t happen.

The Art of Persuasion

If logic by itself isn’t enough, what does work? To find out, we go to Aristotle. Rhetoric is the art of persuasion and Aristotle literally wrote the book on it.

In Rhetoric, Aristotle described three main modes of persuasion: logos (reasoning, words, and logic), ethos (the speaker’s credibility), and pathos (the emotions and psychology of the audience).



To get past the paleolithic mental defences you need to demonstrate to your audience that listening to you won’t turn them into pariahs. If the person you’re trying to persuade isn’t going to get kicked out of the tribe and die a cold, hungry virgin, they need to trust you and believe that you’re credible.

Do you have the skills and knowledge to talk on this subject? Do you have something in common with the audience? Do you have the audience’s best interests at heart?

At the start of this post I mentioned that the post is derived from a workshop I’ve run at a speakers’ group. It was presented as a simple statement of fact, but its real purpose was to provide a dose of credibility.

The need for ethos is why celebrity endorsements work. I have my mortgage with Westpac and I’m happy with that decision knowing that someone as professional, sincere, and humble as former All Blacks captain Richie McCaw does too. I know that I won’t get kicked out of the tribe for associating myself with such a widely respected local hero.


If you’re presenting, the person introducing you should build up some credibility in the eyes of the audience, but sometimes you need to be your own celebrity endorsement.

In You Talkin’ To Me, his guide to rhetoric, Sam Leith shows how public figures from popular American singers to notorious German chancellors use ethos to claim that they’re just like us.

Don’t be fooled by the rocks that I got
I’m still I’m still Jenny from the block.

Seventy years earlier, at the Siemens Dynamo Works:

German compatriots, my German workers, if today I am speaking to you and to millions of other German workers, I have a greater right to be doing this than anybody else. Once I stood amongst you. For four and a half years of war, I was in your midst. And through diligence, learning – and, I have to say, hunger – I slowly worked my way up. Deep inside me, I always remained what I had been before.

I’m still – I’m still Adolf from the block.

Politicians of all stripes are desperate to show off just how working class, or middle class, or just plain normal they are.

One of New Zealand’s most popular recent Prime Ministers, John Key, had no obvious political convictions, but most of the country agreed that he was the sort of bloke you could have a beer with. He was Prime Minister for eight years.

» Exercise

Look back at the two questions you answered earlier: what do you want me to believe and what supporting arguments do you have?

Now think about how you can get on side with your audience. Why should I believe you? What skills and experience do you have? Can you convince me that you and I have common interests?

Who are you? Why should I like, trust, and believe you?

As well as the logical structure of your message, you now also have credibility – a reason for me to listen to your message.


But Wait, There’s More

Unfortunately, showing that you’re credible and that you have the audience’s best interests at heart still isn’t enough. Even then, facts aren’t that persuasive. We often decide what to believe first and then add the facts on later.

That’s where Aristotle’s third mode of persuasion, pathos, the emotional appeal of your message, comes in. I’ll talk about that in my next post on the topic.