From af38f82406ee189539e009419540ecdcc43f933f Mon Sep 17 00:00:00 2001 From: woodser Date: Fri, 10 Nov 2023 11:29:23 -0500 Subject: [PATCH] document signing accounts in deployment guide, minor fixes --- .../core/account/sign/SignedWitness.java | 4 ++-- .../account/sign/SignedWitnessService.java | 3 +-- .../witness/AccountAgeWitnessService.java | 2 +- .../closedtrades/ClosedTradesListItem.java | 3 ++- docs/deployment-guide.md | 23 ++++++++++++++++++- docs/developer-guide.md | 9 -------- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/haveno/core/account/sign/SignedWitness.java b/core/src/main/java/haveno/core/account/sign/SignedWitness.java index 65aebe72..8e8e2182 100644 --- a/core/src/main/java/haveno/core/account/sign/SignedWitness.java +++ b/core/src/main/java/haveno/core/account/sign/SignedWitness.java @@ -23,6 +23,7 @@ import haveno.common.app.Capability; import haveno.common.crypto.Hash; import haveno.common.proto.ProtoUtil; import haveno.common.util.Utilities; +import haveno.core.trade.HavenoUtils; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.payload.CapabilityRequiringPayload; import haveno.network.p2p.storage.payload.DateTolerantPayload; @@ -30,7 +31,6 @@ import haveno.network.p2p.storage.payload.PersistableNetworkPayload; import haveno.network.p2p.storage.payload.ProcessOncePersistableNetworkPayload; import lombok.Value; import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; import java.time.Clock; import java.time.Instant; @@ -176,7 +176,7 @@ public class SignedWitness implements ProcessOncePersistableNetworkPayload, Pers ",\n signerPubKey=" + Utilities.bytesAsHexString(signerPubKey) + ",\n witnessOwnerPubKey=" + Utilities.bytesAsHexString(witnessOwnerPubKey) + ",\n date=" + Instant.ofEpochMilli(date) + - ",\n tradeAmount=" + Coin.valueOf(tradeAmount).toFriendlyString() + + ",\n tradeAmount=" + HavenoUtils.formatXmr(tradeAmount, true) + ",\n hash=" + Utilities.bytesAsHexString(hash) + "\n}"; } diff --git a/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java b/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java index b40a7fb0..bcb0e796 100644 --- a/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java +++ b/core/src/main/java/haveno/core/account/sign/SignedWitnessService.java @@ -35,7 +35,6 @@ import haveno.network.p2p.P2PService; import haveno.network.p2p.storage.P2PDataStorage; import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService; import lombok.extern.slf4j.Slf4j; -import org.bitcoinj.core.Coin; import org.bitcoinj.core.ECKey; import org.bitcoinj.core.Utils; @@ -62,7 +61,7 @@ import java.util.stream.Collectors; public class SignedWitnessService { public static final long SIGNER_AGE_DAYS = 30; private static final long SIGNER_AGE = SIGNER_AGE_DAYS * ChronoUnit.DAYS.getDuration().toMillis(); - public static final BigInteger MINIMUM_TRADE_AMOUNT_FOR_SIGNING = HavenoUtils.coinToAtomicUnits(Coin.parseCoin("0.0025")); + public static final BigInteger MINIMUM_TRADE_AMOUNT_FOR_SIGNING = HavenoUtils.xmrToAtomicUnits(.1); private final KeyRing keyRing; private final P2PService p2PService; diff --git a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java index a97a2b1b..c8724b0f 100644 --- a/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java +++ b/core/src/main/java/haveno/core/account/witness/AccountAgeWitnessService.java @@ -844,7 +844,7 @@ public class AccountAgeWitnessService { } public SignState getSignState(Trade trade) { - if (trade instanceof ArbitratorTrade) return SignState.UNSIGNED; // TODO (woodser): arbitrator has two peers + if (trade instanceof ArbitratorTrade) return SignState.UNSIGNED; return findTradePeerWitness(trade) .map(this::getSignState) .orElse(SignState.UNSIGNED); diff --git a/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesListItem.java b/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesListItem.java index 36725fa4..7cd2f9ba 100644 --- a/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesListItem.java +++ b/desktop/src/main/java/haveno/desktop/main/portfolio/closedtrades/ClosedTradesListItem.java @@ -21,6 +21,7 @@ import haveno.core.locale.CurrencyUtil; import haveno.core.monetary.Price; import haveno.core.offer.Offer; import haveno.core.offer.OfferDirection; +import haveno.core.trade.ArbitratorTrade; import haveno.core.trade.ClosedTradableFormatter; import haveno.core.trade.ClosedTradableManager; import haveno.core.trade.Tradable; @@ -100,7 +101,7 @@ public class ClosedTradesListItem implements FilterableListItem { public String getDirectionLabel() { Offer offer = tradable.getOffer(); - OfferDirection direction = closedTradableManager.wasMyOffer(offer) + OfferDirection direction = closedTradableManager.wasMyOffer(offer) || tradable instanceof ArbitratorTrade ? offer.getDirection() : offer.getMirroredDirection(); String currencyCode = tradable.getOffer().getCurrencyCode(); diff --git a/docs/deployment-guide.md b/docs/deployment-guide.md index 05fcf8fa..77fd66b9 100644 --- a/docs/deployment-guide.md +++ b/docs/deployment-guide.md @@ -149,8 +149,29 @@ Enter a private key which is registered to send alerts. Enter the alert message and new version number, then click the button to send the notification. +## Manually sign payment accounts as the arbitrator + +Arbitrators can manually sign payment accounts. First open the legacy UI. + +### Sign payment account after trade is completed + +1. Go to Portfolio > History > open trade details > click 'DETAIL DATA' button. +2. Copy the `,` string for the buyer or seller. +3. Go to Account > `ctrl + i` > `ctrl + p`. +5. Paste the buyer or seller's `,` string. +6. Click the "Import unsigned account age witness" button to confirm. + +### Sign payment account from dispute + +1. Go to Account > `ctrl + i` > `ctrl + s`. +2. Select payment accounts to sign from disputes. + +### Sign unsigned witness pub keys + +1. Go to Account > `ctrl + i` > `ctrl + o`. + ## Other operating tips -* To maintain the network, avoid all seed nodes going offline at the same time. If all seed nodes go offline at the same time, arbitrator registration and the network filter will be fully reset, so all arbitrators will need to be re-registered, and the network filter will need to be recreated. This should be done immediately or clients will cancel their offers due to the signing arbitrators being unregistered and no replacements being available to re-sign. +* Avoid all seed nodes going offline at the same time. If all seed nodes go offline at the same time, arbitrator registration and the network filter will be fully reset, so all arbitrators will need to be re-registered, and the network filter will need to be recreated. This should be done immediately or clients will cancel their offers due to the signing arbitrators being unregistered and no replacements being available to re-sign. * If a dispute does not open properly, try manually reopening the dispute with a keyboard shortcut: `ctrl + o`. * To send a private notification to a peer: click the user icon and enter `alt + r`. Enter a private key which is registered to send private notifications. \ No newline at end of file diff --git a/docs/developer-guide.md b/docs/developer-guide.md index 9e0fdc1a..83cf9d93 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -36,15 +36,6 @@ Follow [instructions](https://github.com/haveno-dex/haveno-ts#run-tests) to run 9. Run the tests with `npm run test -- -t 'my test'` to run tests by name and `npm test` to run all tests together. Ensure all tests pass and there are no exception stacktraces in the terminals of Alice, Bob, or the arbitrator. 10. Open pull requests to the haveno and haveno-ts projects for the backend and frontend implementations. -## Manually sign accounts as the arbitrator - -1. Open legacy UI as the arbitrator. -2. Go to the 'Account' tab. -3. Open Signing tab: `ctrl+i` - a. Sign payment account: `ctrl+s`, select payment accounts to sign (sourced from disputes). - b. Sign account age witness: `ctrl+p` then enter , (from past trade details) and click the "Import unsigned account age witness" button. - c. Sign unsigned witness pub keys: `ctrl+o` - ## Release portable Monero binaries for each platform 1. Update the release-v0.18 branch on Haveno's [monero repo](https://github.com/haveno-dex/monero) to the latest release from upstream + any customizations (e.g. a commit to speed up testnet hardforks for local development).