Post
Topic
Board Project Development
Merits 1 from 1 user
Re: "Proof of Work" - A game about the history of Bitcoin
by
askii
on 02/06/2025, 01:43:32 UTC
⭐ Merited by stwenhao (1)
My plan is to see, if the official network can halt. I also wonder, if your chain is compatible with BIP-42: https://github.com/bitcoin/bips/blob/master/bip-0042.mediawiki

Because in the original code, after 64 halvings, the network started again with 50 coins. It was fixed by BIP-42, and I wonder, how your network will behave after 64th halving, and even if it can reach it without halting.
BIP-42 always makes me laugh every time I read it  Cheesy
But yeah it won't restart or overflow or do anything funky like that, the code for halvings is pretty simple:

Code:
let halvings = Math.floor(tip.height / chain_params.halving_interval);
return Math.floor(chain_params.subsidy_base / Math.pow(2,  halvings));
Javascript handles this nicely and block rewards will stay at zero after the last halving. You can verify for yourself by trying it in a JS console:

Code:
let halvings = Math.floor(100000000000000000000000000000000000 / 500);
console.log(Math.floor(5000000000 / Math.pow(2,  halvings)));


Also, I think some kind of "save" button will be needed, sooner or later, because then, it would be easier to restore the state of the network. Another feature I think about is "pruning". Because currently, everything lives in a memory. And if I could save some blocks on disk, and detach it from RAM, then it could be possible to test thousands of blocks, without killing my browser. Or even: pruning alone, without saving things, is also an option, to test some edge cases, like "no new nodes can join, because nobody has the full history anymore, and everyone switched to pruning".

And some minor UI things: when the price per coin is around 2.7 million dollars, it is no longer fully visible in charts. Also, charts seems to be in the future, because I have transactions from Jan 5, while I can see Jan 7 on the exchange.
I'll be releasing a major update sometime soon with more content, alongside that will be saving and other fixes.


​Edit: Custom secrets unlocked:
Code:
await encrypt_aes("<comment>stwenhao: Now I can make my own secrets!</comment>",await sha256('stwenhao'))
Array(75) [ 70, 226, 192, 193, 39, 154, 126, 71, 112, 129, ... ]
SECRETS.push([70,226,192,193,39,154,126,71,112,129,180,132,226,181,21,137,229,145,196,116,207,60,99,201,27,15,156,229,195,221,255,63,152,11,214,145,7,230,61,174,176,26,247,180,212,249,188,143,62,154,81,6,149,67,20,3,206,65,53,12,4,33,55,22,101,172,225,215,174,117,33,23,243,215,97])
And now, I can see this:
Code:
user@st> stwenhao
stwenhao: Now I can make my own secrets!
Which means, that users can also use "encrypt_aes" and "decrypt_aes" for encrypting and decrypting messages. And I guess, as long as everything is single player, you can just use things like that for any kind of encryption, including for example transaction signatures. Also, I guess if you will implement forum and private messages, then such things can be useful, to hide some things from the player, until they will appear in the story.
Nice! Yeah, it could be good for cheat prevention, my only concern really is overcomplicating my codebase and making it too messy for myself with a bunch of AES blobs and hidden keys. I think you're the only person that is exploring the game to this extent anyway  Grin

I'll give it some thought, but it's probably a future problem.