CLI implementation for WalletConnect


#1

Hi there,

Following up on a discussion we had on Telegram, I was mentioning that it would be great to have a CLI implementation of WalletConnect that would allow CLI to easily connect to a user’s wallet.

Why

Today, it is extremely difficult to connect to a user’s wallet from, say, a command line python script. It is easy only if there is a synced ethereum node running locally (in which case we can tap into the go-ethereum API to connect to the local ethereum accounts of the user). But given the size of the ethereum blockchain and the strong requirement (bandwith, disk I/O…) to keep a local node in sync, it is fair to assume that it is almost never the case. So we need a solution to address this problem and it seems totally within the scope of WalletConnect.

Use cases

Crypto is programmable money right? So it’d be nice to actually be able to easily write programs that interacts with smart-contract for starters. Have you ever tried to deploy or interact with a smart-contract from a command line script? :exploding_head: (to say the least).

Today, the only reasonable alternative, is to ask the user to:

  1. create an account on Infura and input his API key in some config file
  2. programmatically create an ethereum account for him via Infura
  3. ask him to transfer some eth to the newly created account

It’s clearly suboptimal because:

  1. lots of friction: need to create an Infura account (plus, on a personal level, I don’t think it’s good that all ethereum development relies on a centralized service, no matter how good it is)
  2. security issues: the private key of the ethereum account has to be stored locally so it is up to the developer to make sure that the private key is safe… what could go wrong?
  3. need to transfer eth: after that, the user still has to transfer some eth to the new account (and it’s always hard to assess how much is needed to transfer) and wait for the transaction to finalize.

How it would (ideally) work

Using a WalletConnect library, I wish I could display a QR code on the user terminal. There are now lots of library to do this very easily. Here with python-qrcode:


The user would then scan it with his WalletConnected-enabled wallet and would be able to easily approve any transaction made by the script from his wallet :heart:

WDYT?


#2

Concur. It would be a great way for developers to mess around with mobile wallets without the overhead of a web-dApp.

My notes:

  • Remember that once WalletConnect is up and integrated, you’ll be able to use web-based tools like MyCrypto to do some of the things you mentioned (e.g. deploying and interacting with smart contracts). However, those tools always have their limits.
  • It could use a bridge server over a LAN IP address or a public bridge. If we want a private bridge over LAN, we may as well build the bridge into the WC-CLI as one package.
  • It might also become a method of testing the WC-core library & bridge code(?)
  • A CLI integration would be simple to build – probably easier than the web one.
  • That python-qrcode library is sick.

#3

This is so cool! I love everything about this :clap:

We could add also this as nodeJS library as part of the walletconnect-monorepo


#4

Hehe funny: with this use-case I created https://github.com/walleth/console-barcodes a month ago :wink:
Just had some other things on the table in between - but will for sure get back to it.