HackerBOSS (OP)
|
|
April 19, 2016, 02:50:25 PM |
|
Hello,
how to use wallet notify (bitcoind) ?
I generate new address by json-rpc..
I need update info in MySQL after 3 confirmations.
how think how much need confirmations for receive payments?
|
|
|
|
|
|
|
The block chain is the main innovation of Bitcoin. It is the
first distributed timestamping system.
|
|
|
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
|
|
|
danda
|
|
April 20, 2016, 05:25:45 AM |
|
-alertnotify=<cmd> Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message) -blocknotify=<cmd> Execute command when the best block changes (%s in cmd is replaced by block hash) -walletnotify=<cmd> Execute command when a wallet transaction changes (%s in cmd is replaced by TxID) So for individual transactions, you would want to use walletnotify, eg: bitcoind -walletnotify=/path/to/script.php %s Then in script.php, you could do something like: <?php $tx = $argv[1]; $txinfo = json_decode( `bitcoin-cli gettransaction $tx` ); if( $txinfo['confirmations'] >= 3 ) { // update mysql if necessary. }
of course with sanitization, error checks, etc.... ;-) If you are likely to have more than one tx in a given block, a more efficient way to do it can be to include the block-hash with the tx in the db, so you can look up all tx by block. Then use blocknotify instead of walletnotify. edit: and don't forget that the txid can change due to transaction malleability.
|
|
|
|
HackerBOSS (OP)
|
|
April 20, 2016, 07:46:43 AM |
|
-alertnotify=<cmd> Execute command when a relevant alert is received or we see a really long fork (%s in cmd is replaced by message) -blocknotify=<cmd> Execute command when the best block changes (%s in cmd is replaced by block hash) -walletnotify=<cmd> Execute command when a wallet transaction changes (%s in cmd is replaced by TxID) So for individual transactions, you would want to use walletnotify, eg: bitcoind -walletnotify=/path/to/script.php %s Then in script.php, you could do something like: <?php $tx = $argv[1]; $txinfo = json_decode( `bitcoin-cli gettransaction $tx` ); if( $txinfo['confirmations'] >= 3 ) { // update mysql if necessary. }
of course with sanitization, error checks, etc.... ;-) If you are likely to have more than one tx in a given block, a more efficient way to do it can be to include the block-hash with the tx in the db, so you can look up all tx by block. Then use blocknotify instead of walletnotify. edit: and don't forget that the txid can change due to transaction malleability. Thanks! how much times wallet notify call script.php ?
|
|
|
|
belcher
|
|
April 20, 2016, 12:15:32 PM |
|
-walletnotify will run twice per transaction, when it's first seen on the network as unconfirmed, and when it gets it's first confirmation.
To track more than one confirmation you need to use -blocknotify
|
1HZBd22eQLgbwxjwbCtSjhoPFWxQg8rBd9 JoinMarket - CoinJoin that people will actually use. PGP fingerprint: 0A8B 038F 5E10 CC27 89BF CFFF EF73 4EA6 77F3 1129
|
|
|
HackerBOSS (OP)
|
|
April 20, 2016, 12:25:39 PM |
|
-walletnotify will run twice per transaction, when it's first seen on the network as unconfirmed, and when it gets it's first confirmation.
To track more than one confirmation you need to use -blocknotify
after first confirmation payment not lost?
|
|
|
|
HackerBOSS (OP)
|
|
April 20, 2016, 12:29:27 PM |
|
-walletnotify will run twice per transaction, when it's first seen on the network as unconfirmed, and when it gets it's first confirmation.
To track more than one confirmation you need to use -blocknotify
and blocknotify how much times call myscript.php?
|
|
|
|
Polyatomic
|
|
April 21, 2016, 12:10:31 AM Last edit: April 29, 2016, 09:34:32 AM by Polyatomic |
|
Every new block. milton@milton:~$ ps -eo cmd | egrep bitcoind | egrep -v grep bitcoind -daemon -blocknotify=blocknotify %s #!/bin/bash -e
block_message() { local DATE=$1 local HEIGHT=$2 local BLOCKHASH=$3 echo -e "+=====================================================================" echo -e "| \033[31m ${DATE} \033[0m" echo -e "+=====================================================================" echo -e "| \033[31m ${HEIGHT} \033[0m" echo -e "+=====================================================================" echo -e "| \033[31m ${BLOCKHASH} \033[0m" echo -e "+====================================================================="
} >> $HOME/temp/blocknotify.txt
block_message "$(date -u)" "$(bitcoin-cli getblockcount)" "$@"
milton@milton:~$ tail -f temp/blocknotify.txt +====================================================================+ | 0000000000000000016c397b5eac0d5b3580d11b585996d2a8452bef2e03fa3e | +====================================================================+ +====================================================================+ | Wed Apr 20 23:49:27 UTC 2016 +====================================================================+ | 408221 +====================================================================+ | 0000000000000000033ed3a5284a10c8992cb9411bf4fd33a130fc742436e3f7 | +====================================================================+
|
|
|
|
HackerBOSS (OP)
|
|
April 21, 2016, 03:06:32 AM |
|
i use gettransaction($txid);
how get my wallet address for receiving? (this method get payer wallet address only)
|
|
|
|
Alaki
|
|
April 21, 2016, 03:53:47 AM |
|
i use gettransaction($txid);
how get my wallet address for receiving? (this method get payer wallet address only)
Run this command-> getaccountaddress <account> . This'll return the current bitcoin address for receiving payments to this account. If <account> does not exist, it will be created along with an associated new address that'll be returned. P.S.-> "getaccountaddress" will return the same address until coins are received on that address; once coins have been received, it will generate and return a new address.
|
|
|
|
HackerBOSS (OP)
|
|
April 21, 2016, 04:10:15 AM |
|
i use gettransaction($txid);
how get my wallet address for receiving? (this method get payer wallet address only)
Run this command-> getaccountaddress <account> . This'll return the current bitcoin address for receiving payments to this account. If <account> does not exist, it will be created along with an associated new address that'll be returned. P.S.-> "getaccountaddress" will return the same address until coins are received on that address; once coins have been received, it will generate and return a new address. ok. i generated 2 addresses getaccountaddress(); after i send btc to 1 new generated address. and call gettransaction($txid); how get address of 2 addresses that received payemnt?
|
|
|
|
Alaki
|
|
April 21, 2016, 04:40:40 AM |
|
ok.
i generated 2 addresses getaccountaddress(); after i send btc to 1 new generated address.
and call gettransaction($txid);
how get address of 2 addresses that received payemnt?
You mean listing your addresses that've received payment(in the past)? Yep that's possible as well. Run this command-> . Basically, it lists only addresses that already 've received transactions. However, you can list all the addresses by setting the first argument to 0, and the second one to true-> listreceivedbyaddress 0 true
|
|
|
|
HackerBOSS (OP)
|
|
April 21, 2016, 06:13:39 AM |
|
ok.
i generated 2 addresses getaccountaddress(); after i send btc to 1 new generated address.
and call gettransaction($txid);
how get address of 2 addresses that received payemnt?
You mean listing your addresses that've received payment(in the past)? Yep that's possible as well. Run this command-> . Basically, it lists only addresses that already 've received transactions. However, you can list all the addresses by setting the first argument to 0, and the second one to true-> listreceivedbyaddress 0 true for example sport betting.. 1 wallet - win #1 team 2 wallet - win #2 team player placed bet to 2 wallet.. (send paymet to 2 wallet) my script get hash, amount etc.. but i need wallet of player.
|
|
|
|
shorena
Copper Member
Legendary
Offline
Activity: 1498
Merit: 1520
No I dont escrow anymore.
|
|
April 21, 2016, 07:41:28 AM |
|
-snip- my script get hash, amount etc.. but i need wallet of player.
There is no simple way to get the "sending address"[1]. You have to check the inputs, but more often than not there will be several inputs. Its better to let the user set an address you store in your database along with their other information. txid = dc8697d1afd6c7ac2f667cd3239e19bf227a7b5ce8be64b2f8bb3c626979425b # "random" one from the block to the hash that Polyatomic posted. raw_tx = getrawtransaction(txid) decoded_tx = decoderawtransaction(raw_tx)
within decoded_tx you will find a "vin" section with a value "vout" and a txid. If you check each of the txids you will see that they have a "vout" section. The outputs that created the inputs that are used in the TX you received. Find the one where "vout" matches "n" and look up its address. In this example there are 4 inputs, all "from" the address "1NgrpJJj2PMj9RsHutVK7vf8dchcpfM4YZ", but you need to decide how you want to handle different addresses. IIRC the data is mixed formatted, arrays within JSON, but that might be different for PHP. [1] there is no such thing
|
Im not really here, its just your imagination.
|
|
|
HackerBOSS (OP)
|
|
April 21, 2016, 09:49:23 AM |
|
-snip- my script get hash, amount etc.. but i need wallet of player.
There is no simple way to get the "sending address"[1]. You have to check the inputs, but more often than not there will be several inputs. Its better to let the user set an address you store in your database along with their other information. txid = dc8697d1afd6c7ac2f667cd3239e19bf227a7b5ce8be64b2f8bb3c626979425b # "random" one from the block to the hash that Polyatomic posted. raw_tx = getrawtransaction(txid) decoded_tx = decoderawtransaction(raw_tx)
within decoded_tx you will find a "vin" section with a value "vout" and a txid. If you check each of the txids you will see that they have a "vout" section. The outputs that created the inputs that are used in the TX you received. Find the one where "vout" matches "n" and look up its address. In this example there are 4 inputs, all "from" the address "1NgrpJJj2PMj9RsHutVK7vf8dchcpfM4YZ", but you need to decide how you want to handle different addresses. IIRC the data is mixed formatted, arrays within JSON, but that might be different for PHP. [1] there is no such thing ok. i will experience.. but how make it secondstrade.com ? bet is send to address only. no need enter player wallet
|
|
|
|
Alaki
|
|
April 21, 2016, 10:27:54 AM |
|
but how make it secondstrade.com ?
bet is send to address only. no need enter player wallet
Secondstrade do have a notice board[1] that'll(can) answer your above question. Basically, you'll not receive your payment if you do make a bet(transaction) with multiple(or >2) input addresses(&/or a shared wallet) AFAIK. [1]-> http://secondstrade.com/notice.html
|
|
|
|
shorena
Copper Member
Legendary
Offline
Activity: 1498
Merit: 1520
No I dont escrow anymore.
|
|
April 21, 2016, 11:09:18 AM |
|
-snip- my script get hash, amount etc.. but i need wallet of player.
There is no simple way to get the "sending address"[1]. You have to check the inputs, but more often than not there will be several inputs. Its better to let the user set an address you store in your database along with their other information. txid = dc8697d1afd6c7ac2f667cd3239e19bf227a7b5ce8be64b2f8bb3c626979425b # "random" one from the block to the hash that Polyatomic posted. raw_tx = getrawtransaction(txid) decoded_tx = decoderawtransaction(raw_tx)
within decoded_tx you will find a "vin" section with a value "vout" and a txid. If you check each of the txids you will see that they have a "vout" section. The outputs that created the inputs that are used in the TX you received. Find the one where "vout" matches "n" and look up its address. In this example there are 4 inputs, all "from" the address "1NgrpJJj2PMj9RsHutVK7vf8dchcpfM4YZ", but you need to decide how you want to handle different addresses. IIRC the data is mixed formatted, arrays within JSON, but that might be different for PHP. [1] there is no such thing ok. i will experience.. but how make it secondstrade.com ? bet is send to address only. no need enter player wallet AFAIK they do it in this crude way, same as most ponzi "games". If they warn you not to use certain wallets, they almost always just assume which is your address. This can fail horribly if your customer/user uses a wallet where they share addresses with others or use something like CoinJoin. A common example for shared wallets are most exchanges. You have your own deposit address, but when you withdraw the coins come from a different address. If you return coins to the address they came from they will be credited to a different account (if at all).
|
Im not really here, its just your imagination.
|
|
|
HackerBOSS (OP)
|
|
April 26, 2016, 05:27:18 PM |
|
-snip- my script get hash, amount etc.. but i need wallet of player.
There is no simple way to get the "sending address"[1]. You have to check the inputs, but more often than not there will be several inputs. Its better to let the user set an address you store in your database along with their other information. txid = dc8697d1afd6c7ac2f667cd3239e19bf227a7b5ce8be64b2f8bb3c626979425b # "random" one from the block to the hash that Polyatomic posted. raw_tx = getrawtransaction(txid) decoded_tx = decoderawtransaction(raw_tx)
within decoded_tx you will find a "vin" section with a value "vout" and a txid. If you check each of the txids you will see that they have a "vout" section. The outputs that created the inputs that are used in the TX you received. Find the one where "vout" matches "n" and look up its address. In this example there are 4 inputs, all "from" the address "1NgrpJJj2PMj9RsHutVK7vf8dchcpfM4YZ", but you need to decide how you want to handle different addresses. IIRC the data is mixed formatted, arrays within JSON, but that might be different for PHP. [1] there is no such thing ok. i will experience.. but how make it secondstrade.com ? bet is send to address only. no need enter player wallet AFAIK they do it in this crude way, same as most ponzi "games". If they warn you not to use certain wallets, they almost always just assume which is your address. This can fail horribly if your customer/user uses a wallet where they share addresses with others or use something like CoinJoin. A common example for shared wallets are most exchanges. You have your own deposit address, but when you withdraw the coins come from a different address. If you return coins to the address they came from they will be credited to a different account (if at all). thanks for your answer sir. i have problem get who send payment.. for example this hash: 3d919bf7929b983954e9c439348649e11ba21f8f740530aa4ecbbd3c5f496071 a64020eea0719df9318e185d1a44cea8f9b5e872ced67e1e746fe1b9fbb6670c who sent payment? could you help me please
|
|
|
|
shorena
Copper Member
Legendary
Offline
Activity: 1498
Merit: 1520
No I dont escrow anymore.
|
|
April 26, 2016, 05:37:58 PM |
|
-snip- my script get hash, amount etc.. but i need wallet of player.
There is no simple way to get the "sending address"[1]. You have to check the inputs, but more often than not there will be several inputs. Its better to let the user set an address you store in your database along with their other information. txid = dc8697d1afd6c7ac2f667cd3239e19bf227a7b5ce8be64b2f8bb3c626979425b # "random" one from the block to the hash that Polyatomic posted. raw_tx = getrawtransaction(txid) decoded_tx = decoderawtransaction(raw_tx)
within decoded_tx you will find a "vin" section with a value "vout" and a txid. If you check each of the txids you will see that they have a "vout" section. The outputs that created the inputs that are used in the TX you received. Find the one where "vout" matches "n" and look up its address. In this example there are 4 inputs, all "from" the address "1NgrpJJj2PMj9RsHutVK7vf8dchcpfM4YZ", but you need to decide how you want to handle different addresses. IIRC the data is mixed formatted, arrays within JSON, but that might be different for PHP. [1] there is no such thing ok. i will experience.. but how make it secondstrade.com ? bet is send to address only. no need enter player wallet AFAIK they do it in this crude way, same as most ponzi "games". If they warn you not to use certain wallets, they almost always just assume which is your address. This can fail horribly if your customer/user uses a wallet where they share addresses with others or use something like CoinJoin. A common example for shared wallets are most exchanges. You have your own deposit address, but when you withdraw the coins come from a different address. If you return coins to the address they came from they will be credited to a different account (if at all). thanks for your answer sir. i have problem get who send payment.. for example this hash: 3d919bf7929b983954e9c439348649e11ba21f8f740530aa4ecbbd3c5f496071 You are asking "who" but there is no such info on the blockchain. The inputs the TX uses have been received on two addresses, which is exactly what I warned you about. There is no right answer to this. Its possible that the sender controls both, one or none of the addresses the coins came "from". a64020eea0719df9318e185d1a44cea8f9b5e872ced67e1e746fe1b9fbb6670c
who sent payment? could you help me please
That one has a confirmed double spend -> https://blockchain.info/tx/3a07b7957cf29d267cd8c20fbd5eb8824366096e09d722d888ce635098851b70The inputs the TXs use came from a single address '15iET5Zp3GdXkp2sbUvsenUysFCAzoW1Fq', but same here its possible that the person behind the coins controls it or not.
|
Im not really here, its just your imagination.
|
|
|
HackerBOSS (OP)
|
|
April 27, 2016, 02:10:18 AM |
|
-snip- my script get hash, amount etc.. but i need wallet of player.
There is no simple way to get the "sending address"[1]. You have to check the inputs, but more often than not there will be several inputs. Its better to let the user set an address you store in your database along with their other information. txid = dc8697d1afd6c7ac2f667cd3239e19bf227a7b5ce8be64b2f8bb3c626979425b # "random" one from the block to the hash that Polyatomic posted. raw_tx = getrawtransaction(txid) decoded_tx = decoderawtransaction(raw_tx)
within decoded_tx you will find a "vin" section with a value "vout" and a txid. If you check each of the txids you will see that they have a "vout" section. The outputs that created the inputs that are used in the TX you received. Find the one where "vout" matches "n" and look up its address. In this example there are 4 inputs, all "from" the address "1NgrpJJj2PMj9RsHutVK7vf8dchcpfM4YZ", but you need to decide how you want to handle different addresses. IIRC the data is mixed formatted, arrays within JSON, but that might be different for PHP. [1] there is no such thing ok. i will experience.. but how make it secondstrade.com ? bet is send to address only. no need enter player wallet AFAIK they do it in this crude way, same as most ponzi "games". If they warn you not to use certain wallets, they almost always just assume which is your address. This can fail horribly if your customer/user uses a wallet where they share addresses with others or use something like CoinJoin. A common example for shared wallets are most exchanges. You have your own deposit address, but when you withdraw the coins come from a different address. If you return coins to the address they came from they will be credited to a different account (if at all). thanks for your answer sir. i have problem get who send payment.. for example this hash: 3d919bf7929b983954e9c439348649e11ba21f8f740530aa4ecbbd3c5f496071 You are asking "who" but there is no such info on the blockchain. The inputs the TX uses have been received on two addresses, which is exactly what I warned you about. There is no right answer to this. Its possible that the sender controls both, one or none of the addresses the coins came "from". a64020eea0719df9318e185d1a44cea8f9b5e872ced67e1e746fe1b9fbb6670c
who sent payment? could you help me please
That one has a confirmed double spend -> https://blockchain.info/tx/3a07b7957cf29d267cd8c20fbd5eb8824366096e09d722d888ce635098851b70The inputs the TXs use came from a single address '15iET5Zp3GdXkp2sbUvsenUysFCAzoW1Fq', but same here its possible that the person behind the coins controls it or not. how resolve this problem? what function rpc-api need use? i need know sender wallet for refund amount..
|
|
|
|
danda
|
|
April 27, 2016, 06:35:19 AM |
|
If you potentially need to send refunds then the only correct way is to ask the user to provide a refund address at the time of payment. The concept of a single guaranteed "from address" simply does not exist in bitcoin. how resolve this problem? what function rpc-api need use?
i need know sender wallet for refund amount..
|
|
|
|
HackerBOSS (OP)
|
|
April 27, 2016, 07:05:28 AM |
|
If you potentially need to send refunds then the only correct way is to ask the user to provide a refund address at the time of payment. The concept of a single guaranteed "from address" simply does not exist in bitcoin. how resolve this problem? what function rpc-api need use?
i need know sender wallet for refund amount.. that how works secondstrade.com ? player send to address. if win that receive win to back. no need enter player address
|
|
|
|
shorena
Copper Member
Legendary
Offline
Activity: 1498
Merit: 1520
No I dont escrow anymore.
|
|
April 27, 2016, 08:12:44 AM |
|
If you potentially need to send refunds then the only correct way is to ask the user to provide a refund address at the time of payment. The concept of a single guaranteed "from address" simply does not exist in bitcoin. how resolve this problem? what function rpc-api need use?
i need know sender wallet for refund amount.. that how works secondstrade.com ? player send to address. if win that receive win to back. no need enter player address They guess and hope they are correct. If they are not, they blame the user for not reading #3 of their "how to play"[1] [1] http://secondstrade.com/howtoplay.html
|
Im not really here, its just your imagination.
|
|
|
HackerBOSS (OP)
|
|
April 27, 2016, 08:47:39 AM |
|
If you potentially need to send refunds then the only correct way is to ask the user to provide a refund address at the time of payment. The concept of a single guaranteed "from address" simply does not exist in bitcoin. how resolve this problem? what function rpc-api need use?
i need know sender wallet for refund amount.. that how works secondstrade.com ? player send to address. if win that receive win to back. no need enter player address They guess and hope they are correct. If they are not, they blame the user for not reading #3 of their "how to play"[1] [1] http://secondstrade.com/howtoplay.htmlbut luckyb.it too, no need enter wallet.. i think that can get player wallet, but i don't know how.. do you have idea?
|
|
|
|
shorena
Copper Member
Legendary
Offline
Activity: 1498
Merit: 1520
No I dont escrow anymore.
|
|
April 27, 2016, 11:54:17 AM |
|
If you potentially need to send refunds then the only correct way is to ask the user to provide a refund address at the time of payment. The concept of a single guaranteed "from address" simply does not exist in bitcoin. how resolve this problem? what function rpc-api need use?
i need know sender wallet for refund amount.. that how works secondstrade.com ? player send to address. if win that receive win to back. no need enter player address They guess and hope they are correct. If they are not, they blame the user for not reading #3 of their "how to play"[1] [1] http://secondstrade.com/howtoplay.htmlbut luckyb.it too, no need enter wallet.. i think that can get player wallet, but i don't know how.. do you have idea? You cant get the users address from the blockchain, because the blockchain does not store user information. You can either guess like secondstrade etc. (bad) or ask the user. If you ask the user they will need accounts and passwords. That adds complexity to your service. Both are viable ways to handle this, depending who you ask. I personally think that the guesswork approach is a sign of a bad concept. You are transferring funds for other people, you should never have to guess where they want the funds to go.
|
Im not really here, its just your imagination.
|
|
|
danda
|
|
April 27, 2016, 10:26:43 PM |
|
WARNING: This method can go wrong if the user sent from an exchange account or some other method that the user does not directly control, or if they sent an old-style multisig tx, or a non-standard tx. It is NOT recommended. But you asked.
The basic idea is to look at the first address entry of the vout structure of the first vin of the transaction the user sent to you. ie: tx.vin[0].vout.addresses[0] This is a little convoluted to obtain with stock bitcoind, because gettransactions does not include any vout.addresses field. So we need to do it in two steps. Step 1. ./bitcoin/src/bitcoin-cli getrawtransaction <txid> 1
Then you will see output like this: { "txid" : "...", "version" : 1, "locktime" : 0, "vin" : [ { "txid" : "<first_vin_txid>", "vout" : 0, "scriptSig" : { "asm" : "...", "hex" : "..." }, "sequence" : 0 }, ... }
Notice the vout in this case is 0. So now, let's find the matching vout for <first_vin_txid>. Step 2. ./bitcoin/src/bitcoin-cli getrawtransaction <first_vin_txid> 1
{ ... "vout" : [ { "value" : <amount>, "n" : 0, "scriptPubKey" : { "asm" : "...", "hex" : "...", "reqSigs" : 1, "type" : "pubkeyhash", "addresses" : [ "1GN..." ] } }, ...
Ok, we find the vout where "n" matches "vout" from the vin we looked at in the orig transaction. In this case "n" and "sequence" are both 0. Therefore 1GN... is the address associated with the first input of the orig transaction. ie, this address contributed <amount> of funds. Note that: 1) There may be one vin or multiple vin in the orig tx. ie, outputs from multiple tx may have been consolidated into one. It should be relatively safe to always choose the first vin. 2) There may be multiple values in the "addresses" field, eg if type = multisig. in this case, you should probably abort. again, don't do this. ;-) but luckyb.it too, no need enter wallet..
i think that can get player wallet, but i don't know how..
do you have idea?
|
|
|
|
HackerBOSS (OP)
|
|
April 28, 2016, 04:38:00 AM |
|
WARNING: This method can go wrong if the user sent from an exchange account or some other method that the user does not directly control, or if they sent an old-style multisig tx, or a non-standard tx. It is NOT recommended. But you asked.
The basic idea is to look at the first address entry of the vout structure of the first vin of the transaction the user sent to you. ie: tx.vin[0].vout.addresses[0] This is a little convoluted to obtain with stock bitcoind, because gettransactions does not include any vout.addresses field. So we need to do it in two steps. Step 1. ./bitcoin/src/bitcoin-cli getrawtransaction <txid> 1
Then you will see output like this: { "txid" : "...", "version" : 1, "locktime" : 0, "vin" : [ { "txid" : "<first_vin_txid>", "vout" : 0, "scriptSig" : { "asm" : "...", "hex" : "..." }, "sequence" : 0 }, ... }
Notice the vout in this case is 0. So now, let's find the matching vout for <first_vin_txid>. Step 2. ./bitcoin/src/bitcoin-cli getrawtransaction <first_vin_txid> 1
{ ... "vout" : [ { "value" : <amount>, "n" : 0, "scriptPubKey" : { "asm" : "...", "hex" : "...", "reqSigs" : 1, "type" : "pubkeyhash", "addresses" : [ "1GN..." ] } }, ...
Ok, we find the vout where "n" matches "vout" from the vin we looked at in the orig transaction. In this case "n" and "sequence" are both 0. Therefore 1GN... is the address associated with the first input of the orig transaction. ie, this address contributed <amount> of funds. Note that: 1) There may be one vin or multiple vin in the orig tx. ie, outputs from multiple tx may have been consolidated into one. It should be relatively safe to always choose the first vin. 2) There may be multiple values in the "addresses" field, eg if type = multisig. in this case, you should probably abort. again, don't do this. ;-) but luckyb.it too, no need enter wallet..
i think that can get player wallet, but i don't know how..
do you have idea?
OK, Thank you very much! "2) There may be multiple values in the "addresses" field, eg if type = multisig. in this case, you should probably abort." If multiple values in the "addresses" field, eg if type = multisig... Can i choose any address or first?
|
|
|
|
airezx20
|
|
April 28, 2016, 07:55:53 AM |
|
Looks like you are nearly done this project and i hope you can share it to me once you have done to make the script.. using json_rpc.. I really want to study it because i want to make a website dice game or lotto game in altcoin or crypto currency.. i hope that you can finished this and give me a sample of your work too.. Thanks..
|
|
|
|
danda
|
|
April 28, 2016, 08:07:51 AM |
|
"2) There may be multiple values in the "addresses" field, eg if type = multisig. in this case, you should probably abort."
If multiple values in the "addresses" field, eg if type = multisig... Can i choose any address or first?
Well, you could, but it does not seem "correct". Consider that a multisig transaction may have multiple signers. As in, different people or businesses. which is which? The safest thing is to abort in this case, and follow up with user manually. But you might not ever see this type of tx.
|
|
|
|
|