Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: troiste on November 11, 2013, 11:31:45 AM



Title: Creation of website using Bitcoins
Post by: troiste on November 11, 2013, 11:31:45 AM
Hello everyone,

I need to integrate Bitcoins in one future website but I have no idea how to do, can someone give me some insights?

The website will have personal user accounts and each account will have a BTC wallet associated with it, so that the user can transfer BTC to his wallet and see his balance on the website.

I need some API to do the following:

- Be able to create BTC wallets automatically (for each User account)
- Receive BTC on the created wallets
- Check the balance and confirmations on the created wallet
- Send BTC from the created wallets (In case user wants to withdraw)

How to do this?

Thanks


Title: Re: Creation of website using Bitcoins
Post by: Mitchell on November 11, 2013, 11:34:11 AM
BlockChain API provides everything you need. If you need help and are willing to pay for it, hit me up ;)


Title: Re: Creation of website using Bitcoins
Post by: Come-from-Beyond on November 11, 2013, 11:59:48 AM
Hello everyone,

I need to integrate Bitcoins in one future website but I have no idea how to do, can someone give me some insights?

The website will have personal user accounts and each account will have a BTC wallet associated with it, so that the user can transfer BTC to his wallet and see his balance on the website.

I need some API to do the following:

- Be able to create BTC wallets automatically (for each User account)
- Receive BTC on the created wallets
- Check the balance and confirmations on the created wallet
- Send BTC from the created wallets (In case user wants to withdraw)

How to do this?

Thanks

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list


Title: Re: Creation of website using Bitcoins
Post by: troiste on November 11, 2013, 01:29:13 PM
Seems is more or less clear with the Blockchain API, but what is the best and secure way to send Bitcoins automatically from the created wallets?

For what I see we need to send password in URL of the blockchain API to make payment, but isnt this unsecure?

Even they say in the page https://blockchain.info/api/create_wallet

"It is possible to send payments from the wallet by providing the guid and password to the blockchain wallet api. However this is not recommended as if the wallet password is changed or two factor authentication is enabled you will no longer be to access the wallet."

What should I do about this?



Title: Re: Creation of website using Bitcoins
Post by: Mitchell on November 11, 2013, 01:36:05 PM
Seems is more or less clear with the Blockchain API, but what is the best and secure way to send Bitcoins automatically from the created wallets?

For what I see we need to send password in URL of the blockchain API to make payment, but isnt this unsecure?

Even they say in the page https://blockchain.info/api/create_wallet

"It is possible to send payments from the wallet by providing the guid and password to the blockchain wallet api. However this is not recommended as if the wallet password is changed or two factor authentication is enabled you will no longer be to access the wallet."

What should I do about this?
It just states that if the password changes you aren't able to use the script anymore (until you update it). Also 2FA is not possible. It is possible to use a second password. I have been using the BlockChain API to make my faucet payments and it works just fine for me.


Title: Re: Creation of website using Bitcoins
Post by: troiste on November 11, 2013, 02:02:25 PM
Seems is more or less clear with the Blockchain API, but what is the best and secure way to send Bitcoins automatically from the created wallets?

For what I see we need to send password in URL of the blockchain API to make payment, but isnt this unsecure?

Even they say in the page https://blockchain.info/api/create_wallet

"It is possible to send payments from the wallet by providing the guid and password to the blockchain wallet api. However this is not recommended as if the wallet password is changed or two factor authentication is enabled you will no longer be to access the wallet."

What should I do about this?
It just states that if the password changes you aren't able to use the script anymore (until you update it). Also 2FA is not possible. It is possible to use a second password. I have been using the BlockChain API to make my faucet payments and it works just fine for me.

But isn't it unsecure to send the password via URL? In case someone sniffs the networks the wallets can be compromised, or no?


Title: Re: Creation of website using Bitcoins
Post by: Mitchell on November 11, 2013, 02:06:05 PM
Seems is more or less clear with the Blockchain API, but what is the best and secure way to send Bitcoins automatically from the created wallets?

For what I see we need to send password in URL of the blockchain API to make payment, but isnt this unsecure?

Even they say in the page https://blockchain.info/api/create_wallet

"It is possible to send payments from the wallet by providing the guid and password to the blockchain wallet api. However this is not recommended as if the wallet password is changed or two factor authentication is enabled you will no longer be to access the wallet."

What should I do about this?
It just states that if the password changes you aren't able to use the script anymore (until you update it). Also 2FA is not possible. It is possible to use a second password. I have been using the BlockChain API to make my faucet payments and it works just fine for me.

But isn't it unsecure to send the password via URL? In case someone sniffs the networks the wallets can be compromised, or no?
Well, they would have to be on the network of your host to sniff it out. So the possibility of that happening is quite low.


Title: Re: Creation of website using Bitcoins
Post by: troiste on November 11, 2013, 02:50:06 PM
Seems is more or less clear with the Blockchain API, but what is the best and secure way to send Bitcoins automatically from the created wallets?

For what I see we need to send password in URL of the blockchain API to make payment, but isnt this unsecure?

Even they say in the page https://blockchain.info/api/create_wallet

"It is possible to send payments from the wallet by providing the guid and password to the blockchain wallet api. However this is not recommended as if the wallet password is changed or two factor authentication is enabled you will no longer be to access the wallet."

What should I do about this?
It just states that if the password changes you aren't able to use the script anymore (until you update it). Also 2FA is not possible. It is possible to use a second password. I have been using the BlockChain API to make my faucet payments and it works just fine for me.

But isn't it unsecure to send the password via URL? In case someone sniffs the networks the wallets can be compromised, or no?
Well, they would have to be on the network of your host to sniff it out. So the possibility of that happening is quite low.

hm... in my opinion this is not secure, but ok... if it is the only possible way... because you know, hosting companies are run by people that we don't know at all :)

Thanks for useful info


Title: Re: Creation of website using Bitcoins
Post by: smeagol on November 11, 2013, 03:11:03 PM
You could probably use any web wallet's API


Title: Re: Creation of website using Bitcoins
Post by: JonnyBravo on November 12, 2013, 02:06:55 PM
A local bitcoind would be a far better idea. Why introduce an external point of failure you have no control over?


Title: Re: Creation of website using Bitcoins
Post by: inform on November 12, 2013, 02:36:48 PM
this sounds nice  ;) some hostings is make discounts i know in practic


Title: Re: Creation of website using Bitcoins
Post by: b!z on November 12, 2013, 02:37:16 PM
A local bitcoind would be a far better idea. Why introduce an external point of failure you have no control over?

If you don't know how to setup bitcoind safely, then you will have an internal point of failure.


Title: Re: Creation of website using Bitcoins
Post by: dudeami on November 12, 2013, 02:47:13 PM
A local bitcoind would be a far better idea. Why introduce an external point of failure you have no control over?

If you can give more details on the site (language?), that would help.

From what I see, your looking for the JSON-RPC API provided with bitcoind (the daemon version of the satoshi client).

Note this will require being able to execute a program in your production environment (aka, not a shared hosting plan) and have enough storage to hold the entire blockchain, as well as a CPU powerful enough to verify the blockchain in a timely manner (this isn't as important). Also note, any bitcoins stored on the site are vulnerable to hacks! Best to send them off to cold storage if they aren't required to be on the site (even then, delayed withdrawl is much better than no withdrawl). Please don't store large amounts of users coins in a hot wallet, I cannot stress this enough! This is the same for a blockchain.info API method where the password/private key is stored on the online machine.

Anyways, the RPC API calls your looking for:

Creating a new wallet
Code:
RPC: 'getnewaddress' 'user-01234'
Returns: '1YourUsersDepositAddress'

Getting the addresses of an account:
Code:
RPC: 'getaddressesbyaccount' 'user-01234'
Returns: [
    '1YourUsersDepositAddress11111',
    '1YourUsersDepositAddress22222'
]

Checking the balance of a wallet
Code:
RPC: 'getbalance' 'user-01234' <min_confirmations>
Returns: 0.00000000

Getting transactions (to display non-confirmed transactions)
Code:
RPC: 'listtransactions' 'user-01234' <limit> <offset>
Returns: {
    "account" : "user-01234",
    "address" : "1YourUsersDepositAddress",
    "category" : "receive",
    "amount" : 0.01234567,
    "confirmations" : 13172,
    "blockhash" : "000000000000002217950f22b11d8c3f6c957b29a764173c7a7562036f2aa17b",
    "blockindex" : 93,
    "blocktime" : 1378290684,
    "txid" : "87fd5e9e...",
    "time" : 1378289833,
    "timereceived" : 1378289833
}

Send BTC from account/wallet (note this will not go over the users balance)
Code:
RPC: 'sendfrom' 'user-01234' 1WithdrawlAddress 0.01234567 <min_confirmations>
Returns: '87fd5e9e...txid_goes_here'

Send BTC from server wallet (will take from any account, though account balances will not change):
Code:
RPC: 'sendtoaddress' 1WithdrawlAddress 0.01234567
Returns: '87fd5e9e...txid_goes_here'

Edit: To clarify, I am piggy backing off of bitcoind's internal account system. This allows multiple addresses to be tied to an account. If you ever want to give your users a new address (or they request it), running the getnewaddress call will give you another address, and both can be used. Note that an accounts balance does not always represent the actual amount of bitcoins in the address tied to the account (due to the ability to move coins off-chain to another account).

If you need more help, feel free to ask!