jl777 / SuperNET

57 stars 222 forks source link

Use UUIDs for swaps #740

Closed lukechilds closed 6 years ago

lukechilds commented 6 years ago

I think I came up with a much better solution for swap identification.

Problem

Currently, to correctly track a swap in a database and keep track of it’s progress via the socket messages you need to do the following:

This seems overcomplicated, is quite fragile and involves complex queries and hopping around different ids.

Solution

Instead I propose a much simpler approach.

All swaps on the alice and bob side generate their own UUID (UUID v4) locally. Due to the nature of UUIDs this can be safely assumed to be collision free network wide. All network requests contain your UUID. When you get matched with another peer you both have each others UUID and all future network requests should contain both UUIDS.

e.g:

{
  "aliceuuid": "97115bbe-da22-4960-84f5-ba32a19d3ed4",
  "bobuuid": "a197b126-2cda-4a91-b818-b2ac62d3d004",
  …
}

This simplifies the hugely complicated trade identification process above to just listening to anything with your UUID. It also means instead of a database with complex queries and multiple indexes, the swap DB can just be a simple key-value store.

The new process would just be:

That's literally it. No chance of collisions, no complicated queries, no fragile id hopping.

imylomylo commented 6 years ago

From wikipedia: Thus, for there to be a one in a billion chance of duplication, 103 trillion version 4 UUIDs must be generated.

jl777 commented 6 years ago

how does this deal with a swap that is started but has no bob yet? if it is ok to have the same alice uuid refer to different bobs during the trade negotiation, then you can just use alice's pubkey + requestid and bob's pubkey + quoteid as the uuid

lukechilds commented 6 years ago

how does this deal with a swap that is started but has no bob yet?

Swaps that have started but have no bob yet have an aliceuuid. It should be returned in the pending swap object that's returned by the API from buy/sell. That's all you need to reference them for the full lifetime of the swap, whether it ever gets matched or not. Once it's matched it'll have a bobuuid.

you can just use alice's pubkey + requestid and bob's pubkey + quoteid as the uuid

That's what I'm doing at the moment but just minus the pubkey. requestid and quoteid should always be unique, right?

But that ends up with the mess described in the original message of how we track a swap during it's progress from being posted to getting matched.

jl777 commented 6 years ago

the requestid will be the same for alice, so adding the alice pubkey makes it unique the quoteid will be the same for bob and all bob involved requests will have a quoteid

the issue I see is that when alice makes a request there is no bob involved, so what bob uuid should be used? The trade negotiation has one alice with many possible bobs, not sure how to make a uuid for the swap that will happen BEFORE the trade negotiation is done

jl777 commented 6 years ago

the requestid is a 32bit uuid for alice the quoteid is a 32bit uuid for bob

that might be not enough for global uuid, so that is why I suggest to add the pubkeys to them

a swap that is started does not know the bob until a connected message is received, there will be many reserved messages and in some edge cases it is possible to have more than one connect message.

given these constraints and what I think you want (a single value to identify all phases of a swap) I just dont see how to do it.

Maybe you can do (alicepubkey + requestid + timestamp/expiration) and then allow multiple bobs to be part of that swap in the negotiation phase and just store all resposes under that key. That would be global for all requests

lukechilds commented 6 years ago

the issue I see is that when alice makes a request there is no bob involved, so what bob uuid should be used? The trade negotiation has one alice with many possible bobs, not sure how to make a uuid for the swap that will happen BEFORE the trade negotiation is done

You don't need a bobuuid in any requests until you have a bob. Bob needs to put aliceuuid in all requests to alice along with his bobuuid. Then we send out bobuuid in future requests once we have it.

In fact, from my perspective, you don't need a bobuuid at all, as long as bob always responds with aliceuuid. I only need aliceuuid to track the trade. But it would probably be useful to keep the behaviour the same on both ends incase someone wants to build something that tracks trades on the bob side.

in some edge cases it is possible to have more than one connect message.

I wasn't aware of that and that will break my existing code.

given these constraints and what I think you want (a single value to identify all phases of a swap) I just dont see how to do it.

Yes, that's what I want, and my proposed solution will allow that. aliceuuid will identify all phases of the swap. And it will allow me to detect the multiple connect messages and handle that case.

jl777 commented 6 years ago

but the requestid should always be there for anything swap related, along with alice pubkey

let me know of any message without a requestid and alicepubkey (desthash) and I will add it to the request. it sounds like (desthash + requestid) is the alice uuid

and (srchash + quoteid) is the bob uuid

and it should already be in all swap related events

lukechilds commented 6 years ago

We don't get requestid in the response to the buy/sell command (not socket messages, the actual HTTP request) so we can't store it as soon as a user places an order to reference the match in the future. That's the issue I'm trying to solve.

jl777 commented 6 years ago

it should return a pending object that has the requestid in it, what response do you get on a successful start of a trade negotiation?

imylomylo commented 6 years ago

Using a UUID, you can abstract away the need to cobble together a psuedo-UUID and document it. It also allows for the UUID to be transportable to another application/protocol that also supports UUID.

jl777 commented 6 years ago

i added an explicit requestid and desthash fields to the return of buy and sell commands. that should allow you to correlate all future events to the call that started a specific requestid

lukechilds commented 6 years ago

it should return a pending object that has the requestid in it, what response do you get on a successful start of a trade negotiation?

This is the standard kind of response I get:

{"expiration":1522743064,"timeleft":58,"tradeid":765031138,"requestid":0,"quoteid":0,"bob":"CHIPS","base":"CHIPS","basevalue":0.81402133,"alice":"KMD","rel":"KMD","relvalue":0.1001,"aliceid":"2078779117658570753"}

requestid and quoteid are always 0. Assumed that was because they didn't exist yet but maybe it's a bug?

Currently on Marketmaker 0.1 27772

i added an explicit requestid and desthash fields to the return of buy and sell commands. that should allow you to correlate all future events to the call that started a specific requestid

As in you literally added it just now?

jl777 commented 6 years ago

yes, in jl777 branch

lukechilds commented 6 years ago

Ok, thanks, will test.

lukechilds commented 6 years ago

I just checked on the latest build from jl777. I don't get requestid in the response to buy. This is the response:

{
  "result":"success",
  "swaps": [...],
  "netamounts": [...],
  "pending": {"expiration":1522842793,"timeleft":60,"tradeid":1273111965,"requestid":0,"quoteid":0,"bob":"CHIPS","base":"CHIPS","basevalue":0.08231401,"alice":"KMD","rel":"KMD","relvalue":0.0101,"aliceid":"8686389057111719937"}
}
jl777 commented 6 years ago

it seems there is an issue that i cant calculate the same requestid until after I know the bob... if I change how requestid is calculated, it will break all pending swaps...

maybe desthash + expiration is the way to go, I can add that to the pending object and pretty sure expiration is in all the swap events. alternatively aliceid + expiration

lukechilds commented 6 years ago

maybe desthash + expiration is the way to go

What is desthash? Hash of alice address? Is desthash + expiration guaranteed to be collision free? It doesn't sound like it will be. And it needs to be in all socket messages otherwise we'll miss those messages.

alternatively aliceid + expiration

aliceid is calculated from the UTXO set though, right? So it wouldn't be collision proof.

If you have a trade that doesn't get matched, then try it again with the same UTXOs you'd get the same aliceid. And if the first trade had a longer expiration time and the second one had a shorter expiration time they could collide.

jl777 commented 6 years ago

desthash is alice's curve25519 pubkey since only one trade at a time can be issued, expiration would be unique, for all non-BTC swaps and also unique for all BTC swaps. I guess to ensure uniqueness it would be: expiration + hasBTC

desthash identifie's alice uniquely and it should be in all messages srchash identifies bob uniquely

hash(desthash + aliceid + expiration + srccoin + destcoin) would be unique from alice side hash(srchash + desthash + aliceid + expiration + srccoin + destcoin) would be unique from bob side

lukechilds commented 6 years ago

We don't get these fields on all messages, I just tested. On a successful swap we've got 13 messages (maybe more if our current logic is missing some) + the response from the buy/sell command:

{"response":{"expiration":1522923130,"timeleft":60,"tradeid":1334982468,"requestid":0,"quoteid":0,"bob":"CHIPS","base":"CHIPS","basevalue":0.83197481,"alice":"KMD","rel":"KMD","relvalue":0.1001,"aliceid":"6115652558972256257"},"messages":[{"gui":"hyperdex","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","timestamp":1522923070,"txfee":"10000","satoshis":"83197481","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.12033061,"pubkey":"0000000000000000000000000000000000000000000000000000000000000000","method":"request"},{"gui":"hyperdex","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","timestamp":1522923070,"txfee":"10000","satoshis":"83197481","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.12033061,"pubkey":"0000000000000000000000000000000000000000000000000000000000000000","method2":"request","method":"request"},{"gui":"nogui","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD","timestamp":1522923070,"txid":"7afefefd7098b70657ebd2a290ccef454e41113a23e8143242f3817ba4907664","vout":1,"srchash":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","txfee":"10000","quotetime":1522923071,"satoshis":"92553530","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"54df357e5d6a723c8bd6164e8bc4f18f85f05dfefc456c28a196da7e7e3df104","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.10816531,"requestid":2206105599,"quoteid":703404732,"pending":1522923160,"method2":"reserved","method":"reserved"},{"gui":"nogui","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RT9MpMyucqXiX8bZLimXBnrrn2ofmdGNKd","timestamp":1522923070,"txid":"c5b8740ff5936604ce1034d4251c6b7cee5d673267254cb45c3b402c7b154d1a","vout":1,"srchash":"bab6ad2eebe1e666369cab504d4622b22c1f1ef718ef388e88020f30a1573e01","txfee":"10000","quotetime":1522923073,"satoshis":"84968569","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"8d4a7141a2ded43b690aff57eb7522a0730f83da93253725abae3a35a529fec9","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.11782214,"requestid":2206105599,"quoteid":703404732,"pending":1522923160,"method2":"reserved","method":"reserved"},{"gui":"hyperdex","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD","timestamp":1522923070,"txid":"7afefefd7098b70657ebd2a290ccef454e41113a23e8143242f3817ba4907664","vout":1,"srchash":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","txfee":"10000","quotetime":1522923071,"satoshis":"92553530","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"54df357e5d6a723c8bd6164e8bc4f18f85f05dfefc456c28a196da7e7e3df104","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.10816531,"requestid":2723334766,"quoteid":187195014,"pubkey":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","method":"connect","proof":[]},{"gui":"hyperdex","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD","timestamp":1522923070,"txid":"7afefefd7098b70657ebd2a290ccef454e41113a23e8143242f3817ba4907664","vout":1,"srchash":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","txfee":"10000","quotetime":1522923071,"satoshis":"92553530","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"54df357e5d6a723c8bd6164e8bc4f18f85f05dfefc456c28a196da7e7e3df104","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.10816531,"requestid":2723334766,"quoteid":187195014,"pubkey":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","proof":[],"method2":"connect","method":"connect"},{"gui":"nogui","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD","timestamp":1522923070,"txid":"7afefefd7098b70657ebd2a290ccef454e41113a23e8143242f3817ba4907664","vout":1,"srchash":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","txfee":"10000","quotetime":1522923075,"satoshis":"92553530","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"54df357e5d6a723c8bd6164e8bc4f18f85f05dfefc456c28a196da7e7e3df104","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.10816531,"requestid":2723334766,"quoteid":3014014511,"pair":"tcp://173.212.225.176:55676","proof":[],"method2":"connected","method":"connected"},{"gui":"hyperdex","aliceid":"6115652558972256257","tradeid":1334982468,"base":"CHIPS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RB8yufv3YTfdzYnwz5paNnnDynGJG6WsqD","timestamp":1522923070,"txid":"7afefefd7098b70657ebd2a290ccef454e41113a23e8143242f3817ba4907664","vout":1,"srchash":"8adbf9d5de4fb49ec1fca9ca3f28ba384715752de1197c9cddbb756c3d2a1a7c","txfee":"10000","quotetime":1522923075,"satoshis":"92553530","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"54df357e5d6a723c8bd6164e8bc4f18f85f05dfefc456c28a196da7e7e3df104","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"df5452aa1daf7b8d4e587352365c0cae03c7e17390250c547f42744ea636b12a","destvout":1,"feetxid":"40ab98297727e932d2c2de6c09f947508a5ee7815da6dd78541bdfb01f45d593","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":0.10816531,"requestid":2723334766,"quoteid":3014014511,"result":"success"},{"name":"myfee","coin":"KMD","tx":"010000000193d5451fb0df1b5478dda65d81e75e8a5047f9096cdec2d232e927772998ab40010000006b483045022100ee4bb50c1a75f886bb0856e2bab0cec7e87481b991fc3b2f65fe0e48b7b80be9022014b7cb4f917750ad25ac4cef3e2fcfab8e11bf093c47b919b6a969d58fc026d701210330b4191bd253364abe8c19976f196bbcc2f3e66724816ef70e7fe472b5f59d0cffffffff0251320000000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88acf3760200000000001976a914a9d2476fa20db74a8a9117f7999614ecb5b0a9d988ac3ff6c55a","txid":"f660ab4ce6452aba7c0f1269fb6b482bb958ec866062cc5df9291ec10f7b872e","expiration":1522938670,"iambob":0,"bobcoin":"CHIPS","alicecoin":"KMD","lock":0,"amount":0.00012881,"Apayment":"bRKnLXnD12bFFvJY4yTpSE9SSYxK7MK3oD","method":"update","update":"myfee","requestid":2723334766,"quoteid":3014014511},{"name":"bobdeposit","coin":"CHIPS","tx":"010000000104f13d7e7eda96a1286c45fcfe5df0858ff1c48b4e16d68b3c726a5d7e35df54010000006b4830450221009c51c956c0b15a60125d478ee55adb28cca7c005c3bfe889ecb36ce3b901c4a90220358851c97e5f4c45b67cb2de96dc85aab502c0933701163cba576184fdf699ea01210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff028feb34060000000017a914cc185df6cce745f264d86b40ab002631c7e26a488731124a04000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88ac2e33c65a","txid":"4861f56ada3715862d4b4cac9f2fe006ee7ba34b9d69c73e6f70fc8cb219ebf1","Bdeposit":"bXLRjR6ajmn6CVtkw3PKhUTNq6d341XeuZ","expiration":1522938670,"iambob":0,"bobcoin":"CHIPS","alicecoin":"KMD","lock":0,"amount":1.04131471,"Apayment":"bRKnLXnD12bFFvJY4yTpSE9SSYxK7MK3oD","redeem":"63042e33c65ab17582012088a914d5d40ccc23b72d10142ae271a8b45f5ec617b6ad88210262770e6eee22d10e0a9987844e93d254687aa59b06cb71a2f9c39524be0aac45ac6782012088a914ff5b1f0313943b43625af5b886548b7a4dc9897a8821031f00e8a93cf3a9ef89c509d9f24feb2f2e67642163ef4c41478388ef1be2acc0ac68","method":"update","update":"bobdeposit","requestid":2723334766,"quoteid":3014014511},{"name":"alicepayment","coin":"KMD","tx":"01000000012ab136a64e74427f540c259073e1c703ae0c5c365273584e8d7baf1daa5254df010000006b483045022100c9a1a89ac26773874dd0237b9b9473f5d02c98c04199824956bdb0f5b581c0b40220155f2a148dbf5daf0b901aee078131bc871ba4e760416ba2c19db3dde24be01a01210330b4191bd253364abe8c19976f196bbcc2f3e66724816ef70e7fe472b5f59d0cffffffff0278c198000000000017a9148a28659d700b9d50ee295156253474091cd606838794326503000000001976a914a9d2476fa20db74a8a9117f7999614ecb5b0a9d988ac61f3c55a","txid":"afd0309cd1e38187239b500adab0dc966abf0237ba607b6796fa5552001b064e","Bdeposit":"bXLRjR6ajmn6CVtkw3PKhUTNq6d341XeuZ","expiration":1522938670,"iambob":0,"bobcoin":"CHIPS","alicecoin":"KMD","lock":0,"amount":0.10011,"trigger":"4861f56ada3715862d4b4cac9f2fe006ee7ba34b9d69c73e6f70fc8cb219ebf1","Apayment":"bRKnLXnD12bFFvJY4yTpSE9SSYxK7MK3oD","redeem":"522102d08661d1e6c0a0a3b48407ed71715d2285fe0542212314dd341a44766857fabe21031ccf1d38e6c6f5a3208f92c6c20efc39440729c238256087ba48b23e759b72ce52ae","method":"update","update":"alicepayment","requestid":2723334766,"quoteid":3014014511},{"name":"bobpayment","coin":"CHIPS","tx":"0100000001647690a47b81f3423214e8233a11414e45efcc90a2d2eb5706b79870fdfefe7a010000006b483045022100e31c001b1fc63c9fc3467ece1529bcf501efd4db1373b8bd5633b1de997a3bce022031ae4ef7d8e07dde5c3d223f095d7ed47ba2a8357c5e213584ae265ae69a1f1f01210315d9c51c657ab1be4ae9d3ab6e76a619d3bccfe830d5363fa168424c0d044732ffffffff024a6884050000000017a91409ecbc507d1bfb57e1031abfec536b6f51cfb1ee8761b72b00000000001976a9141462c3dd3f936d595c9af55978003b27c250441f88acb614c65a","txid":"802e32d0ec02c0ff71afc79f32d30f8dbd1d78ef8fc895c66c1cabb6551f8f2e","Bdeposit":"bXLRjR6ajmn6CVtkw3PKhUTNq6d341XeuZ","Bpayment":"bDdkNdoP93fQKe5u4hHi7sKESWgHnkkoty","expiration":1522938670,"iambob":0,"bobcoin":"CHIPS","alicecoin":"KMD","lock":0,"amount":0.9256353,"Apayment":"bRKnLXnD12bFFvJY4yTpSE9SSYxK7MK3oD","redeem":"6304b614c65ab1752103eb410b5c041dc0aa1cdcf72c00dcfc1fe3f9a8f1db2a184c1f58e9bdf69e9b00ac6782012088a914d5d40ccc23b72d10142ae271a8b45f5ec617b6ad88210262770e6eee22d10e0a9987844e93d254687aa59b06cb71a2f9c39524be0aac45ac68","method":"update","update":"bobpayment","requestid":2723334766,"quoteid":3014014511},{"expiration":1522938670,"tradeid":1334982468,"requestid":2723334766,"quoteid":3014014511,"iambob":0,"Bgui":"","Agui":"hyperdex","gui":"hyperdex","bob":"CHIPS","srcamount":0.9254353,"bobtxfee":0.0001,"alice":"KMD","destamount":0.10009,"alicetxfee":0.00001,"aliceid":"6115652558972256257","sentflags":["alicespend","bobpayment","alicepayment","bobdeposit","myfee"],"values":[0.9255353,0,0.9256353,0.10011,1.04131471,0,0.00012881,0,0,0,0],"result":"success","status":"finished","finishtime":1522923368,"bobdeposit":"4861f56ada3715862d4b4cac9f2fe006ee7ba34b9d69c73e6f70fc8cb219ebf1","alicepayment":"afd0309cd1e38187239b500adab0dc966abf0237ba607b6796fa5552001b064e","bobpayment":"802e32d0ec02c0ff71afc79f32d30f8dbd1d78ef8fc895c66c1cabb6551f8f2e","paymentspent":"f2f374169e5dc3d838fd2fd7cd0e3bb39a5352b0d1d6eb3f5753ccd2b07b1a90","Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000","depositspent":"0000000000000000000000000000000000000000000000000000000000000000","method":"tradestatus"}]}

We are missing desthash and expiration on quite a few messages:

// desthash missing from 5 messages
debug.messages.map(msg => msg.desthash)
["2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", "2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d", undefined, undefined, undefined, undefined, undefined]

// expiration missing from 8 messages
debug.messages.map(msg => msg.expiration)
[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, 1522938670, 1522938670, 1522938670, 1522938670, 1522938670]

srccoin/destcoin seem to be available under different properties for different trades.

They go from base/rel to alicecoin/bobcoin to alice/bob. Is it possible to keep these the same between messages?

debug.messages.map(msg => msg.base)
["CHIPS", "CHIPS", "CHIPS", "CHIPS", "CHIPS", "CHIPS", "CHIPS", "CHIPS", undefined, undefined, undefined, undefined, undefined]

debug.messages.map(msg => msg.rel)
["KMD", "KMD", "KMD", "KMD", "KMD", "KMD", "KMD", "KMD", undefined, undefined, undefined, undefined, undefined]

debug.messages.map(msg => msg.alicecoin)
[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "KMD", "KMD", "KMD", "KMD", undefined]

debug.messages.map(msg => msg.bobcoin)
[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "CHIPS", "CHIPS", "CHIPS", "CHIPS", undefined]

debug.messages.map(msg => msg.alice)
[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "KMD"]

debug.messages.map(msg => msg.bob)
[undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, "CHIPS"]
jl777 commented 6 years ago

I can change things to be just one, but whenever changing an existing JSON, everything that relies on it will break...

I know it is horrible.... The three different modules used different naming conditions. Let me think how to do this. adding missing fields is much safer. do you know which exact messages are missing it?

imylomylo commented 6 years ago

Add UUID to everything and deprecate the old way over time.

On Mon, 9 Apr 2018, 17:23 jl777 notifications@github.com wrote:

I can change things to be just one, but whenever changing an existing JSON, everything that relies on it will break...

I know it is horrible.... The three different modules used different naming conditions. Let me think how to do this. adding missing fields is much safer. do you know which exact messages are missing it?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jl777/SuperNET/issues/740#issuecomment-379658935, or mute the thread https://github.com/notifications/unsubscribe-auth/ASgBvj08wqvixO9CqTQSm_R69FqJAQKWks5tmwxUgaJpZM4TEYkS .

jl777 commented 6 years ago

actually why dont i add a "uuid" passthrough the GUI can add a uuid field and I will just pass it through, would that work?

lukechilds commented 6 years ago

Add UUID to everything and deprecate the old way over time.

I really think this is the best solution. I know it'll cause breakage, but I think it's best to cause breakage now, while the majority of people on the network are aware this is bleeding edge tech and are expecting things to be unstable.

It will be much more painful to make breaking network changes once BarterDEX has a large user base of people who aren't expecting things to change. And split the network if they don't update.

I'd hazard a guess that like 90% of the people currently on the network are also a member of the Komodo Slack and will update if you tell them. So now would be the time to make breaking changes.

actually why dont i add a "uuid" passthrough the GUI can add a uuid field and I will just pass it through, would that work?

Do you mean when I place a buy/sell I pass mm a UUID? And you track the trade internally and always attach the same UUID to the relevant messages before sending them back over the socket?

If so, that would be a great workaround that would solve the immediate issue. But I'd still recommend the UUID solution for a cleaner long term fix.

imylomylo commented 6 years ago

Passthru and deprecate is very similar imo. jl777 and other existing devs familiar can still use desthash src alice bob etc.

Newer devs/GUI can use UUID. The vars will always be accessible.

No need to break stuff. Passthru is good.

imylomylo commented 6 years ago

Passthru will only break if there is sanitization and other sanity checks I'm guessing.

On Mon, 9 Apr 2018, 17:56 Mylo Mylo imylomylo@gmail.com wrote:

Passthru and deprecate is very similar imo. jl777 and other existing devs familiar can still use desthash src alice bob etc.

Newer devs/GUI can use UUID. The vars will always be accessible.

No need to break stuff. Passthru is good.

lukechilds commented 6 years ago

It's only a fix from the UI perspective though. The issue still exists for any future client rewrites or alternative clients.

jl777 commented 6 years ago

I am adding an automatically calculated uuid that will be passed through to all trade related JSON. the GUI can pass it in to override the calculation and so presumable whatever silly bob/bobcoin/base type of differences can be reconciled via the uuid

lukechilds commented 6 years ago

Ok, yeah, this sounds like it would work, thanks!

Let me know when I can test.

lukechilds commented 6 years ago

Just tested with the latest build and the UUIDs are working great:

[
  {"gui":"hyperdex","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","timestamp":1523343649,"txfee":"1000","satoshis":"6286398","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59258014,"pubkey":"0000000000000000000000000000000000000000000000000000000000000000","method":"request"},
  {"gui":"hyperdex","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","timestamp":1523343649,"txfee":"1000","satoshis":"6286398","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59258014,"pubkey":"0000000000000000000000000000000000000000000000000000000000000000","method2":"request","method":"request"},
  {"gui":"nogui","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RPMpwKpzWyg5KoMcsuy3mZucUWNdcP2ndD","timestamp":1523343649,"txid":"b593e60aac3481e3828e2dfb59c8db4b772139585528d94d7643f805080bd886","vout":0,"srchash":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","txfee":"1000","quotetime":1523343650,"satoshis":"6290397","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"ae2b851d09b5db40ed8330c081d04f6325d46a490d7c6871d4c930e57c080b6c","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59156752,"requestid":2842308411,"quoteid":66669176,"pending":1523343739,"method2":"reserved","method":"reserved"},
  {"gui":"hyperdex","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RPMpwKpzWyg5KoMcsuy3mZucUWNdcP2ndD","timestamp":1523343649,"txid":"b593e60aac3481e3828e2dfb59c8db4b772139585528d94d7643f805080bd886","vout":0,"srchash":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","txfee":"1000","quotetime":1523343650,"satoshis":"6290397","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"ae2b851d09b5db40ed8330c081d04f6325d46a490d7c6871d4c930e57c080b6c","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59156752,"requestid":924724266,"quoteid":2005958738,"pubkey":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","method":"connect","proof":[]},
  {"gui":"hyperdex","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RPMpwKpzWyg5KoMcsuy3mZucUWNdcP2ndD","timestamp":1523343649,"txid":"b593e60aac3481e3828e2dfb59c8db4b772139585528d94d7643f805080bd886","vout":0,"srchash":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","txfee":"1000","quotetime":1523343650,"satoshis":"6290397","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"ae2b851d09b5db40ed8330c081d04f6325d46a490d7c6871d4c930e57c080b6c","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59156752,"requestid":924724266,"quoteid":2005958738,"pubkey":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","proof":[],"method2":"connect","method":"connect"},
  {"gui":"nogui","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RPMpwKpzWyg5KoMcsuy3mZucUWNdcP2ndD","timestamp":1523343649,"txid":"b593e60aac3481e3828e2dfb59c8db4b772139585528d94d7643f805080bd886","vout":0,"srchash":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","txfee":"1000","quotetime":1523343652,"satoshis":"6290397","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"ae2b851d09b5db40ed8330c081d04f6325d46a490d7c6871d4c930e57c080b6c","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59156752,"requestid":924724266,"quoteid":2163786247,"pair":"tcp://5.9.253.199:37459","proof":["e75fc810e2787693dac4a2702be55524185468ec3b11de5abc3d722c2b558479","78d7b50d0d9f67aaa7e71b2e42c0f04a286580e673b6537f4b0fb44dc9faf755"],"method2":"connected","method":"connected"},
  {"gui":"hyperdex","uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","aliceid":"4231218073246957569","tradeid":2467778052,"base":"REVS","etomicsrc":"","rel":"KMD","etomicdest":"","address":"RPMpwKpzWyg5KoMcsuy3mZucUWNdcP2ndD","timestamp":1523343649,"txid":"b593e60aac3481e3828e2dfb59c8db4b772139585528d94d7643f805080bd886","vout":0,"srchash":"b8c5f621194ffbe5641fecbfbd7ab75bf05574f2becccbcf79ffa9643dc6f163","txfee":"1000","quotetime":1523343652,"satoshis":"6290397","desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","txid2":"ae2b851d09b5db40ed8330c081d04f6325d46a490d7c6871d4c930e57c080b6c","vout2":1,"destaddr":"RQm8BNygniNVqVPRYXEosznRZ7uEiooqSm","desttxid":"b83a4bee9d17205e6a9bef99c5a2b2da35c860c078cdda934fc92654a6dbb558","destvout":1,"feetxid":"196f6a4e2dd349db86eba0fb14204fe93f80d0c6d08c0a1a57bd1202714086ee","feevout":1,"desttxfee":"1000","destsatoshis":"10010000","price":1.59156752,"requestid":924724266,"quoteid":2163786247,"result":"success"},
  {"name":"myfee","coin":"KMD","tx":"0100000001ee8640710212bd571a0a8cd0c6d0803fe94f2014fba0eb86db49d32d4e6a6f19010000006a473044022030482b89aa29741b6809f103a691273f92da6b7a8f2f8c5ef5eb8b91535f7f4402203d2b1b38a8ce8144a92de084f1141972a964082e1a3d03086ab2b9d6139f674101210330b4191bd253364abe8c19976f196bbcc2f3e66724816ef70e7fe472b5f59d0cffffffff0251320000000000001976a914ca1e04745e8ca0c60d8c5881531d51bec470743f88ac9d310100000000001976a914a9d2476fa20db74a8a9117f7999614ecb5b0a9d988ac2261cc5a","txid":"886798d9dde662d307dbbbdb70d859489d1416b965ea4248b90d4c397467a002","expiration":1523359249,"uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","iambob":0,"bobcoin":"REVS","alicecoin":"KMD","lock":0,"amount":0.00012881,"Apayment":"bGYxPRycp2SEAfYfsiZWSzo83ykQewBjDr","method":"update","update":"myfee","requestid":924724266,"quoteid":2163786247},
  {"name":"bobdeposit","coin":"REVS","tx":"01000000016c0b087ce530c9d471687c0d496ad425634fd081c03083ed40dbb5091d852bae010000006b483045022100f95e8ec0f0d7ed3085da3a48b09433a23b6a2503eea506b4e276426694a9327b02205dccfbba817e2f5a4b0b5542a914d935b606faef8b664d37c12e0c59ef1ec279012102b837850cd42bce3402fed23a20369a926c2e00af1a3b52561ea4731a913180efffffffff02c3fe6b000000000017a9142e23dd37fc115926d0c4788a13517ef004fac055879e570500000000001976a9149a723167435ae2b4d49c14b678c93171fe0b0e7688ac119ecc5a","txid":"791ad49e522458fba313c183752735d363559cc13574efce6e3ce61d366d92f9","Bdeposit":"bGwEjwQGZKvfay4csWDsuFbhYLTidUGgth","expiration":1523359249,"uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","iambob":0,"bobcoin":"REVS","alicecoin":"KMD","lock":0,"amount":0.07077571,"Apayment":"bGYxPRycp2SEAfYfsiZWSzo83ykQewBjDr","redeem":"6304119ecc5ab17582012088a9147061c30a87ad253888953d6b3cf1e1d978fe6ca0882102e162ab832d77aa06b8bfb626880bee56abadb621266a0eadea0a4ecb6719144dac6782012088a9145c760eaa293da2230008a04edb377b32bbf1c142882103c26a6647228439d28dcf137028cd8db8b4e8bce01baca2edb94cb2d39280457eac68","method":"update","update":"bobdeposit","requestid":924724266,"quoteid":2163786247},
  {"name":"alicepayment","coin":"KMD","tx":"010000000158b5dba65426c94f93dacd78c060c835dab2a2c599ef9b6a5e20179dee4b3ab8010000006a473044022070b52290a6c7b4cc19a9a55d881091da9bbf28b124bc074323982c80e3b6e4d602201559bb63e03be05d41e2f3515588a4900bf35cfd1643d49b5d1601cea993ee7201210330b4191bd253364abe8c19976f196bbcc2f3e66724816ef70e7fe472b5f59d0cffffffff0278c198000000000017a91429ed0fcb8a4894365525767f2d2106568cfe5e338774b56900000000001976a914a9d2476fa20db74a8a9117f7999614ecb5b0a9d988ac295ecc5a","txid":"80416f675f29eb6541a9c605ba1f0c8bac01f94adf92917652c296b694025ff4","Bdeposit":"bGwEjwQGZKvfay4csWDsuFbhYLTidUGgth","expiration":1523359249,"uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","iambob":0,"bobcoin":"REVS","alicecoin":"KMD","lock":0,"amount":0.10011,"trigger":"791ad49e522458fba313c183752735d363559cc13574efce6e3ce61d366d92f9","Apayment":"bGYxPRycp2SEAfYfsiZWSzo83ykQewBjDr","redeem":"522102490f6ecad6606a3d9e429484c3e7d7469abfa933a8619b5055633c3822d9932721039b9f718dd79acd29d7c8cd234a670c72c8347fd108633c5a88cee8cabeb0a4cd52ae","method":"update","update":"alicepayment","requestid":924724266,"quoteid":2163786247},
  {"name":"bobpayment","coin":"REVS","tx":"010000000286d80b0805f843764dd92855583921774bdbc859fb2d8e82e38134ac0ae693b5000000006a4730440220008fcb807d7e7a3e1e40197935ac1383e544fb70cf4ad46d3a54b6e09489415a02202f672318b36649e4f3305d73bd7eed3fccc600be86b70ea5f9925dcc9de19eb3012102b837850cd42bce3402fed23a20369a926c2e00af1a3b52561ea4731a913180effffffffff9926d361de63c6eceef7435c19c5563d335277583c113a3fb5824529ed41a79010000006a473044022025515de95a8a7c79b4aaa6c2ca76460d6ebe47d62903c5a28c687f4076381891022047e8d282c81508665fde03c42cbe5d8370fc2b64efee7d6834d9f2d76dac487d012102b837850cd42bce3402fed23a20369a926c2e00af1a3b52561ea4731a913180efffffffff02c5ff5f000000000017a91427903e774b875eb99553c2c79fc25dcae9352b3c877e153200000000001976a9149a723167435ae2b4d49c14b678c93171fe0b0e7688ac997fcc5a","txid":"477a96eb952592cef209c263d06ccad3e9b008d3ea98e48d99a9e3ab6a1c45e7","Bdeposit":"bGwEjwQGZKvfay4csWDsuFbhYLTidUGgth","Bpayment":"bGLTqxijSf1J1s2YmtvtikU6HsJrieJqye","expiration":1523359249,"uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","iambob":0,"bobcoin":"REVS","alicecoin":"KMD","lock":0,"amount":0.06291397,"Apayment":"bGYxPRycp2SEAfYfsiZWSzo83ykQewBjDr","redeem":"6304997fcc5ab1752103c17f6b3c21fd711a6cbd615cbf35e44565fd3be06517aa648b519cf86c768faaac6782012088a9147061c30a87ad253888953d6b3cf1e1d978fe6ca0882102e162ab832d77aa06b8bfb626880bee56abadb621266a0eadea0a4ecb6719144dac68","method":"update","update":"bobpayment","requestid":924724266,"quoteid":2163786247},
  {"uuid":"7c2d9cac938b8c7e61f563d4253cb587382a030cf824f52c7f5d7a61e372a184","expiration":1523359249,"tradeid":2467778052,"requestid":924724266,"quoteid":2163786247,"iambob":0,"Bgui":"","Agui":"hyperdex","gui":"hyperdex","bob":"REVS","srcamount":0.06289397,"bobtxfee":0.00001,"alice":"KMD","destamount":0.10009,"alicetxfee":0.00001,"aliceid":"4231218073246957569","sentflags":["alicespend","bobpayment","alicepayment","bobdeposit","myfee"],"values":[0.06290397,0,0.06291397,0.10011,0.07077571,0,0.00012881,0,0,0,0],"result":"success","status":"finished","finishtime":1523344485,"bobdeposit":"791ad49e522458fba313c183752735d363559cc13574efce6e3ce61d366d92f9","alicepayment":"80416f675f29eb6541a9c605ba1f0c8bac01f94adf92917652c296b694025ff4","bobpayment":"477a96eb952592cef209c263d06ccad3e9b008d3ea98e48d99a9e3ab6a1c45e7","paymentspent":"1518bdc3d884a1c7511ec966f68ec2dbda9f3a440e3c5a3d5d94a2c501f286a8","Apaymentspent":"0000000000000000000000000000000000000000000000000000000000000000","depositspent":"0000000000000000000000000000000000000000000000000000000000000000","method":"tradestatus"}
]

They seem to be appearing in every message. 🎉

When I was using this build it took a while for me to get matches. Was that just a coincidence? Or will this build intentionally only allow connections from other peers that also run the UUID version?

lukechilds commented 6 years ago

Oh, I just noticed, we don't get a uuid back in the buy/sell response. This was the pending object:

{"expiration":1523343709,"timeleft":60,"tradeid":2467778052,"requestid":0,"quoteid":0,"bob":"REVS","base":"REVS","basevalue":0.06286398,"alice":"KMD","rel":"KMD","relvalue":0.1001,"desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","aliceid":"4231218073246957569"}

Are you able to add the uuid into the response?

jl777 commented 6 years ago

the uuid should be in the buy/sell response. I will add it to the pending object also

lukechilds commented 6 years ago

Ahh yes, sorry just seen it:

{"result":"success","swaps":[[2971561724, 893432067, {"CHIPS":0.82980340,"KMD":-0.10009000,"price":0.12061893}], [1036607520, 765047526, {"CHIPS":1.02617539,"KMD":-0.12009000,"price":0.11702678}], [924724266, 2163786247, {"REVS":0.06289397,"KMD":-0.10009000,"price":1.59140852}]],"netamounts":[{"KMD":-0.32027000}, {"CHIPS":1.85597879}, {"REVS":0.06289397}],"pending":{"expiration":1523421795,"timeleft":59,"tradeid":3172833298,"requestid":0,"quoteid":0,"bob":"CHIPS","base":"CHIPS","basevalue":0.81402133,"alice":"KMD","rel":"KMD","relvalue":0.10010000,"desthash":"2632d12cd16572b7f45ce0ec3cf92d6beac9a2f53ca3971afbc90dbf6a16344d","aliceid":"8164005029987024897"},"uuid":"d99201d1903c6e6c8103e82a95a535ab7ea41fea518f1d804c56fd9d368aff6d"}

In our api client we just pluck the pending object from the response and return that to our app code as that's the only relevant data for the buy/sell command. (or at-least it was up until now.)

If you can move the uuid into the pending object to keep it consistent with the other swap messages, that would be great.

lukechilds commented 6 years ago

uuid is in the latest pending option and is working great! I'll close this issue now as it's resolved.

Any idea when this will be ready to make it into one of @artemii235's cross platform releases?

jl777 commented 6 years ago

just ask him when he plans to rebase to my repo

artemii235 commented 6 years ago

@lukechilds https://github.com/artemii235/SuperNET/releases/tag/v1.0.108 I have merged jl777 dev branch to my repo. Here is new release: https://github.com/artemii235/SuperNET/releases/tag/v1.0.108. Please note that it needs to be tested.

lukechilds commented 6 years ago

Thanks @artemii235, I think the UUID change also needs https://github.com/jl777/SuperNET/commit/10450b558cfb9cff0c7bc10f834c528cdf6f9aa5 to be reliable.

I think that commit was only in jl777 when you made that build, but has recently merged into dev: https://github.com/jl777/SuperNET/pull/760

artemii235 commented 6 years ago

@lukechilds Merged, new release: https://github.com/artemii235/SuperNET/releases/tag/v1.0.112

lukechilds commented 6 years ago

Thanks @artemii235 testing now