Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,12 +288,13 @@ print(desoPosts.getNFTBidsForNFTPost(postHashHex).json())

To perform all the WRITE actions to DeSo Blockchain you need SEED_HEX and DESO Public Key.

This is how you generate SEED_HEX using your 12 word mnemonic phrase.
This is how you generate SEED_HEX using your 12 word mnemonic phrase and account number (optional).

```python
from deso import Identity
SEED_PHRASE = 'YOUR 12 WORD DESO SEED PHRASE'
SEED_HEX = Identity.getSeedHexFromSeedPhrase(SEED_PHRASE)
ACCOUNT_NUMBER = 0
SEED_HEX = Identity.getSeedHexFromSeedPhrase(SEED_PHRASE, ACCOUNT_NUMBER)
print(SEED_HEX)
```

Expand Down
8 changes: 5 additions & 3 deletions deso/Identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,11 @@ def generateDesoSeedPhrase():
return seedPhrase
# Credit to @Nathanwells on DeSo for this function

def getSeedHexFromSeedPhrase(seedPhrase):
'''Returns the seedHex of a seedPhrase'''
# Credit to @10XChris on DeSo for accountNumber functionality
# Referenced from: https://github.com/deso-protocol/deso-offline-tool/blob/7e0e216ef8e134626751c80ecf0f5e9c5995db3c/src/ts/components/sign-form.ts#L388C21-L388C25
def getSeedHexFromSeedPhrase(seedPhrase, accountNumber=0):
'''Returns the seedHex of a seedPhrase and account number (optional)'''
hdwallet = HDWallet(symbol=BTC)
hdwallet.from_mnemonic(mnemonic=seedPhrase, passphrase=None)
hdwallet.from_path(path='m/44\'/0\'/0\'/0/0')
hdwallet.from_path(path='m/44\'/0\'/'+str(accountNumber)+'\'/0/0')
return hdwallet.private_key()