Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Remove python-bitcoinaddress dependency p.2 (issue #2867) #2886

Merged
merged 14 commits into from
Nov 6, 2014

Conversation

techtonik
Copy link
Contributor

Previous PR #2885 got accidentally merged, so this is a continuation.

@techtonik
Copy link
Contributor Author

This is ready to be reviewed. This code for bitcoin address validation is written by Gavin Andresen (unlike the code used at https://pypi.python.org/pypi/python-bitcoinaddress), so it is tested and ported to multiple languages, and there is no reason not to trust it. If there is consensus to keep it as external dependency, I can make a package.

@Changaco
Copy link
Contributor

Changaco commented Nov 3, 2014

That bitcoin module looks terrible, it doesn't follow PEP8 at all.

@techtonik
Copy link
Contributor Author

@Changaco I intentionally left it consistent with original code, so that it is possible to compare it to original and ensure that it was not seriously messed with and modifications are visible.

In this case application security is more important than consistency of application code style, and on module level consistency is preserved, which is also what PEP8 says:
http://legacy.python.org/dev/peps/pep-0008/#a-foolish-consistency-is-the-hobgoblin-of-little-minds

So it does follow PEP8 in this way. =)

@techtonik
Copy link
Contributor Author

Good check would be to dump all bitcoin addresses from live db and run utils/bitcoin.py -i <address> over them. It should fail with non-0 status if some address can not be validated.

@techtonik
Copy link
Contributor Author

Rebased.

@chadwhitacre
Copy link
Contributor

IRC

@chadwhitacre
Copy link
Contributor

@techtonik The purpose of this PR is to get the GPL out of our codebase, yes?

@chadwhitacre
Copy link
Contributor

"Reach license clarity" #2881

@chadwhitacre
Copy link
Contributor

All current participant.bitcoin_address values pass the validation check (the tail call trims noise resulting from my .psqlrc):

[gratipay] $ echo "copy (select bitcoin_address from participants where bitcoin_address > '') to stdout" \
    | heroku pg:psql \
    | tail -n +4 \
    | xargs -n1 ./env/bin/python gratipay/utils/bitcoin.py -i $0 \
    | grep invalid
[gratipay] $


Gratipay changes:

[x] Django field type made optional
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove that code entirely instead of making it optional.

@chadwhitacre
Copy link
Contributor

I intentionally left it consistent with original code, so that it is possible to compare it to original and ensure that it was not seriously messed with and modifications are visible.

We should at least trim trailing whitespace.

@chadwhitacre
Copy link
Contributor

If there is consensus to keep it as external dependency, I can make a package.

This isn't a bad idea. Surely there are others who want a non-GPL bitcoin library. I say +1 on this route ... then we can clean up the code. :-)

@techtonik
Copy link
Contributor Author

@whit537, the primary purpose became to use approved and security checked code for bitcoin address validation. The secondary is to remove dependency that conflicts with new setuptools (and prevent Vagrant bootstrapping). Removing GPL dependency just adds to that.

Cleaning up the code...

@techtonik
Copy link
Contributor Author

All current participant.bitcoin_address values pass the validation check

Awesome. =)

@chadwhitacre
Copy link
Contributor

the primary purpose became to use approved and security checked code for bitcoin address validation.

Why does python-bitcoinaddress not satisfy this condition? Is it not approved? Or not security-checked? Or ... ?

The secondary is to remove dependency that conflicts with new setuptools (and prevent Vagrant bootstrapping).

Ah, yes. Now I remember: #2327.

Removing GPL dependency just adds to that.

I'm right that we want to not use GPL code, right? We can't use GPL code without releasing our code as GPL, right?

@chadwhitacre
Copy link
Contributor

@techtonik The Travis error looks like the one we were seeing after #2899. Did you rebase on master while it was in an inconsistent state?

@techtonik
Copy link
Contributor Author

Why does python-bitcoinaddress not satisfy this condition? Is it not approved? Or not security-checked? Or ... ?

It was copied from http://paddy3118.blogspot.nl/2012/11/some-identities-for-python-inttobytes.html and I don't know who is this guy, where this code was used, and if somebody from crypto experts reviewed it.

I'm right that we want to not use GPL code, right? We can't use GPL code without releasing our code as GPL, right?

It is not that clear, but I am sure FSF wants people to think so. I know for sure that LGPL is 100% fine to use, AGPL is 100% not ok. GPL must be somewhere in the middle, but it is better avoid speculations and don't use it.

@techtonik
Copy link
Contributor Author

@techtonik The Travis error looks like the one we were seeing after #2899. Did you rebase on master while it was in an inconsistent state?

Yes. It is now green though after the last commit.

@chadwhitacre
Copy link
Contributor

IRC re: GPL


"""
Bitcoin address validator by Gavin Andresen.
https://bitcointalk.org/index.php?topic=1026.0;all
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also reference this PR for convenience to document alterations:

#2886

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Done.

@chadwhitacre
Copy link
Contributor

That bitcoin module looks terrible[...]

What do you expect from an academic? ;-) It was written by Gavin Andresen, so while it might look terrible, I think we can have a high degree of trust in it (I believe that's what I hear @techtonik suggesting).

chadwhitacre added a commit that referenced this pull request Nov 6, 2014
Remove python-bitcoinaddress dependency p.2 (issue #2867)
@chadwhitacre chadwhitacre merged commit 4865141 into gratipay:master Nov 6, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants