chain: Index | Files | Directories

package core

import ""

Package core implements Chain Core and its API.


Package Files

access_tokens.go accounts.go api.go assets.go authn.go control_programs.go core.go errors.go exec_unix.go health.go hsm.go http.go metrics.go query.go request.go rpc.go transact.go txfeeds.go

func CleanupSubmittedTxs Uses

func CleanupSubmittedTxs(ctx context.Context, db pg.DB)

CleanupSubmittedTxs will periodically delete records of submitted txs older than a day. This function blocks and only exits when its context is cancelled.

TODO(jackson): unexport this and start it in a goroutine in a core.New() function?

func WriteHTTPError Uses

func WriteHTTPError(ctx context.Context, w http.ResponseWriter, err error)

WriteHTTPError writes a json encoded detailedError to the ResponseWriter. It uses the status code associated with the error.

type Handler Uses

type Handler struct {
    Chain         *protocol.Chain
    Store         *txdb.Store
    PinStore      *pin.Store
    Assets        *asset.Registry
    Accounts      *account.Manager
    HSM           *mockhsm.HSM
    Indexer       *query.Indexer
    TxFeeds       *txfeed.Tracker
    AccessTokens  *accesstoken.CredentialStore
    Config        *config.Config
    DB            pg.DB
    Addr          string
    AltAuth       func(*http.Request) bool
    Signer        func(context.Context, *bc.Block) ([]byte, error)
    RequestLimits []RequestLimit
    // contains filtered or unexported fields

Handler serves the Chain HTTP API

func (*Handler) HealthSetter Uses

func (h *Handler) HealthSetter(name string) func(error)

HealthSetter returns a function that, when called, sets the named health status in the map returned by "/health". The returned function is safe to call concurrently with ServeHTTP.

func (*Handler) ServeHTTP Uses

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RequestLimit Uses

type RequestLimit struct {
    Key       func(*http.Request) string
    Burst     int
    PerSecond int


accesstokenPackage accesstoken provides storage and validation of Chain Core credentials.
accountPackage account stores and tracks accounts within a Chain Core.
assetPackage asset maintains a registry of all assets on a blockchain.
blocksignerPackage blocksigner implements remote block signing.
configPackage config manages persistent configuration data for Chain Core.
coretestPackage coretest provides utilities for testing Chain Core.
coreunsafePackage coreunsafe contains Core logic that is unsafe for production.
fetchPackage fetch implements block replication for participant Chain Cores.
generatorPackage generator implements the Chain Core generator.
leaderPackage leader implements leader election between cored processes of a Chain Core.
migratePackage migrate implements database migration for Chain Core.
mockhsmPackage mockhsm provides a mock HSM for development environments.
queryPackage query implements indexing and querying of annotated blockchain data.
query/filterPackage filter parses and evaluates Chain filter expressions.
rpcPackage rpc implements Chain Core's RPC client.
signersPackage signers associates signers and their corresponding keys.
txbuilderPackage txbuilder builds a Chain Protocol transaction from a list of actions.
txdbPackage txdb provides storage for Chain Protocol blockchain data structures.
txfeedPackage txfeed implements Chain Core's transaction feeds.

Package core imports 46 packages (graph). Updated 2019-02-15. Refresh now. Tools for package owners.

The go get command cannot install this package because of the following issues: