oracle

package
v0.0.0-...-42c6bbb Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: GPL-2.0, GPL-3.0 Imports: 13 Imported by: 0

README

oracle

This folder contains the AI oracle functionality that is used to verify data via cross-referencing.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Schedule

func Schedule()

Schedule() schedules regular calls to APIs and FTP servers for data, sends the data to the oracle for verification and storage on IPFS and Ethereum. To add new scheduled API wrappers, simply add another c.AddFunc() call with your desired schedule, the report type of the data received from the external API, the type of climate actor that the data is associated with, the ID of the actor, and the function. The function must not receive any parameters and must output (interface{}, error); must conform to the getExternalData function type.

func VerifyAndCommit

func VerifyAndCommit(reportType string, entityType string, entityID int, data interface{}) error

VerifyAndCommit receives data and depending on what kind of data it is, sends it to a helper function to verify the data and compute the "true value". Next, it commits the verified data itself to IPFS, receives the IPFS hash, then commits the hash and the computed statistic to Ethereum.

Types

type BlockChainDataStruct

type BlockChainDataStruct struct {
	EntityType string
	EntityID   int
	ReportType string
	DataVal    float64
	IpfsHash   string
}

Struct defining the data scheme of all reported climate action data when it is stored on Ethereum. Contains all metadata necessary to locate the correct data and statistic and ensure that it is attached to the correct climate actor.

type FileString

type FileString struct {
	Name    string
	FileStr string
}

Struct attaches a name to the filestring.

type GlobalCO2

type GlobalCO2 struct {
	Source    string
	Location  string
	Frequency string // annually, monthly, daily, etc.
	Year      int
	Month     int
	Day       int
	Cycle     float64
	Trend     float64
}

The GlobalCO2 struct defines the data and meta-data that will be attached To the atmospheric CO2 measurements observed at various sites and stored on the NOAA ESRL FTP server.

type GlobalTemp

type GlobalTemp struct {
	Source    string
	Location  string
	Frequency string // annually, monthly, daily, etc.
	Year      int
	Month     int
	Day       int
	Cycle     float64
	Trend     float64
}

The GlobalTemp struct defines the data and meta-data that will be attached to global temp measurements (TBD where the temperature data will come from).

type UserDefinedIntegrity

type UserDefinedIntegrity func(interface{}) bool

Function type that returns a bool to test whether data meets user-specified criteria

Jump to

Keyboard shortcuts

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