Timekoin and Python

Development & Technical discussion about Timekoin.
Forum rules
Bug Collecting Database is Click Here
GitHub Account is Click Here
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Timekoin and Python

Post by warmach »

I wanted to starting some development using Python but haven't done any crypto before with Python. I was wondering if anyone could point me to some libraries or code examples I could use for doing the crypto involved with Timekoin.

Thanks!
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Timekoin and Python

Post by warmach »

I guess this leads me to the next question, do I even need to do the crypto side of it in Pythong? Shouldn't the API handle all that? Right now, the api call to send TK requires that I do the hashing and encrypting before sending it to the server. Why couldn't there be an API call that you provide your public and private key, the address to send to, amount, and message? Let the TK server do all the necessary hashing. You would need to trust the server you are sending data to, which will probably be your own server anyway. This would allow easier interfacing into the network from third party apps.

Thoughts?
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Timekoin and Python

Post by KnightMB »

warmach wrote:I wanted to starting some development using Python but haven't done any crypto before with Python. I was wondering if anyone could point me to some libraries or code examples I could use for doing the crypto involved with Timekoin.

Thanks!
Do you plan on using the OpenSSL library or did you want to do all the crypto literally from scratch?
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Timekoin and Python

Post by KnightMB »

warmach wrote:I guess this leads me to the next question, do I even need to do the crypto side of it in Pythong? Shouldn't the API handle all that? Right now, the api call to send TK requires that I do the hashing and encrypting before sending it to the server. Why couldn't there be an API call that you provide your public and private key, the address to send to, amount, and message? Let the TK server do all the necessary hashing. You would need to trust the server you are sending data to, which will probably be your own server anyway. This would allow easier interfacing into the network from third party apps.

Thoughts?
Looking over the API list, currently the way to send a transaction to another server to process required encrypting the data ahead of time for the "send_tk" API.

But.. that doesn't mean another one couldn't be created to do exactly what you mentioned, which is don't worry about encrypting, let the server do it. Because the Private Key would have to be sent, that is really the only part to be careful with. So, sending to the destination server would be best done via HTTPS (SSL basically) then (provided the server supported it), it could do the work of building the transaction just like it would if you did it right on the server itself.

That would allow some very thin clients to be created, all they need to do is send the Private Key, Public Key, Amount, etc. (hopefully via some encrypted channel) and let the server do the rest.
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Timekoin and Python

Post by warmach »

KnightMB wrote:
warmach wrote:I guess this leads me to the next question, do I even need to do the crypto side of it in Pythong? Shouldn't the API handle all that? Right now, the api call to send TK requires that I do the hashing and encrypting before sending it to the server. Why couldn't there be an API call that you provide your public and private key, the address to send to, amount, and message? Let the TK server do all the necessary hashing. You would need to trust the server you are sending data to, which will probably be your own server anyway. This would allow easier interfacing into the network from third party apps.

Thoughts?
Looking over the API list, currently the way to send a transaction to another server to process required encrypting the data ahead of time for the "send_tk" API.

But.. that doesn't mean another one couldn't be created to do exactly what you mentioned, which is don't worry about encrypting, let the server do it. Because the Private Key would have to be sent, that is really the only part to be careful with. So, sending to the destination server would be best done via HTTPS (SSL basically) then (provided the server supported it), it could do the work of building the transaction just like it would if you did it right on the server itself.

That would allow some very thin clients to be created, all they need to do is send the Private Key, Public Key, Amount, etc. (hopefully via some encrypted channel) and let the server do the rest.
This is exactly what I want to do... No different than some of the browser based wallets available now. You need to trust the server.

Unless, and this is just crazy talk, would there be a way to create one time use keys?
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Timekoin and Python

Post by KnightMB »

warmach wrote:This is exactly what I want to do... No different than some of the browser based wallets available now. You need to trust the server.

Unless, and this is just crazy talk, would there be a way to create one time use keys?
You sure can, if you can generate a RSA key pair, it only needs to be 1,536 bits. Once you have the Private/Public Key pair, you could use them for one time transactions for example that zero out any balance they have, that way you don't have to worry as much about the private key going out wild into the Internet. :mrgreen:
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Timekoin and Python

Post by warmach »

KnightMB wrote:
warmach wrote:This is exactly what I want to do... No different than some of the browser based wallets available now. You need to trust the server.

Unless, and this is just crazy talk, would there be a way to create one time use keys?
You sure can, if you can generate a RSA key pair, it only needs to be 1,536 bits. Once you have the Private/Public Key pair, you could use them for one time transactions for example that zero out any balance they have, that way you don't have to worry as much about the private key going out wild into the Internet. :mrgreen:
You would still need to do a transfer ahead of time before using the key. In some ways it defeats the purpose. Are able to have multiple public keys that match up to the same private? I am not sure if that is how the algorithm works.
User avatar
KnightMB
Site Admin
Posts: 1019
Joined: Thu Feb 23, 2012 5:03 pm

Re: Timekoin and Python

Post by KnightMB »

warmach wrote:
KnightMB wrote:
warmach wrote:This is exactly what I want to do... No different than some of the browser based wallets available now. You need to trust the server.

Unless, and this is just crazy talk, would there be a way to create one time use keys?
You sure can, if you can generate a RSA key pair, it only needs to be 1,536 bits. Once you have the Private/Public Key pair, you could use them for one time transactions for example that zero out any balance they have, that way you don't have to worry as much about the private key going out wild into the Internet. :mrgreen:
You would still need to do a transfer ahead of time before using the key. In some ways it defeats the purpose. Are able to have multiple public keys that match up to the same private? I am not sure if that is how the algorithm works.
You can have multiple public keys for a private key, but the more public keys you produce, the more likely someone can take all the public keys and do some reverse-math to figure out the private key. So with RSA, it is assumed to only use one private key and public key to prevent that from happening.
User avatar
bucket
Posts: 32
Joined: Thu May 16, 2013 8:30 pm

Re: Timekoin and Python

Post by bucket »

Maybe these links could be useful?
RSA crypto implemented in python, you could still encrypt the data using python without needing to install openssl I believe?

https://gist.github.com/JonCooperWorks/5314103

https://gist.github.com/avalonalex/2122098

http://code.activestate.com/recipes/578 ... mentation/
warmach
Posts: 404
Joined: Thu Jun 21, 2012 5:18 pm

Re: Timekoin and Python

Post by warmach »

bucket wrote:Maybe these links could be useful?
RSA crypto implemented in python, you could still encrypt the data using python without needing to install openssl I believe?

https://gist.github.com/JonCooperWorks/5314103

https://gist.github.com/avalonalex/2122098

http://code.activestate.com/recipes/578 ... mentation/
Awesome! I'll be checking these out...
Post Reply