Skip to content

evmos/wallet-py

Repository files navigation

Evmos wallet

PyPI version pre-commit.ci status

Evmos wallet utils for python3.9+.

Requirements

The cryptocurve dependency requires some libs to be built:

sudo apt-get install build-essential libssl-dev libffi-dev python3-dev autoconf libtool pkgconf

MacOS:

brew install autoconf automake libtool

Installation

pip install evmoswallet

Usage

from evmoswallet import Wallet

wallet = Wallet(seed)
seed = 'report spend crisp crisp world shock morning hour ' \
       'spoon problem one hole program piano donkey width ' \
       'today view canoe clap brick bundle rose book'

print(wallet.eth_address)
# "0xe7e3654bc1ea915e7216d8193ef8dd7d5dae987f"
print(wallet.evmos_address)
# "evmos1ul3k2j7pa2g4uuskmqvna7xa04w6axrl85alz5"
print(wallet.private_key)
# bytes.fromhex("8721109b7244925c0480f4172546b8b53dfe87845274070fbe8e6da739d1b813")

msg = bytes(...) # protobuf message
signed = wallet.sign(msg)

MacOS openssl error

If you get the error that says something like the libcrypto is running on unsafe mode and the process is aborted:

brew install openssl
sudo ln -s /opt/homebrew/opt/openssl@1.1/lib/libcrypto.1.1.dylib /usr/local/lib
sudo ln -s /opt/homebrew/opt/openssl@1.1/lib/libssl.1.1.dylib /usr/local/lib
cd /usr/local/lib
sudo ln -s libcrypto.3.dylib libcrypto.dylib
sudo ln -s libssl.3.dylib libssl.dylib

References