1

On many occasions, I'd like to quickly connect to a local or remote node via web3.js and query for things directly from the console. I imagine something like:

web3-cli set --host http://localhost:8545
web3-cli eth --get-accounts

The first command would switch over to the given host, and when you query for accounts or others things it connects to that HttpProvider in the backend.

Is this possible? I've seen David Knott from OmiseGo created a nice cli for plasma-mvp, so why not upgrade the idea to a general-purpose, handy terminal tool?

Note: I'm already running node in the console, but it's not the same sweet level of flexibility provided by a cli.

3

I assume you are referring to the web3.js Javascript library for interfacing with the Ethereum blockchain? I agree. It is great.

so why don't upgrade the idea to a general-purpose, handy terminal tool?

Because doing so would be reinventing the wheel. Javascript can be executed in all sorts of different environments nowadays. If you want to use it through your terminal, why not just use nodejs.

web3.js is available as a package through npm

Start a node console, import web3.js and off you go.

  • Yup, web3.js. I'm already running node in the console, but it's not the same sweet level of flexibility provided by a cli. – Paul Berg Aug 7 '18 at 16:20
  • What additional flexibility do you want? web3.js provides access to every method exposed by the JSON-RPC API. The only difference is the calling syntax.. – Thomas Clowes Aug 7 '18 at 16:22
  • I'm a heavy user of bash aliases, so, for instance, I use gpom for git push origin master. I know we're talking about smallish productivity increases here, but it's just what I do. Devs have many different tastes. Thank you anyway! :) – Paul Berg Aug 7 '18 at 16:39
  • @PaulRBerg geth uses github.com/urfave/cli CLI , you can extend it and personalize it as you want. Or you can create your shortcuts in javascript and load them in a javascript file at initialization time. – Nulik Aug 8 '18 at 14:00
0

There's a web3 CLI here: https://github.com/gochain-io/web3/

Works with Ethereum, GoChain, etc.

Can examine the blockchain, build, deploy and interact with smart contracts, send tokens, etc. Some example commands:

web3 send --to RECIPIENT_ADDRESS AMOUNT
web3 contract build token.sol
web3 contract deploy Token.bin
web3 contract call --address 0xCONTRACT_ADDRESS --abi Hello.abi --function hello

See the README for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.