bitcoinx / colored-coin-tools

22 stars 7 forks source link

bitcoinjs-lib: colored wallet #5

Closed killerstorm closed 11 years ago

killerstorm commented 11 years ago

Wallet needs to be updated to make use of color information, get integrated with colorman.

Some demo is required.

Bounty: 3 BTC

katuma commented 11 years ago

WIP.

I presume this includes sending colored coins too, ie finding proper color UTXOs and paying fees with uncolored coins.

killerstorm commented 11 years ago

Yes. It shouldn't be a problem if you refactor createSend: split out UTXO selection code.

Even better, you can make a function which constructs complete part of transaction for one color, i.e. yields both inputs and outputs, including change. We can later use such function in p2p exchange protocol.

katuma commented 11 years ago

This is the critical part, so here's sketch of early implementation if anyone dares to check (especially the fee split code)

https://github.com/katuma/bitcoinjs-lib/commit/2d2858fe6b9f5f858dd76189aa3043145b273bc8

(the gui/colorman part will be WIP for a while...)

killerstorm commented 11 years ago

This is good enough for a demo, but we would need to refactor it later...

One thing you can improve with little effort: get rid of this.currentColor and instead pass color as a parameter to each function. This seems to be a bit more verbose, but it is better this way.

Basically, it is up to called to have a concept of 'current color', it should not exist on low level. And it is harmful in case you want to display balance for each of known colors, for example.

killerstorm commented 11 years ago

Can you explain your strategy with finding colors of incoming unspent outputs? Who initiates coloring, what happens in a window of time when color is unknown?

(In ArmoryX there is COLOR_UNKNOWN state, which makes unspent out basically invisible for normal operations.)

katuma commented 11 years ago

Yep, this is indeed troublesome. EDIT: Undecided colors are not used now: https://github.com/katuma/bitcoinjs-lib/commit/be5c2f382cfff7c4e64af558658851464561e393 https://github.com/katuma/bitcoinjs-gui/commit/50f579cb5765546cd8636e39b53d24787271eb40

Using dedicated incoming address for each color is considered to be a nice shortcut (and actually good practice to prevent accidents like someone sends us color we dont have definition for yet, but is valuable and gets spent as btc...), but hacking on webcoin gui is excercise in futility.

Personally I'd opt to rewrite the ui from scratch :(

killerstorm commented 11 years ago

Can you please elaborate on what's wrong with webcoin ui, what parts need to be rewritten and how much time it might take?

(It would be better to post it into bitcoinX mailing lists, since I doubt a lot of people read issue comments.)

katuma commented 11 years ago

After some GUI wrestling, demo available at

http://webcoinx.tumak.cz/index.html