Bitcoin Forum
April 26, 2024, 11:08:09 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Broadcasting transaction with unconfirmed input(s)  (Read 2061 times)
phedny (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
July 31, 2012, 10:34:37 AM
 #1

Because of an invitation to a hackathon, I started thinking to work out an idea I had, so it could be implemented during the hackathon weekend.

Relevant for the idea is a question about the following scenario:

I am going to create two transactions, A and B. In B, I need an input that refers to an output with a specific amount, so in tx A I want to create that output.

1. In tx A, I create two outputs: one that holds the exact amount required for tx B and one that holds the change.
2. In tx B, I refer to the output of tx A

I now broadcast both transactions right after each other into the Bitcoin network. How will existing clients (miners) react to tx B, while it is not yet confirmed? Will both transactions be included in the same block, will tx B be rejected altogether until tx A has been confirmed or will client accept tx B, but hold it until A has been confirmed?
1714172889
Hero Member
*
Offline Offline

Posts: 1714172889

View Profile Personal Message (Offline)

Ignore
1714172889
Reply with quote  #2

1714172889
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714172889
Hero Member
*
Offline Offline

Posts: 1714172889

View Profile Personal Message (Offline)

Ignore
1714172889
Reply with quote  #2

1714172889
Report to moderator
1714172889
Hero Member
*
Offline Offline

Posts: 1714172889

View Profile Personal Message (Offline)

Ignore
1714172889
Reply with quote  #2

1714172889
Report to moderator
pieppiep
Hero Member
*****
Offline Offline

Activity: 1596
Merit: 502


View Profile
July 31, 2012, 12:41:13 PM
 #2

Do you mean what satoshi dice does?
http://www.satoshidice.com/
deepceleron
Legendary
*
Offline Offline

Activity: 1512
Merit: 1025



View Profile WWW
July 31, 2012, 12:43:40 PM
 #3

A transaction will not be included in the blockchain unless the address(es) that are funding it have a confirmed balance equal to or above the input amount. You can see many transactions here that are funded with unconfirmed coins Here - (bitcoincharts.com - warning-10MB web page). Just search for "1dice" and you will see that "Satoshi Dice" is paying out with unconfirmed coins (creating possibly 1000+ transactions that will never complete).
If the second transaction uses an input address with no previous balance, then it will remain pending until the first transaction (that pays adequate funds to that address) is included in the blockchain.
EhVedadoOAnonimato
Hero Member
*****
Offline Offline

Activity: 630
Merit: 500



View Profile
July 31, 2012, 01:05:10 PM
 #4

If the second transaction uses an input address with no previous balance, then it will remain pending until the first transaction (that pays adequate funds to that address) is included in the blockchain.

They may be included both at once though, in the same block.
phedny (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
July 31, 2012, 02:04:49 PM
 #5

They may be included both at once though, in the same block.

Actually, this is the answer I hoped to get Smiley

Is this also the way most implementations work right now?

What I'm working on looks much like https://en.bitcoin.it/wiki/Contracts#Example_3:_Assurance_contracts and since adding an output to hold the change in the group transaction makes the protocol more complex (and making it two-phase), this is not desired. Adoption of the idea might however be difficult if it requires multiple blocks before the confirmation of tx B is finished.
nibor
Sr. Member
****
Offline Offline

Activity: 438
Merit: 291


View Profile
July 31, 2012, 03:22:36 PM
 #6

See transactions for:
http://satoshidice.com/full.php?tx=e5cdfea713b511f993d36a6cad0ab6fe0e4d03ae4f17b3a5ccadb91c610230aa

Both incoming bet and outgoing payment are in same block:
http://blockchain.info/block-index/257078

jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
July 31, 2012, 03:29:52 PM
 #7


Transactions that cannot be connected to the main chain are known as "orphans."  The standard bitcoin client will keep up to 10,000 orphans in memory, before randomly deleting them to keep that at or below 10,000.

Connect-able transactions are stored in the "memory pool" -- the zero-confirmation state -- until they appear in a block.

Assuming that A is broadcast as well as B, you are connected to the chain, and your transactions will not be orphans.  Nodes will relay A and B for you.

As another poster noted, A and B may appear in the same block.



Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
phedny (OP)
Newbie
*
Offline Offline

Activity: 25
Merit: 0


View Profile WWW
July 31, 2012, 03:57:42 PM
 #8

Okay, cool. Thanks for the answers.

Based on these answers I'm going for the one-phase protocol.
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526
Merit: 1128


View Profile
August 03, 2012, 05:29:37 PM
 #9

Are you implementing assurance contracts? Would you give us more details?

As the author of that page I'm interested in anyone who is working on code for it.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!