go

module
v0.0.0-...-4b7be03 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2020 License: Apache-2.0

README

AiBlocks
Creating equitable access to the global financial system

AiBlocks Go Monorepo

Build Status GoDoc Go Report Card

This repo is the home for all of the public Go code produced by the AiBlocks Development Foundation.

This repo contains various tools and services that you can use and deploy, as well as the SDK you can use to develop applications that integrate with the AiBlocks network.

Package Index

  • Millennium Server: Full-featured API server for AiBlocks network
  • Go Millennium SDK - millenniumclient: Client for Millennium server (queries and transaction submission)
  • Go Millennium SDK - txnbuild: Construct AiBlocks transactions and operations
  • Ticker: An API server that provides statistics about assets and markets on the AiBlocks network
  • Keystore: An API server that is used to store and manage encrypted keys for AiBlocks client applications
  • Servers for Anchors & Financial Institutions
    • Compliance Server: Allows financial institutions to exchange KYC information
    • Federation Server: Allows organizations to provide addresses for users (jane*examplebank.com)

Dependencies

This repository is officially supported on the last two releases of Go, which is currently Go 1.14 and Go 1.15.

It depends on a number of external dependencies, and uses Go Modules to manage them. Running any go command will automatically download dependencies required for that operation.

You can choose to checkout this repository into a GOPATH or into any directory.

Directory Layout

In addition to the other top-level packages, there are a few special directories that contain specific types of packages:

  • clients contains packages that provide client packages to the various AiBlocks services.
  • exp contains experimental packages. Use at your own risk.
  • handlers contains packages that provide pluggable implementors of http.Handler that make it easier to incorporate portions of the AiBlocks protocol into your own http server.
  • support contains packages that are not intended for consumption outside of AiBlocks's other packages. Packages that provide common infrastructure for use in our services and tools should go here, such as db or log.
  • support/scripts contains single-file go programs and bash scripts used to support the development of this repo.
  • services contains packages that compile to applications that are long-running processes (such as API servers).
  • tools contains packages that compile to command line applications.

Each of these directories have their own README file that explain further the nature of their contents.

Other packages

In addition to the packages described above, this repository contains various packages related to working with the AiBlocks network from a go program. It's recommended that you use godoc to browse the documentation for each.

Package source layout

While much of the code in individual packages is organized based upon different developers' personal preferences, many of the packages follow a simple convention for organizing the declarations inside of a package that aim to aid in your ability to find code.

In each package, there may be one or more of a set of common files:

  • errors.go: This file should contains declarations (both types and vars) for errors that are used by the package.
  • example_test.go: This file should contains example tests, as described at https://blog.golang.org/examples.
  • main.go/internal.go (deprecated): Older packages may have a main.go (public symbols) or internal.go (private symbols). These files contain, respectively, the exported and unexported vars, consts, types and funcs for the package. New packages do not follow this pattern, and instead follow the standard Go convention to co-locate structs and their methods in the same files.
  • main.go (new convention): If present, this file contains a main function as part of an executable main package.

In addition to the above files, a package often has files that contains code that is specific to one declared type. This file uses the snake case form of the type name (for example loggly_hook.go would correspond to the type LogglyHook). This file should contain method declarations, interface implementation assertions and any other declarations that are tied solely to that type.

Each non-test file can have a test counterpart like normal, whose name ends with _test.go. The common files described above also have their own test counterparts... for example internal_test.go should contains tests that test unexported behavior and more commonly test helpers that are unexported.

Generally, file contents are sorted by exported/unexported, then declaration type (ordered as consts, vars, types, then funcs), then finally alphabetically.

Test helpers

Often, we provide test packages that aid in the creation of tests that interact with our other packages. For example, the support/db package has the support/db/dbtest package underneath it that contains elements that make it easier to test code that accesses a SQL database. We've found that this pattern of having a separate test package maximizes flexibility and simplifies package dependencies.

Contributing

Contributions are welcome! See CONTRIBUTING.md for more details.

Developing

See DEVELOPING.md for helpful instructions for getting started developing code in this repository.

Directories

Path Synopsis
Package address provides utility functions for working with aiblocks addresses.
Package address provides utility functions for working with aiblocks addresses.
Package amount provides utilities for converting numbers to/from the format used internally to aiblocks-core.
Package amount provides utilities for converting numbers to/from the format used internally to aiblocks-core.
Package clients contains sub-packages that provide client access to the various aiblocks services.
Package clients contains sub-packages that provide client access to the various aiblocks services.
aiblockscore
Package aiblockscore is a client library for communicating with an instance of aiblocks-core using through the server's HTTP port.
Package aiblockscore is a client library for communicating with an instance of aiblocks-core using through the server's HTTP port.
millenniumclient
Package millenniumclient provides client access to a Millennium server, allowing an application to post transactions and look up ledger information.
Package millenniumclient provides client access to a Millennium server, allowing an application to post transactions and look up ledger information.
Package crc16 is implementation according to CCITT standards.
Package crc16 is implementation according to CCITT standards.
exp
Package exp houses experimental packages related to AiBlocks developement
Package exp houses experimental packages related to AiBlocks developement
crypto/derivation
Package derivation provides functions for ed25519 key derivation as described in: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
Package derivation provides functions for ed25519 key derivation as described in: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
support/jwtkey
Package jwtkey provides utility functions for generating, serializing and deserializing JWT ECDSA keys.
Package jwtkey provides utility functions for generating, serializing and deserializing JWT ECDSA keys.
support/pipeline
TODO explain here how to write wrappers to use without casting from `interface{}`.
TODO explain here how to write wrappers to use without casting from `interface{}`.
handlers
federation
Package federation provides a pluggable handler that satisfies the AiBlocks federation protocol.
Package federation provides a pluggable handler that satisfies the AiBlocks federation protocol.
Package ingest provides primitives for building custom ingestion engines.
Package ingest provides primitives for building custom ingestion engines.
io
verify
Package verify provides helpers used for verifying if the ingested data is correct.
Package verify provides helpers used for verifying if the ingested data is correct.
Package meta provides helpers for processing the metadata that is produced by aiblocks-core while processing transactions.
Package meta provides helpers for processing the metadata that is produced by aiblocks-core while processing transactions.
Package network contains functions that deal with aiblocks network passphrases and IDs.
Package network contains functions that deal with aiblocks network passphrases and IDs.
Package price implements functions to ease working with aiblocks price values.
Package price implements functions to ease working with aiblocks price values.
protocols
millennium
Package millennium contains the type definitions for all of millennium's response resources.
Package millennium contains the type definitions for all of millennium's response resources.
Package services contains sub-packages that provide long-running applications such as API servers.
Package services contains sub-packages that provide long-running applications such as API servers.
millennium/internal/actions
Package actions provides the infrastructure for defining and executing actions (code that is triggered in response to an client request) on millennium.
Package actions provides the infrastructure for defining and executing actions (code that is triggered in response to an client request) on millennium.
millennium/internal/assets
Package assets is a simple helper package to help convert to/from xdr.AssetType values
Package assets is a simple helper package to help convert to/from xdr.AssetType values
millennium/internal/codes
Package codes is a helper package to help convert to transaction and operation result codes to strings used in millennium.
Package codes is a helper package to help convert to transaction and operation result codes to strings used in millennium.
millennium/internal/db2
Package db2 is the replacement for db.
Package db2 is the replacement for db.
millennium/internal/db2/history
Package history contains database record definitions useable for reading rows from a the history portion of millennium's database
Package history contains database record definitions useable for reading rows from a the history portion of millennium's database
millennium/internal/hchi
Package hchi provides functions to support embedded and retrieving a request id from a go context tree
Package hchi provides functions to support embedded and retrieving a request id from a go context tree
millennium/internal/ingest
Package ingest contains the new ingestion system for millennium.
Package ingest contains the new ingestion system for millennium.
millennium/internal/ledger
Package ledger provides useful utilities concerning ledgers within aiblocks, specifically as a central location to store a cached snapshot of the state of both millennium's and aiblocks-core's views of the ledger.
Package ledger provides useful utilities concerning ledgers within aiblocks, specifically as a central location to store a cached snapshot of the state of both millennium's and aiblocks-core's views of the ledger.
millennium/internal/operationfeestats
Package operationfeestats provides useful utilities concerning operation fee stats within aiblocks,specifically as a central location to store a cached snapshot of the state of network per operation fees and surge pricing.
Package operationfeestats provides useful utilities concerning operation fee stats within aiblocks,specifically as a central location to store a cached snapshot of the state of network per operation fees and surge pricing.
millennium/internal/paths
Package paths provides utilities and facilities for payment paths as needed by millennium.
Package paths provides utilities and facilities for payment paths as needed by millennium.
millennium/internal/reap
Package reap contains the history reaping subsystem for millennium.
Package reap contains the history reaping subsystem for millennium.
millennium/internal/render/sse
This package contains the Server Sent Events implementation used by millennium.
This package contains the Server Sent Events implementation used by millennium.
millennium/internal/simplepath
Package simplepath provides an implementation of paths.
Package simplepath provides an implementation of paths.
millennium/internal/test
Package test contains simple test helpers that should not have any dependencies on millennium's packages.
Package test contains simple test helpers that should not have any dependencies on millennium's packages.
millennium/internal/test/db
Package db provides helpers to connect to test databases.
Package db provides helpers to connect to test databases.
millennium/internal/test/trades
Common infrastructure for testing Trades
Common infrastructure for testing Trades
millennium/internal/test/transactions
Package transactions offers common infrastructure for testing Transactions
Package transactions offers common infrastructure for testing Transactions
millennium/internal/txsub
Package txsub provides the machinery that millennium uses to submit transactions to the aiblocks network and track their progress.
Package txsub provides the machinery that millennium uses to submit transactions to the aiblocks network and track their progress.
millennium/internal/txsub/sequence
Package sequence providers helpers to manage sequence numbers on behalf of millennium clients.
Package sequence providers helpers to manage sequence numbers on behalf of millennium clients.
millennium/internal/utf8
Package utf8 contains utilities for working with utf8 data.
Package utf8 contains utilities for working with utf8 data.
Package strkey is an implementation of StrKey, the address scheme for the AiBlocksNetwork.
Package strkey is an implementation of StrKey, the address scheme for the AiBlocksNetwork.
support
app
Package app provides vars that can be populated via "-X" linker flags to provide global application metadata, such as build time or version.
Package app provides vars that can be populated via "-X" linker flags to provide global application metadata, such as build time or version.
config
Package config provides a common infrastructure for reading configuration data stored in local TOML files.
Package config provides a common infrastructure for reading configuration data stored in local TOML files.
db
Package db is the base package for database access at aiblocks.
Package db is the base package for database access at aiblocks.
db/sqlutils
Package sqlutils contains utility functions for manipulating strings of SQL
Package sqlutils contains utility functions for manipulating strings of SQL
env
errors
Package errors provides the common infrastructure for managing errors.
Package errors provides the common infrastructure for managing errors.
http
Package http provides easy access to AiBlocks's best practices for building http servers.
Package http provides easy access to AiBlocks's best practices for building http servers.
http/httpauthz
Package httpauthz contains helper functions for parsing the 'Authorization' header in HTTP requests.
Package httpauthz contains helper functions for parsing the 'Authorization' header in HTTP requests.
http/httptest
Package httptest enhances the stdlib net/http/httptest package by integrating it with gopkg.in/gavv/httpexpect.v1, reducing the boilerplate needed for http tests.
Package httptest enhances the stdlib net/http/httptest package by integrating it with gopkg.in/gavv/httpexpect.v1, reducing the boilerplate needed for http tests.
http/mutil
Package mutil contains various functions that are helpful when writing http middleware.
Package mutil contains various functions that are helpful when writing http middleware.
log
Package log provides the common logging facilities used by the AiBlocks Development foundation.
Package log provides the common logging facilities used by the AiBlocks Development foundation.
render/health
Package health contains simple utilities for implementing a /health endpoint that adheres to the requirements defined in the draft IETF network working group standard, Health Check Response Format for HTTP APIs.
Package health contains simple utilities for implementing a /health endpoint that adheres to the requirements defined in the draft IETF network working group standard, Health Check Response Format for HTTP APIs.
render/problem
Package problem provides utility functions for rendering errors as RFC7807 compatible responses.
Package problem provides utility functions for rendering errors as RFC7807 compatible responses.
test
Package test contains simple test helpers that should not have any service-specific dependencies.
Package test contains simple test helpers that should not have any service-specific dependencies.
url
tools
aiblocks-sign
aiblocks-sign is a small interactive utility to help you contribute a signature to a transaction envelope.
aiblocks-sign is a small interactive utility to help you contribute a signature to a transaction envelope.
Package txnbuild implements transactions and operations on the AiBlocks network.
Package txnbuild implements transactions and operations on the AiBlocks network.
cmd/demo
Demo is an interactive demonstration of the Go SDK using the AiBlocks TestNet.
Demo is an interactive demonstration of the Go SDK using the AiBlocks TestNet.
cmd/demo/operations
Package demo is an interactive demonstration of the Go SDK using the AiBlocks TestNet.
Package demo is an interactive demonstration of the Go SDK using the AiBlocks TestNet.
examplemillenniumclient
Package examplemillenniumclient provides a dummy client for use with the GoDoc examples.
Package examplemillenniumclient provides a dummy client for use with the GoDoc examples.
Package xdr contains the generated code for parsing the xdr structures used for aiblocks.
Package xdr contains the generated code for parsing the xdr structures used for aiblocks.

Jump to

Keyboard shortcuts

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