1. Introduction
Overpool lets you build your own off-chain bitcoin transaction ledger, which can optionally be shared over an overlay P2P network (DAT), in realtime.
With Overpool, you can effortlessly set up an HTTP endpoint which:
- accepts signed OR unsigned transactions from your users
- creates an offchain timestamped ledger
- which can be optionally shared over DAT P2P network to pass around transactions between peers in a decentralized manner BEFORE broadcasting.
The API is very simple and easy to use. To create a private local pool, this is all you need:
const Overpool = require('overpool')
const pool = new Overpool()
pool.create({ path: "mypool" }) // create a pool ledger at path "overpool/mypool"
pool.on("tx", (e) => {
console.log("new payment", e) // listen to realtime events from the ledger.
})
The file-based ledger not only provides traceability but also lets you feed directly into a state machine framework such as Neon Planaria.
When combined with Neon Planaria, Overpool becomes a Turing Complete System.
Here we create a pool named loop
which counts up to 100. Once you run this program, you'll see that it populates the Overpool ledger with 100 transactions, each of which is constructed iteratively from its preceding transaction.
const Overpool = require("overpool")
const datapay = require('datapay');
const pool = new Overpool();
var counter = 0;
(async () => {
await pool.create({ path: "loop" })
pool.on("tx", (e) => {
let pushdata = e.parsed.out[0].tape[1].cell.map((c) => {
return c.s
})
console.log("LOOP #"+counter, pushdata)
counter++;
if (counter <= 100) {
let newpushdata = pushdata.concat(counter.toString())
datapay.build({ data: newpushdata }, (err, tx) => {
e.payment.transaction = tx.toString();
pool.post({ path: "loop", payment: e.payment })
});
}
})
})();
This pool can also be published to the DAT P2P network which allows other developers to take advantage of the ledger as well.
2. The 3rd State of Bitcoin
Overpool can be used to pass around transactions before they are broadcasted and/or confirmed on the blockchain. You can:
- Create a "3rd state" which comes before mempool. You can build your state machine (such as Neon Planaria) without waiting for the broadcast.
- Modify the submitted transactions and broadcast to the blockchain.
- Modify the submitted transaction and RE-submit to the pool. This becomes interesting as other users or peer applications may pick up the new transaction and modify and rebroadcast again.
- Store an unsigned transaction on your Overpool ledger, and let someone else sign and broadcast for you.
- Store an unsigned transaction on your Overpool, sign it yourself and broadcast on behalf of your users.
- Many more...
However, Overpool should not be treated as if it's the true ledger. Bitcoin is the only ledger that matters at the end of the day. Until the transactions actually end up on the ledger, it didn't happen. You can treat Overpool like an interim state which comes before Mempool. There are many flexible ways to use Overpool to implement powerful and instant applications, but just remember, the blockchain is always the single source of truth.
3. Portable File-based Design
Overpool exist as flat files. And the ledger adopts the tape.txt protocol, which makes it compatible with Bitbus and Neon Planaria. You can read the ledger over and over just like you read from Bitbus and construct the same state machine deterministically.
Overpool doesn't have any restrictions. You may broadcast the transactions immediately, or you may keep them on your ledger without broadcasting, just to batch-broadcast later. Or broadcast ONLY when certain conditions are met. Also you may accept not just signed transactions but also unsigned transactions.
Finally, Overpool nodes can optionally share their pools over DHT (Distributed Hash Table), forming a global decentralized overlay network of pre-broadcast Bitcoin transactions.
Overpool is a part of the larger Bitcoin data grid system which includes Bitbus, Grid Planaria, and Neon Planaria.
4. Feature Overview
Here are the highlights:
- Completely Open and Decentralized: Overpool is an MIT Licensed open source project which you can instantly integrate into your Bitcoin apps. And on top of that, it goes even further to let you completely open up your ledger for total interoperability and transparency through DAT, a decentralized data replication protocol.
- Pre-broadcast Transaction Storage: Store pre-broadcast Bitcoin transactions to your own file based ledger, on your own machine.
- BIP270: Supports BIP270 (Implements the
Payment
and thePaymentACK
). Instead of trying to implement a whole monolithic stack, Overpool stays minimal, which makes it effortless to blend into rest of the ecosystem products and services such as wallets. - Passing around Transactions: In addition to BIP270 which is all about signed transactions, overpool also lets you even store and pass around unsigned transactions. There are many things you can do with unsigned transactions. For example, you can sign transactions with your own keys on behalf of your users, which lets you build zero-friction apps such as Bitchat, and in extreme cases, apps may even pay users to use their apps, implementing negative-friction apps. All effortlessly possible with Overpool.
- Filter: Overpool also lets you filter transactions to reject those that don't fit your criteria. For example, you may choose to only accept transactions which are signed by a certain set of addresses, or if they follow a certain pattern. The filter function deserializes each transaction using BPU and makes it easy to process them.
- Traceable Transparent Ledger: Keeps the full history of all submitted transactions on its own append-only ledger called
tape.txt
in order to provide accountability, as well as transparency when published to a decentralized network. - Turing Complete Ledger: The "tape" data structure is compatible with Bitbus, which means Overpool can easily plug into Neon Planaria along with Bitbus. In addition to
onmempool
andonblock
events, you also getonoverpool
. (coming soon) - P2P Multiplayer Ledger: Lets you open up your local ledger to the world over DHT in a decentralized manner (Using DAT), providing global interoperability with other applications.