How to enable website users to trade bitcoins on my website? I also want user wallets stored on my server. So users user can buy and purchase bitcoins on my website and they can completely use my website as their local wallet. Like they can gets all information regarding all transaction as history on my website.
1 Answer
What you would probably want to do is just create one wallet for yourself which you encrypt, and then create some kind of data type on your server called wallet that you could create arbitrarily many of.
When people want to deposite money onto "their" wallet you would generate a new address for your wallet, which you can do as many times as you want. Once the bitcoins arrive you will credit them however many bitcoins they deposited on their fake wallet, which just lives on your server.
Then when they want to withdraw money you send bitcoins from your main wallet, making sure to never allow them to withdraw more then they have been credited.
When people want to make a purchase with bitcoins on your site you just give them whatever they paid for and deduct from however many bitcoins are currently being credited to their account.
While this is all possible, unless your making a heavily bitcoin centric service such as an exchange, I would recommend using a third party service which already has tools built for merchants such as coinbase or coinlab.