Skip to content

OpenAudio/go-openaudio

Repository files navigation

Open Audio Protocol

license Docs releases Dockerhub

A golang implementation of the Open Audio Protocol.

Quickstart

docker run --rm -it \
  -p 80:80 \
  -p 443:443 \
  -p 26656:26656 \
  -e OPENAUDIO_TLS_SELF_SIGNED=true \
  -e OPENAUDIO_STORAGE_ENABLED=false \
  openaudio/go-openaudio:stable

# in another terminal session
open https://localhost/console/overview

To run a validator and secure the network, visit docs.openaudio.org.

Local Development

Prerequisites

Ensure the following are installed:

  • Docker
  • Docker Compose
  • Go v1.25

The remaining dependencies can then be automatically installed with make:

make install-deps

Running local devnet

You can simulate an openaudio network by running multiple nodes on your machine. This makes developing certain features fast and easy.

Setup

Add the following hosts to your /etc/hosts file:

echo "127.0.0.1       node1.oap.devnet node2.oap.devnet node3.oap.devnet node4.oap.devnet" | sudo tee -a /etc/hosts

Then add the local dev x509 cert to your keychain so you will have green ssl in your browser.

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain dev/tls/cert.pem

Run

Build and run a local devnet with 4 nodes.

make up

Access the dev nodes

# add -k if you don't have the cert in your keychain
curl https://node1.oap.devnet/health-check
curl https://node2.oap.devnet/health-check
curl https://node3.oap.devnet/health-check
curl https://node4.oap.devnet/health-check

# view in browser (quit and re-open if you added the cert and still get browser warnings)
open https://node1.oap.devnet/console
open https://node2.oap.devnet/console
open https://node3.oap.devnet/console
open https://node4.oap.devnet/console

Smoke test

# after 5-10s there should be 4 nodes registered
# this validates that the registry bridge is working,
# as only nodes 1 and 2 are defined in the genesis file as validators

$ curl -s https://node1.oap.devnet/core/nodes | jq .
{
  "data": [
    "https://node2.oap.devnet",
    "https://node1.oap.devnet",
    "https://node3.oap.devnet",
    "https://node4.oap.devnet"
  ]
}

# or in the UI
open https://node1.oap.devnet/console/nodes

# view uptime across the network
open https://node1.oap.devnet/console/uptime

Note: By default, hot reloading is only enabled on node1.oap.devnet to conserve system resources. To enable on other nodes, update the corresponding env file in dev/env.

Develop against stage or prod

Build a local docker image

make docker-dev

Peer with mainnet

docker run --rm -it -p 80:80 -p 443:443 -e NETWORK=prod openaudio/go-openaudio:dev

Run tests

Run all tests

make test

Run only storage service tests

make test-mediorum

Run only unittests

make test-unit

Run only integration tests

make test-integration

ETL

The ETL service indexes blockchain data into the postgres database, enabling faster queries for certain views.

OPENAUDIO_ETL_ENABLED=true

Explorer

The Explorer provides a web-based interface to browse blocks, transactions, validators, and other data. If enabled, the explorer runs at the site root, e.g. https://node1.oap.devnet/. Explorer requires ETL.

OPENAUDIO_ETL_ENABLED=true
OPENAUDIO_EXPLORER_ENABLED=true

# View explorer in browser
open https://node1.oap.devnet/

About

Go implementation of the Open Audio Protocol.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 8