github.com/fff-chain/go-fff@v0.0.0-20220726032732-1c84420b8a99/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", "pairing password")
    35    ```
    36  
    37    The pairing password has been generated during the card initialization process.
    38    
    39    The process needs to be repeated once more with the PIN:
    40  
    41    ```
    42    > personal.openWallet("keycard://044def09", "PIN number")
    43    ```
    44    
    45    If everything goes well, you should see your new account when typing `personal` on the console:
    46  
    47    ```
    48    > personal
    49    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"
    50    {
    51      listAccounts: [],
    52      listWallets: [{
    53          status: "Empty, waiting for initialization",
    54          url: "keycard://044def09"
    55      }],
    56      ...
    57    }
    58    ```
    59  
    60    So the communication with the card is working, but there is no key associated with this wallet. Let's create it:
    61  
    62    ```
    63    > personal.initializeWallet("keycard://044def09")
    64    "tilt ... impact"
    65    ```
    66  
    67    You should get a list of words, this is your seed so write them down. Your wallet should now be initialized:
    68  
    69    ```
    70    > personal.listWallets
    71    [{
    72      accounts: [{
    73          address: "0x678b7cd55c61917defb23546a41803c5bfefbc7a",
    74          url: "keycard://044d/m/44'/60'/0'/0/0"
    75      }],
    76      status: "Online",
    77      url: "keycard://044def09"
    78    }]
    79    ```
    80  
    81    You're all set!
    82  
    83  ## Usage
    84  
    85    1. Start `geth` with the `console` command
    86    2. Check the card's URL by checking `personal.listWallets`:
    87  
    88  ```
    89    listWallets: [{
    90        status: "Online, can derive public keys",
    91        url: "keycard://a4d73015"
    92    }]
    93  ```
    94  
    95    3. Open the wallet, you will be prompted for your pairing password, then PIN:
    96  
    97  ```
    98  personal.openWallet("keycard://a4d73015")
    99  ```
   100  
   101    4. Check that creation was successful by typing e.g. `personal`. Then use it like a regular wallet.
   102  
   103  ## Known issues
   104  
   105    * Starting geth with a valid card seems to make firefox crash.
   106    * PCSC version 4.4 should work, but is currently untested