@zhangweis is on PowPing!

PowPing is a place where you can earn Bitcoin simply by socializing, for FREE.
Never tried Bitcoin? It's OK! Just come, socialize, and earn Bitcoin.
Check out zhangweis's activities

Bitcoin Script

visit channel home
Total Economy: 0.42 USD

Layer 1 order book contract with Layer 2 token

With the difficulty of the layer 1 token and ways of contract communication, we may need a way to have a layer 1 order book contract which can handle layer2 tokens.

Using techniques of op_push_tx, it's relatively easy to place an ask order as it only needs to verify received bsv.

To place an ask order, you can send token to a contract which verify output's bsv and token has the correct price. The bsv and amount is easy to verify as it's already verified by miners. The token output utxo is controlled by the contract.

But to place a bid order, you'll need to verify layer 2 token utxo which is tricky. To solve this problem, we can do a snapshot of all current token utxos and make a merkle tree from it. Then we get H(all token utxos)=merkle root, we put it in the contract. When some one wants to take the order, he needs to send tokens and also the merkle path to show that the token is in the list. The contract can verify the token against the merkle root.

As the merkle root is set in stone at the moment of bid order creation, future token utxos will not be in the list (merkle tree), if you have token utxos after the bid order creation, then you may need some coordinator's help to bridge your token utxos to token utxos beofre the bid order creation.

We may also face the double spend issue when 2 users take the same bid order at the same time. The user needs to keep a close watch at whether his request is satisfied and only when the tx is put into a block he can be assured.

An optional coordinator can be set in contract to improve user experience.

To have coordinator support, the contract can be spent in 2 ways.

1. by coordinator's signature. Coordinator needs to sign the tx using preset key, the public key is written in the contract.

2. with no coordinator's signature. This will be put in lower priority by verifying output's nLocktime to slight time after the order creation (like 10 seconds or 1 min.)

powered by powpress
link Tip
Share
tx
translate
unwriter tipped:
ccoincash tipped:
xhliu tipped:
What is tcpip in this ? Is tcpip a lower layer? There is a company called toda.network who is claiming to be able to build below bitcoin. Is this a good thing ?
zhangweis replied:
Layer 1 means directly use bitcoin script. Not about transport layers.
The layer 2 token needs to be utxo based.
mikolaj tipped: