Bitcoin Forum
November 19, 2024, 02:20:31 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1] 2 3 4 5 6 7 8 »  All
  Print  
Author Topic: Yet another Coin Control Release [CLOSED]  (Read 47464 times)
cozz (OP)
Member
**
Offline Offline

Activity: 61
Merit: 15


View Profile
February 15, 2013, 01:38:36 PM
Last edit: March 22, 2014, 09:54:44 PM by cozz
Merited by ABCbits (5)
 #1

Here's some good news for all coin control fans:

I was going to merge the old coin control code, making a few changes to the crappy GUI form, but ended up in a complete rewrite of coin control:)
I have been testing this for a week now, works great for me, so I guess, I can throw this out to the public now.

What is coin control?
When you send bitcoins to someone else, the bitcoin client chooses kinda randomly which of your addresses will send the coins. With coin control you can exactly choose, which of your addresses will be the sending addresses. And even more specific which of your unspent outputs will be the sending inputs.
  
What is an unspent output?
Lets say your bitcoin address is 111. Now someone sends 1 BTC to this address. Now address 111 has one unspent output. Now someone else sends 2 BTC to this address. Now address 111 has two unspent outputs and a balance of 3 BTC in total. Now lets say you want to send someone 0.1 BTC. One could say "ok, simply subtract 0.1 BTC from the first unspent output and send it". But this is not possible, because the bitcoin protocol works different. You always have to spent the whole output. This means in this case the bitcoin client would take the first unspent output, send 0.1 BTC to the other person and 0.9 BTC back to yourself. For this the client creates a new change address in the background and adds this address to your wallet. This address would then have one unspent output of 0.9 BTC. This means every wallet has kinda "hidden" change addresses. For example if you now would loose your wallet, but still know the private key of 111, you would be only able to get the 2 BTC back. The 0.9 BTC from the change address are gone, because you would have to know the private key of the change address.
  
Why coin control?
The first version of coin control was called "Patching The Bitcoin Client To Make It More Anonymous". Sometimes when you receive bitcoins, the sender or even the public knows that it is you who owns the bitcoin address. Now if you later want to make a real anonymous payment, you shouldnt use those coins. Also you get full control over your unspent outputs and can do things like choosing which address actually owns the coins, clean them up or send all change back to the origin address etc. You can also prevent the bitcoin client from creating a change address by exactly sending the amount of selected unspent outputs minus the fee. Also you get a better impression of whats going on in your wallet and get a better understanding of the bitcoin protocol.

Changes to the GUI

Screenshots
screenshot1.png
screenshot2.png
screenshot3.png
screenshot4.png
screenshot5.png

Main
  • Settings checkbox "Display coin control features (experts only!)" (default=no)

Tab Send coins
  • Button Inputs
    • click on this button opens actual coin control dialog. If no Inputs are selected "automatically selected" is shown.
  • Change Checkbox
    • checked -> provide custom change address

Coin Control Dialog
  • Shows a list of all unspent outputs with two view modes
    • tree mode: outputs including change are grouped by wallet address
      tree can be opened showing the actual outputs for this wallet address including change
      if change, the change bitcoin address is shown in column "address", otherwise the column "address" is empty, because its a direct output of the wallet address having the bitcoin address already shown in the parent node (same with label)
    • list mode: simple list of all unspent outputs
  • select outputs by checkbox -> only the checked outputs are used when sending a transaction
    if none are selected -> coin control inactive (just as normal)
  • check/uncheck all by clicking on "(Un)select all"
  • sort colums
  • tooltip available in column list mode in column label for the change (shows from which address the change came from)
  • Context menu
    Copy to clipboard (amount,label,address,transaction id,lock,unlock)
  • Labels at the top
    Quantity: number of selected outputs
    Amount: sum of selected unspent outputs
    Fee:   see "Calculation of fee and transaction size" below
    minus fee: simply the amount shown is "Selected" minus the amount shown in "Fee"
    Bytes: see "Calculation of fee and transaction size" below
    Priority: priority = coinage / transactionsize. coinage = value * confirmations.  miners order transactions by priority when selecting which go into a block
    Low Output: "yes" if any recipient receives an amount < 0.01BTC
    Change: shows the change you get back
  • direct right click the labels for copy amount to clipboard
   


Selection
In this version of coin control, all selected outputs are going into the transaction for sure!!
Of course, if you select more than you actually send, the bitcoin core will send the rest back to you as change, just as normal.
And of course, if you select less than you send you will get "The amount exceeds your balance".
And as already mentioned, if none are selected, coin control is inactive, this means everything is just the same as without coin control.
  
Fee
If the sum of selected outputs minus the amount you are going to send is smaller than the required fee, you will probably get
"The total exceeds your balance when the transaction fee is included"
This is because you didnt select enough outputs to pay the fee.
You always must select enough outputs, so that those outputs can pay the fee.
  
Calculation of fee and transaction size
The fee is calculated according to the fee set in the Settings menu.
The calculation assumes 2 outputs in total. One for the destination address and one for the change.
The formula is nBytesOutputs + (2 * 34) + 10. nBytesOutputs is the sum of selected outputs, 148 or 180 bytes per output, depending if compressed public key.
Due to the inner workings of bitcoin the size per output is actually +/- 1 byte. Meaning the shown calculation is not always 100% correct.
If you send exactly "selected minus fee" then you will not have change (1 output only). The transaction will then be 34 bytes smaller as what was calculated before.

Free Transactions
In order to be able to send a free transaction, you need to follow the rules:
     - transaction size must be < 10000 bytes
     - priority must be at least "medium"
     - any recipient must receive at least 0.01BTC
     - change must be either zero or at least 0.01BTC
  If you violate one rule you will see a min-fee and also the labels turn red:
  Bytes.Priority,Low Output,Change. Depending which rule you violated.
  Those 4 labels also have tool tips explaining this.
  Also remember that violating one of the first 2 rules means 0.0005 PER kilobyte min-fee,
  while violating one of the last 2 means 0.0005 min-fee only.

Links
Source code
Pull Request
Binaries including this patch available here
Bitcoin OMG


1cozzwyCJvDiyBA8zXGJ1qxtrd5b4i1nB
debianlinux
Full Member
***
Offline Offline

Activity: 221
Merit: 100


View Profile
February 15, 2013, 01:44:10 PM
 #2

For example if you now would loose your wallet, but still know the private key of 111, you would be only able to get the 2 BTC back. The 0.9 BTC from the change address are gone, because you would have to know the private key of the change address.

Can this be verified? My understanding was that each address within a given wallet was simply another hash function of the same private key. That is, there is only a single private key for all of the addresses in a given wallet. If the quoted portion is correct then there is a private key for each address and I have a lot of remedial work to do.
DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4851



View Profile
February 15, 2013, 02:22:04 PM
 #3

My understanding was that each address within a given wallet was simply another hash function of the same private key. That is, there is only a single private key for all of the addresses in a given wallet. If the quoted portion is correct then there is a private key for each address and I have a lot of remedial work to do.

If the wallet used deterministic key generation (such as Electrum) then all the private keys could be derived from the single seed used for the deterministic algorithm. As of 0.7.2 Bitcoin-Qt uses a random key generation.  So the description in the OP is correct.  I'm not sure if this is changed in 0.8.0 (I haven't looked at that release yet).  I know there is work being done towards making Bitcoin-Qt deterministic, so the spirit of your statement may be true eventually in the future (even if the specifics aren't quite right).

I'm not sure that this means that you "have a lot of remedial work to do", but it certainly means that given the current 0.7.2 version of Bitcoin-Qt it is important to create backups on a regular basis. It also means that storing private keys from Bitcoin-Qt is only useful if you are not spending the bitcoin associated with those keys at all.
debianlinux
Full Member
***
Offline Offline

Activity: 221
Merit: 100


View Profile
February 15, 2013, 02:32:57 PM
 #4

It also means that storing private keys from Bitcoin-Qt is only useful if you are not spending the bitcoin associated with those keys at all.

This.
While I have electronic backups I also have paper backups and the paper backups consist of a single private key which is, apparently, insufficient.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
February 15, 2013, 02:38:26 PM
 #5

Version 0.7.2 and later include the raw transaction API (JSON-RPC), which permits full coin control.

The upcoming release 0.8 includes contrib/spendfrom/ utility, which illustrates how easily an external utility may provide coin control capability.  No GUI patching required.


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

Activity: 3486
Merit: 4851



View Profile
February 15, 2013, 02:42:16 PM
 #6

. . . I also have paper backups and the paper backups consist of a single private key which is, apparently, insufficient.
Assuming that you are using Bitcoin-Qt, and unless you are using a special "coin control" release that allows you to specify where the change goes, you are correct.  A paper backup with a single private key is insufficient.  Fortunately you've discovered this before it was a problem.

I'm don't know how old your electronic backups are, nor do I know how many transactions you create per month, but if the sum of all the bitcoin addresses you've created in "Receive Coins" and the total number of transactions you've created since your last electronic backup is more than 100, and you haven't modified your configuration to increase the size of the address pool, then you don't have a recent enough electronic backup either.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
February 20, 2013, 03:41:20 AM
 #7

Why isn't coin control in the main client? It seems like an EXTREMELY useful feature.

See the 'spendfrom' script in contrib/ of version 0.8.0.


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4284
Merit: 8808



View Profile WWW
February 20, 2013, 04:09:46 AM
 #8

Why isn't coin control in the main client? It seems like an EXTREMELY useful feature.
Because basically no one was interested in doing even the most basic maintenance on the GUI and the code that was submitted wasn't really mergable without work. We added the bare minimum for a sufficiently technical user to do it on their own (or for someone to roll an external GUI for it).

The screenshots look pretty interesting! This seems like a MAJOR improvement over the old stuff.  I'm more inclined to merge something like this than Jeff is sounding, assuming that the author is willing to endure the requisite hoop jumping and shed painting... not just because it's useful, but because its a feature that can help increase technical understanding of the Bitcoin system.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
February 20, 2013, 11:44:22 PM
 #9

Ideal for those who want a UI is simply to write an add-on utility or plugin that uses the RPC API.

Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
February 21, 2013, 08:10:07 AM
 #10

Please open a pullreq for this after rebasing to 0.8. Smiley

wiggi
Sr. Member
****
Offline Offline

Activity: 403
Merit: 251


View Profile
February 21, 2013, 06:52:28 PM
 #11

It feels like individual coins in the wallet now, each with it's own history
instead of just a number.

Bonus points for improved privacy, improved control over fees, and being
educational for noobs about how bitcoin works.

Please include it in 0.8.1 *exactly like this* Smiley
Luke-Jr
Legendary
*
expert
Offline Offline

Activity: 2576
Merit: 1186



View Profile
February 21, 2013, 06:53:25 PM
 #12

Please include it in 0.8.1 *exactly like this* Smiley
IMO, this is definitely a 0.9 feature at the earliest. Way too big a change for 0.8.x Smiley

cozz (OP)
Member
**
Offline Offline

Activity: 61
Merit: 15


View Profile
March 04, 2013, 08:31:23 PM
 #13

update v0.8.0

Changes:
- GUI: removed tab coin control, it is now integrated in send coins dialog as popup
- REMOVAL: removed trace back feature completely, because it is no more possible with pruned txindex
- FEATURE: control of change address (auto,back to input,custom)
- rebased to current master, using the new lockCoin methods
- updated screenshots
- submitted pull request

1cozzwyCJvDiyBA8zXGJ1qxtrd5b4i1nB
ShadowOfHarbringer
Legendary
*
Offline Offline

Activity: 1470
Merit: 1006


Bringing Legendary Har® to you since 1952


View Profile
March 05, 2013, 08:38:42 AM
 #14

@cozz:

This is soooo awesome.

I want to express my gratitude for your hard work on this. Is your donation address valid ?

creativex
Sr. Member
****
Offline Offline

Activity: 434
Merit: 250



View Profile
March 05, 2013, 08:57:20 AM
 #15

@cozz:

This is soooo awesome.

I want to express my gratitude for your hard work on this. Is your donation address valid ?

+1

Nice work!

rebroad
Newbie
*
Offline Offline

Activity: 26
Merit: 9



View Profile
March 05, 2013, 01:20:24 PM
 #16

Fantastic! Thank you! I shall be using this now in preference to the standard bitcoin-qt project. Do you have a reference to where the source is on github please? Also, I'd quite like to compile this myself on Windows - so if you'd be willing to include info on how you compiled the windows binary, this would be fantastic.

Thank you again!
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
March 05, 2013, 03:43:19 PM
 #17

Anyone know PyQt?  That could provide the same functions, without patching bitcoind / Bitcoin-Qt, for coin control via python-bitcoinrpc.




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

Activity: 1632
Merit: 1010



View Profile WWW
March 05, 2013, 03:58:01 PM
 #18

These python releases would be much more useful to most of us if they were integrated with python included and gui'ed in windows/LINUX/mac

Eyes open, No Fear. Be Safe! Trinity: Currency Without Bias
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1596
Merit: 1100


View Profile
March 05, 2013, 04:01:13 PM
 #19

These python releases would be much more useful to most of us if they were integrated with python included and gui'ed in windows/LINUX/mac

PyQt is a GUI API for python, so it would definitely be a GUI coin control app.  Integrated releases should be easily possible with py2exe and similar tools, for those platforms that need it.





Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
eldentyrell
Donator
Legendary
*
Offline Offline

Activity: 980
Merit: 1004


felonious vagrancy, personified


View Profile WWW
March 07, 2013, 03:36:38 AM
 #20

Cozz, you are awesome.  Used your own feature to send you a tip. Smiley  Hope this gets merged upstream.

The printing press heralded the end of the Dark Ages and made the Enlightenment possible, but it took another three centuries before any country managed to put freedom of the press beyond the reach of legislators.  So it may take a while before cryptocurrencies are free of the AML-NSA-KYC surveillance plague.
Pages: [1] 2 3 4 5 6 7 8 »  All
  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!