Author Topic: Bitshares 0.9.3c problem. Need to export/import private keys  (Read 2158 times)

0 Members and 1 Guest are viewing this topic.

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
For anyone that find it useful, the bash script below takes a 0.X json wallet backup and dumps "account name, owner pubkey, owner privkey".

Tested with a 07/2014 backup  (0.4.X?)
Tested with a 03/2015 backup  (0.8.X?)

Only one "rare" dependecy.
npm install -g json

For the rest it uses standard command line tools (openssl, sha512sum, xxd

pip install bitcoin (optional to have the privatekey in Wif format)

Code: [Select]
#!/bin/bash
WALLET_FILE=$1
PASSWORD=$2
SHA512=$(echo -n $PASSWORD | sha512sum -)
KEY=${SHA512:0:64}
IV=${SHA512:64:32}

cat $WALLET_FILE | json -c "this.type == 'account_record_type'" | json -c "this.data.is_my_account == true" | json -a data.name data.owner_key | while read -a line; do
  NAME=${line[0]}
  PUBKEY=${line[1]}
  ENC_PRIVKEY=$(cat $WALLET_FILE | json -c "this.type == 'key_record_type'" | json -c "this.data.public_key == '$PUBKEY'" | json -a data.encrypted_private_key)

  PRIVKEY=$(echo -n $ENC_PRIVKEY | xxd -r -p | openssl enc -d -aes-256-cbc -K $KEY -iv $IV | xxd -p | tr -d '\n')

  which pybtctool > /dev/null
  if [ $? -eq 0 ]; then
    PRIVKEY=$(echo -n $PRIVKEY | pybtctool -s encode_privkey wif)
  fi

  echo $NAME $PUBKEY $PRIVKEY
done
+5%
BitShares committee member: abit
BitShares witness: in.abit

Offline ElMato

  • Sr. Member
  • ****
  • Posts: 288
    • View Profile
For anyone that find it useful, the bash script below takes a 0.X json wallet backup and dumps "account name, owner pubkey, owner privkey".

Tested with a 07/2014 backup  (0.4.X?)
Tested with a 03/2015 backup  (0.8.X?)

Only one "rare" dependecy.
npm install -g json

For the rest it uses standard command line tools (openssl, sha512sum, xxd

pip install bitcoin (optional to have the privatekey in Wif format)

Code: [Select]
#!/bin/bash
WALLET_FILE=$1
PASSWORD=$2
SHA512=$(echo -n $PASSWORD | sha512sum -)
KEY=${SHA512:0:64}
IV=${SHA512:64:32}

cat $WALLET_FILE | json -c "this.type == 'account_record_type'" | json -c "this.data.is_my_account == true" | json -a data.name data.owner_key | while read -a line; do
  NAME=${line[0]}
  PUBKEY=${line[1]}
  ENC_PRIVKEY=$(cat $WALLET_FILE | json -c "this.type == 'key_record_type'" | json -c "this.data.public_key == '$PUBKEY'" | json -a data.encrypted_private_key)

  PRIVKEY=$(echo -n $ENC_PRIVKEY | xxd -r -p | openssl enc -d -aes-256-cbc -K $KEY -iv $IV | xxd -p | tr -d '\n')

  which pybtctool > /dev/null
  if [ $? -eq 0 ]; then
    PRIVKEY=$(echo -n $PRIVKEY | pybtctool -s encode_privkey wif)
  fi

  echo $NAME $PUBKEY $PRIVKEY
done

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
I'm trying to do the same thing.

could you please post the steps here?

could the people who can help, if not the author of the original post, please reply publicly as well as to the author privately?
See https://bitsharestalk.org/index.php/topic,20822.0.html

Full chain data of 0.9.3c can also be downloaded from here:
https://mega.nz/#!P8BhCZ4I!NZHkhUEbrgVTNRI1QXhDJI6ly7z1Fv2nFgrpQM1UWDQ
« Last Edit: March 20, 2016, 07:08:42 pm by abit »
BitShares committee member: abit
BitShares witness: in.abit

Offline baying

  • Newbie
  • *
  • Posts: 3
    • View Profile
I'm trying to do the same thing.

could you please post the steps here?

could the people who can help, if not the author of the original post, please reply publicly as well as to the author privately?

Offline xeroc

  • Board Moderator
  • Hero Member
  • *****
  • Posts: 12922
  • ChainSquad GmbH
    • View Profile
    • ChainSquad GmbH
  • BitShares: xeroc
  • GitHub: xeroc
I wonder why in all those 10 mails or so that you wrote me over the last two weeks you never asked me for a skype session ..

Offline abit

  • Committee member
  • Hero Member
  • *
  • Posts: 4664
    • View Profile
    • Abit's Hive Blog
  • BitShares: abit
  • GitHub: abitmore
I am offering 0.123 BTC to anyone who can hold my hand via the phone or Skype (no email) and help me with my Bitshares Blues.
1) I don't check this forum very often, so please don't respond to me here.
2) Please don't respond unless you really know what you're talking about. If you DON'T really know what you're talking about and you waste my time (as has happened 2x now), of course I will not pay you.

I need to export/import my private keys but I'm having a lot of problems.
Please email me for an initial discussion and then we can set up a Skype session or Wechat via phone or regular old phone.
I'm in the U.S. on Central time - 1 hour behind NYC. I never go to bed before 12 midnight fyi.
Email:
jcbarrett2003@yahoo.com

Thanks,

JB
Email sent. Wish I can help.
BitShares committee member: abit
BitShares witness: in.abit

Offline Eastside

  • Newbie
  • *
  • Posts: 5
    • View Profile
I am offering 0.123 BTC to anyone who can hold my hand via the phone or Skype (no email) and help me with my Bitshares Blues.
1) I don't check this forum very often, so please don't respond to me here.
2) Please don't respond unless you really know what you're talking about. If you DON'T really know what you're talking about and you waste my time (as has happened 2x now), of course I will not pay you.

I need to export/import my private keys but I'm having a lot of problems.
Please email me for an initial discussion and then we can set up a Skype session or Wechat via phone or regular old phone.
I'm in the U.S. on Central time - 1 hour behind NYC. I never go to bed before 12 midnight fyi.
Email:
jcbarrett2003@yahoo.com

Thanks,

JB