Pages:
Author

Topic: how to use wallet notify (bitcoind) ? (Read 4180 times)

full member
Activity: 203
Merit: 168
April 28, 2016, 03:07:51 AM
#28
"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.
sr. member
Activity: 350
Merit: 250
April 28, 2016, 02:55:53 AM
#27
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..
full member
Activity: 224
Merit: 101
April 27, 2016, 11:38:00 PM
#26
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.

Code:
./bitcoin/src/bitcoin-cli getrawtransaction  1
Then you will see output like 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?
full member
Activity: 203
Merit: 168
April 27, 2016, 05:26:43 PM
#25
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.

Code:
./bitcoin/src/bitcoin-cli getrawtransaction  1
Then you will see output like 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?
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
April 27, 2016, 06:54:17 AM
#24
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.

Quote
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

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?

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.
full member
Activity: 224
Merit: 101
April 27, 2016, 03:47:39 AM
#23
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.

Quote
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

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?
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
April 27, 2016, 03:12:44 AM
#22
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.

Quote
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
full member
Activity: 224
Merit: 101
April 27, 2016, 02:05:28 AM
#21
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.

Quote
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
full member
Activity: 203
Merit: 168
April 27, 2016, 01:35:19 AM
#20
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.

Quote
how resolve this problem?
what function rpc-api need use?

i need know sender wallet for refund amount..
full member
Activity: 224
Merit: 101
April 26, 2016, 09:10:18 PM
#19
-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.

Code:
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/3a07b7957cf29d267cd8c20fbd5eb8824366096e09d722d888ce635098851b70

The 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..
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
April 26, 2016, 12:37:58 PM
#18
-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.

Code:
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/3a07b7957cf29d267cd8c20fbd5eb8824366096e09d722d888ce635098851b70

The 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.
full member
Activity: 224
Merit: 101
April 26, 2016, 12:27:18 PM
#17
-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.

Code:
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

copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
April 21, 2016, 06:09:18 AM
#16
-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.

Code:
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).
sr. member
Activity: 266
Merit: 250
April 21, 2016, 05:27:54 AM
#15

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
full member
Activity: 224
Merit: 101
April 21, 2016, 04:49:23 AM
#14
-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.

Code:
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
copper member
Activity: 1498
Merit: 1528
No I dont escrow anymore.
April 21, 2016, 02:41:28 AM
#13
-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.

Code:
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
full member
Activity: 224
Merit: 101
April 21, 2016, 01:13:39 AM
#12


 
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->
Code:
listreceivedbyaddress
. 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->
Code:
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.

 


sr. member
Activity: 266
Merit: 250
April 20, 2016, 11:40:40 PM
#11


 
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->
Code:
listreceivedbyaddress
. 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->
Code:
listreceivedbyaddress 0 true
full member
Activity: 224
Merit: 101
April 20, 2016, 11:10:15 PM
#10
i use gettransaction($txid);

how get my wallet address for receiving? (this method get payer wallet address only)
Run this command->
Code:
getaccountaddress
. This'll return the current bitcoin address for receiving payments to this account. If 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?
sr. member
Activity: 266
Merit: 250
April 20, 2016, 10:53:47 PM
#9
i use gettransaction($txid);

how get my wallet address for receiving? (this method get payer wallet address only)
Run this command->
Code:
getaccountaddress
. This'll return the current bitcoin address for receiving payments to this account. If 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.
Pages:
Jump to: