npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

blockstack-trezor

v0.10.0

Published

Simple utility for Blockstack trezor transactions

Downloads

19

Readme

Trezor Signing Library for Blockstack

This package implements the TransactionSigner interface from blockstack.js using Trezor's connect.js API.

This provides both single-sig and multi-sig signers.

To use:

import { TrezorSigner } from 'blockstack-trezor'
import bsk from 'blockstack'

const signer = TrezorSigner.create(`m/44'/88'/0'/0/1`)
bsk.makeTokenTransfer(recipientAddress, 'STACKS', BigInteger.fromHex('10'), '', signer)
    .then((signedTX) => ...)

Note: Because this uses connect.js, this is only usable in browser-y contexts.

Dependencies

Multi-sig support depends on the current develop branch of blockstack.js.

Testing

This repo includes a karma-based testing system, which tests the generation/signing of Blockstack UPDATE transactions.

To run these, you need to:

  1. Install the Trezor emulator from here
  2. Start the emulator and trezord with an emulator connection
# if you already have trezord running
$ sudo service trezord stop
# start emulator
$ ./emu.sh
# restart trezord with emulator connection
$ trezord -e 21324
  1. Restore the emulator wallet with the following 12-word phrase:
wink around rely cluster level off monitor ugly oak enrich plate street
  1. Run the karma tests:
$ npm run karma
  1. You will be prompted throughout the tests to click through trezor-connect dialogs and confirm actions on the emulator. Do that.

See bitcoin transactions:

099b1dfc916ec5b435a8b8e50462984f359248fe30b9f276b8937e0a1eba37e2

6d9dad793ed967e6cd1821b86bc7aafad75b8b30b282f7b5255a7a71fb862150

For the bitcoin transactions which should be created.

Testnet Usage

Using this in normal Blockstack reg-test contexts is kind of difficult. This is because Trezor's interfaces will not let you specify a particular Bitcoin bitcore node to use, rather, they use their own Testnet nodes (I understand their reasons for this, as this is the best policy for the security of users, but it makes testing much harder!) Instead, the way I've been testing this is to point the blockstack.js configuration at the blockstack testnet, and override the bitcoind URL to point at the Trezor bitcore instances. This "works" in that it will correctly generate and sign transactions which are valid on the Bitcoin Testnet, however, because this is actually a different network from Blockstack's testnet, these transaction will not be picked up there.

Anyways, this terrible conconction can be configured via:

import { configureTestnet } from 'blockstack-trezor'

configureTestnet()
// now your blockstack.js network configuration object will
//  be configured to use trezor's bitcore service.

Just use mainnet BTC: Since using BTC testnet is often a pain, it can be easier to just use BTC mainnet, but point your Blockstack API at testnet. This will create real BTC spends, but they'll be invalid Blockstack transactions. BE SURE NOT TO USE ADDRESSES WITH REAL STACKS BALANCES --- OR NAMES as consensus hashes will invalidate some, but not all transactions.

To do that, just modify your blockstack.js configuration object:

  bsk.config.network = bsk.network.defaults.MAINNET_DEFAULT
  bsk.config.network.blockstackAPIUrl    = `http://${blockstackTestnet}:16268`