Bitcoin Forum
May 02, 2024, 12:37:28 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Contracts  (Read 481 times)
dipsy (OP)
Full Member
***
Offline Offline

Activity: 210
Merit: 100



View Profile
March 06, 2013, 06:10:54 PM
 #1

I've been reading through Contracts on the Bitcoin wiki and just wanted to check something about one of the use cases: https://en.bitcoin.it/wiki/Contracts

Quote
Consider the example of an old man who wishes to give an inheritance to his grandson, either on the grandson's 18th birthday or when the man dies, whichever comes first.

To solve this, the man first sends the amount of the inheritance to himself so there is a single output of the right amount. Then he creates a transaction with a lock time of the grandson's 18th birthday that pays the coins to another key owned by the grandson, signs it, and gives it to him - but does not broadcast it. This takes care of the 18th birthday condition. If the date passes, the grandson broadcasts the transaction and claims the coins. He could do it before then, but it doesn't let him get the coins any earlier, and some nodes may choose to drop transactions in the memory pool with lock times far in the future.

Forgetting the scenario where the grandfather dies for the time being, what happens if the grandfather spends his coins before the 18th birthday? Or are the coins "spent" by the grandfather and in a locked state so that they can only be accessed by the Grandson once the lock time has past?

Thanks!
1714610248
Hero Member
*
Offline Offline

Posts: 1714610248

View Profile Personal Message (Offline)

Ignore
1714610248
Reply with quote  #2

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

Posts: 1714610248

View Profile Personal Message (Offline)

Ignore
1714610248
Reply with quote  #2

1714610248
Report to moderator
1714610248
Hero Member
*
Offline Offline

Posts: 1714610248

View Profile Personal Message (Offline)

Ignore
1714610248
Reply with quote  #2

1714610248
Report to moderator
tomcollins
Full Member
***
Offline Offline

Activity: 182
Merit: 101


View Profile
April 30, 2013, 05:32:26 PM
 #2

I had this same question.  If the transaction is never broadcast, then surely he can spend his coins, then the transaction is invalid when the grandson tries to cash it in.  If he broadcasts it right away, then it must somehow be revoked or modified for the death claim to work.  Is this understanding correct?  But that would still create a small window where the old tx is modified and the new contract added, leaving a chance for a spend in that time.  My understanding of txs is still very rudimentary, so I feel like I must be missing an important piece of this.
zedsdead
Newbie
*
Offline Offline

Activity: 6
Merit: 0


View Profile
April 30, 2013, 05:42:01 PM
 #3

I would like to hear how this can be resolved too.

Also, it looks like Ripple has a contract option too and it looks like it's being pushed more so than in Bitcoin.
jspilman
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
April 30, 2013, 06:46:50 PM
 #4

If you wanted to prevent the grandfather from spending the coins before the 18th birthday, you would use multisig.

Grandfather would pay into a multisig with his pubKey and his grandson's pubKey.  Then grandfather could make the same locked spend from the multisig, which would become valid when the grandson was 18.  The grandson would also sign with his key and broadcast when he's 18.
tomcollins
Full Member
***
Offline Offline

Activity: 182
Merit: 101


View Profile
April 30, 2013, 07:13:14 PM
 #5

If you wanted to prevent the grandfather from spending the coins before the 18th birthday, you would use multisig.

Grandfather would pay into a multisig with his pubKey and his grandson's pubKey.  Then grandfather could make the same locked spend from the multisig, which would become valid when the grandson was 18.  The grandson would also sign with his key and broadcast when he's 18.

Forgive me because I'm still pretty new in raw transactions and how they work, so I'm a bit lost with that explanation.  I'll try to re-explain it in my own words and if I make a mistake, let me know.

First a transaction is created that requires both the grandfathers and grandsons private keys to spend.  Once that transaction is broadcast, then the grandfather signs a new transaction that has a time lock on it of the grandsons 18th birthday.  This transaction isn't broadcast.  The grandfather hands the transaction to his grandson, who can sign it on his 18th birthday and he is guaranteed that the grandfather hasn't spent the money yet, since he never signed the money away.  Once his birthday hits, he signs it, and proves he now owns the coins, and they are his, and he can get the transaction into the blockchain.

Is this correct?

Personally, I am more interested in the other case (I'm not sure if both have to be combined) for it to work - the death condition.  But it sounds like something similar could happen.  A new tx is created that requires 2 people to spend out of.  The transaction would require a 3rd party to sign the transaction for it to be accepted at that time.  In particular, I'm interested in an escrow-like use case, where the address of the output changes based on an external state (oracle).  One transaction to set up the multisig, then another transaction to allow either to cash in once the oracle decides it can be cashed in?
jspilman
Newbie
*
Offline Offline

Activity: 19
Merit: 0


View Profile
May 08, 2013, 07:57:47 AM
 #6

Yes, that's right.

You can also do a 2 of 3 multi-sig and let the 3rd signer be the trustee of the estate.  If gramps kicks the bucket, the estate signs to release the funds early.
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!