Generating Wallets and Printing Them Securely

7 replies 399 views
its_hawkMember
Posts: 14 · Reputation: 65
#1Jan 10, 2025, 10:17 PM
Hey everyone, wanna share some code I wrote. Might be useful if you’re into crypto security! So, it generates a private key using a random number between 2^204 and 2^256 for crypto and prints it straight to a receipt printer. No saving is done on the computer. If you find this amusing, drop a note! Check out the demo video I made!
6 Reply Quote Share
dave.forkMember
Posts: 375 · Reputation: 185
#2Jan 11, 2025, 01:14 AM
Wait, are you saying it doesn’t store data on disk? I think it’s temporarily stored in memory, which means it can be accessed by software with the right permissions. Your approach might not boost security, especially since you're sending the key to a printer that often has closed firmware.
2 Reply Quote Share
its_hawkMember
Posts: 14 · Reputation: 65
#3Jan 11, 2025, 04:12 PM
Not worried about that. If you don’t know your gear, that’s on you. A malicious actor could look at anything on your PC, even banking info.
0 Reply Quote Share
Posts: 185 · Reputation: 37
#4Jan 11, 2025, 09:12 PM
I see a potential problem in your code. It looks like it could generate private keys outside the valid range. A Bitcoin private key should be between 1 and n-1, where n is the generator point in hex. Sure, the chances are slim, but it’s not impossible if your code is right. Might throw errors down the line when generating public keys.
2 Reply Quote Share
its_hawkMember
Posts: 14 · Reputation: 65
#5Jan 11, 2025, 10:11 PM
As long as secp256k1 is solid, I’m cool with the code. A tiny wallet possible is still way larger than Bitcoin's biggest puzzles. Plus, keep your cryptos safe by never sending from wallets you’ve used before. Always go for a fresh private key for unspent funds.
3 Reply Quote Share
Posts: 185 · Reputation: 37
#6Jan 13, 2025, 05:24 AM
Yeah, secp256k1 has been considered secure for ages. But your code doesn’t stop generating out-of-bounds numbers, which leads to invalid private keys. Good luck hoping the library catches these edge cases because I’m not counting on that.
5 Reply Quote Share
its_hawkMember
Posts: 14 · Reputation: 65
#7Jan 13, 2025, 07:24 AM
I fixed that private key range issue you mentioned! Thanks for pointing it out! Now it throws an error when it tries to go out of bounds. Always better to prevent problems.
1 Reply Quote Share
gang2015Member
Posts: 682 · Reputation: 62
#8Jan 13, 2025, 08:42 AM
If you really care about security, you'd wanna swap out random for secrets. Using the right libraries is key for safety.
3 Reply Quote Share

Related topics