Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Staring Owl on November 19, 2013, 07:57:16 PM



Title: Working with encrypted remote wallet over PHP?
Post by: Staring Owl on November 19, 2013, 07:57:16 PM
For security reasons the bitcoind and wallet are on separate server from the site.
The communication between the site and bitcoind is over SSL RPC.
php on the site side

Now I would like to encrypt the wallet, but then how do i remotely decrypt it to send money?
to be honest i really don't have idea how this would work :(


Title: Re: Working with encrypted remote wallet over PHP?
Post by: moderate on November 19, 2013, 09:16:00 PM
For security reasons the bitcoind and wallet are on separate server from the site.
The communication between the site and bitcoind is over SSL RPC.
php on the site side

Now I would like to encrypt the wallet, but then how do i remotely decrypt it to send money?
to be honest i really don't have idea how this would work :(

I really hope you are not running any service, this is very basic usage.

First you unlock the wallet, then do the operation you want. Check out the walletpassphrase command.


Title: Re: Working with encrypted remote wallet over PHP?
Post by: Staring Owl on November 19, 2013, 09:39:49 PM
nah, don't worry i'm just learning :)

is there a sample php code that does that?


Title: Re: Working with encrypted remote wallet over PHP?
Post by: moderate on November 19, 2013, 09:44:18 PM

is there a sample php code that does that?

How do you currently use RPC through PHP ? All you do is use the walletpassphrase the same way you use other commands, passing the password you used to encrypt the wallet and a number of seconds that specifies for how long the wallet will stay decrypted.


Title: Re: Working with encrypted remote wallet over PHP?
Post by: Staring Owl on November 19, 2013, 10:04:19 PM
i'm passsing them through array
ok if it's that simple i'll play a bit, but still ready to use code would have been better :)


Title: Re: Working with encrypted remote wallet over PHP?
Post by: BitCloud on November 19, 2013, 10:10:22 PM
site should connect to intermediate which in turn issues commands to bitcoind:

site connects to:

intermediate (either on separate or bitcoind server): sanitize inputs (reject sending more than x BTC for instance) and issue walletunlock

bitcoind


Title: Re: Working with encrypted remote wallet over PHP?
Post by: Staring Owl on November 20, 2013, 12:39:46 PM
wait? why intermediate?
i can't just give it commands over php from the site?
not really sure i understand :(


Title: Re: Working with encrypted remote wallet over PHP?
Post by: Stake on November 21, 2013, 12:13:07 AM
wait? why intermediate?
i can't just give it commands over php from the site?
not really sure i understand :(

Assuming you're using the jsonRPCClient class and have an object of the class, you can call whatever method you want by $bitcoin->methodhere('param1', 'param2');


Title: Re: Working with encrypted remote wallet over PHP?
Post by: Staring Owl on November 27, 2013, 01:15:15 PM
while it's unlocked for the timeout time everyone from the host  can take it right?

and seems like it needs to be unlocked for generating new addresses too, so chances are it will be unlocked good amount of the time
did i get it right?


if that's so, encrypting it, makes it only a tiny bit harder for someone from the host to take it, right?


Title: Re: Working with encrypted remote wallet over PHP?
Post by: Staring Owl on November 27, 2013, 01:38:24 PM
i seem to have been wrong
it seems like you can generate new addresses without unlocking with bitcoind
it's just bitcoin-qt that asks for a password for that

ok is decrypting only necessary only when sending money with bitcoind?