Bitcoin Forum
December 11, 2017, 03:48:23 PM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Broadcasting transaction with unconfirmed input(s)  (Read 1997 times)
phedny
Newbie
*
Offline Offline

Activity: 25


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?

1PHednyu7gf1zzhKQogKbpvNHQWQGb1Nvu
http://stichtingbitcoin.nl
1513007303
Hero Member
*
Offline Offline

Posts: 1513007303

View Profile Personal Message (Offline)

Ignore
1513007303
Reply with quote  #2

1513007303
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513007303
Hero Member
*
Offline Offline

Posts: 1513007303

View Profile Personal Message (Offline)

Ignore
1513007303
Reply with quote  #2

1513007303
Report to moderator
1513007303
Hero Member
*
Offline Offline

Posts: 1513007303

View Profile Personal Message (Offline)

Ignore
1513007303
Reply with quote  #2

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

Activity: 684



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

Do you mean what satoshi dice does?
http://www.satoshidice.com/

    ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄   
   ████████████████████████████████   
     ▀██████████████████████████▀     
        ▀████████████████████▀       
          ████████████████▀         
            █████████████           
            ▀████████████▀           
             ▀██████████▀             
              ██████████             
               ████████               
               ▀██████▀               
                ██████               
                  ▀                   
.
.trade.io.
██████
██████
███
███
███
███
███
███
███
███
███
██████
██████

▄██████████████████▄
███       ▀███████
███       █████████
███       █████████
███       █████████
███              ██
███   ▄▄▄▄▄▄▄▄   ███
███   ▄▄▄▄▄▄▄▄   ███
███              ███
███▄▄▄▄▄▄▄▄▄▄▄▄▄▄███
██████████████████▀

▄██████████████████▄
███████████▀ ███████
█████████▀   ███████
███████▀     ██▀ ███
███ ▀▀       █▄▄████
███          █▀▀▀▀██
███ ▄▄       ███████
██████▄     █▄ ▀███
█████████▄   ███▄███
███████████▄ ███████
▀██████████████████▀

▄██████████████████▄
████████████████████
███████████████▀▀ ██
█████████▀▀     ███
████▀▀     ▄█▀   ███
███▄    ▄██      ███
█████████▀      ▄██
█████████▄     ████
█████████████▄ ▄████
████████████████████
▀██████████████████▀
██████
██████
   ███
   ███
   ███
   ███
   ███
   ███
   ███
   ███
   ███
██████
██████
.
.Join the Trading Revolution.
deepceleron
Legendary
*
Offline Offline

Activity: 1512



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: 616



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
Newbie
*
Offline Offline

Activity: 25


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.

1PHednyu7gf1zzhKQogKbpvNHQWQGb1Nvu
http://stichtingbitcoin.nl
nibor
Sr. Member
****
Offline Offline

Activity: 389


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: 1484


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
Newbie
*
Offline Offline

Activity: 25


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.

1PHednyu7gf1zzhKQogKbpvNHQWQGb1Nvu
http://stichtingbitcoin.nl
Mike Hearn
Legendary
*
expert
Offline Offline

Activity: 1526


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!