0

I want to create a payment service where I want to be able to charge each client according to its invoice. I picked Electrum as my underlying wallet and pybitcontools as my Python interface.

I would like to assign for each invoice a separate address. However, using wallet GUI it requires a person doing so and would like to automate that. Sadly, I am unable to replicate the Electrum addresses and am a bit lost at what is going wrong

My current test code:

import bitcoin as btc

electrum_master_public_key = 'xpub67xegn2C1yS...'

for i in xrange( 5 ):
    print btc.pubkey_to_address( btc.bip32_descend( electrum_master_public_key, [0,i] ) )

All my generated addresses start with a 1 whereas Electrum's star with 3. Would appreciate if somebody would help me to link the two.

0

Electrum's addresses will only start with 3 if you are using some sort of Multisig (i.e. you either have a Multisig wallet or are using the TrustedCoin 2FA thing). With Multisig, you will need to get the master public keys for the other signers in order to create the right addresses. If you do have those keys, then you can use the bip32_hdm_addr function to create those addresses.

Non-multisig addresses will start with 1, and that is what most wallets will create by default as multisig requires multiple parties.

  • I do have a 2FA account and I can get the master public keys for 3 cosigners, but how to merge them and then generate the keys for each n? – Sharapolas Jul 30 '17 at 15:41

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.