Bitcoin Forum
April 25, 2024, 12:50:03 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Generating payment addresses from a user's public key  (Read 327 times)
VictorBTC (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 3


View Profile
September 01, 2019, 08:20:55 PM
Merited by o_e_l_e_o (1)
 #1

Hi, I've already implemented a custom script for that purpose, it works in the following way.

1. User provides it's public key (xpub)
2. the scripts takes this xpub key and every time an order is made it generates a new payment address
3. After that a cron job queries the blockhain for the generated address and checks whether the payment has been made.
4. if balance for the address is equal to the order price the order is marked as paid.

It works, however I am wondering whether there is a better way to implement this task now?

I can't use any existing gateways like bitpay and others. It should be a custom application/script and we cannot run a full bitcoin node for that.

I would be grateful for any suggestions.
1714049403
Hero Member
*
Offline Offline

Posts: 1714049403

View Profile Personal Message (Offline)

Ignore
1714049403
Reply with quote  #2

1714049403
Report to moderator
It is a common myth that Bitcoin is ruled by a majority of miners. This is not true. Bitcoin miners "vote" on the ordering of transactions, but that's all they do. They can't vote to change the network rules.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714049403
Hero Member
*
Offline Offline

Posts: 1714049403

View Profile Personal Message (Offline)

Ignore
1714049403
Reply with quote  #2

1714049403
Report to moderator
1714049403
Hero Member
*
Offline Offline

Posts: 1714049403

View Profile Personal Message (Offline)

Ignore
1714049403
Reply with quote  #2

1714049403
Report to moderator
pooya87
Legendary
*
Offline Offline

Activity: 3430
Merit: 10499



View Profile
September 02, 2019, 03:48:22 AM
Merited by ABCbits (2), LoyceV (1), hugeblack (1)
 #2

1. User provides it's public key (xpub)
i'm confused, why does the "user" provide his xpub if it is "you" who is accepting payments?

3. After that a cron job queries the blockhain for the generated address and checks whether the payment has been made.
4. if balance for the address is equal to the order price the order is marked as paid.
we cannot run a full bitcoin node for that.
so you are relying on a third party to do this verification for you? it doesn't sound safe, specially if the payments are not small.
also you should look for "transaction" not just balance. of course since RBF is a thing you have to keep looking. the benefit of this is that as soon as you receive the transaction you can show a message to the user so that they don't have to wait in the dark without knowing if the site is broken or not.
a message saying "we've receive this transaction (txid) which has (low/medium/high) fee and needs (x) number of confirmation, it currently has (y)".

you could also run bitcoin core in pruned mode which requires less resources. again it depends on the size and frequency of payments you are receiving.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
September 03, 2019, 10:39:19 AM
 #3

The best way would be to simply run a full node.
It would be the easiest to implement and the most safest way.

Can you elaborate on the reasons why you can't run a full node ? It doesn't take much effort to set it up and it costs close to nothing to keep it running. The power costs are low and a 500GB HDD costs about 30$.
If you want to run a marketplace or a website, this shouldn't be a problem at all. So i assume there are other problems you are facing ? Maybe we can find a solution for them.

VictorBTC (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 3


View Profile
September 11, 2019, 05:58:52 PM
 #4

1. User provides it's public key (xpub)
i'm confused, why does the "user" provide his xpub if it is "you" who is accepting payments?

3. After that a cron job queries the blockhain for the generated address and checks whether the payment has been made.
4. if balance for the address is equal to the order price the order is marked as paid.
we cannot run a full bitcoin node for that.
so you are relying on a third party to do this verification for you? it doesn't sound safe, specially if the payments are not small.
also you should look for "transaction" not just balance. of course since RBF is a thing you have to keep looking. the benefit of this is that as soon as you receive the transaction you can show a message to the user so that they don't have to wait in the dark without knowing if the site is broken or not.
a message saying "we've receive this transaction (txid) which has (low/medium/high) fee and needs (x) number of confirmation, it currently has (y)".

you could also run bitcoin core in pruned mode which requires less resources. again it depends on the size and frequency of payments you are receiving.

Thanks all for your replies.

The main idea is allow an administrator to receive payments from other users that will order goods on the marketplace.

There is no way we can run the full node.
So what is the best option in this case? Can I use current flow (with an xpub key) in that case? I understand that is not safe to query a third party service to check a transaction state.
But we have some limitations.
I just want to know maybe there are any other types of wallets that allows an owner to provide some public key to generate new payment addresses.

Thanks
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
September 12, 2019, 08:11:23 AM
Merited by ABCbits (1)
 #5

There is no way we can run the full node.

Are you sure ? What is the reason for that ?

A hard drive costs around 25$ and basically any CPU would be suitable. You could even use a raspberry pi to run a full node.



So what is the best option in this case? Can I use current flow (with an xpub key) in that case?

Yes, definitely.



I understand that is not safe to query a third party service to check a transaction state.
But we have some limitations.

What are your limitations ?
Are you going to start a service which sells goods but can't afford a 50$ device to run a full node ?

If you can not run your own node, the only option is to rely on a 3rd party.

You could either query an API provided by a blockchain explorer or query an electrum server.



I just want to know maybe there are any other types of wallets that allows an owner to provide some public key to generate new payment addresses.

I guess you mean to provide the master public key to derive multiple addresses ?
In this case, yes. You could go for electrum.

bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
September 18, 2019, 08:02:51 AM
Merited by ABCbits (2), bones261 (2), hugeblack (1)
 #6

What's kind problem you are facing to use Bitpay??

The problem is that bitpay is cancer.

They only allow paying the invoice with their own application. They do not simply display an address and an amount.
You explicitly have to use a tool (DeBitpay) to convert the invoice into standard address/amount information.

They are trying to force users to use their (shitty) application to store/send funds.


And additional - that's the biggest problem - they are a centralized service holding the keys.
That's absolutely against the philosophy of bitcoin. You don't need to accept BTC if you don't hold your own keys. Can as well use CC then.
BTC has been made to be your own bank, not to let someone else store your money. We have banks and FIAT for that.

TryNinja
Legendary
*
Offline Offline

Activity: 2814
Merit: 6971



View Profile WWW
September 18, 2019, 12:18:40 PM
Merited by ABCbits (1)
 #7

What's kind problem you are facing to use Bitpay??
They also blocked some donations destinated to the rain forest recovery, funds donated to the Hong Kong Free Press movement and they just randomly freeze many user's payments out of the air from time to time. It's just not worth it when you can have an open source, self hosted node accepting payments. No middleman, trully descentralized and as censorship resistent as Bitcoin. I'm talking about BTC Pay Server btw. Smiley

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!