create account

Steem Python BIP38 Wallet Error with Fix by anthonyadavisii

View this thread on: hive.blogpeakd.comecency.com
· @anthonyadavisii · (edited)
$1.27
Steem Python BIP38 Wallet Error with Fix
![steem python.jpg](https://steemitimages.com/DQmS7joWnTrfYrcfJMu31hdmuQjhpST6FJuX5D5c18CkH2n/steem%20python.jpg)
Good evening Steem Scripters,

I had recently exercised what I like to call the nuclear option regarding my Ubuntu virtual machine when I began receiving NoneType errors. In other words, I completely blew away my VM and started from scratch. Well, in retrospect, that may have not been the least painful way I could have addressed the problem but resulted in a couple good things namely the upgrade of my OS and Python. Turns out it was the node that I was connecting that was having issues but that's unimportant now. 

What is important is I understand other Steem scripters may be having issues with the libraries and I wanted to share a prospective fix for one that seemed to assist in my issue. I was encountering errors when attempting to add a new key. I received the following error which I just duplicated. (b was a sample bytecode string I had generated but I was receiving the same upon using the related library function)

>aes = AES.new(b)
Traceback (most recent call last):
  File "stdin", line 1, in module
TypeError: new() missing 1 required positional argument: 'mode'

What was the fix you might ask? It took me a bit of investigating and I came accross the following page with info on the AES module:

https://pythonhosted.org/pycrypto/Crypto.Cipher.AES-module.html

Here is the function:

![](https://steemitimages.com/DQmZsss7Pu3TxwDunTrJVa4Ckf4oMsUf2hvNtgz6vzPrPiE/image.png)

Details

![](https://steemitimages.com/DQmZZfKJMzTVr9FQFLpd6EcAjQ81jkSAecaCjAJeQLJhXh5/image.png)

Notice the "Mode" parameter. Hmmm remember that error?

>mode (a MODE_* constant) - The chaining mode to use for encryption or decryption. Default is MODE_ECB.

If we examine the BIP38.py wallet script in the steembase directory, we will notice that the mode argument is absent. What if we were to add it? That's exactly what I did to both the encrypt and decrypt functions. After that, I was able to successful add the key and perform voting operations with python. Here is the line you will need to replace.

>    aes = AES.new(derived_half2,AES.MODE_ECB)

I will also note that, if my memory serves me, I had encountered issues with the requires file involving versioning of dependences (toml among them I think). If there is demand, I will look into creating an article for that as well.

Please, let me know if this helps you or, if there are any questions, feel free to drop a comment.
Upvote, Resteem, and comment if you want to show some love 💖 and 👀 more!

To tip crypto, you may also use the following addresses:
https://files.coinmarketcap.com/static/img/coins/16x16/bitcoin.png BTC wallet: 1BKV8gfFbWgeVJVqedsDj9TX9TWGxpCSEh 
https://files.coinmarketcap.com/static/img/coins/16x16/ethereum.png ETH: 0xaC8920ACaD58C40c46B75E13957605c72770C2Ca 
https://files.coinmarketcap.com/static/img/coins/16x16/litecoin.png LTC wallet: LfP1he2KyZzGJYXwbSNdfLZ6wUNL71nBvt 
https://files.coinmarketcap.com/static/img/coins/16x16/dogecoin.png DOGE wallet: DNAQbrku7HmxDSX8RayHp6cv4mum5XGERe 
https://files.coinmarketcap.com/static/img/coins/16x16/dash.png DASH wallet: XbfzvP7Jt3LaMe2x1ho97uJp4TdfiZ9C1W 
https://files.coinmarketcap.com/static/img/coins/16x16/blackcoin.png BLK: BBXcqjeqYdREt9ExSN6jduL7kEh6YjY2RF 
https://files.coinmarketcap.com/static/img/coins/16x16/veriumreserve.png VRM: VWFPCf7DmHYhQbXtV2SNRdCdo4LkMjFAkR

https://steemitimages.com/0x0/https://img.esteem.ws/gginnpbr1h.jpg
👍  , , , , , , , ,
properties (23)
authoranthonyadavisii
permlinksteem-python-bip38-wallet-error-with-fix
categorysteemdev
json_metadata{"tags":["steemdev","steempython","python","steem","steemthatshare"],"image":["https://steemitimages.com/DQmS7joWnTrfYrcfJMu31hdmuQjhpST6FJuX5D5c18CkH2n/steem%20python.jpg","https://steemitimages.com/DQmZsss7Pu3TxwDunTrJVa4Ckf4oMsUf2hvNtgz6vzPrPiE/image.png","https://steemitimages.com/DQmZZfKJMzTVr9FQFLpd6EcAjQ81jkSAecaCjAJeQLJhXh5/image.png","https://files.coinmarketcap.com/static/img/coins/16x16/bitcoin.png","https://files.coinmarketcap.com/static/img/coins/16x16/ethereum.png","https://files.coinmarketcap.com/static/img/coins/16x16/litecoin.png","https://files.coinmarketcap.com/static/img/coins/16x16/dogecoin.png","https://files.coinmarketcap.com/static/img/coins/16x16/dash.png","https://files.coinmarketcap.com/static/img/coins/16x16/blackcoin.png","https://files.coinmarketcap.com/static/img/coins/16x16/veriumreserve.png","https://steemitimages.com/0x0/https://img.esteem.ws/gginnpbr1h.jpg"],"links":["https://pythonhosted.org/pycrypto/Crypto.Cipher.AES-module.html"],"app":"steemit/0.1","format":"markdown"}
created2017-12-29 04:37:06
last_update2017-12-29 15:32:21
depth0
children3
last_payout2018-01-05 04:37:06
cashout_time1969-12-31 23:59:59
total_payout_value0.978 HBD
curator_payout_value0.296 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length3,503
author_reputation212,565,147,344,592
root_title"Steem Python BIP38 Wallet Error with Fix"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id25,805,685
net_rshares95,992,494,536
author_curate_reward""
vote details (9)
@boombastic ·
$0.02
had same problem, pull request submitted https://github.com/steemit/steem-python/pull/245
👍  ,
properties (23)
authorboombastic
permlinkre-anthonyadavisii-steem-python-bip38-wallet-error-with-fix-20180606t181828791z
categorysteemdev
json_metadata{"tags":["steemdev"],"links":["https://github.com/steemit/steem-python/pull/245"],"app":"steemit/0.1"}
created2018-06-06 18:18:30
last_update2018-06-06 18:18:30
depth1
children1
last_payout2018-06-13 18:18:30
cashout_time1969-12-31 23:59:59
total_payout_value0.017 HBD
curator_payout_value0.003 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length89
author_reputation3,736,161,083,342
root_title"Steem Python BIP38 Wallet Error with Fix"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id59,567,393
net_rshares8,241,908,361
author_curate_reward""
vote details (2)
@coininstant · (edited)
# EDIT: Thanks for not telling me to use beempy!!
![A560CEDF-37CE-4AFA-A241-A59A98253AD2.png](https://cdn.steemitimages.com/DQmfDhHprGMx8Lq9LY2Rm51d9No9TdUUy3EQBhZ6J9C5Mk4/A560CEDF-37CE-4AFA-A241-A59A98253AD2.png)

Wow, thanks it helped! Not sure why they release stuff with errors? lol
2019-06-09 14:59:17 ☆  nickademous in ~
± |master ↑1 ↓2 S:387 U:367 ?:474 ✗| → steempy importaccount coininstant
Account Passphrase: 
Importing active key!
Passphrase: 
Importing posting key!
Importing memo key!
👍  
👎  
properties (23)
authorcoininstant
permlinkpsuz3c
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1","image":["https://cdn.steemitimages.com/DQmfDhHprGMx8Lq9LY2Rm51d9No9TdUUy3EQBhZ6J9C5Mk4/A560CEDF-37CE-4AFA-A241-A59A98253AD2.png"]}
created2019-06-10 01:06:48
last_update2019-06-10 22:59:42
depth2
children0
last_payout2019-06-17 01:06:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length498
author_reputation87,712,212,981,650
root_title"Steem Python BIP38 Wallet Error with Fix"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id86,348,683
net_rshares-1,620,633,044
author_curate_reward""
vote details (2)
@mggiodev ·
$0.38
100% upvote for support... great information.
👍  ,
properties (23)
authormggiodev
permlinkre-anthonyadavisii-steem-python-bip38-wallet-error-with-fix-20180101t032358402z
categorysteemdev
json_metadata{"tags":["steemdev"],"app":"steemit/0.1"}
created2018-01-01 03:23:57
last_update2018-01-01 03:23:57
depth1
children0
last_payout2018-01-08 03:23:57
cashout_time1969-12-31 23:59:59
total_payout_value0.326 HBD
curator_payout_value0.051 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length45
author_reputation428,991,678,035
root_title"Steem Python BIP38 Wallet Error with Fix"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id26,306,667
net_rshares30,835,439,129
author_curate_reward""
vote details (2)