in

Ethereum : Trustless inter-chain transactions: any flaws in the idea?

Ethereum update: Trustless inter-chain transactions: any flaws in the idea?



Originally posted on Stack Exchange (https://ethereum.stackexchange.com/questions/56066/trustless-inter-chain-transaction-with-bitcoin-are-there-any-flaws):

Let’s say that Alice wants to send Bob 1 BTC, and in return Bob will send Alice 1 ETH.

Alice’s Bitcoin address is BTC_A, and Alice’s Ethereum address is ETH_A. Likewise, Bob owns addresses BTC_B and ETH_B.

BTC_B is a “fresh” address, with no transaction history whatsoever.

Alice creates a single transaction to ETH_A containing slightly over the amount that she will send to Bob and broadcasts it. The transaction hash of this will be called tx1.

Bob waits for that transaction to be confirmed and then creates a smart contract with the following (immutable) parameters:

inputaddr, set to BTC_A

inputtx, set to the tx1_txhash from above

outputaddr, set to BTC_B

minfee, set to a “reasonable” Bitcoin fee/byte, based on current network conditions

waittime, set to the number of seconds after which a transaction with minfee will be confirmed on the BTC blockchain, plus a significant margin for safety

val is set to an amount representing 1 BTC, or however much Alice is sending to Bob

Bob also deposits 1 ETH into the smart contract, and is not allowed to withdraw it

Alice submits a transaction, tx2, to the Bitcoin blockchain with the following properties:

– inputtx is its only input
– outputaddr is its only output address
– fee > minfee
– signed by BTC_A

She also submits this whole transaction to the smart contract, which verifies these four properties. If they are all met, note the time as txtime.

Bob will continuously monitor the Bitcoin blockchain, and if Alice tries to double spend the input transaction, he will submit the double spend transaction to the smart contract. The smart contract will verify that this transaction is legitimate, and if it isn’t identical to the first transaction that Alice submitted earlier, will refund the ETH back to ETH_B.

Bob will also be able to withdraw the locked ETH if Alice doesn’t submit the BTC transaction to the contract in a reasonable amount of time.

If waittime has passed since txtime and Bob hasn’t submitted proof of a double spend, Alice can withdraw the locked ETH to ETH_A at her leisure.

———-

This seems like the kind of thing that someone would have already come up with, but I couldn’t find any other trustless examples of a BTC-ETH exchange. Is there a fundamental flaw in this system?




View the link

About Ethereum



Ethereum is a decentralized platform that runs smart contracts: applications that run exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference.

Author: Dmelc9

Score: 2

Don’t forget to share the post if you love it !

CryptoCurrency : Brazil Presidential Candidate Amoedo want to make Bitcoin legal currency

Blockchain : FREE XRP!