So I dropped a puzzle involving Proof of Work in Script. Check it out here if you're curious. Basically, the private key to solve it is set to one, just to keep it simple for everyone. But there's a lot more to Proof of Work, especially with sidechains directly linked to Bitcoin. Think of sidechain transactions as easy one-input-one-output chunks, with peg-ins and peg-outs attached.
Exploring Proof of Work in Sidechains
7 replies 26 views
I've been meaning to jump in here, but honestly, this is a bit tricky to wrap my head around. Can someone break down the point of this puzzle securing the sidechain? Looks like the "puzzle transaction" is on-chain, not on the sidechain, and it manages peg-ins and peg-outs to stop double spends. Seems like a basic merged mining concept, right?
If Proof of Work is in Script, then it's enforced by the main chain. But sidechains can have their own rules too. Miners could potentially swipe all the funds on the sidechain by making Bitcoin-valid but sidechain-invalid transactions. BIPs like 300 and 301 assume something like this could happen. But hey, all Script conditions need to be met, right? So if the sidechain uses Proof of Work and locktime, then you gotta stick to that locktime.
Exactly, you’ve got this per-transaction merged mining setup. Grind a signature so it hits the target hash, then include the sidechain header in that message. Miners can grab the tx for fees, and the sidechain uses that "work" in the signature for deciding which chain to follow. But remember: what the sig commits to is key. Lock everything in with SIGHASH_ALL, and use fee adjustments like CPFP or RBF.
Gotta say, mining puzzles with SIGHASH_ALL is a bit sketchy. Once it's locked in, you can't change it. If you find a valid solution but someone moves inputs around, your signature could end up invalid, even if it did the Proof of Work. Using SIGHASH_ANYONECANPAY might be smarter; it lets anyone bump the fees without needing to re-grind everything.
Yeah I'm with you on fee flexibility. One way to balance it is to split duties. Strict anchor input with SIGHASH_ALL for binding the sidechain header and payout template, then a flexible fee input using ANYONECANPAY. This way "work" stays valid while allowing fee-payers to add coins last minute, keeping your intended payout intact.
Thanks for making this clearer! And big shoutout to @flapduck for joining in! My issue was mainly that BIPs 300/301 rely on the peg-in/out validators also being mainchain miners which adds security. You mentioned sending "shares" to the sidechain P2P network, but I’m still worried about those sidechains having less hashrate than the main chain.
You can set any difficulty level you want. It can be tougher than rewriting the main chain. When there’s no merged mining, that’s the limit you hit. You can keep a fixed difficulty or adjust it using OP_CHECKLOCKTIMEVERIFY. Some believe coins without merged mining might actually be better. But like, no real support from the community means merged mining isn’t happening anytime soon.
Related topics
- Exploring Proof of Work from a Miner’s Perspective 6
- Exploring Renewable Energy for BTC Mining 8
- Exploring Bitcoin Mining Opportunities in Indonesia and the Middle East 4
- Is a 24TB External Hard Drive Enough for Running a Solo Node? 3
- Funding Your Bitcoin Mining Adventure 9
- Need help setting up my Antminer 8