Introduction

OpenFare is a funding mechanism which is deployable with one commit.

The goal: fund the next million software content creators.

OpenFare can be used to fund open source or commercial software at any scale. It is a decentralized protocol which defines how payees can be paid.

With OpenFare, payments are managed programmatically. Payment plans and methods are defined in code. Which leads to the following advantages:

  • Donations span the entire software dependency tree. Critical software which is outside the limelight is supported.

  • Micropayment obligations for commercial software can be managed across thousands of software dependencies.

Funding Free and Open Source Software (FOSS)

The OpenFare Protocol is compatible with every source available software license. This includes the MIT License, Apache licenses, GPL licenses, and so on.

OpenFare lock files are discovered programmatically from within the software dependency tree. This mechanism reveals the demand for funding across the entire software library ecosystem. Donations made using OpenFare reach the roots. It brings to the surface critical software dependencies which are not in the limelight.

OpenFare offers a distributed solution which sidesteps the need for accounts or centralized gatekeepers.

Setting up a project to receive donations is easy. Simply use the openfare tool to generate a OpenFare.lock file in the project's top level directory.

In this example OpenFare.lock file Steve and John split their donations 10/4. John can be paid via PayPal or via the Bitcoin Lightning Network. Steve can only be paid via PayPal:

{
    "plans": {
        "0": {
            "type": "voluntary",
            "payments": {
                "shares": {
                    "steve": "100",
                    "john": "40"
                }
            }
        }
    },
    "payees": {
        "john": {
            "payment-methods": {
                "paypal": {
                    "email": "john@example.com"
                },
                "btc-lightning": {
                    "lnurl": "03488242941915ed5a10151...a55ef4dedf590a7d7dd5"
                }
            }
        },
        "steve": {
            "payment-methods": {
                "paypal": {
                    "email": "steve@example.com"
                }
            }
        }
    }
}

Micropriced Software

OpenFare can manage payment obligations across thousands of software dependencies. Programmatic management and micropayments means that public software contributors can raise meaningful capital with low prices1.

openfare detects applicable fees across a project's entire software dependency tree. Thousands of micro-fees can be consolidated into a single lump sum using OpenFare compatible payment services. These services take on the complexities of distributing funds to public software contributors based on lock file payment plans.

Fee Funded Payment Plans

Payment plans for fee funded software are defined in the package lock files.

The following example describes a single payment plan. The plan is applicable to for-profit organizations which use the software before 2022-12-19 and which have more than 100 employees. It stipulates that this version of the software necessitates a one off payment totalling 0.0025 USD. The payment is split 10/4 between Steve and John. John can be paid via the Bitcoin Lightning Network. Steve can only be paid via PayPal.

{
    "plans": {
        "0": {
            "type": "compulsory",
            "conditions": {
                "for-profit": "true",
                "employees-count": "> 100",
                "expiration": "2022-12-19"
            },
            "payments": {
                "total": "0.0025 USD",
                "shares": {
                    "steve": 100,
                    "john": 40
                }
            }
        }
    },
    "payees": {
        "john": {
            "payment-methods": {
                "paypal": {
                    "email": "john@example.com"
                },
                "btc-lightning": {
                    "lnurl": "03488242941915ed5a101511b8dfeb6db81e0fcd7546f6a55ef4dedf590a7d7dd5"
                }
            }
        },
        "steve": {
            "payment-methods": {
                "paypal": {
                    "email": "steve@example.com"
                }
            }
        }
    }
}

Pricing Software Packages

Specific packages or a project's software dependency tree can be priced using the price command.

1

Technical lower bound price as of February 2022: $0.0003788 (USD).

Installation

Pre-compiled binaries

Executable binaries are available for download on the GitHub Releases page. Download the binary for your platform (Windows, macOS, or Linux) and extract the archive. The archive contains the openfare command line tool.

To make it easier to run, put the path to the binary into your PATH.

Build from source using Rust

To build the openfare executable from source, you will first need to install Rust and Cargo. Follow the instructions on the Rust installation page. OpenFare currently requires at least Rust version 1.58.0

Once you have installed Rust, the following command can be used to build and install openfare:

cargo install openfare

This will automatically download openfare from crates.io, build it, and install it in Cargo's global binary directory (~/.cargo/bin/ by default).

Installing the latest master version

The version published to crates.io will ever so slightly be behind the version hosted on GitHub. If you need the latest version you can build the git version of openfare yourself. Cargo makes this super easy!

cargo install --git https://github.com/openfare/openfare.git openfare

Again, make sure to add the Cargo bin directory to your PATH.

Concepts

This section outlines key concepts of the OpenFare funding mechanism.

Lock File

Lock files define donation/fee payment plans for software packages. They also describe payees and their preferred payment methods.

A lock file is constructed using the openfare tool. Command line interface documentation for creating and managing a lock file can be found here.

Lock files are always located in the package's top level directory as OpenFare.lock.

Overview

A lock file is composed of payment plans and payees:

{
    "plans": {
        ...
    },
    "payees": {
        ..
    }
}

Payment Plans

A lock file can contain multiple payment plans. A payment plan describes the following:

  • how funds should be split between payees
  • conditions used to determine applicability
  • and a total fee for compulsory plans.

Example

"plans": {
    "0": {
        "type": "compulsory",
        "conditions": {
            "for-profit": "true",
            "employees-count": "> 100",
            "expiration": "2022-12-19"
        },
        "payments": {
            "total": "0.0025 USD",
            "shares": {
                "steve": 100,
                "john": 40
            }
        }
    },
    "1": {
        "type": "voluntary",
        "conditions": {
            "expiration": "2022-12-19"
        },
        "payments": {
            "shares": {
                "steve": "100",
                "john": "40"
            }
        }
    }
}

Conditions

A payment plan is deemed applicable to a software library user based on plan conditions. Conditions are evaluated programmatically in conjunction with a user's configuration settings.

For example, the expiration condition invalidates a plan at any time beyond the associated date value.

Compulsory payment plan "0" from the example above stipulates three conditions. The plan is applicable to for-profit organizations which use the software before 2022-12-19 and which have more than 100 employees. Conditions are logic-AND chained together.

Payments

Shares are allocated by payee labels (steve and john in the example above). These labels refer to payees within the lock file's payees section. Shares determine the proportion of funds received by each payee.

Payees

The payees section of a lock file describes payees and their supported payment methods for receiving funds.

Here's an example:

"payees": {
    "john": {
        "url": "github.com/john",
        "unique-id": "797f003a-3358-4bd2-bc24-c239ad2bf5de",
        "payment-methods": {
            "btc-lightning": {
                "lnurl": "03488242941915ed5a10151...a55ef4dedf590a7d7dd5"
            }
        }
    },
    ...
}

Field descriptions:

  • url - Payee's OpeFare profile URL for pulling profile updates.
  • unique-id - Helper (not security critical) field to ensure lock file payee labels are unique and to simplify mapping between local and remote profiles.
  • payment-methods - Supported payment methods for receiving funds.

Payment Services

OpenFare compatible payment services take on the infrastructure complexity necessary to distribute funds to public software developers.

Command line interface documentation for managing payment services can be found here.

Command Line Tool

The openfare command-line tool is used to manage payment methods and pay software maintainers. After you have installed openfare, you can run the openfare help command in your terminal to view the available commands.

The following sections provide in-depth information on the different commands available.

Profile

Your OpenFare profile describes how you can receive funds. Here's an example:

{
  "openfare-profile": {
    "unique-id": "797f003a-3358-4bd2-bc24-c239ad2bf5de",
    "payment-methods": {
      "btc-lightning": {
          "lnurl": "LNURL1DP68GURN8GHJ7CMVDA6K...23JS3YTAFK"
      }
    }
  }
}

Payment methods

Add payment methods to your profile:

openfare profile add payment-method btc-ln <lnurl>

Setup via services

Some services can be used to setup payment methods, for example:

openfare profile add payment-method btc-ln --service lnpay

Share

Sharing your profile allows other users to programmatically discover how you can be paid. Project lock files can then be curated and updated by pulling in your latest profile payment methods.

Use the push subcommand to share your profile:

openfare profile push <url>

Where url is any Git repository or GitHub user profile URL (github.com/<username>).

Lock

A project OpenFare.lock file describes how funds are distributed between contributors. Here's an example:

{
    "scheme-version": "1",
    "plans": {
        "0": {
            "type": "voluntary",
            "conditions": {},
            "payments": {
                "shares": {
                    "rndhouse": 1000,
                    "steve": 500
                }
            }
        }
    },
    "payees": {
        "rndhouse": {
            "url": "github.com/rndhouse",
            "unique-id": "797f003a-3358-4bd2-bc24-c239ad2bf5de",
            "payment-methods": {
                ...
            }
        },
        "steve": {
            "url": "github.com/steve",
            "unique-id": "888f003a-6658-4pl2-af76-c239ad2bf6fg",
            "payment-methods": {
                ...
            }
        }
    }
}

Creating a lock file

Create a lock file in your project's top level directory:

openfare lock new

Payment plans

Add a payment plan (donation or fee funded):

openfare lock add plan compulsory --fee 2usd
openfare lock add plan voluntary

Manage profiles

Add a project contributor profile to the plan:

openfare lock add profile --url github.com/steve --shares 1000

Add your local profile using the command:

openfare lock add profile --shares 1000

Update

Update a lock file by pulling the latest profile payment methods using the command:

openfare lock update

Service

The openfare service command manages payment services which can be used for sending and receiving payments.

The following payment services are currently supported:

  • LNPAY — LNPAY.co is a custodial Bitcoin (BTC) Lightning Wallet.

LNPAY.co

LNPAY.co is a custodial Bitcoin (BTC) Lightning Wallet.

Setup

The first step is to create a lnpay.co account and obtain a secret API key from the developers dashboard. Sign-up is currently free and only requires and email address.

Then, add LNPAY.co as a payment service using the command:

openfare service add lnpay <api-key>

Remove service

Remove the payment service using the command:

openfare service remove lnpay

Pay

The pay command uses a payment service to pay donations or fees to software dependency tree contributors.

openfare pay <donation>

--service

Specify payment service for sending payment.

--default

Set specified payment service as default.

Donations

Donations made via the pay command are divided equally between dependency tree packages. Package sums are then split per contributor based on payment plan shares.

For example, running the following command in a project directory donates $1 (USD) to the project's software dependency tree contributors:

openfare pay 1usd

Hundreds if not thousands of developers might have contributed the software which makes up a dependency tree. openfare converts a $1 donation into satoshis (SATS) which is the smallest bitcoin denomination. 100 million SATS make up a single bitcoin. This means that each contributor will likely receive some fraction of the total donation.

Price

OpenFare supports fee based payment plans.

Run the price command in a project directory to produce a software dependencies fee report:

openfare price

Specify a package to obtain a package specific fee report:

openfare price <package-name> <package-version>

-e, --extension

Specify an extension to differentiate between package registries/ecosystems. Example:

--extension js

Example

openfare price is-even

Output:

Registry: npmjs.com
Total: 0.001 USD
   name    | version | price (USD) | notes 
-----------+---------+-------------+---------------------
 is-even   | 1.0.0   |      -      |  
           |         |             |    
 is-buffer | 1.1.6   |      -      |  
 is-number | 3.0.0   |    0.001    | employees-count > 100
 is-odd    | 0.1.2   |      -      |  
 kind-of   | 3.2.2   |      -      |     

Microprice

Software priced using openfare can cost less than a cent. This is because openfare converts payments into satoshis (SATS) which is the smallest bitcoin denomination. 100 million SATS make up a single bitcoin.

There are 2608 SATS in $1.00 (USD) as of February 2022. Which implies a technical lower limit software price of $0.0003788!

Config

Modify config variables using the command:

openfare config set <field-path> <field-value>

Show config values (as JSON) using the command:

openfare config show <field-path>

Example config file

{
  "core": {
    "preferred-currency": "USD"
  },
  "services": {
    "default": "lnpay",
    "portal": {
      "url": "http://openfare.dev/",
      "api-key": "<key>",
      "email": null
    },
    "lnpay": {
      "secret-api-key": "<key>"
    }
  },
  "profile": {
    "url": "github.com/rndhouse",
    "employees-count": null,
    "commercial": false,
    "include-voluntary-donations": true
  },
  "extensions": {
    "enabled": {
      "js": true
    },
    "registries": {
      "npmjs.com": "js"
    }
  }
}

Extensions

Extensions allow the openfare tool to interact with package registries and ecosystems. For example, the openfare-js extension allows openfare to find lock files within npmjs.com packages.

Official extensions

NameEcosystemPackage Registries
openfare-jsJavascriptnpmjs.com

Add extension

The openfare-js extension is included with openfare out of the box. Other extensions can be added using the command:

openfare extensions add <repository_url_or_name>

Examples

Add via repository URL:

openfare extensions add https://github.com/openfare/openfare-py

Add via extension name:

openfare extensions add py

openfare will search for the latest extension release at address:

https://github.com/openfare/openfare-{name}

Disable extension

Extensions can be disabled without deletion (config file retained) using the command:

openfare extensions disable py

Enable extension

Disabled extensions can be enabled using the command:

openfare extensions enable py

Removing extension

Extensions can be disabled and deleted using the command:

openfare extensions remove py