Bitcoin Forum
November 11, 2024, 11:42:18 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to spend coins from a secure wallet  (Read 583 times)
schnuber (OP)
Member
**
Offline Offline

Activity: 96
Merit: 18


View Profile
May 08, 2013, 08:12:21 AM
 #1

Hi guys

Referring to post https://bitcointalk.org/index.php?topic=17240.0 i have a question.

May someone please help me out on how to retrieve the money of a secure wallet.
So aiwk171 says in order the get the money back you should start the Live distro, install the bitcoin client and replace the wallet.dat file, then you are ready to spend your coins. But do I not have to download the full blockchain first each time I wanna spend my bitcoins this way.? This is a bit cumbersome, is there another way, that doesnt require to download the whole blockchain each time.
Greets
bitcoinminerz
Newbie
*
Offline Offline

Activity: 14
Merit: 0



View Profile
May 08, 2013, 08:51:15 AM
 #2

Multibit?
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
May 08, 2013, 12:51:31 PM
 #3

I can think of 4 options off the tip of my head:

  • Import the private keys into Electrum
  • Import the private keys into MultiBit
  • Import the private keys (or wallet.dat) into blockchain.info/wallet
  • Use createrawtransaction/signrawtransaction/sendrawtransaction in the "Console" interface in Bitcoin-Qt
schnuber (OP)
Member
**
Offline Offline

Activity: 96
Merit: 18


View Profile
May 08, 2013, 10:27:41 PM
 #4

I can think of 4 options off the tip of my head:

  • Use createrawtransaction/signrawtransaction/sendrawtransaction in the "Console" interface in Bitcoin-Qt

Thank you very much for this reply. May you elaborate a bit on this topic. Why does making raw transaction solve my problem of not wanting to download the blockchain.
 The other suggestions you made are also interesting, I will check them out.
buddrulez
Full Member
***
Offline Offline

Activity: 164
Merit: 100



View Profile
May 08, 2013, 10:45:08 PM
 #5

All sounds a bit suspect to me!
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
May 09, 2013, 12:40:17 AM
 #6

I can think of 4 options off the tip of my head:

  • Use createrawtransaction/signrawtransaction/sendrawtransaction in the "Console" interface in Bitcoin-Qt

Thank you very much for this reply. May you elaborate a bit on this topic. Why does making raw transaction solve my problem of not wanting to download the blockchain.
 The other suggestions you made are also interesting, I will check them out.

I'm pretty sure that createrawtransaction will allow you to create a transaction without having the inputs that you want to spend in your blockchain yet.  Of course you have to know what those inputs are, but you can look them up elsewhere (such as blockexplorer.com or blockchain.info).

Note: You need to make sure you know exactly what you are doing if you use createrawtransaction.  It is very easy to mess it up and lose all your bitcoins.  This is an advanced function for technically knowledgeable people.

This is a bit cumbersome, is there another way, that doesnt require to download the whole blockchain each time.

Note also that using createrawtransaction is cumbersome.  Perhaps not as cumbersome as waiting several days for a download, but certainly much more risky, and more cumbersome than clicking a button that says "send coins".
 
Assuming you decide that you've learned enough about it and you are sure you know exactly what you are doing, you can issue a createrawtransaction command to spend some inputs and send the value to new outputs (wherever is it that you are trying to send it).

Here's an example.

Lets say you previously received a transaction output for 1.08336887 BTC to an address 19Mz366CWAdi84587ZEDVUAui1nztH5MSn in the first (zeroth) output of a transaction with a transactionID of c3fb2a38ff0d1d8f60a9887c8909c85172268596a7b6d2a6b1c7966549471500.  For example this transaction: http://blockchain.info/tx/c3fb2a38ff0d1d8f60a9887c8909c85172268596a7b6d2a6b1c7966549471500

Now lets say you want to spend that output, and sent 0.9 BTC to address 1DhBKMWrMnZwMkvWsVpD7XWY3qBux1py5o

Lets also say you want to send the change back to your address of 19Mz366CWAdi84587ZEDVUAui1nztH5MSn

You could issue:

Code:
createrawtransaction [{\"txid\":\"c3fb2a38ff0d1d8f60a9887c8909c85172268596a7b6d2a6b1c7966549471500\",\"vout\":0}] {\"1DhBKMWrMnZwMkvWsVpD7XWY3qBux1py5o\":0.90000000,\"19Mz366CWAdi84587ZEDVUAui1nztH5MSn\":0.18286887}

This would create a transaction that would send 0.9 BTC to 1DhBKMWrMnZwMkvWsVpD7XWY3qBux1py5o and 0.18286887 BTC of change to 19Mz366CWAdi84587ZEDVUAui1nztH5MSn leaving 0.0005 as a transaction fee. For example this transaction: https://blockchain.info/tx/3ad09ee01058e568c08c2431d1ef6f7c6390417325f66c13110d573384216e6b

You will end up with a sequence of hex characters:

Code:
0100000001001547496596c7b1a6d2b6a79685267251c809897c88a9608f1d0dff382afbc30000000000ffffffff02804a5d05000000001976a9148b3ac275cc063ea5f02ecb62d07567d857333ff088ac27091701000000001976a9145bb8efcf57d0f98e1c4b591ac1c9ced0fdb4708688ac00000000

This is the unsigned raw transaction.

Next step is to sign the transaction to provide proof that you own the private key to the 19Mz366CWAdi84587ZEDVUAui1nztH5MSn address.

To do this you can issue the following command:

Code:
signrawtransaction 0100000001001547496596c7b1a6d2b6a79685267251c809897c88a9608f1d0dff382afbc30000000000ffffffff02804a5d05000000001976a9148b3ac275cc063ea5f02ecb62d07567d857333ff088ac27091701000000001976a9145bb8efcf57d0f98e1c4b591ac1c9ced0fdb4708688ac00000000 [{\"txid\":\"c3fb2a38ff0d1d8f60a9887c8909c85172268596a7b6d2a6b1c7966549471500\",\"vout\":0,"scriptPubKey":\"OP_DUP OP_HASH160 yourPublicKeyHashHere OP_EQUALVERIFY OP_CHECKSIG\"}] [\"yourPrivateKeyHere\"]

Replacing the text:
  • "OP_DUP " with "76"
  • "OP_HASH160 " with "a9"
  • "yourPublicKeyHashHere" with your public key hashed first with SHA-256 and then the result of that hashed with RIPEMD-160 (in this case 5bb8efcf57d0f98e1c4b591ac1c9ced0fdb47086)
  • "OP_EQUALVERIFY " with "88"
  • "OP_CHECKSIG" with "ac"
  • "yourPrivateKeyHere" with your actual private key to the 19Mz366CWAdi84587ZEDVUAui1nztH5MSn address
  • Remove all blankspace between the 76 at the beginning of the script and the ac at the end of the script.
.

Now, I've never tried this signrawtransaction step with a blockchain that isn't caught up, so I suppose there is a chance that this step won't work.  Hopefully someone with more knowledge or experience than me can stop by and either confirm or deny that this step will work, but I would expect that it should.

Assuming it works, you'll end up with an updated sequence of hex characters.  In this case:

Code:
0100000001001547496596c7b1a6d2b6a79685267251c809897c88a9608f1d0dff382afbc3000000008c493046022100e6c5c80b094bbb3a3a62cc0c059615b129ebb1fccc92295ac840486a45cdaa12022100e8e6fa0c8b3f361e6d966805732069c2854f10222a33f7d253e508185e27f11f0141046f4d347032fceb46395513be9223d4d23db7f0765cd9fb1701ca44cca7a4aab1d8a28ca5b7de3c43d19099a0bc14c1096226140077c1005b1359830877a3674affffffff02804a5d05000000001976a9148b3ac275cc063ea5f02ecb62d07567d857333ff088ac27091701000000001976a9145bb8efcf57d0f98e1c4b591ac1c9ced0fdb4708688ac00000000

You can then issue the command:

Code:
sendrawtransaction 0100000001001547496596c7b1a6d2b6a79685267251c809897c88a9608f1d0dff382afbc3000000008c493046022100e6c5c80b094bbb3a3a62cc0c059615b129ebb1fccc92295ac840486a45cdaa12022100e8e6fa0c8b3f361e6d966805732069c2854f10222a33f7d253e508185e27f11f0141046f4d347032fceb46395513be9223d4d23db7f0765cd9fb1701ca44cca7a4aab1d8a28ca5b7de3c43d19099a0bc14c1096226140077c1005b1359830877a3674affffffff02804a5d05000000001976a9148b3ac275cc063ea5f02ecb62d07567d857333ff088ac27091701000000001976a9145bb8efcf57d0f98e1c4b591ac1c9ced0fdb4708688ac00000000

To broadcast that transaction to the network.

Of course if you have some programming skills, it might be a lot easier to do this with a computer program that handles most of the steps.
schnuber (OP)
Member
**
Offline Offline

Activity: 96
Merit: 18


View Profile
May 09, 2013, 02:22:21 PM
 #7

Thank you very much for this instructive post. The procedure you describe would indeed exactly do what I intend to do. However, I think it is too complicated for me. Maybe someone else is smart enough to write a small script that would do the work. If so, please let me know.

The most easiest thing would be, if my client simply allowed me to send bitcoins even if it does not know whether I am in possesion of those coins. Of course if I do not posses the coins, the network would then reject my transaction. The benefit of this would be, that I could spend coins without downloading the blockchain. As you pointed out, whether I own coins I can figure out by blockexplorer so I actually do not need the blockchain for anything.

Have fun!
calecho
Member
**
Offline Offline

Activity: 94
Merit: 10



View Profile
May 09, 2013, 02:35:37 PM
 #8

Thank you for the information.Good job..We need posts like this! Grin
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
May 09, 2013, 02:56:08 PM
 #9

Thank you very much for this instructive post. The procedure you describe would indeed exactly do what I intend to do. However, I think it is too complicated for me. Maybe someone else is smart enough to write a small script that would do the work. If so, please let me know.

The most easiest thing would be, if my client simply allowed me to send bitcoins even if it does not know whether I am in possesion of those coins. Of course if I do not posses the coins, the network would then reject my transaction. The benefit of this would be, that I could spend coins without downloading the blockchain. As you pointed out, whether I own coins I can figure out by blockexplorer so I actually do not need the blockchain for anything.

Have fun!


Such scripts already exist.  However, if you don't understand the programming language that the script is written in, you need to be VERY CAREFUL about using it.  The person who writes it could include malicious code that steals your bitcoins.  At the very minimum you need to have a computer programmer whom you trust review the source code and confirm for you that it is safe.

Here is an example of some code that will do it for you.  You'll have to decide for yourself if you trust it or not:

http://brainwallet.org/#tx
schnuber (OP)
Member
**
Offline Offline

Activity: 96
Merit: 18


View Profile
May 09, 2013, 03:32:45 PM
 #10

Thx, very much appreciate your help
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!