Bitcoin Forum
December 13, 2024, 07:52:12 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Return to Sender  (Read 799 times)
optimator (OP)
Sr. Member
****
Offline Offline

Activity: 351
Merit: 250



View Profile WWW
November 01, 2013, 09:46:02 PM
 #1

Is it possible to construct a transaction such that if the coins are not spent after some pre-determined time period the transaction becomes null?

For example, I want to give 1 btc as a gift, but I don't want that gift to be thrown away.... I create a transaction that says I will spend 1 btc to address A. The coins can be spent from address A by the appropriate private key for 1 year. However, after 1 year the coins can no longer be spent and the original sender is free to re-spend the coins.

riplin
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 01, 2013, 09:58:13 PM
 #2

If you're handing out paper wallets, just add that you'll be swiping the funds after X months if they're not used. Problem solved.
optimator (OP)
Sr. Member
****
Offline Offline

Activity: 351
Merit: 250



View Profile WWW
November 01, 2013, 11:58:19 PM
Last edit: November 02, 2013, 12:25:02 AM by optimator
 #3

If you're handing out paper wallets, just add that you'll be swiping the funds after X months if they're not used. Problem solved.

I like you thinking! If I were a teacher I give you an A (I wish more teacher would give credit for answers out side the box)

But my example was only illustrative.

But I'm still curious if the protocol (script??) supports this feature.

riplin
Member
**
Offline Offline

Activity: 116
Merit: 10


View Profile
November 02, 2013, 12:15:08 AM
Last edit: November 02, 2013, 12:25:31 AM by riplin
 #4

No. All bitcoin transactions are non reversible. The only thing you can do is spend the coins to a new address, you can't revoke them.

Edit: Just to be clear, that goes for transactions that end up in a block. As long as it's not in a block (and not sent out to the network), you can obviously choose to spend the inputs of a transaction in another one, rendering the first one invalid. But I figured you meant transactions already in a block.
sebastian
Full Member
***
Offline Offline

Activity: 129
Merit: 119


View Profile
November 02, 2013, 03:11:02 AM
 #5

nLockTime?
https://en.bitcoin.it/wiki/Protocol_specification#tx

Create a transaction spending Coin X to receiver's public adress, but do not transmit it yet. Send txOUT to receiver. (eg the output, so the receiver knows what to write in input in the next transaction with nLockTime)
Ask receiver to sign a transaction spending Coin X with a nLockTime set to 1 year and seq=0 to your adress and send to you.

Broadcast both transactions.

Now, if receiver does not spend Coin X (which is done by resending transaction with same nLockTime but seq set to UINT_MAX), coin will automatically return to you after 1 year.

If you create a bonus card or a gift card, you simply create both transactions yourself, and broadcast. If the receiver of the physical card does not redeem the card Before nLockTime expires, funds return to you.



However, I don't know if nLockTime and sequence is enabled yet in network.


jonasbits
Newbie
*
Offline Offline

Activity: 16
Merit: 0


View Profile
November 02, 2013, 06:07:17 PM
 #6

Locktime and Sequence is not completely implemented in mainnet.

You can create a transaction that uses Locktime with Sequence = 0. If you try to broadcast the transaction before locktime, it will fail.
In Testnet, you are able to broadcast the transaction, and it will be included in a block sometime after locktime. Take note that the prev_outputs will be on hold, until included in a block.
I'm not sure how Sequence is implemented in testnet, there is talk about being able to replace transactions in mempool if you use a bigger Sequence number. That would enable prev_outputs to get unstuck from a broadcasted locktime transaction far in the future.

In mainnet Sequence = 0 is the only sensible value to use when specifying locktime, because there is only two possible outcomes:

  • locktime have expired, broadcast is successful
  • locktime is in the future, broadcast failed

If your intention is to plant very small amounts in paperwallets with an expire date, you could use ALL|ANYONECANPAY to sign every "return to sender" transactions.
That would enable you to collect every unspent output and combine them in a single transaction to save on fees.

When all transactions are signed and saved for use when locktime have expired, you can purge all traces of private keys on your system :-)
forbun
Member
**
Offline Offline

Activity: 107
Merit: 10


View Profile WWW
November 03, 2013, 10:05:10 AM
 #7

I like this idea.

Note, today you can do this by relying on a third party service (e.g. Coinbase). With Coinbase you can send BTC to someone as a gift, and if they don't claim it, it automatically goes back to you.

Handing out paper wallets is also a cool idea, but works better on the tech-savvy. Mere mortals* can use Coinbase.

*Normal people

What name would you give to the smallest unit of bitcoin (0.00000001)? sat. What name would you give to 100 sats? bit. 1 bit = 1 uBTC. 1,000,000 bits = 1 BTC. It's bits
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!