1.7K Followers
·
Follow

Overledger Network Treasury

Image for post
Image for post
The Overledger Network Ecosystem

Payment Channel Introduction

Quant Network has recently commenced the first phase trial of the Overledger Network (OVN). The Overledger Network is made up of many gateways. Each gateway connects and allows access to a resource such as a distributed ledger, data or API.

Developers can then use the Overledger Network to consume functionality from any gateway connected resource. For every resource used, there will be an associated price.

The community treasury allows developers to pay gateway owners QNT to use their resources. As QNT is on the Ethereum blockchain, the community treasury uses uni-directional payment channels to vastly increase transaction throughput as well as minimising transaction fee cost.

Therefore each developer has a uni-directional payment channel open to the community treasury, the community treasury has a uni-directional payment channel open to each gateway and the community treasury is responsible for routing payments between the developer and gateway channels.

For increased security, developers and gateway owners must provide two different Ethereum addresses:

· QNT Wallet: The address that will hold any QNT of the user and it can be used as a cold wallet.

· Operator: The address that can call functions on the treasury smart contracts, including authorising QNT payments to flow through the channel or claiming QNT from a channel.

For transparency, the Treasury addresses are published in GitHub as follows:

Testnet Treasury Smart Contract Addresses:

  • Treasury Proxy: 0x3e29e13ef3241d5858eeaff70e5a25f0b424c38b
  • Treasury Factory Proxy: 0x4a42aa05fb7cd58e9e388c82ec11b811bdf5ada7
  • Treasury Deposit Proxy: 0xb60bc1b22f322a5ddc214f0d0fb14260746d50bb
  • Treasury Rulelist Proxy: 0x963e705d50bde3f21a03cacf03e045b3599568ca

Mainnet Treasury Smart Contract Addresses:

  • Treasury Proxy: 0x2ee1f3535325bc596f616f0591d1a1bc85164775
  • Treasury Factory Proxy: 0x836fe8f597dc6cf4fb86bd3e86ad724dc4327560
  • Treasury Deposit Proxy: 0x83e9918ddee45a661a31a63474f864d77b156724
  • Treasury Rulelist Proxy: 0xff42f979d183c88e930bb07ab88ff1211679814b

Lets go through some examples to make the distinction between them clear:

Example 1: Developer to Treasury Payment Channel Creation

A new developer wanting to use the OVN, signs up at Quant Network’s dev portal, providing a QNT Wallet and operator address (step 1). To create a new payment channel with the treasury, the developer needs to approve (step 2) the Treasury Factory smart contract to take a certain amount of QNT and move it into the soon to be created Payment Channel, with a small additional amount to be moved into the developer’s Escrowed Deposit smart contract. This approval is a standard ERC20 smart contract request, and therefore recorded as a transaction on the Ethereum blockchain. This approval transaction is the only one in all of these examples that is sent from the Developer’s QNT Wallet address.

Next, after the developer is authorised by the treasury, the developer’s Payment Channel and Escrow Deposit will be created via an on chain transaction from the Treasury (step 3). This on chain transaction, sent to the Treasury Factory smart contract, moves the approved amount of QNT out of the Developers QNT Wallet address and transfers it into the newly created smart contracts.

Now that the payment channel has been set up, many off-chain QNT transfers between the developer and the treasury can occur without changing the on-chain data (step 4). Each off chain QNT transfer from the developer to the treasury is authorised by the developer’s operator address.

Eventually the treasury will want to align the off-chain transfers with the on-chain data. To do so, the treasury will create a claim QNT transaction and send it to the developer’s payment channel smart contract address. This transaction will embed an off-chain message, signed by the developer’s operator address, that states all the QNT transferred between the Developer to the treasury off chain.

Image for post
Image for post

​Finally, note that when a developer to treasury payment channel runs out of funds, it is the developer’s responsibility to top up this channel. This topped up QNT can come from any address (including the developer’s QNT Wallet address) and needs to transfer QNT to the developer’s Payment Channel smart contract address.

Example 2: Developer to Treasury Payment Channel Expiry

Every created Payment Channel and Escrowed Deposit smart contract locks up QNT until a certain time, after which the developer can reclaim the remaining QNT. We join this example after the expiration time (step 1).

Now to reclaim from the Payment Channel or Escrowed Deposit smart contracts (step 2 and 3 respectively), an on chain transaction requesting the reclaim needs to be sent from the developer’s operator address to the relevant smart contract address. This transaction will transfer the remaining QNT back to the developer’s QNT Wallet address.

Image for post
Image for post

Example 3: Treasury to Gateway Payment Channel Creation

A new gateway owner wanting to use the OVN, signs up at Quant Network’s dev portal, providing a QNT Wallet and operator address (step 1). To create a new payment channel with the treasury, the gateway owner needs to approve (step 2) the Treasury Factory smart contract to take an X amount of QNT (for the licence fee) as well as a Y amount of QNT (for the gateway’s staked amount). The X QNT is used to initially fund the Payment Channel, whereas the Y QNT will be moved into the Escrowed Deposit smart contract. This approval is a standard ERC20 smart contract request, and therefore recorded as a transaction on the Ethereum blockchain. This approval transaction is the only one in all of these examples that is sent from the Gateway owner’s QNT Wallet address.

Next, after the gateway owner is authorised by the treasury, the gateway owner’s Payment Channel and Escrow Deposit will be created via an on chain transaction from the Treasury (step 3). This on chain transaction, sent to the Treasury Factory smart contract, moves the approved amount of QNT out of the Gateway owner’s QNT Wallet address and transfers it into the newly created smart contracts.

Now that the payment channel has been set up, many off-chain QNT transfers between the treasury and the gateway can occur without changing the on-chain data (step 4).

Eventually the treasury or gateway will want to align the off-chain transfers with the on-chain data. To do so, the treasury or gateway operator address will create a claim QNT transaction and send it to the gateway owner’s payment channel smart contract address. This transaction will embed an off-chain message, signed by the treasury’s operator address, that states all the QNT transferred between the treasury and gateway off chain.

Image for post
Image for post

Example 4: Treasury to Gateway Payment Channel Topup

When a treasury to gateway Payment Channel runs out of funds (step 1), it is the treasury’s responsibility to top it up, because the treasury is the designated sender of this channel. The treasury does this via an onchain transaction (step 2), which allows off-chain QNT payments to continue (step 3) and eventually this QNT is transferred to the gateway via an on-chain transaction (step 4).

Image for post
Image for post

Example 5: Treasury to Gateway Payment Channel Expiry

Every created Payment Channel and Escrowed Deposit smart contract locks up QNT until a certain time, after which the treasury and gateway operator can reclaim portions of the remaining QNT. We join this example after the expiration time (step 1).

A reclaim of QNT from the Payment Channel goes to the treasury’s QNT Wallet address (step 2), as it is the treasury’s responsibility to keep treasury to gateway payment channels topped up. A reclaim of QNT from the Escrowed Deposit smart contract goes back to the gateway owner’s QNT wallet (step 3), as this is a return of the gateway’s stake amount. Note that the gateway owner requests the reclaim of stake via an on chain transaction to the Escrow Deposit smart contract.

Image for post
Image for post

Next Steps

To sign up for the Overledger Network, go to https://developer.quant.network/register.

To interact with the community treasury, enter your Ethereum addresses inside the dev portal, wait to receive testnet QNT and then follow the instructions here:

https://github.com/quantnetwork/overledger-treasury-community/tree/master/Code.

Detailed technical view of the Treasury Design: https://github.com/quantnetwork/overledger-treasury-community/blob/master/OverledgerNetworkTreasury.pdf

Written by

Quant is committed to unleashing the power of systems that are as connected as the world we live in.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store