Author

Topic: Bitcoin Childchains Today w/ 2-way-pegs and no oracles/federations/multisigs (Read 408 times)

newbie
Activity: 16
Merit: 1
Using childchains would require using mainchain nodes too as childchains must be mainchain aware without requiring mainchain to be childchain aware, best of both worlds.

Childchains would natively depend on mainchain for security, so any devs working on childchain would have to keep mainchain interests in mind.

Mainchain hashrate is not hurt since childchains do not need hashrate and they accumulate fees otherwise not used for Bitcoin and increase payment to miners, effectively paying for more mainchain hashrate. Any tx demand from burning w/ high enough fees for inclusion in blocks increases the fee market and further increases mainchain security.

I honestly think this allows any and all altcoin type experimentation on Bitcoin, benefits Bitcoin, and removes need for altcoins



I've been trying to consider various options for such designs and mention why I chose what I did, could be wrong:

Quote
c- child chain (some refer to as side chain / sc)
m- main chain or parent chain


POB WINNING CHAIN TIP

1) pick child chain tip at c-height via (total) burnt size
---- gives advantage to higher burn amounts even if small % of total burnt, requires burning pools (e.g. 5% x 18, 10% x 1 - 18 people burning 5% lose to 1 person burning 10% of total)
---- revealing data for earlier large burn commit at later time does not necessarily shift c-chain tip if original chain has more accumulated burn

2) pick child chain tip at c-height via deterministic random func weighted by m-burn amount (source of randomness is current m-block-header-hash)
---- if winner for deterministic randomness is chosen based on all submitted burns, revealing c-block data for a relatively small burn at later time could shift the c-chain tip too easily
---- if winner for deterministic randomness is chosen based on all submitted burns, burn at later time for same c-block could shift chain tip
---- if winner for deterministic randomness is chosen based on all submitted burns & burns require reveal on childchain, revealing an old burn could shift the c-chain tip too easily

3) winner via tx fee instead of burn (allows miners paying enormous fee to themselves for free)
---- gives control to m-miners paying themselves when there's spare block space (so do not have to displace others fees)
---- if using covenants to limit to 1 tx, gives m-miners control when spare block space and low/no displaced miner fee from others

I consider (1) best. (2) can cause shifts in chain tips with relatively insignificant costs. (3) happens in (1) either way by being forced to pay enough of miner fee to be included in block. (2) might only work if



C-HEIGHT VS M-HEIGHT

1) c-height = m-height : you cannot post earlier c-height commitat later time
---- does not address doing m-chain commit at correct m-height but withholding c-data until later time

2) c-height independent of m-height: you can post any c-height commit at any m-height
---- allows reorganizing childchain at later time via new commit or revealing old data

I consider (2) best. C-chain reorg can happen in both cases, but the latter does not punish tx that were delayed by a block before cancelation of rbf is broadcast.



WHO GETS C-FEES REWARDS ON CHILDCHAIN

changes to who gets fees is as damaging as changes to winning chain tip by changing state

1) winning chain tip gets 100%
- simplest but punishes losing chain tips

2) split b/w every burn for that c-height (weighted by amount)
- causes an issue for a burn at later m-height commits or revealed data for same c-height forcing changes to earlier paid out fees, invalidating state
- if m-miners double as c-miners, and others burns are discovered by mainchain miners, it creates incentive for mainchain miners to censor others burns to increase their own % payouts on childchain

3) split b/w every burn for that m-height (weighted by amount)
- possible if public childchain commits do not require reveal to know all participants & payout is independent of c-block validity or availability - cannot be changed later.
- if m-miners double as c-miners, and others burns are discovered by mainchain miners, it creates incentive for mainchain miners to censor others burns to increase their own % payouts on childchain

4) split rewards between main-chain miners and child-chain "miners/burners" (e.g. 50/50)
- total burnt doesn't change via split, still unforgeable costliness
- payout to childchain miners is smaller reducing how much they are willing to burn and thus childchain security
- miners get paid enough of a main-chain fee regardless for burns to be included in full blocks
- at ~0% childchain adoption m-miners get paid aggregation of smaller fees so reduces incentive to censor childchains and encourages to allow childchain "mining" by others if they want to withdraw via burn-diversion scheme
- at ~100% childchain adoption m-miners would still get paid on childchain even if nobody is sending mainchain tx, otherwise main chain hashrate would go unpaid and security would be gone

5) only paying main-chain miners
- forces them to actively produce c-blocks and thus be child-chain aware forcing higher costs on them
- at 0% childchain adoption, would be very difficult to expect any significant burn. Allowing others to produce childchain blocks for reward or for tx they want goes away. Also, if independent burners aren't incentivized to include all childchain transactions for their fees, they have no cost to censor other childchain users.

Simplest is (1) + (4). (3) seems to suffer from incentive problem of possibly making it more profitable for childchain-miners to censor other childchain-miners. Also (4) appears to be required to account for high % adoption and incentivizing main chain miners not censoring childchain at low % adoption. Incentivizing main chain miners to allow childchain seems safest via being paid in childchain coins. Either way, mainchain miners do get trickle down of accumulated small fees on childchain by burners being able to include larger mainchain fees to be included in blocks.

PAYING MAIN CHAIN MINERS?

1) no, only enough fee for inclusion
---- doesn't dissentivize childchain censorship if miners decide it's profitable

2) yes, fraction of fees paid on childchain
---- gives more incentive for miners to allow childchains for extra income
---- at high adoption, can become main chain miners ~entire income
---- at low adoption & thus low value, miners can ignore childchain completely, doesn't force them to claim rewards, incentivizes miners to allow others to burn for withdrawals or use childchain for c-coins to have value

3) pay everything to main chain miners on childchain
---- removes incentive for child chain users to create blocks or include others childchain tx
---- at low adoption, miners can ignore childchain and effectively stop its growth forever

4) require payment of fraction of burn to mainchain miners on mainchain (not known ahead of time, so has to be for previous m-block)
---- miners can ignore childchain completely when accumulated fees are not worth syncing childchain nodes.
---- similar to (2) but gives miners additional discount on creating childchain blocks and thus control over childchain
---- does not incentivize miners to allow others to burn and propagate childchain without funds to withdraw on childchain

5) bmm style single tx where c-winner is effectively picked via highest miner fee and not burn amount (bmm requires output templates soft forked primitives)
---- miners get paid directly so safe at high % adoption, more direct transition than 50/50 mainchain/childchain miner split
---- minimum impact on main-chain utxo set
---- maximum discount possible for mainchain miners to control childchain blocks for censorship/doublespends/rewards at opportunity cost of non-miners fee displaced. e.g. m-miners can double spend on childchain by paying themselves 1sat-1000000 btc in tx fee without any risk of losing that money by referencing an earlier c-height at later m-chain height.

6) paying mainchain miners based on empty mainchain block weight
---- at low % adoption, does not incentivize mainchain miners to allow childchain
---- at high % adoption, effectively pays mainchain miners to censor mainchain users and force them to move to childchain
---- Encourages smaller bandwidth use by main chain for easier mainchain validation and creates a minimum main chain fee at which its more profitable for miners not to include that mainchain tx than to include for higher childchain reward.

I like (2) to account for both layers block producers independently. (4) is not necessary and worse for childchain security. Beautify in paying mainchain miners in childchain coins is in effect dissentivizes mainchain miners from creating childchain blocks if they want to withdraw 2wp as they would be literally reimbersing themselves for net-0 income from childchain. I dislike (6) since I want users to choose layer they want but I could see how it could be used to utilize childchains as means of protocol upgrades by abstracting mainchain to only miners and incentivizing use of higher layers. Block weight cap already limits bandwidth. Ideally impact on mainchain should be minimal & do no harm to mainchain. BMM (5) could be combined with burning to reduce m-miner discount and increase their costs while retaining minimum impact on mainchain utxo.

HIDDEN OR KNOWN CHILDCHAIN COMMITS/BURNS

1) Public burns and commits
---- Main chain miners might choose to censor childchain commits to prevent losses of fees to childchain.
---- On other hand, users that can only pay very small fees would have an option to childchain over nothing at all connected to Bitcoin miners. Mainchain miners would not benefit from those fees if they are too low to be included in full main chain blocks, child chain does serve as an aggregation or batching of many small fees into a single fee that's large enough to be included in the m-block.
---- If c-reward is split weighted by (winning burn amount / total burn amounts), m-minners might censor others burns on mainchain to reduce total burn amounts to maximize their c-reward
---- Immediately know the difference between accumulated burn between different block versions to calculate differences and thus how much additional cost would be required for a double spend.

2) Private burns
---- Allows withholding the reveal of a commit until later time for potential double spends
---- Immediately know the difference between accumulated burn between different block versions to calculate differences and thus how much additional cost would be required for a double spend.

lmk if group chat is undesired, I'm just happy to see any discussion on these sc/cc ideas.

MECHANISM OF WITHDRAWALS TO MAINCHAIN

1-directional peg to childchain is possible by burning mainchain coins to mint same # of coins on childchain.

1) Childchain commits require fraction of burnt amount (let's say 10%) to be used to payout withdrawal queue for validity. Childchain withdrawal requests to be added to the withdrawal queue can be published on as mainchain or childchain tx.
---- As long as childchain blocks are created, each requires burns & fraction of that used for withdrawals for validity, overtime all c-coins can be converted to m-coins at 1:1 or better at some point in future
---- For edgecase where users doing withdrawal from childchain are also childchain-miners they effectively pay 10% less to decide consensus from paying to themselves instead of someone else. However, the difference between someone else paying for their own withdrawal and themselves is, in first case, they get that withdrawal but, in the latter case, they do not get any new main-chain Bitcoin and effectively lose amount withdrawn to mainchain. Childchain security at each height can be approximated by businesses/exchanges via total accumulated burn; For measuring # of confirmations when childchain tx is secure, they simply need to account for maximum discount of 10% where 90% is still unforgeably costly
---- Childchain reorgs and overpaying withdrawals do not by themselves hinder future withdrawals

2) No withdrawal mechanism so price of childchain coins relies on 1-directional peg and demand of childchain keeping c-coin purchasing power as close to mainchain bitcoin
---- no risks from discounts for consensus to any party
---- strongly depends on unpredictable high demand or it falls below 1:1 value

3) Instead of burning mainchain coins, they can be placed in mainchain outputs controlled by childchain block producers. Peg depends on having a coin in mainchain reserve for each coin on childchain.
---- main chain consensus rules are not aware of childchains without main chain rule changes, so very hard to account for changes in block producers, non-responsive block producers, and malicious block producers
---- allows profitable collusion of childchain producers to steal more mainchain funds than costs to do it, breaking the peg.
---- any reorgs on childchain could mean invalid withdrawal was already done and thus reserve is already lacking coins and, thus, breaks 1:1 peg

I consider (1) best and unique in where 2 way peg can be created without mainchain changes without issues of collusion, trust, or oracles. It's hard to find another mechanism for source of mainchain Bitcoins.

Did I make mistake? Do you disagree? Please, let me know. Thank you!
legendary
Activity: 4410
Merit: 4766
child chains and side chains are just stupid ploys to try making an altcoin token be worth just as much as a true bitcoin token
the solution is not to divert people away from bitcoin.

the hashrate of one chain is more secure and important than diluting it down to loads of different chains.
because the more chains there are, the less secure each one becomes and more possibility to attack each one and repeat until every one is screwed.

its better to concentrate resources on one chain. that way its increasingly harder to be messed with by individuals.
same with coding..
its better to have 10+ teams working on one chain rather than 1 team per childchain. as its then easy to push in exploits if a team becomes corrupt and isnt independantly peer reviewed.
even the main bitcoin devs fear and dislike having to review other codebases for bitcoin. they fear it s much they get abusinve about it. so imagine their care/desire to even review a codebase thats not even looking after bitcoins mainnet... they wont/dont care

also the whole full node concern of users. if people are playing with sidechains. they no longer have any desire to be a full node for the main chain. because they 'burned' those coins thus no longer need to secure the main chain as they have no 'skin in the game' of the main chain.

its one of the flaws of things like LN. because people lock funds up for 1-6 months. they see they no longer need to be full nodes for that period. the coins are locked after all. so no harm.
and instead just run crappy lite wallets to buy crappy forum avatars. and play with millisat tokens but foolshly think that what they play with has the same security as a blockchain/bitcoin.

too many people just end up trusting crappy sidechains and alt networks all because they pretend to have the brand bitcoin attached, but never offer the same features and security level of bitcoin

..
so if you wanna play around with sidechains. go do it with an altcoin and see if it makes an altcoin any better. let it show its success or failure on an altcoin
newbie
Activity: 16
Merit: 1
Theoretical design possible today presented for review. Please be brutal.

Permissionless Bitcoin Childchains w/ Continuous Proof of Bitcoin Burn (CPoBB) and 2-way-value-pegs (2wvp)

Basic idea:

Childchain consensus on chain-tip is reached via highest total accumulated burn, possible today. Queue of withdrawals from childchain is filled as required for childchain block validity from a fixed fraction of amount burned. Deposits onto childchain require separate independent from consensus Bitcoin burns.  Combined this allows childchains with enforced 1:1 coins value peg in both directions (2WVP).

Quote
"burn" - act of rendering coins permanently irreversibly unspendable by anyone
c- child chain (some refer to as side chain / sc), cBTC = childchain-BTC
m- main chain or parent chain, BTC or mBTC = mainchain-BTC

Summary:

- Bitcoin can be the parent chain - highly secure and light PoW chain as it is today with no changes and no awareness of childchains
- Childchains will arrive at consensus on chain-tip based on total accumulated burned Bitcoin in return for childchain fees (simulating PoW sunk costs via sunk costs of burning Bitcoin)
- The child-to-parent-peg for childchain (cBTC) to Bitcoin (BTC) works by diverting a small fraction of burnt Bitcoins used for block commitments to reimbursing withdrawals over time (burning cBTC).
- The parent-to-child-peg for BTC to cBTC is done via a completely independent from block commitments BTC burns that generate equal number of cBTC.
- Both directions provide long timeframe 2-way-peg of creating/destroying ~1:1 valued assets w/ security on scale of burns over time. Atomic swaps provide short-time frame swaps between existing already 2wp assets.
- With no effect on or risk to mainchain, this would allow any degree of complexity to be anchored into Bitcoin, remain completely optional, and all risks and security scale with its own demand and some of Bitcoin's security.
- This inherits and simulates most of PoW benefits without additional energy costs for any number of childchains or any number of users without any of PoS downsides
- All Bitcoin owners would see Bitcoins becoming more scarce and thus more valuable

Childchain block producers and rewards:

Each childchain producer (burner) that's willing to burn Bitcoin will be assembling blocks and once ready will create a secret they will commit to the Bitcoin mainchain.
The new childchain blocks are not propagated until after there's a confirmation of commits on Bitcoin mainchain to hide the childchain commits from miners.

Quote

secret = hash of ( childchain id & hash of childchain block header & other data like address miner wants to use on childchain for fees )

Bitcoin block contains the following content embedded and part of its transactions (more on hiding them later):

tx11: burns 0.01 BTC &
tx56: burns 0.05 BTC &
tx78: burns 1 BTC &  
tx124: burns 0.2 BTC &

Total fees paid in childchain block version 1 is 0.8 cBTC from however many tx


After the Bitcoin block is created, the childchain blocks are propagated.

The secret is then calculated from childchain block headers and is matched to burn commit transactions.
Chaintip chosen for the childchain is by most amount burnt by a commit for a valid known block, tie break is by first seen by height and further by tx order.
When presented with multiple childchain chaintips (at different bitcoin mainchain blockheight), one is chosen by the highest total amount burnt (simulation of total accumulated work).

Total accumulated burn is easily calculated for each chain tip and provides similar incentives as using total accumulated work, only 1 layer higher.

Most likely tx78 is picked due to most burn at which point the block content is validated. (validating every block version every time is not necessary, only winners)
If the tx78's block is valid, the fees of that block's tx are distributed based on amounts burnt.
If the block is invalid (e.g. if tx124 was picked by hash) it's removed from all consideration and a new block is picked same way as before. (tx124 burner gets nothing)

Let's say tx78's block was picked & tx124 block wasn't so 0.8 cBTC in simplest design are distributed to winner.

However, some fee smoothing is ideal to reduce the load on mainchain and overshooting or undershooting the amounts burnt each Bitcoin block.
This way the burning doesn't have to happen every block and accidentally participating in a block with too many burners can be used to even out the diluted rewards.
Additionally there's then always an expected minimum fee payout for a future block even if there are too few transactions.

With fee smoothing 0.8 cBTC is added to fee pool (can be stored in the header) and let's say 50% of fee pool is distributed each round based on amounts burnt in last 6 blocks (arbitrary number used for example).
At steady state and on average the new tx fees added would be roughly the total fee payout in each block.
The distribution of fees this block would have to be part of next block in order for next block to be considered valid (either implied during this block or as part of coinbase tx in next block)

Quote
Optional:  
cBTC payout to burner = (50% of cBTC fee pool) * (Bitcoin this burner burnt for winning commits in last 6 winning commits) / (total burns by last 6 winning commits by anyone)

2-way Bitcoin peg

First of all, the deposits onto the childchain are always simplest: burning Bitcoin (separate from commits) on mainchain is seen as a signal to create equal amount of cBitcoin on childchain for designated recipient.
The withdrawals of Bitcoin to childchain are the hard direction, but as drivechain's design suggested, doesn't have to be fast. Withdrawal's job is to provide the equal value on mainchain to enforce the peg even if it takes a long time to withdraw. Once the value of pegs is fixed in both directions, the trade between existing cBTC and BTC can be done independent of peg process and much faster via atomic swaps, subatomic channel trades, and so on.

There is no multisig pool and thus no people in charge of collaterals to worry about nor any oracles to collude.
Instead, the childchain Bitcoin (cBTC) value is kept by a childchain queue funding those withdrawals over time from the sidestream off burning transactions.

Let's say the childchain validity requires all commits to put between 10 to 20% of Bitcoin intended for burning into paying off the withdrawal queue. The number is a range so that the ratio between burning and fee can't be used to ID the childchain commits & can be picked at random with total spent being same either way. Let's also cap the withdrawals to not payout more than 50% of each withdrawal balance left.

Using those example design parameters this is what might see:
Quote

Withdrawal queue:

1. 10k sats to requester A
2. 200k sats to requester B.

Block commits:

Burner C
    burns 20k sats to commit his version of childchain block to Bitcoin (80%)
    sends 5k sats to A's withdrawal (20%)

Burner D
    burns 10k sats to commit another version of childchain block to Bitcoin (85%)
    sends 1.7k sats to A's withdrawal (15%)

Burner E
    burns 50k sats to commit another version of childchain block to Bitcoin (81%)
    sends 5k sats to A's withdrawal (8.1%) (hit 50% cap on 1st so paying out next one as well)
    sends 6.7k sats to B's withdrawal (10.9%)

A fully paid (overpaid)
B remaining balance is 200k-6.7k is now at top for next block's queue


Note how overpaying A is not a big deal since we're not limited by a 1:1 pool to keep the peg. In fact his original withdrawal might've been much higher so wasn't overpaid significantly.

Hiding commits and withdrawals on childchain from miners until they are confirmed:

Simplest burning would just use OP_0 OP_RETURN type transactions with non-0 value.

Obvious burns and commits could be used as means to censor childchains by miners potentially seeking those transaction fees. Since they can't get around burning Bitcoin to access those, miners do not have significant advantage to win burns. To avoid miners censoring the childchain, fraction of the fees paid out on child chain must be paid to winning main chain miners on the childchain (e.g. 50%). This provides incentives to miners to support child chains without having to mine them. Withdrawals from childchain to main chain also requires other burners helping the child chain propagate safety.

If miners see obvious burning they can guess it's a childchain transaction. To hide that, provable burns can be hidden inside scripts. Various ideas of hiding burns are possible including varations on BMM or this:

The withdrawal and commits can be hidden as any P2SH and P2WSH transaction output as such:

BTC withdrawal output:
Quote
op_sha256 op_equalverify
< recipient pub key > op_checksigverify

spender's scriptSig stack: their signature,

Provably unspendable burn output:
Quote

op_drop
op_false

no spending script possible

In other words, when users withdraw btc from 2 way peg on main chain (that are present in every burn whenever there's anyone withdrawing still), they reveal the secret that can be used to determine the output script is just a number and then op_false and that output can be forgotten.

The withdrawal of BTC reveals the secret as part of redeem stack that can be used to prove op_false script in burn output even without having the full blocks from childchains.
Ideally the effective batching of many transactions fees on childchains for paying burners that can then pay higher transaction fees on mainchain will be reason enough for miners to not mind their use.
The outputs for withdrawals can ideally be batched even easier by recipients after schnorr soft fork on BItcoin.

If that's too complicated, just burn by any regular more obvious means. As long as miners get paid, there's little reason to censor childchains.

Transactions on childchain:

The childchain clients would be built on top of or combined with a Bitcoin client and be fully Bitcoin-aware.
The childchain network transactions and childchian blocks containing them would be broadcast in 2 ways:
1) over their independent network of nodes
2) embedded in Bitcoin network as optional backup for data availability

The fees in transactions would be paid in cBTC. To minimize frequency of having to use the Bitcoin chain for commits, all the fees would go into a fee pool and be distributed over a specific period.
The rules for transactions in childchains can be anything they want otherwise. Childchain transactions embedded on Bitcoin would likely have to be at least the most important ones like requests for withdrawals to mainchain to make all childchain nodes aware it was made and render blocks not including them as invalid to avoid burner censorship.

Burning pools:

To avoid the issue of larger burn amounts easily winning over many smaller burn amounts, burning pools can be used. Combine burns with PSBT from many people for child chain commit they agree with. Unlike some mining pools, it's quite obvious what child block hash they are signing.



This work was previously written up by me here https://bitcointalksearch.org/topic/m.53482314 but as it started not as a pure Bitcoin peg I didn't feel comfortable posting it here. However, as thought experiment progressed, I would like to see opinions on this method. Please look there for considerations of withholding childchain blocks attacks, measuring security of childchains, avoiding weak subjectivity, censorship, and many other concerns I had.

Please post here if you find major issues or not, possible attacks, let's see if this makes any sense to pursue, a sanity check of sorts. Wanted to get the views for it on a pure Bitcoin board.

I think this might be the best approach to optional infinite complexity and expressiveness on Bitcoin without any security compromises to the main chain nor the countless issues of inferior consensus systems.
Best of all it's possible today.

See you space cowboy

--- edit changes ---

- should pick 1 winner per child height for most burned. pick chain tip by total accumulated burn only.
- paying all burners would cause small burns for same child height revealed/posted later to change fee payouts and makes no sense. only pay winner

--- to review ---

- fee smoothing needs bit of rework
- must show boundary conditions at ~0% adoption and ~100% adoption including paying fraction of fees to main chain miners to keep them vested and paid
- considerations for bmm style single tx chain commits (need ctv or similar soft fork to only allow single output and avoid wasted burns)
Jump to: