Pages:
Author

Topic: Looking for a PHP /HTML/Xapo-API Person ! (Read 2192 times)

full member
Activity: 238
Merit: 100
July 16, 2016, 02:06:35 PM
#41

only question is, do you have anything in place to stop users using different addresses from the same IP/user agent so quickly. he could user about 30 different addresses and get paid all at same time.

One IP with 30 real BTC Addresses ? .. i think i don't have .. (but thats the other thing i asket prev. posts before - to increase the treshold (inex .000010000)) so that cheaters dont have fun, but basicly i wish everybody uses xapo ^^
hero member
Activity: 686
Merit: 502
maybe we misunderstand us a bit  Roll Eyes ..

For Xapo users the Balance is not needed (show 0 or nothing) .. because they will get the payout immediately (no threshold - [some other xapo faucet's have] - i am not).

For NON Xapo users the idea:

user claim -> Script get the balance from Xapo via API (this is working! - this is the point we are at the moment)

but if the user left the page and come back or do a browser refresh .. the balance disapear! .. the balance will only show again when he can claim again (after countdown).


Now what would really cool:
User left page and come back or do a brwoser refresh the Balance is still showing.

So maybe this only works with a login impementation via database (like moonbitcoin) or cookie-based .. i know cookie based is not server-side but if i use multi device i deal with it to see the balance after enter the BTC Address

 

Okay okay, I understand now.

best way to deal with this is mysql. just holding a balance for an address (no login). if user comes along with same address and his accrued balance reaches threshold, he gets paid (then his accrued balance goes to 0) and we start over with that user. or that address.

only question is, do you have anything in place to stop users using different addresses from the same IP/user agent so quickly. he could user about 30 different addresses and get paid all at same time.
full member
Activity: 238
Merit: 100
maybe we misunderstand us a bit  Roll Eyes ..

For Xapo users the Balance is not needed (show 0 or nothing) .. because they will get the payout immediately (no threshold - [some other xapo faucet's have] - i am not).

For NON Xapo users the idea:

user claim -> Script get the balance from Xapo via API and is showing on the Faucet Site (this is working! - this is the point we are at the moment - https://bitcointalksearch.org/topic/m.15587870)

but if the user left the page and come back or do a browser refresh .. the balance disapear! .. the balance will only show again when he can claim again (after countdown).


Now what would really cool:
User left page and come back or do a brwoser refresh the Balance is still showing.

So maybe this only works with a login impementation via database (like moonbitcoin) or cookie-based .. i know cookie based is not server-side but if i use multi device i deal with it to see the balance after enter the BTC Address

 
hero member
Activity: 504
Merit: 501
I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet

I was meaning other people who are NOT xapo though, What happens to them? if you want them to accrue a balance without being paid directly their balance will need to be stored somewhere.
Thats who we are talking about non Xapo acccounts
hero member
Activity: 686
Merit: 502
I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet

I was meaning other people who are NOT xapo though, What happens to them? if you want them to accrue a balance without being paid directly their balance will need to be stored somewhere.
hero member
Activity: 546
Merit: 500
I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet
Yeah you're right, Xapo hold the balances and Xapo pays directly to the wallet address once the threshold meets, any custom database tables are not needed, we just have to get/query the balance from the Xapo account using just the API, just like what 5ub_zero did.
hero member
Activity: 504
Merit: 501
I think what ever works its ok  but since Xapo hold the balance  i dont see the reason to have a table other then maybe easier for some one to code.  how does the balance change when xapo pays it because they pay it not the faucet
full member
Activity: 238
Merit: 100
I am interesstet in the SQL solution  Tongue
hero member
Activity: 686
Merit: 502
But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?

We could. but if the users uses a diff browser or clears his cookies he has lost his accrued amount. this would have to be stored server side.
How about, we add an additional table in the existing SQL database just for the payout threshold. Then it's like this:
-The user will enter a wallet address,
-Solve the captcha,
-Click Claim,
-The script will enter the address to the payout table and if the address exist,
-The script will proceed to getting the balance of the wallet address from Xapo,
-Then the script will write the value to the table overwriting the previous stored value, if any.

In the SQL table using phpMyAdmin panel, it will look like this:


What do you think?

OP wants no SQL side tables created. I suggested this or a flatfile db further up.
hero member
Activity: 546
Merit: 500
But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?

We could. but if the users uses a diff browser or clears his cookies he has lost his accrued amount. this would have to be stored server side.
How about, we add an additional table in the existing SQL database just for the payout threshold. Then it's like this:
-The user will enter a wallet address,
-Solve the captcha,
-Click Claim,
-The script will enter the address to the payout table and if the address exist,
-The script will proceed to getting the balance of the wallet address from Xapo,
-Then the script will write the value to the table overwriting the previous stored value, if any.

In the SQL table using phpMyAdmin panel, it will look like this:


What do you think?
hero member
Activity: 686
Merit: 502
But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?

We could. but if the users uses a diff browser or clears his cookies he has lost his accrued amount. this would have to be stored server side.
full member
Activity: 238
Merit: 100
But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.

I have no clue .. but an other "idea" .. could we work with a cookie here maybe ?
hero member
Activity: 686
Merit: 502
ok , i think i know what your trying to do...i will try and complete but im not an expert



ahh what a headache

Thats how it looks after claim with BTC Address


With Xapo EMail is zero cause we have no threshold and it immidiatly send out - thats correct

But that would require some form of storing the current account balance for that address if its not xapo. so we know how much the address has before it can be released.
full member
Activity: 238
Merit: 100
ok , i think i know what your trying to do...i will try and complete but im not an expert



ahh what a headache

Thats how it looks after claim with BTC Address


With Xapo EMail is zero cause we have no threshold and it immidiatly send out - thats correct
hero member
Activity: 546
Merit: 500
Hi, glad to see this thread moving.

@icanscript i would like to send you some BTC even though it was made before you completed here for your time. Also what he is saying is a great idea as far as setting threshold automatic or even to let them change it themselves . What i'm trying to figure out is how to have a balance for non Xapo users on the front page and is automatically checked when claimed instead of what i did here. http://www.bitcoinfaucetexchange.com/Balance.php

Though the page is a better advertising platform....would be more better in the front page.

Do you mean.

A user who uses the faucet who IS NOT a Xapo user also has a balance? so when they reach a certain amount they can then withdraw? and cant withdraw until they reach that amount?

That would work slightly differently, as we would need to store their addresses value, which we could do in a db like mysql, or a flatdb file.

My address is 1Dt5KPqWQ18L4EQ3DWzriHLnKfDg45uTx7 , thanks for any tips.

Regards,

icanscript
No, the account is held by Xapo and will show the balance if API is called but if its a email or a Xapo account BTC address the counter is always zero. subzero is talking about automatic setting threshold for 10,000 but for me it would be cool just to call the API automatic when claimed...so there is also an api call to change the threshold for any non-Xapo address.so no need for SQL table.
 I sent you a tip  https://blockchain.info/address/1Dt5KPqWQ18L4EQ3DWzriHLnKfDg45uTx7   Wink
The concept is the same as getting the own account balance, just like what I did to get my faucet's remaining balance. The difference is after claiming, we have to get the address from the address box then call the API to get the balance of that address, it will show 0 if the address is an e-mail. But it will only show after a successful claim, just like the referral link in Xapo faucets, only showing after a successful claim.
hero member
Activity: 504
Merit: 501
ok , i think i know what your trying to do...i will try and complete but im not an expert



ahh what a headache
hero member
Activity: 504
Merit: 501
OK .. cant sleep .. got an idea and testet it .. it works .. not at the best but a beginning .. ok what have i done ..

i took this part of script
Code:

require_once("functions.php");

$sToken json_decode(GetAuthToken());

if(isset(
$_POST['addyBalance'])){

$addyBalance $_POST['addyBalance'];

if(empty(
$addyBalance)) {
   echo 
"No Address Entered";
   die();
}

   
$ch curl_init();
   
curl_setopt($chCURLOPT_URL"https://v2.api.xapo.com/addresses/" $addyBalance);
   
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
   
curl_setopt($chCURLOPT_HEADERFALSE);
   
curl_setopt($chCURLOPT_HTTPHEADER, array(
     
"Authorization: Bearer " $sToken->access_token
   
));
   
$response curl_exec($ch);

and change the word "addyBalance" into username and "$addyBalance" into $username

this Code i put into the main index.php (not the style one) after the  if($response->success){ line ...

Code:
    if($response->success){
//EDIT
require_once("check/functions.php");

$sToken = json_decode(GetAuthToken());

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://v2.api.xapo.com/addresses/" . $username);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     "Authorization: Bearer " . $sToken->access_token
   ));
   $response = curl_exec($ch);
//EDITEND

Then i open the Style index.php and puted in
Code:
     


          $jsonresponse json_decode($response);
      echo 
'Your current balance = ' $jsonresponse->accrued_balance ' Cashout at = ' $jsonresponse->payment_threshold;
     
?>




OK now when i as non Xapo user Claim with the BTC Address i can see my Balance .. but now come the ugly part .. if i reload the browser its dissapears ... and i have to wait for the next claim .. maybe there is a smarter solution ?  Wink
  Im not sure what you did so i will go to your website and check
full member
Activity: 238
Merit: 100
OK .. cant sleep .. got an idea and testet it .. it works .. not at the best but a beginning .. ok what have i done ..

i took this part of script
Code:

require_once("functions.php");

$sToken json_decode(GetAuthToken());

if(isset(
$_POST['addyBalance'])){

$addyBalance $_POST['addyBalance'];

if(empty(
$addyBalance)) {
   echo 
"No Address Entered";
   die();
}

   
$ch curl_init();
   
curl_setopt($chCURLOPT_URL"https://v2.api.xapo.com/addresses/" $addyBalance);
   
curl_setopt($chCURLOPT_RETURNTRANSFERTRUE);
   
curl_setopt($chCURLOPT_HEADERFALSE);
   
curl_setopt($chCURLOPT_HTTPHEADER, array(
     
"Authorization: Bearer " $sToken->access_token
   
));
   
$response curl_exec($ch);

and change the word "addyBalance" into username and "$addyBalance" into $username

this Code i put into the main index.php (not the style one) after the  if($response->success){ line ...

Code:
    if($response->success){
//EDIT
require_once("check/functions.php");

$sToken = json_decode(GetAuthToken());

   $ch = curl_init();
   curl_setopt($ch, CURLOPT_URL, "https://v2.api.xapo.com/addresses/" . $username);
   curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
   curl_setopt($ch, CURLOPT_HEADER, FALSE);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array(
     "Authorization: Bearer " . $sToken->access_token
   ));
   $response = curl_exec($ch);
//EDITEND

Then i open the Style index.php and puted in
Code:
     


          $jsonresponse json_decode($response);
      echo 
'Your current balance = ' $jsonresponse->accrued_balance ' Cashout at = ' $jsonresponse->payment_threshold;
     
?>




OK now when i as non Xapo user Claim with the BTC Address i can see my Balance .. but now come the ugly part .. if i reload the browser its dissapears ... and i have to wait for the next claim .. maybe there is a smarter solution ?  Wink
hero member
Activity: 504
Merit: 501
Here is an example of someone else doing it. http://moonbit.co.in

As you can see there is a balance up top in a counter. If your a Xapo client the API knows and leaves at zero but if not the API shows the balance automatic.
Its basically the same  API calls but using the input box for address and the claim button to call the API to check/chnage threshold and post the balance if an Xapo acccount.  Here is the faucet script we are all using. https://github.com/destinybogan/Faucet-Builder

Thanks for the tip, Very much appreciated.

I cant see the counter at the top.

So a form. They enter their email or BTC address.

If xapo show balance and set a threshold of 0? if not xapo do nothing?



You will have to sign in to see up top... if Xapo no balance or threshold and counter is 0    if non Xapo counter shows balance
hero member
Activity: 686
Merit: 502
Here is an example of someone else doing it. http://moonbit.co.in

As you can see there is a balance up top in a counter. If your a Xapo client the API knows and leaves at zero but if not the API shows the balance automatic.
Its basically the same  API calls but using the input box for address and the claim button to call the API to check/chnage threshold and post the balance if an Xapo acccount.  Here is the faucet script we are all using. https://github.com/destinybogan/Faucet-Builder

Thanks for the tip, Very much appreciated.

I cant see the counter at the top.

So a form. They enter their email or BTC address.

If xapo show balance and set a threshold of 0? if not xapo do nothing?


Pages:
Jump to:
© 2020, Bitcointalksearch.org