aleph-im / aleph-sdk-python

Python SDK library for the Aleph.im network
MIT License
3 stars 4 forks source link

Add support for signing messages using LedgerHQ wallet on Ethereum #51

Closed hoh closed 1 year ago

hoh commented 1 year ago

The ability to use private keys stored on a hardware wallet to sign messages would greatly enhance the security of the network, especially since messages can be amended and the virtual machines will potentially have many side effects.

The command / response scheme used by LedgerHQ to address the device is similar to the ISO/IEC 7816-4 smartcard protocol. Each command / response packet is called an APDU (application protocol data unit).

Each APDU is specific to Ledger application, that adds the support for a chain or functionality.

The library ledgereth implements the LedgerHQ ADPU for the Ethereum application.

This branch adds support in the SDK.

Usage:

>>> import asyncio
>>> from aleph.sdk.client import AuthenticatedAlephClient
>>> from aleph.sdk.wallets.ledger.ethereum import LedgerETHAccount
>>> account = LedgerETHAccount.from_address("0x...")
>>> client = AuthenticatedAlephClient(account=account, api_server="https://api2.aleph.im")
>>> await client.create_post(post_content="coucou", post_type="ALEPH_TEST")

Related to https://github.com/aleph-im/aleph-client/issues/13