BlockPo / BlockPo-to-Tradelayer

Incubation Repo for the TradeLayer protocol, 0.2.0
http://www.tradelayer.org
Other
8 stars 8 forks source link

Trade Channel NPM #206

Closed patrickdugan closed 2 years ago

patrickdugan commented 4 years ago

We want to have an all-in-one module for people to just import into their .js based trading algos and start slugging in the Trade Channels.

Trade Channel module:

a) creation

Get new address, validate address, use pubkey to send message, get back other pubkey, proposed multisig address, re-create address to verify, now we commit some collateral and include some BTC in a fee so this is our first major address build.

b) funding/signed tx management

Additional risk logic about the counterparty double checks before firing off the commit.

The mempool/confirmation status of this and the counterparty's funding commit are tracked.

Different signals return as the trade channel becomes more secure to start using, light stoplight gradients.

Partially-signed and signed, unpublished trades are tracked like an inventory.

Transfer tx also tracked.

c) co-sign this? true/false function

A function that take's a tx apart, looks at the OP_Return, independently reasons about the UXTO inputs and outputs based on it, and returns true or false depending on if it conforms to the desired trade or not.

d) channel management

A listener waits to be pinged by the server directing messaging in the v1. When handshakes come through, different functions are triggered asynchronously. Preferences can be set to filter down on handshake requests from automatic handshake, to pending, to fake-pending auto-reject but notify, to reject an ignore.

An inventory of open channels is tracked in a local array of objects containing their own arrays of tx's per the above tx management.

e) prototype reputation chirper

The millisecond gaps in commencing trade requests to closing them is reported to the server which collates these inputs into an reputation index for a number of addresses, which presumably are also saved in the SQL and served up via API. We'll want to decentralized this an the handshake messaging between clients in the future.

patrickdugan commented 3 years ago

Most of these functions were prototyped and committed to the web folder back in August. Needs to be used incrementally then tested independently, as we complete the TC bot and wallet API integration.

patrickdugan commented 2 years ago

Val made this.