Author

Topic: What do OffChain Tx Look Like When They Hit The Blockchain? (Read 1245 times)

legendary
Activity: 1036
Merit: 1000
Thug for life!
I didn't see any post that actually addresses what a offchain transactions look like so here is my best attempt to draw one out.

Coinbase tells Alice a bitcoin deposit address via their webpage
Coinbase --(address)--> Alice | HTTP(s) when Alice visits the coinbase website

Alice deposit's 1btc into the coinbase address.
Alice --> Coinbase address | Standard bitcoin transaction recorded in blockchain

Coinbase notices that the address received 1btc and credits Alice in a private database
Alice account = 1btc | Essentially a SQL insert statement

Alice now sends Bob 1btc from her coinbase account. Bob's address also happens to be a coinbase address. Coinbase does NOT need to make this transaction on the blockchain.
Alice account - 1btc = 0btc | Essentially a SQL update statement
Bob account + 1btc = 1btc | Essentially a SQL update statement

Finally, Bob sends 1btc to a friend Charlie, but Charlie does not use coinbase. Coinbase must make a transaction on the blockchain.
Coinbase --> Charlie | Standard bitcoin transaction recorded in blockchain

As you can see, there were only 2 transactions recorded in the blockchain even though there were 3 total transactions. As long as both Alice and Bob trust coinbase to keep its DB correct, then they do not need the transaction recorded on the blockchain. Charlie doesn't care that the btc actually came from coinbase instead of Bob because the transaction has been recorded in the blockchain just like any other normal transaction.

The overall point of this is that bitcoin is fungible as it does not matter where the inputs for your TX came from as long as they are valid and do not get double spent.
legendary
Activity: 3416
Merit: 1912
The Concierge of Crypto
Here's a nice example: Take off-chain gaming sites that accept bitcoin.

1. Alice decides to play some dice, deposits some BTC.
2. Bob decides to play some dice, deposits some BTC.
3. Charlie decides to play some dice, deposits some BTC.
4. 20 other people want to play too, they all deposit some BTC.

- snip - a few hours later - a few hundred or thousand games played.

30000. Everyone lost except a few.
30001. Some of the winners decide to withdraw.


As you can see, there are maybe 20 transactions recorded in the blockchain, even though they all collectively rolled dice 30,000 times.

This is true of most of these game sites. There's one listed in my sig (the last one) which is a referral link for me.
member
Activity: 98
Merit: 10
I didn't see any post that actually addresses what a offchain transactions look like so here is my best attempt to draw one out.

Coinbase tells Alice a bitcoin deposit address via their webpage
Coinbase --(address)--> Alice | HTTP(s) when Alice visits the coinbase website

Alice deposit's 1btc into the coinbase address.
Alice --> Coinbase address | Standard bitcoin transaction recorded in blockchain

Coinbase notices that the address received 1btc and credits Alice in a private database
Alice account = 1btc | Essentially a SQL insert statement

Alice now sends Bob 1btc from her coinbase account. Bob's address also happens to be a coinbase address. Coinbase does NOT need to make this transaction on the blockchain.
Alice account - 1btc = 0btc | Essentially a SQL update statement
Bob account + 1btc = 1btc | Essentially a SQL update statement

Finally, Bob sends 1btc to a friend Charlie, but Charlie does not use coinbase. Coinbase must make a transaction on the blockchain.
Coinbase --> Charlie | Standard bitcoin transaction recorded in blockchain

As you can see, there were only 2 transactions recorded in the blockchain even though there were 3 total transactions. As long as both Alice and Bob trust coinbase to keep its DB correct, then they do not need the transaction recorded on the blockchain. Charlie doesn't care that the btc actually came from coinbase instead of Bob because the transaction has been recorded in the blockchain just like any other normal transaction.
sr. member
Activity: 325
Merit: 250
This is pretty normal, there would be very little point to moving funds around in the same wallet.
legendary
Activity: 1036
Merit: 1000
Thug for life!
Offchain transactions are just records or changes in a database of a service that provides accounts for users.
For example, if users A and B both have accounts at OnkelPaul.com, both can deposit bitcoins there by sending them to addresses handed out (and controlled) by OnkelPaul.com.
From then on, they can trade with each other (and anyone else who has an account at OnkelPaul.com) which will only result in balance changes in my account database. These are the so-called offchain transactions. Once they want to withdraw, the send a withdrawal request (using a web page or whatever is appropriate at OnkelPaul.com). I'll check that their account balance in my database is sufficient, then I'll deduce that amount from their balance and send it from one of OnkelPaul.com's hot wallet addresses to their withdrawal target bitcoin address.
One optimization (if I'm really eager to avoid miner fees) would be to batch withdrawals into one transaction so that one miner fee serves multiple withdrawals.

Onkel Paul
The biggest advantage of off chain transactions is that you can have essentially unlimited transactions without having to pay any miner fees. The problem with off chain transactions is that you must trust the central provider of your database to accurately keep track of how much each user has in their account, which is against the principles of bitcoin
hero member
Activity: 686
Merit: 500
So, Coinbase does a bunch of offchain transactions to save on miner fees, then they take all those transactions and put them on the blockchain all at once.

Is this correct? That is how it works, right?

What does that look like on the blockchain? When a third party like Coinbase enters in a group of tx at once? Anyone have a link to such a transaction?
No this is not correct. They only keep track of users' balances electronically. When a user wants to move their bitcon off of the coinbase "system" then coinbase will use various inputs that will be most efficient for them but will not necessarily be the inputs that you "received" from the off chain transactions. This allows for them to save on TX fees on the long term and allows them to have a competitive advantage for very small transactions
hero member
Activity: 854
Merit: 1000
I think that they are offchain until someone want them to be on the blockchai, i.e until someone wants to take them out of coinbase
legendary
Activity: 1039
Merit: 1005
Offchain transactions are just records or changes in a database of a service that provides accounts for users.
For example, if users A and B both have accounts at OnkelPaul.com, both can deposit bitcoins there by sending them to addresses handed out (and controlled) by OnkelPaul.com.
From then on, they can trade with each other (and anyone else who has an account at OnkelPaul.com) which will only result in balance changes in my account database. These are the so-called offchain transactions. Once they want to withdraw, the send a withdrawal request (using a web page or whatever is appropriate at OnkelPaul.com). I'll check that their account balance in my database is sufficient, then I'll deduce that amount from their balance and send it from one of OnkelPaul.com's hot wallet addresses to their withdrawal target bitcoin address.
One optimization (if I'm really eager to avoid miner fees) would be to batch withdrawals into one transaction so that one miner fee serves multiple withdrawals.

Onkel Paul
legendary
Activity: 1316
Merit: 1004
Although it will save fees for customers, it will hurt the blockchain from the long run. If all of bitcoin holders are approaching to such service, the accumulated transaction fees will be too few to incentivize the miners to carry on mining after the last block will be mined.
member
Activity: 75
Merit: 10
Right, but, does it look at all special?
legendary
Activity: 3416
Merit: 1912
The Concierge of Crypto
I think they simply don't touch your deposits until someone does a withdrawal to a wallet outside Coinbase.
member
Activity: 75
Merit: 10
So, Coinbase does a bunch of offchain transactions to save on miner fees, then they take all those transactions and put them on the blockchain all at once.

Is this correct? That is how it works, right?

What does that look like on the blockchain? When a third party like Coinbase enters in a group of tx at once? Anyone have a link to such a transaction?
Jump to: