npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

huff

v0.7.0

Published

Commandline utility for ethereum.

Downloads

9

Readme

huff

Commandline utility for ethereum. For convenience.

  1. Create, Mine and Reset private network.
  2. Keystore / Account tools.
  3. Transferring ether between accounts.
  4. Deploying contracts.
  5. Calling and transacting with contracts.
  6. Watching contracts
  7. Scripting
npm install -g huff
huff -h

Made for osx/linux, your paths may differ

Create, Mine and Reset private network.

huff --reset
huff --reset [--datadir <alternative>]
  • Destroys the network in $HOME/.huff/* or <alternative>
  • Recreates it, prompting for new etherbase account passphrase
  • Generates genesis.json file.

huff --mine
  • Start mining the new network
  • Creates $HOME/.huff/geth.ipc for attach

Keystore / Account tools.

huff --create-account
  • Creates a new account in the datadir/keystore
  • Prompts for a passphrase for the new account
  • Same as geth --datadir ~/.huff/ account new
  • BUT: Adding accounts using geth will put the account sequences out of order

huff --list-accounts
  • List all accounts in datadir/keystore
  • Listing includes balance in wei

huff --show-key <account>
huff --show-key 0
huff --show-key c10d9bbb5c9481860997e8dc5c6ada6e0ccd6f61
  • Show account's privateKey

huff --balance 0
huff --balance 9372fbb45a307c70f874f48a0668b512ed1ae64d
  • Show accounts balance in wei

Transferring ether between accounts.

huff --transfer 20 --to 2
  • Transfers 20 ether from account[0] to account[2]
  • Prompts for passphrase for account[0]
  • Displays transaction receipt

huff --transfer 10 \
     --sender 9372fbb45a307c70f874f48a0668b512ed1ae64d \
     --to 02a82e3e3fb4e2afb01971556373fa0e03898c79
  • Transfers 10 ether from sender address
  • Prompts for passphrase of 9372fbb45a307c70f874f48a0668b512ed1ae64d account

huff --transfer 10000000 --wei --sender 1 --to 0
  • Transfer unit as wei instead of ether

Deploying contracts

huff --deploy example/greeter.sol -p 'hello world!' [--gas 1000000]
  • Deploys contract from source in example/greeter.sol
  • Constructor param as 'hello world'
  • Writes deployment state files into example/greeter.sol.deployed/*
  • You may want to .gitignore *.deployed

huff --sender 2 --deploy example/imagine.sol -p 'all the' -p people
  • Supports more than one constructor parameter

huff --deploy example/greeter.sol -p 'hello africa!' --tag africa
huff --deploy example/greeter.sol -p 'hello asia!' --tag asia
  • Use optional --tag to deploy multiple instances of the same contract.
  • Separate state files are created in example/greeter.sol.deployed/*
  • The tag is used to distinguish between them in --connect and --send (see below)

huff --compile example/greeter.sol
  • A variation on --deploy that only performs the compile step
  • Stores subset of state files in example/greeter.sol.deployed/(abi,code)

Calling and transacting with contracts

huff --connect example/greeter.sol --tag africa --send greet
  • Runs the greet() method on the previously compiled contract
  • Uses the utility files (as deployed) from example/greeter.sol.deployed/latest/* for ABI and Address
  • Displays the result to console

huff --connect example/greeter.sol --send echo -p 'arg1' -p 'arg2'
  • Runs echo() with two arguments

huff --connect example/greeter.sol --send kill
  • Sends transaction to the kill() method

huff --connect token.sol --send balanceOf -p 0x9372fbb45a307c70f874f48a0668b512ed1ae64d
  • Precede address with '0x' when passing as parameters

huff --compile contract.sol
huff --connect contract.sol --address 0x8ca785e0bea58aa09e88bc3411e648f5aff636bc --send method
  • Uses the compile (without deploy) option to generate the necessary abi utility file
  • Then connects to an existing instance of that contact at the specified address

Watching contracts

huff --watch example/greeter.sol
# second console
huff --connect example/greeter.sol --send update -p 'hello world'
  • The first starts watching the contract for events.
  • The second calls update('hello world') which emits an event

Scripting

eg.

# deploy the parent contract
huff --pass z --deploy example/parent.sol

# spawn a child through it and use --json pointer to only
# print that part of the transaction reciept containing 
# the new child's address
CHILD_ADDRESS=`huff --pass z --connect example/parent.sol --send spawnChild -p 'Child Name' --json /logs/0/args/child`

# compile but don't deploy the child
# (for abi written into example/child.sol.deployed/..
huff --compile example/child.sol

# get childs name
huff --connect example/child.sol --address $CHILD_ADDRESS --send name

TODO

  • pop archive on kill()