Bitcoin Forum
May 07, 2024, 05:07:26 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin Qt: lockunspent broken?  (Read 1179 times)
Hans0 (OP)
Member
**
Offline Offline

Activity: 91
Merit: 10


View Profile
February 28, 2014, 01:12:39 PM
Last edit: February 28, 2014, 01:35:40 PM by Hans0
 #1

In Bitcoin Qt, I tried to lock unspent outputs. My intention was to lock all but one to force a particular output to be selected for a transaction.

I understand it should work like this:

  • call lockunspent with a list of outputs
  • call listlockunspent and observe that all specified outputs are actually locked

Unfortunately, none are locked in my testing. What am I doing wrong? There was no error message. I entered the command in the debug window.

Edit: I reviewed the source code and I did not find any obvious usage errors on my part. Debugging the client is beyond my abilities, though.
1715058446
Hero Member
*
Offline Offline

Posts: 1715058446

View Profile Personal Message (Offline)

Ignore
1715058446
Reply with quote  #2

1715058446
Report to moderator
Even in the event that an attacker gains more than 50% of the network's computational power, only transactions sent by the attacker could be reversed or double-spent. The network would not be destroyed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3388
Merit: 4623



View Profile
February 28, 2014, 03:42:39 PM
 #2

In Bitcoin Qt, I tried to lock unspent outputs. My intention was to lock all but one to force a particular output to be selected for a transaction.

I understand it should work like this:

  • call lockunspent with a list of outputs
  • call listlockunspent and observe that all specified outputs are actually locked

Unfortunately, none are locked in my testing. What am I doing wrong? There was no error message. I entered the command in the debug window.

Edit: I reviewed the source code and I did not find any obvious usage errors on my part. Debugging the client is beyond my abilities, though.

I haven't used it yet, but don't you need to pass a parameter of "true" when calling lockunspent?

Code:
lockunspent true [list of outputs]

Where list of outputs is in the format:

{"txid":txid,"vout":n},...
Hans0 (OP)
Member
**
Offline Offline

Activity: 91
Merit: 10


View Profile
February 28, 2014, 04:32:45 PM
 #3

Yes, I did this. When I initially left it out I received an error. After filling it in the error went away.
btcseptember
Newbie
*
Offline Offline

Activity: 5
Merit: 0


View Profile
March 17, 2014, 07:53:21 AM
 #4

I got this:
Code:
Error: Error parsing JSON:ture
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4158
Merit: 8382



View Profile WWW
March 17, 2014, 08:05:46 AM
Merited by hybridsole (2)
 #5

Works fine here:


[gmaxwell@helmholtz tmp]$ bitcoin-cli listlockunspent
[
]
[gmaxwell@helmholtz tmp]$ bitcoin-cli lockunspent false '[{"txid":"76a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac","vout":0}]'
true
[gmaxwell@helmholtz tmp]$ bitcoin-cli listlockunspent
[
    {
        "txid" : "0000000000000076a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac",
        "vout" : 0
    }
]
[gmaxwell@helmholtz tmp]$ bitcoin-cli lockunspent true '[{"txid":"76a914a86e8ee2a05a44613904e18132e49b2448adc4e688ac","vout":0}]'
true
[gmaxwell@helmholtz tmp]$ bitcoin-cli listlockunspent
[
]
[gmaxwell@helmholtz tmp]$
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
March 17, 2014, 08:14:58 AM
 #6

Rather confusing command syntax might be the problem - try a "false" rather than a "true" by the looks of it.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
Hans0 (OP)
Member
**
Offline Offline

Activity: 91
Merit: 10


View Profile
March 17, 2014, 11:04:05 AM
 #7

Looks like I passed in true instead of false. With your example I tested it to work. Thanks!

As a feature request, it would be useful to have the ability to lock all outputs except for a given list of outputs. That would make it easy to send from a specific output bypassing the usual coin selection logic.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1091


View Profile
March 17, 2014, 09:14:32 PM
 #8

As a feature request, it would be useful to have the ability to lock all outputs except for a given list of outputs. That would make it easy to send from a specific output bypassing the usual coin selection logic.

If you need to send from a specific output, easiest to use coin control or raw transaction API.

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

Activity: 91
Merit: 10


View Profile
March 17, 2014, 10:51:51 PM
 #9

As a feature request, it would be useful to have the ability to lock all outputs except for a given list of outputs. That would make it easy to send from a specific output bypassing the usual coin selection logic.

If you need to send from a specific output, easiest to use coin control or raw transaction API.

Googling for "coin control" it seems that this is a non-standard feature not available in the official Bitcoin-qt. I do not like to trust other clients or branches. I'd like to have that feature available, though. Better than locking outputs.

Raw transactions seem error-prone to me. One mistake and the coins are gone.
Hans0 (OP)
Member
**
Offline Offline

Activity: 91
Merit: 10


View Profile
March 17, 2014, 11:21:00 PM
 #10

Doing further research it seems that 0.9 seems to have coin control. That's great news!
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!