0

Services like ShapeShift generate new addresses for each transaction. It is not clear how to they do that. I didn't find any API that supports address generation for such a big amount of coins like on ShapeShift. Or maybe these guys use some crypto exchange to generate the addresses.

How can I implement address generation function?

1
  • you may want to look at the way, how HD wallets do key handling. You could define extended private and public keys and try to go from there... Mar 10, 2018 at 7:20

1 Answer 1

1

There are a lot of online tools to generate bitcoin addresses and some of them have APIs. For example Blockcypher 's one.

But usually such services have their own full node which manages their wallet. In such case they'll generate new addresses using bitcoin-cli tool.

$ bitcoin-cli help getnewaddress
getnewaddress ( "account" )

Returns a new Bitcoin address for receiving payments.
If 'account' is specified (DEPRECATED), it is added to the address 
book 
so payments received with the address will be credited to 'account'.

Arguments:
1. "account"        (string, optional) DEPRECATED. The account name for the address to be linked to. If not provided, the default account "" is used. It can also be set to the empty string "" to represent the default account. The account does not need to exist, it will be created if there is no account by the given name.

Result:
"address"    (string) The new bitcoin address

Examples:
> bitcoin-cli getnewaddress 
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/

As to the other coins, I bet they have alike tools, but looks like there is no "silver bullet" API for every coin out there.

And if you are going to handle big amount of coins, you, maybe, don't want to generate addresses via the third-party services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.