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

feedbase

v0.9.0

Published

**Note:** Feedbase is still under development. There is no live network deployment, and the Morden address may be updated at any time. (If you prefer, you can easily deploy your own instances of Feedbase.)

Downloads

3

Readme

Note: Feedbase is still under development. There is no live network deployment, and the Morden address may be updated at any time. (If you prefer, you can easily deploy your own instances of Feedbase.)

Feedbase

This small, self-contained Ethereum contract lets you create "feeds" that you can use to publish arbitrary 32-byte values, with attached expiration dates to prevent consumers from reading stale data.

Perhaps most interestingly, the owner of a feed has the ability to tax on-chain consumers (i.e., smart contracts) for making use of the feed. This happens at most once for each feed value (to the first consumer). The reason for this is that you couldn't really prevent anyone from creating a simple contract that would repeat your feed values anyway. However, you're free to publish new values again as often as you want.

The prices can be changed at any time, although for security reasons the address of the underlying ERC20 token can only ever be set once.

One obvious application of Feedbase is publishing financial data to smart contracts that rely on "oracles" in a nice, standardized way. Another interesting use case is for configuration of smart contracts.

Think of Feedbase as a piece of low-level Ethereum infrastructure: it's free for anyone to use, and not owned or controlled by anyone.

Getting started

Feedbase comes with a simple commmand-line tool for managing feeds:

npm install -g feedbase

To specify which Ethereum account to use (defaults to the first one):

export ETH_ACCOUNT=0x1234567890123456789012345678901234567890

For anything to happen, you need to run an RPC-enabled Ethereum node:

geth --testnet --rpc --unlock 0x1234567890123456789012345678901234567890

Important: Make sure your chain is synced before using feedbase.

Working with feeds

To start publishing your values, first claim a feed ID:

feedbase claim

If you want to be able to tax your smart contract consumers, this step is where you specify the address of your (ERC20-compatible) token:

feedbase claim 0x4244e29ec71fc32a34dba8e89d4856e507d1bc87

If nothing goes wrong (sad to say, the CLI is a bit flaky sometimes), within a minute you should see something like this:

{
  "id": 7302,
  "token": "0x0000000000000000000000000000000000000000",
  "owner": "0x34e510285d96cdc6063d5447763afea0acd61baa",
  "label": "",
  "price": 0,
  "available": false,
  "value": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": 0,
  "expiration": 0,
  "unpaid": false
}

Now you can do a few things. You can inspect the feed at will:

feedbase inspect 7302

Note: Although you are an off-chain consumer who can in principle read the value of any feed for free, the feedbase inspect command is not currently able to display the value of a feed unless it's either free or you could hypothetically pay for it (then it's "available"); this is because it's implemented using the eth_call RPC operation. If the value has expired or cannot be read, it will show up as zero and the available property will be set to false.

You can set an arbitrary label (32 bytes maximum):

feedbase set-label 7302 "Temperature in Central Park"

If you specified a token, you can change the price:

feedbase set-price 7302 0x10000000

You can transfer ownership of the feed to another account:

feedbase set-owner 7302 0x4b51d646f0e3677411b27101d2a3f09223a8372e

You can also continuously watch the blockchain for all Feedbase events:

feedbase watch

Now, to actually update the feed value, you'd use a command like this:

feedbase set 7302 0x0000000000000000000000000000000490000000000000000000000000000000 1467204471

Here, we're setting the value of feed number 7302 to the number 73 represented in 128x128 fixed-point notation. The expiration date is set to June 29 12:47:51 UTC 2016 (represented in standard Unix time).

Again, the values can be anything as long as they fit within 32 bytes.

That's it!

More information

For more details, take a look at the following files:

contracts/feedbase.sol
contracts/feedbase_test.sol
bin/feedbase
lib/feedbase.js

You can also check out Keeper (https://github.com/nexusdev/keeper), an "admin toolkit for incentive-following software daemons," designed to do things like publishing price feeds to blockchains.

Happy hacking!