Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement BnB strategy #10

Open
karelbilek opened this issue Jun 30, 2017 · 2 comments
Open

Implement BnB strategy #10

karelbilek opened this issue Jun 30, 2017 · 2 comments
Labels

Comments

@karelbilek
Copy link
Contributor

karelbilek commented Jun 30, 2017

@xekyo wrote a master thesis, where he evaluated several coin selection strategies on a large dataset

http://murch.one/wp-content/uploads/2016/11/erhardt2016coinselection.pdf

The best strategy seems to be his own Branch and Bound strategy, that tries to look for exact match. It's defined in the thesis on pages 35 and forward.

The code seems to be here -https://github.com/Xekyo/CoinSelectionSimulator/blob/master/src/main/scala/one/murch/bitcoin/coinselection/StackEfficientTailRecursiveBnB.scala - MIT license

I am now trying to port the algorithm to javascript and to this module style.

See also bitcoin/bitcoin#7664 (comment) , murchandamus/CoinSelectionSimulator#3

edit: And also see c++ implementation here bitcoin/bitcoin#10637

@karelbilek
Copy link
Contributor Author

karelbilek commented Jun 30, 2017

I ported the code from scala to js here

https://github.com/runn1ng/coinselect/commit/0fc554ca3664a9cf14762d1578dd6cf9cd6abf94

The code still a little ugly, but it seems to be working and seems to produce the lowest fees in the stats.

I will clean-up the code now and then think about how to do the tests, when the algorithm is probabilistic. (It has a random utxo selection as a fallback.)

edit: OK there is an error in the algorithm; when I corrected it, the fees are similar to the other ones in the simulation.

@karelbilek
Copy link
Contributor Author

I am unassigning myself, I didn't touch anything Bitcoin for years now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants