Bitcoin Forum
June 19, 2024, 10:54:15 PM *
News: Voting for pizza day contest
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 14, 2014, 11:24:10 AM
This is a lot to bear in mind lol
but i'll handle.
Thank for the help Smiley
2  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 14, 2014, 06:28:40 AM
You said that i should keep the inputs of the transaction as an identifier.
Could you please be more specific about what part of the inputs i should keep?
The transaction hashes of the input transactions? the signatures of the input transaction?
3  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 13, 2014, 10:58:59 PM
What is the difference between txid and txhash? the comment above me says that i shouldn't rely on txhash as an identifier for a transaction since it can change...

About this code:

Code:
$transactions = $bitcoinrpc->listtransactions('accountname', 500);
foreach ($transactions as $tx) {

    if ($tx['category'] == 'receive' && $tx['confirmations'] < 10) {
        $id_user = $db->query('SELECT id_user FROM addresses WHERE address={$tx['address']}');
        $db->query('INSERT INTO balance (txid, id_user, amount, confirmations) VALUES ({$tx['txid']}, {$id_user}, {$tx['amount']}, {$tx['confirmations']})
                           ON DUPLICATE KEY UPDATE confirmations={$tx['confirmations']}');
        // (balance.txid must be defined as unique key of course)

        if ($db->affectedRows() > 0) {
            // number of confirmations for $tx has changed, do any prefered action
        }
    }
}

Where should i write it? in the blocknotify callback page? or do you say that i shouldn't call this code right after the wallet/block notify event and just save the txid in a file and use cronjobs to collect the data every couple minutes?
4  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 12, 2014, 02:32:19 PM
So perhaps the best way is to match the address, date and amount?

Code:
txdb = pull transaction from deposits table where address = tx.address and date = tx.date and amount = tx.amount

Is that right?
5  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 12, 2014, 01:57:55 PM
Ohh.. so just tell me if this pseudocode is right:

Code:
// Blocknotify callback page

blockhash = fromPost("blockhash");

transactions = getblock(blockhash);

foreach(tx in transactions) {
if(tx.hash exists in deposits table) {
txdb = pull transaction from deposits table where transactionHash = tx.hash;
txdb.confirmations = tx.confirmations;
txdb.save();
}
}

I loop through all the transaction in the block, for each transaction i check if it exists in the deposits table and if it does exist there, i update the number of confirmations of this transaction to the current number.

Is it right?
Thank you
6  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 12, 2014, 06:46:16 AM
Thanks for the help guys
Could you also address my second questions(about block notify) please?
7  Bitcoin / Bitcoin Technical Support / Re: walletnotify doesn't work on: August 11, 2014, 09:07:45 PM
- I just tried executing it without "bash", it says "Permission denied".
- I'm not sure, i'm pretty new to linux as well..
ls -l .../transaction.sh says "-rw-rw-r-- 1 arik arik 82 אוג 11 17:45 /home/arik/scripts/transaction.sh"

So you reckon that the problem is with the permissions?
I'm an idiot...   Undecided
8  Bitcoin / Bitcoin Technical Support / walletnotify doesn't work on: August 11, 2014, 02:56:44 PM
Hi Smiley i'm creating an exchange website and the first step is to connect my website to a bitcoind client.
I've installed bitcoin-qt, downloaded the blockchain and configured the bitcoin.conf file.

bitcoin.conf:

Code:
 # bitcoin.conf configuration file. Lines beginning with # are comments.
 
 
 # Network-related settings:
 
 # Run on the test network instead of the real bitcoin network.
 #testnet=0
 
 # Connect via a socks4 proxy
 #proxy=127.0.0.1:9050
 
 ##############################################################
 ##            Quick Primer on addnode vs connect            ##
 ##  Let's say for instance you use addnode=4.2.2.4          ##
 ##  addnode will connect you to and tell you about the      ##
 ##    nodes connected to 4.2.2.4.  In addition it will tell ##
 ##    the other nodes connected to it that you exist so     ##
 ##    they can connect to you.                              ##
 ##  connect will not do the above when you 'connect' to it. ##
 ##    It will *only* connect you to 4.2.2.4 and no one else.##
 ##                                                          ##
 ##  So if you're behind a firewall, or have other problems  ##
 ##  finding nodes, add some using 'addnode'.                ##
 ##                                                          ##
 ##  If you want to stay private, use 'connect' to only      ##
 ##  connect to "trusted" nodes.                             ##
 ##                                                          ##
 ##  If you run multiple nodes on a LAN, there's no need for ##
 ##  all of them to open lots of connections.  Instead       ##
 ##  'connect' them all to one node that is port forwarded   ##
 ##  and has lots of connections.                            ##
 ##       Thanks goes to [Noodle] on Freenode.               ##
 ##############################################################
 
 # Use as many addnode= settings as you like to connect to specific peers
 #addnode=69.164.218.197
 #addnode=10.0.0.2:8333
 
 # ... or use as many connect= settings as you like to connect ONLY
 # to specific peers:
 #connect=69.164.218.197
 #connect=10.0.0.1:8333
 
 
 # Maximum number of inbound+outbound connections.
 #maxconnections=
 
 
 # JSON-RPC options (for controlling a running Bitcoin/bitcoind process)
 
 # server=1 tells Bitcoin-QT to accept JSON-RPC commands.
 server=1
 
 # You must set rpcuser and rpcpassword to secure the JSON-RPC api
 rpcuser=user
 rpcpassword=password
 
 # How many seconds bitcoin will wait for a complete RPC HTTP request.
 # after the HTTP connection is established.
 #rpctimeout=30
 
 # By default, only RPC connections from localhost are allowed.  Specify
 # as many rpcallowip= settings as you like to allow connections from
 # other hosts (and you may use * as a wildcard character).
 # NOTE: opening up the RPC port to hosts outside your local
 # trusted network is NOT RECOMMENDED, because the rpcpassword
 # is transmitted over the network unencrypted.
 rpcallowip=10.0.0.3
 rpcallowip=10.0.0.19
 rpcallowip=127.0.0.1
 
 # Listen for RPC connections on this TCP port:
 rpcport=8332

 walletnotify=/home/arik/scripts/transaction.sh %s
 
 # You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind
 # running on another host using this option:
 #rpcconnect=127.0.0.1
 
 # Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate
 # with Bitcoin -server or bitcoind
 #rpcssl=1
 
 # OpenSSL settings used when rpcssl=1
 #rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
 #rpcsslcertificatechainfile=server.cert
 #rpcsslprivatekeyfile=server.pem
 
 
 # Miscellaneous options
 
 # Set gen=1 to attempt to generate bitcoins
 #gen=0
 
 # Pre-generate this many public/private key pairs, so wallet backups will be valid for
 # both prior transactions and several dozen future transactions.
 #keypool=100
 
 # Pay an optional transaction fee every time you send bitcoins.  Transactions with fees
 # are more likely than free transactions to be included in generated blocks, so may
 # be validated sooner.
 #paytxfee=0.00
 
 # Allow direct connections for the 'pay via IP address' feature.
 #allowreceivebyip=1
   
 # User interface options
 
 # Start Bitcoin minimized
 #min=1
 
 # Minimize to the system tray
 #minimizetotray=1

My bitcoin-qt client runs on ubuntu 14.04

I use asp.net to develop my website, the rpc commands seem to work fine (used getnewaddress and sendtoaddress so far).
The problem is with the walletnotify.

As you can see in my bitcoin.conf file, i have the line:

Code:
walletnotify=/home/arik/scripts/transaction.sh %s

But whenever my wallet receives an incoming transaction the walletnotify doesn't get invoked.
In /home/arik/scripts i have the transaction.sh file:

Code:
#!/bin/sh
curl -d "txid=${1}" http://10.0.0.3:51827/Callbacks/BTC.aspx?secret=666

I have curl installed.
I tried to invoked it manually from the terminal: bash /home/arik/scripts/transaction.sh blablabla
and it works (the asp.net page receives the request with the post parameter blablabla).

So the problem seems to be in the bitcoin.conf file.
Can you help me find the problem please?

Also, i've heard that walletnotify will get called only for the first confirmation and after that i'll have to use blocknotify but the problem is that walletnotify sends the transaction id and i can get all the information about the transaction with the gettransaction method but blocknotify sends the blockid (so i've heard), would i still be able to use gettransaction?

Thanks for the help Smiley
9  Bitcoin / Bitcoin Technical Support / Re: move method in bitcoind on: July 29, 2014, 07:17:20 PM
Alright, then i'll have a look at it.

Anyway it seems much more easier to do it your way (storing the balance in my database).
Thank you for the help Smiley
10  Bitcoin / Bitcoin Technical Support / Re: move method in bitcoind on: July 29, 2014, 07:02:05 PM
I know that the blockchain.info receive payments api does something like that.
It creates an unique address to a user that points at my wallet at blockchain.info.
Whenever a user sends bitcoins to the address that was created for him, blockchain.info sends a request to my website and that way i can know which user had received the payment.

I just thought that using the json rpc api would be more convenient for me since i'm relying on a third party api just for now...
Are walletnotify and blocknotify part of the bitcoind client?

11  Bitcoin / Bitcoin Technical Support / Re: move method in bitcoind on: July 29, 2014, 06:47:20 PM
I'm implementing the accounts in my own database my i don't store the amount of bitcoins of the account in my own database.
I though about supplying the id of the user in my database when using the method getnewaddress i.e. whenever a new user is created in my website, i would use the method getnewaddress and supply it with the user id that's stored in the database.

whenever i would like to know how much bitcoins a user has, i would just use the method getbalance with the userid.
That's my idea of implementing the users in my website.

Aren't all the bitcoins already mixed together in the wallet? my website consists only of one wallet, my wallet.
All the address that are created for the users, point at my wallet. So in that sense, all the bitcoins are mixed together in my wallet, No?
12  Bitcoin / Bitcoin Technical Support / move method in bitcoind on: July 29, 2014, 06:19:07 PM
Hi Smiley
I'm creating an exchange website and the first step is to allow users to deposit and withdraw bitcoins from and to external wallets.
Right now i'm using the json rpc api from blockchain.info, since i don't have where to host my bitcoind client.
But since the json rpc api of blockchain.info implements the same methods that the bitcoind client supplies, i know that in the future i'll be able to move to my own bitcoind client easily so i'm not concerned about using third party api right now (referring to my previous post).

So in my website there will be 2 types of transactions:

External transactions - Transactions between the user's address in my website and an external wallet (Example: User A deposits bitcoins in his account in my website from his external wallet).

Internal transactions - Transactions between bitcoins and my local coin (The one that users will be able to exchange bitcoins with) inside the website itself (Example: User A buys 10 local coins for 0.003 bitcoins per coin from user B).

Now, before i had heard about the method move in the bitcoind client, i thought about adding a column in the users database of my website which would hold only the bitcoins that were earned/spent in internal transactions. The total amount of bitcoins that are in possession of a user would then be the amount that's written in that column + the amount that's returned from the method getBalance of the bitcoind client(the bitcoins that were earned/spent in external transactions).

But obviously, i ditched that idea after hearing about the move method in the bitcoind client(the method takes the address of user A and the address of user B and an amount and sends that amount from user A to user B).

So now my idea is, whenever some user puts a buying order (buying local coins for bitcoins), i will use the method move to move the requested amount from the user's address to another address that doesn't belong to any user.

Whenever some user puts a selling order and that order gets evaluated(someone sells to him), i will use the method move to move the requested amount from the address that doesn't belong to any user (the same address from case A) to the address of the user that sold the local coins.

The first question is: Is that the correct way of doing it? Am i over complicating things and there's a much easier way to implement this?

Second question: Does the move method moves the bitcoins from address A to address B instantly? or there's some delay?

Thank you Smiley
13  Bitcoin / Bitcoin Technical Support / Re: Allowing a User to Deposit and Withdraw Bitcoins in ASP.NET(C#) Application on: July 28, 2014, 04:51:33 AM
Thanks for the reply but I still don't quite understand what I should do with this code.

What should I have on http://local host:8332?
My bitcoin client?

If so, could you address me to a guide of how to install such client?

Also, could you please include an example of how to send a simple transaction with this code?

I'm sorry for the newbie questions, I'm really new to the crypto world and hadn't had a chance to explore it deeply yet.

I would really appreciate if you would give me an example code of how I create an address to the user and send it to an external address, it would really help me with understanding the basics of this client.

Thank you Smiley
14  Bitcoin / Bitcoin Technical Support / Allowing a User to Deposit and Withdraw Bitcoins in ASP.NET(C#) Application on: July 27, 2014, 02:30:11 PM
Hi Smiley
I'm creating an ASP.NET website in c#.
I want to allow a registered user to create his own bitcoin wallet in the website in which he will be able to deposit and withdraw bitcoins to an external wallet.

I have experience with ASP.NET and C# but i am pretty new the crypto world.

I've heard about libraries like BitcoinLib and BitcoinSharp but i wasn't able to find a good documentation that would explain to a newbie like me how to create a wallet in my website.

I also tried to use the blockchain.info api but it takes too much to complete a transaction and i have heard some bad comments about that api.
Also, i don't feel comfortable with relying on a third party api.

I would really appreciate if someone would give me or address me to a proper explanation of how i can implement such system in my website.
Thank you very much Smiley
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!