input-output-hk / cardano-sl

Cryptographic currency implementing Ouroboros PoS protocol
Apache License 2.0
3.78k stars 632 forks source link

Internal error occured: DecodeError "(in 'passphrase' field) suffix is not in base-16 format: still spatial equal spell ticket method cause shine future flavor inflict huge" #2036

Open tanzeelrana opened 6 years ago

tanzeelrana commented 6 years ago

My curl request :

curl -X POST "https://localhost:8090/api/wallets/new?passphrase=still%20spatial%20equal%20spell%20ticket%20method%20cause%20shine%20future%20flavor%20inflict%20huge" -H "accept: application/json;charset=utf-8" -H "Content-Type: application/json;charset=utf-8" -d "{ \"cwInitMeta\": { \"cwName\": \"string\", \"cwAssurance\": \"CWAStrict\", \"cwUnit\": 0 }, \"cwBackupPhrase\": { \"bpToList\": [ \"string\" ] }}"

Response :

Internal error occured: DecodeError "(in 'passphrase' field) suffix is not in base-16 format: still spatial equal spell ticket method cause shine future flavor inflict huge"

adinapoli-iohk commented 6 years ago

Hey @tanzeelrana !

The passphrase is something different from what you may think immediately (@akegalj , @Martoon-00 , this is yet another testament that our current API is confusing). A passphrase is simply an (optional) extra password you specify when creating a wallet which will protect your private keys when spending funds. It is not the backup phrase, which is instead a 12-words mnemonic as the one you tried to post (look that you will still need to pass a 12-word mnemonic as part of the bpToList field, that in your example is simply set to the ["string"] array.

In particular, if you want to specify a passphrase (think of it as a spending password needed when generating a new address or spending funds) there are rules you need to abide to: it must be exactly 32-chars long and be encoded in base-16. You can use a tool like this one to play around.

tanzeelrana commented 6 years ago

@adinapoli-iohk

lets see if i clearly understood this. so the 12 word phrase needs to be converted into a single 32-chars long and be encoded in base-16 string and then be passed ?

tanzeelrana commented 6 years ago

Aha !! sweet got it !! :)

I have one more question. How do I generate a 12 word phrase that has not been used previously ???

akegalj commented 6 years ago

@tanzeelrana You can use some od generic tools for generatong bip39 12 word phrases like https://iancoleman.io/bip39/ (most of popular languages have this implemented)

Chances of collision are very minimal https://www.google.hr/amp/s/amp.reddit.com/r/ledgerwallet/comments/6cjvam/probability_of_seed_phrase_collisionbrute_forcing/

alvinoktavbitcoin commented 6 years ago

hi I don't really understand about the words that I need to enter, can you please tell me the steps more clearly ? I really hope

adinapoli-iohk commented 6 years ago

@alvinoktavbitcoin As @akegalj said, you can simply go to a website like https://iancoleman.io/bip39/ and use their web interface to generate a 12-words mnemonic password which you can use to initialise an HD wallet. Bear in mind if you lose this password you won't be able to restore your wallet anymore, so be careful 😉

alvinoktavbitcoin commented 6 years ago

yes , I have generate 12 words, now what I should I do with that 12 words ? I want to use API : https://cardanodocs.com/technical/wallet/api/#/ , but its need me to enter a passphrase that base 16-code

On Fri, Jan 12, 2018 at 4:41 PM, Alfredo Di Napoli <notifications@github.com

wrote:

@alvinoktavbitcoin https://github.com/alvinoktavbitcoin As @akegalj https://github.com/akegalj said, you can simply go to a website like https://iancoleman.io/bip39/ and use their web interface to generate a 12-words mnemonic password which you can use to initialise an HD wallet. Bear in mind if you lose this password you won't be able to restore your wallet anymore, so be careful 😉

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/input-output-hk/cardano-sl/issues/2036#issuecomment-357176735, or mute the thread https://github.com/notifications/unsubscribe-auth/AgWalTzQemUK7VXlF5c9WGIWYXjOiTMQks5tJxrCgaJpZM4Q2Fds .

tanzeelrana commented 6 years ago

@alvinoktavbitcoin how are u connecting to the cardano-sl ? are you able to connect to it externally ? like is it hosted on a cloud server ? or are u doing everything locally ?

afzydev commented 6 years ago

@tanzeelrana

Please tell me how to run generate new address api. Thanks

sunujacob commented 6 years ago

I generate 12 random words using bip39 ? What should I do next? are there tools to generate passphrase that must be exactly 32-chars long and be encoded in base-16. ?

sunujacob commented 6 years ago

Is below api call correct? curl -k --request POST \ --url https://127.0.0.1:8090/api/wallets/new \ --header 'content-type: application/json' \ --data '{ "cwInitMeta": { "cwName": "My lovely wallet", "cwAssurance": "CWANormal", "cwUnit": 0 }, "cwBackupPhrase": { "bpToList": ["squirrel","material","silly","twice","direct","slush","pistol","razor","become","junk","kingdom","flee"] } }'

Martoon-00 commented 6 years ago

Yes, it seems correct.

Mnemonics should be generated according to bip39, right.

Passphrase is optional; to make it complaint with Daedalus you need to first evaluate its blake2b hash, getting 32-length string, then encode to base16 before making request. See https://goo.gl/2uopZx (this process may be simplified with soon release of new version of wallet backend API)

lhfly5201314 commented 6 years ago

@tanzeelrana @adinapoli-iohk Hi,friend!Could you paste your curl command about creating new wallets with passphrase and creating new addresses?I am really confused about the api docs! And which version api are u using?I tried the v1,but it didn't work,how about u?