Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/summa-tx/riemann-ledger
rapid prototyping library for SegWit and Ethereum txns on ledger hardware wallets 🎈🎈
https://github.com/summa-tx/riemann-ledger
Last synced: 2 months ago
JSON representation
rapid prototyping library for SegWit and Ethereum txns on ledger hardware wallets 🎈🎈
- Host: GitHub
- URL: https://github.com/summa-tx/riemann-ledger
- Owner: summa-tx
- License: other
- Created: 2019-04-16T02:12:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T03:14:06.000Z (about 2 years ago)
- Last Synced: 2024-04-29T11:45:44.427Z (9 months ago)
- Language: Python
- Homepage:
- Size: 296 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE2.md
Awesome Lists containing this project
README
## riemann-ledger: sign transactions on a ledger
Py37+ library for signing transactions on your Ledger hardware wallet.
Supports Native Segwit BTC transactions (`riemann-tx`), and Ethereum
transactions (`riemann-ether`). Check those libraries for documentation of the
transaction format.### Usage
You may need to install `libudev-dev` and/or `libusb-1.0-0-dev`.
If a function needs to communicate with the device, the client object is passed
as the first argument.We recommend using the hardware client as a context manager, although you can
also manage its lifecycle by calling `open` and `close`.### Example
```python
import asynciofrom riemann.tx import Tx as BitcoinTx
from ether.ether_types import UnsignedEthTxfrom ledger import blue, btc, eth
derivation = 'm/44h/0h/0h/0/1'
# for Eth, make sure to use `m/44h/60h/0h/0/0`async def recommended_pattern():
# Recommended: use the client as a context manager
async with blue.Ledger() as client:
# Open the BTC app on the device
xpub = await btc.get_xpub(client, derivation)t: BitcoinTx = ... # a riemann-tx native witness transaction
prevouts: List[PrevoutInfo] = [...] # defined in ledger.ledger_types# sign each input we can sign
# return a list. Each entry is the signature bytes. None if un-signable
sigs: List[Optional[str]] = await btc.get_tx_signatures(
client=client,
t=t,
prevouts=prevouts,
derivation=derivation)# Switch to the Ethereum app on the device
# ethereum key info
key = await eth.get_key_info(client, derivation)# also sign an ethereum txn
eth_tx = UnsignedEthTx(...)
signed_eth_tx = await eth.sign_transaction(client, eth_tx, derivation)def as_an_object_sync():
# use the client as an object
client = blue.Ledger()
client.open()# higher-level methods assume async
# the sync exchange is only useful for low-level communication
client.exchange_sync(...)# if you don't close it, future open() calls on other objects will error
client.close()```
### Development
You may need to install `libudev-dev` and/or `libusb-1.0-0-dev`
Clone the repo, then install dependencies with `pipenv install`
Run tests with `./run_tests.sh`. Right now this only runs the linter and mypy.
We'll write some tests soon### Tests
`./run_tests.sh` will run the linter and type checker. We currently do not have
unit tests.