Hardwarewallets are the best way to keep your cryptocurrency funds secure. We all know about how dangerous it is to leave your private keys exposed to the internet, or to leave your funds in the hands of other organizations. The problem for developers is that hardwarewallets are difficult to integrate with, and each one is different. On top of this, developers need to contend with multiple different platforms, and multiple different blockchain/coins. The aim of Hardwarewallets.Net is to define a set of interfaces and utilities that make the experience of developing for hardwarewallets in C# seamless across platforms, coins, and devices.
Address paths are the fundamental building blocks for dealing with any cryptocurrency. It defines where funds are coming from and where funds can go to. However, there is a great deal of complexity in deriving address paths. The BIP 44 standard was an attempt to put a layer over the top of all address path derivations, but this standard has come too late. Many coins don’t follow this standard, and many apps have to support legacy address paths that do not follow the standard. So, a looser interface for address paths was required while attempting to steer developers toward the BIP 44 standard wherever possible.
IAddressPath is used to define an array of path elements. You would usually use these elements as unhardened values. When the path is passed to the hardwarewallet (such as Trezor or Ledger) the elements will be hardened if the IAddressPathElement specifies the Harden flag. The elements in the path are often useful for determining information about the path before the values are hardened for derivation.
The interface IBIP44AddressPath extends this interface. It allows the developer to glean information like Coin Type and whether or not the coin is a Segwit coin ebfore this information is lost when the numbers are hardened. This interface should be used wherever possible so as to implement the BIP44 standard. However, for some coins, and legacy paths, this is not possible.
For all hardwarewallet libraries that support Hardwarewallet.Net there are useful utilities for deriving addresses. The Parse method allows the developer to convert a string path to an IAddressPath based object like this.
Out of the box there are custom paths, and Bip 44 paths which have inbuilt logic for validation and so on. However, new classes can be derived from the interface with custom logic and used in any of the libraries that implement Hardwarewallets.Net’s interfaces.
Finally, IAddressDeriver is the interface that Trezor.Net, Ledger.Net, and KeepKey.Net implement. This is used to derive addresses. This base interface can be used across all devices.
Here is an example from Trezor.Net:
Currently, transactions (specifically Ethereum transactions) are being worked on. Please jump on slack to have a chat with us about how to implement this:
Hopefully, in the next part, I will talk about how transactions can be made across different hardwarewallets.