spire

command
v0.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 25, 2022 License: AGPL-3.0 Imports: 22 Imported by: 0

README

Spire CLI Readme

Spire allows for broadcasting signed price messages through a network of peer-to-peer nodes over the gossip-sub protocol of libp2p.

  • Table of contents

Installation

To install it, you'll first need Go installed on your machine. Then you can use standard Go command:

go get -u github.com/chronicleprotocol/oracle-suite/cmd/spire

Alternatively, you can build Spire using Makefile directly from the repository:

git clone https://github.com/chronicleprotocol/oracle-suite.git
cd oracle-suite
make

This will build the binary in bindirectory.

Quick Start

Spire consists of two main parts:

  1. P2P node (agent) responsible for connecting to other peers.
  2. Spire CLI, that allows for sending and receiving messages.
Minimal steps
  • Create a new ethereum key.
  • Edit the spire.json configuration file to point to the created file
{
  "ethereum": {
    "from": "0xYourEthereumAddress",
    "keystore": "/path/to/the/keystore/directory",
    "password": "/path/to/a/text/file/with/polain/text/password"
  }, 
  ...
}
  • Start the agent.
spire agent
  • Now you can push price messages into the network
cat <<"EOF" | spire push price
{
    "wat": "BTCUSD",
		// price is 32 bytes (no 0x prefix) `seth --to-wei "$_price" eth`
		// i.e. 1.32 * 10e18 => "13200000000000000000"
    "val": "13200000000000000000",
		// unix epoch (seconds only)
		"age": 123456789,
		"r": <string>, // 64 chars long, hex encoded 32 byte value
		"s": <string>, // 64 chars long, hex encoded 32 byte value
		"v": <string>,  // 2 chars long, hex encoded 1 byte value
    "trace": <string> // (optional) human readable price calculation description
}
EOF
  • ...and you can pull all the prices captured by spire
spire pull prices
  • or pull a price for a specific asset and a specific feed
spire pull price BTCUSD 0xFeedEthereumAddress

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL