DIY crypto wallet out of rain drops βοΈ
When rain starts - where do you look? π
Iβve always been drawn to look down at the street and see how raindrops spread across pavement - marking first watter drop hits on the ground before they cover it all.
Today was no different. When first rain drops hit my head, as usual, I started looking down - but this time, rain had not much concrete to cover apart from lawn and trees, sinse I was walking outside my familyβs countryside residence.
Im my world πΊοΈ
The only concrete in rains posession was a little alley near our house made of perfectly square cement blocks. They obserb rain drops flawelessly, creating a perfectly visible pattern.
The idea of using this natural random generation instantly came to me.
As a square makes a perfect shape to extract data from.
Letβs extract some DATA π
A square cement block can be seen as a grid: number by number.
So all we need to do is define the number (grid size) and extract coordinates to work with.
Instant idea π‘
Was to create a naturally-generated crypto wallet. And the best ratio for this job is 256x256
.
- To generate a wallet mnemonic, 128 bits of entropy are needed (BIP-39).
- Every coordinate X or Y on a 256Γ256 grid ranges from 0 to 255 β representing 1 byte = 8 bits.
- So a pair of (x, y) = 2 bytes = 16 bits of entropy.
- 128 / 16 = 8 pairs of (x, y) are needed to generate a 12-word seed phrase in BIP-39 standard.
Execution π¨π»βπ»
I took a picture of a cement square and mapped the rain hits coordinates onto a 256x256
grid using GIMP
.
1
2
3
4
5
6
7
8
9
10
11
// Coordinates of 8 raindrops on a 256 by 256 square grid
const raindrops = [
{ x: 23, y: 112 },
{ x: 65, y: 34 },
{ x: 136, y: 188 },
{ x: 110, y: 120 },
{ x: 101, y: 140 },
{ x: 227, y: 180 },
{ x: 144, y: 38 },
{ x: 228, y: 56 },
];
All thatβs left is to use BIP-39
to finish the job;
1
2
3
4
5
6
7
import { entropyToMnemonic } from 'bip39';
const entropyBytes = Uint8Array.from(raindrops.flatMap(({ x, y }) => [x, y]));
const mnemonic = entropyToMnemonic(Buffer.from(entropyBytes));
console.log("π§ Mnemonic:", mnemonic);
// π§ Mnemonic: blast link emerge badge shoulder destroy normal organ region license ribbon immense
Feel free to create your own unique wallet using the guide and code above β itβs also available on my GitHub.
NO NEED TO WAIT FOR RAIN: Grab a coloring brush and splash some color onto white paper β random splashes guaranteed π€πΌ