github.com/kisexp/xdchain@v0.0.0-20211206025815-490d6b732aa7/accounts/scwallet/README.md (about)

     1  # Using the smartcard wallet
     2  
     3  ## Requirements
     4  
     5    * A USB smartcard reader
     6    * A keycard that supports the status app
     7    * PCSCD version 4.3 running on your system **Only version 4.3 is currently supported**
     8  
     9  ## Preparing the smartcard
    10  
    11    **WARNING: FOILLOWING THESE INSTRUCTIONS WILL DESTROY THE MASTER KEY ON YOUR CARD. ONLY PROCEED IF NO FUNDS ARE ASSOCIATED WITH THESE ACCOUNTS**
    12  
    13    You can use status' [keycard-cli](https://github.com/status-im/keycard-cli) and you should get _at least_ version 2.1.1 of their [smartcard application](https://github.com/status-im/status-keycard/releases/download/2.2.1/keycard_v2.2.1.cap)
    14  
    15    You also need to make sure that the PCSC daemon is running on your system.
    16  
    17    Then, you can install the application to the card by typing:
    18  
    19    ```
    20    keycard install -a keycard_v2.2.1.cap && keycard init
    21    ```
    22  
    23    At the end of this process, you will be provided with a PIN, a PUK and a pairing password. Write them down, you'll need them shortly.
    24  
    25    Start `geth` with the `console` command. You will notice the following warning:
    26  
    27    ```
    28    WARN [04-09|16:58:38.898] Failed to open wallet                    url=keycard://044def09                          err="smartcard: pairing password needed"
    29    ```
    30  
    31    Write down the URL (`keycard://044def09` in this example). Then ask `geth` to open the wallet:
    32  
    33    ```
    34    > personal.openWallet("keycard://044def09")
    35    Please enter the pairing password:
    36    ```
    37  
    38    Enter the pairing password that you have received during card initialization. Same with the PIN that you will subsequently be
    39    asked for.
    40    
    41    If everything goes well, you should see your new account when typing `personal` on the console:
    42  
    43    ```
    44    > personal
    45    WARN [04-09|17:02:07.330] Smartcard wallet account derivation failed url=keycard://044def09 err="Unexpected response status Cla=0x80, Ins=0xd1, Sw=0x6985"
    46    {
    47      listAccounts: [],
    48      listWallets: [{
    49          status: "Empty, waiting for initialization",
    50          url: "keycard://044def09"
    51      }],
    52      ...
    53    }
    54    ```
    55  
    56    So the communication with the card is working, but there is no key associated with this wallet. Let's create it:
    57  
    58    ```
    59    > personal.initializeWallet("keycard://044def09")
    60    "tilt ... impact"
    61    ```
    62  
    63    You should get a list of words, this is your seed so write them down. Your wallet should now be initialized:
    64  
    65    ```
    66    > personal.listWallets
    67    [{
    68      accounts: [{
    69          address: "0x678b7cd55c61917defb23546a41803c5bfefbc7a",
    70          url: "keycard://044d/m/44'/60'/0'/0/0"
    71      }],
    72      status: "Online",
    73      url: "keycard://044def09"
    74    }]
    75    ```
    76  
    77    You're all set!
    78  
    79  ## Usage
    80  
    81    1. Start `geth` with the `console` command
    82    2. Check the card's URL by checking `personal.listWallets`:
    83  
    84  ```
    85    listWallets: [{
    86        status: "Online, can derive public keys",
    87        url: "keycard://a4d73015"
    88    }]
    89  ```
    90  
    91    3. Open the wallet, you will be prompted for your pairing password, then PIN:
    92  
    93  ```
    94  personal.openWallet("keycard://a4d73015")
    95  ```
    96  
    97    4. Check that creation was successful by typing e.g. `personal`. Then use it like a regular wallet.
    98  
    99  ## Known issues
   100  
   101    * Starting geth with a valid card seems to make firefox crash.
   102    * PCSC version 4.4 should work, but is currently untested