Commit a8fb6807 authored by zeroleak's avatar zeroleak
Browse files

add /rest/tx0/v1 + ErrorResponse.errorCode

parent d4be3f52
......@@ -50,7 +50,8 @@ Each STOMP message from coordinator:
- defines StompHeader `protocolVersion`: your client should check it to detect any beaking coordinator upgrade.
- defines StompHeader `messageType`: this is the payload type (Java class name).
Websocket errors are sent to client's queue `/private/reply` as [`ErrorResponse`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/websocket/messages/ErrorResponse.java).
Websocket errors are sent to client's queue `/private/reply` as [`ErrorResponse`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/websocket/messages/ErrorResponse.java):
- `errorCode` conforms to [`ServerErrorCode`](https://code.samourai.io/whirlpool/whirlpool-server/-/blob/develop/src/main/java/com/samourai/whirlpool/server/exceptions/ServerErrorCode.java)
Client can open multiple websocket connexions to (re)mix in multiple pools simultaneously. We recommend a maximum of 1 PREMIX utxo per pool + 1 POSTMIX utxo per pool. Registering more inputs won't speed-up the mixing.
......@@ -86,7 +87,7 @@ Each message field suffixed as "64" is encoded with Z85.
#### 2. Create Tx0
![](charts/tx0.png)
- Client submits `POST /rest/tx0` [`Tx0DataRequestV2`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/rest/Tx0DataRequestV2.java) to preview TX0:
- Client submits `POST /rest/tx0/v1` [`Tx0DataRequestV2`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/rest/Tx0DataRequestV2.java) to preview TX0:
- `scode`: discount code (optional)
- `partnerId`: partner identifier (`SAMOURAI`, `SPARROW`...)
- Client receives [`Tx0DataResponseV2`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/rest/Tx0DataResponseV2.java):
......@@ -104,7 +105,11 @@ Each message field suffixed as "64" is encoded with Z85.
- [1-N] PREMIX outputs (max count `PoolInfo.tx0MaxOutputs`) of the same value (`PoolInfo.mustMixBalanceMin <= value <= PoolInfo.mustMixBalanceCap`)
- 1 Whirlpool fee output of `feeValue` to `feeAddress`, when `feeValue>0`
- 1 fake Whirlpool fee output of `feeChange` to DEPOSIT, when `feeValue=0`
- 1 OP_RETURN with `xorMask(feePayload64, input[0].key, feePaymentCode)`
- 1 OP_RETURN (80 bytes) generated by concatenating following elements:
- feePayloadMasked (46 bytes): result of `xorMask(feePayload64, signingKey, feePaymentCode)` truncated on 46 bytes
- signingPublicKey (33 bytes): the public key used for xorMask (this can be any key)
- OP_RETURN_VERSION (1 byte): value of `1`
See [`FeeOpReturnImplV1.computeOpReturn()`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/feeOpReturn/FeeOpReturnImplV1.java#L63) or [`FeeOpReturnImplV1Test`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/test/java/com/samourai/whirlpool/protocol/feeOpReturn/FeeOpReturnImplV1Test.java#L92) for implementation details.
- eventual change output to DEPOSIT
- Client submits `POST /rest/tx0/push` [`Tx0PushRequest`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/rest/Tx0PushRequest.java):
- tx64: transaction to push
......@@ -148,7 +153,7 @@ If the client gets disconnected for some reason, it has to restart the whole cyc
- `liquidity`: true for PREMIX, false for POSTMIX
- Client is now automatically queued for mixing and keeps waiting for a [`ConfirmInputMixStatusNotification`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/websocket/notifications/ConfirmInputMixStatusNotification.java).
It takes generally a few minutes to be selected for the first mix (and a few hours for a free remix).
- If UTXO is banned, client will receive error {"message": "Banned from service. <optional details>"} to `/private/reply`
- If UTXO is rejected, client receives an error to `/private/reply`. Example: if UTXO is banned, client receives {"message": "Banned from service. <optional details>"}.
keeps waiting for a [`ConfirmInputMixStatusNotification`](https://code.samourai.io/whirlpool/whirlpool-protocol/-/blob/develop/src/main/java/com/samourai/whirlpool/protocol/websocket/notifications/ConfirmInputMixStatusNotification.java)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment