BTCPayServer.Vault/BTCPayServer.Hwi
nicolas.dorier 348fcbad35
bump hwi
2020-11-26 14:19:21 +09:00
..
Deployment bump hwi 2020-11-26 14:19:21 +09:00
Internals Fix warnings 2019-11-26 11:27:04 +09:00
Transports Simplify the CliTransport, make sure the hdpubkey parse send back Format exception 2019-11-26 11:05:25 +09:00
BTCPayServer.Hwi.csproj [COMMIT] The proj files have been updated to enable SourceLink [BTCPayServer.Hwi.csproj] 2020-06-25 14:29:38 +03:00
DeviceSelectors.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HardwareWalletModels.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HwiClient.cs Prepare the HttpTransport 2019-10-29 20:29:59 +09:00
HwiCommands.cs Fix display address, add SignMessage 2019-10-27 16:40:25 +09:00
HwiDeviceClient.cs Should not finalize automatically 2019-11-19 23:30:36 +09:00
HwiEnumerateEntry.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HwiErrorCode.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HwiException.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HwiOption.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HwiOptions.cs Add BTCpayServer.HWI 2019-10-27 00:25:14 +09:00
HwiParser.cs Fix display address, add SignMessage 2019-10-27 16:40:25 +09:00
PushNuget.ps1 Fix nuget 2019-11-26 11:21:41 +09:00
README.md Bump hwi 2020-06-30 10:12:54 +09:00
Version.csproj bump 2020-06-22 17:41:40 +09:00

NuGet

How to use BTCPayServer.Hwi

First, you need to reference the nuget package in your project.

using System;
using System.Linq;
using System.Threading.Tasks;
using BTCPayServer.Hwi;
using BTCPayServer.Hwi.Deployment;
using NBitcoin;

namespace BTCPayServer.Vault
{
    class Program
    {
        static async Task Main(string[] args)
        {
            // This line will download hwi program in the process current directory
            await HwiVersions.v1_1_2.Current.EnsureIsDeployed();

            var hwiClient = new HwiClient(Network.Main);

            // Enumerate the harware wallets on this computer
            // If your device is not detected and you are on linux,
            // make sure that you properly applied udev rules.
            // These are necessary for the devices to be reachable on Linux environments.
            // See https://github.com/bitcoin-core/HWI/tree/master/hwilib/udev
            var device = (await hwiClient.EnumerateDevicesAsync()).First();

            // Ask the device to display the segwit address on the BIP32 path "84'/0'/0'/0/0"
            await device.DisplayAddressAsync(ScriptPubKeyType.Segwit, new KeyPath("84'/0'/0'/0/0"));
        }
    }
}

You can find some other example on how to use this library in BTCPayServer.Vault.Tests/HwiTests.cs.

Licence

This project is under MIT License.

Special thanks

Special thanks to Wasabi Wallet, this code is based on their work, and as well to the bitcoin developers and achow101 for the HWI Project.