I haven't thought the details, but I'm sure it is possible.
The proposal is simple: decentralized a stock exchange with contracts.
Probably you should read this:
https://en.bitcoin.it/wiki/Smart_Propertyhttps://en.bitcoin.it/wiki/ContractsI'll explain it with an example:
1) The founder of the company sells 100 shares of his company by splitting a btc (or less) into 100 transactions with 0.01 btc to the buyers.
2) The holders of those ownership keys will receive the dividends.
3) Owners can place an ask order (not necessarily in the chain, but distribute it in a parallel p2p network) through a transaction that says sumarizing "I send this 0.1 btc to whatever address sends 30 btc (the selling price) to S2". In fact, the founder could have done this from the beginning.
I think the last part is actually the hardest part. Please, correct me if what I propose is not feasible the way I want to do it.
0) The seller just broadcasts a hash of his secret along with his public key (the receiving key for the trade, S2), the current ownership key (S) and the selling price (all signed with the ownership key). Then the
chain trade is executed with the seller of the share acting like B and the buyer like A. Almost nothing changes:
1) Both parties generates a new key and some random data (the secret).
2) Party S sends a hash of his secret to A along with his public key.
(already done in 0)3) Party A generates Tx1 (the payment
for the share, from A to S2) containing an output with the chain-trade script in it. See below for this script and a discussion of it. It allows coin release either by signing with the two keys (key A and key S) or with (secret A, secret S, key S). This transaction is not broadcast. The chain release script contains hashes, not the actual secrets themselves.
4) Party A generates Tx2 (the contract) which spends Tx1 and has an output going back to key A. It has a lock time of some point in the future and the input has a sequence number of zero, so it can be replaced. A signs Tx2 and sends it to S, who also signs it and sends it back.
5) A broadcasts Tx1 and Tx2. Party S can now see the coins but cannot spend them because it does not have an output going to him, and the tx is not finalized anyway.
6) S performs the same scheme in reverse
on the alternative chain to transfer the share. Both sides of the trade are now pending but incomplete.
7) A sends his secret (random data) to S, who then uses it to re-issue the now finalized contract using (secret A, secret S, key S) and an output of his choice (S2). S now owns the coins but in the process of claiming them, revealed his secret, allowing A to claim the other side of the trade
(to claim the share).
If someone thinks "hey, you have to trust that the founder/managers of the company will pay you the dividends", he is right. Yes you have to trust the managers when you want to buy shares of their company.
What do you think? Another use case for contracts?
Is there anything wrong in the trade part?