Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

internal: Add basic simnet xmr swap. #2885

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ client/cmd/translationsreport/translationsreport
client/cmd/translationsreport/worksheets
server/cmd/dexadm/dexadm
server/cmd/geogame/geogame
internal/libsecp256k1/secp256k1
internal/cmd/xmrswap/xmrswap
244 changes: 244 additions & 0 deletions dex/testing/xmr/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,244 @@
# Monero Development Harness

Monero development Harness - documentation and notes

## Useful Info

Monero is very different than btc in that it does not provide a single rpc
tool like `bitcoin-cli` but rather a set of json 2.0 & other older json apis
which can be accessed by sending curl requests for each one.

Monero wallets are accounts based

<https://web.getmonero.org/resources/moneropedia/account.html>

## Architecture

![alt text](image-1.png)

Embedded in Tmux

- **alpha** is a monero p2p daemon

- **bill** is a miner wallet .. you can top up more funds from bill if you run out

- **fred** is a normal wallet user

- **charlie** is a normal wallet user

- **charlie_view** is a view-only wallet sibling of charlie full wallet - no spend key

## Using

### Prerequisites

- **monero-x86_64-linux-gnu-v0.18.3.3** or later <https://downloads.getmonero.org/cli/linux64>
- **linux** (tested on Ubuntu 22.04)
- **jq** (1.6)

### Setup

**monero-x86_64-linux-gnu-v0.18.3.3** should be in PATH

`export PATH=$PATH:[path-to]/monero-x86_64-linux-gnu-v0.18.3.3`

### Background Mining

By default background mining is set up and mines to bill wallet every 15s

To disable:

`export NOMINER="1" to your shell`

or else invoke the harness with:

`NOMINER="1" ./harness.sh`

You should disable if attempting the manual offline cold signing using `monero-wallet-cli`

You should also ctl-C charlie & charlie_view wallets for this

### Run

`./harness.sh`

### Data Directory

![alt text](image-2.png)

### Known Issues

The transaction spend locking needs more investigation

### Commands Help

run `./help` from the tmux harness window 0

```text

Commands Help:
--------------
alpha_get_transactions

- get transactions info for one or more txid
- inputs:
- tx_hashes - hash1,hash2,hash3,...

alpha_get_transactions_details

- get transaction development details from monerod including tx lock time
- inputs:
- tx_hashes - hash1,hash2,hash3,...

alpha_info

- get running daemon details - height, etc.
- inputs: None

alpha_sendrawtransaction

- broadcast a previously built signed tx
- inputs:
- tx_as_hex string - can be generated with charlie_build_tx or fred_build_tx

alpha_transaction_pool

- get mempool details
- inputs: None

mine-to-bill

- generate 1 or more blocks to bill wallet
- inputs:
- num_blocks - defaults to 1

bill_balance

- get bill wallet balance details
- inputs: None

bill_refresh_wallet

- update bill's wallet from the daemon latest info
- inputs: None

bill_transfer_to

- build, sign and broadcast a transaction from bill wallet to another address
- inputs:
- amount in in atomic units 1e12 - e.g. 1230000000000 echo = 1.23 XMR
- address - recipient primary address - account index 0, subaddr_indeces [0]
- unlock_time - unlock after n blocks and make spendable - defaults to 0 (no lock)

charlie_balance

- get charlie wallet balance details
- inputs: None

charlie_refresh_wallet

- update charlie's wallet from the daemon latest info
- inputs: None

charlie_build_tx

- build a signed tx for later broadcasting using alpha_send
- inputs:
- amount in in atomic units 1e12 - e.g. 1230000000000 = 1.23 XMR
- address - recipient primary address - account index 0, subaddr_indeces [0]
- unlock_time - unlock after n blocks and make spendable - defaults to 0 (no lock)
-outputs:
- signed tx_blob
- tx_hash

charlie_incoming_transfers

- get a list of incoming mined transfers to charlie wallet
- inputs: None

charlie_transfer_to

- build, sign and broadcast a transaction from charlie wallet to another address
- inputs
- amount in in atomic units 1e12 - e.g. 1230000000000 echo = 1.23 XMR
- address - recipient primary address - account index 0, subaddr_indeces [0]
- unlock_time - unlock after n blocks and make spendable - defaults to 0 (no lock)

fred_export_outputs

- export fred outputs hex
- input:
- all - defaults to true - otherwise only new outputs since the last call

charlie_export_outputs

- export charlie outputs hex
- input:
- all - defaults to true - otherwise only new outputs since the last call

charlie_view_export_outputs

- export charlie_view outputs hex - charlie_view knows the outputs but has no spend key
- inputs: None
- only useful in offline, cold signing process using monero-wallet-cli interactive tool
must be hex decoded into a file to use in monero-wallet-cli

fred_export_key_images

- export signed key images from fred wallet - an array of key images and ephemeral signatures
- input:
- all - defaults to true - otherwise only new key images since the last call

charlie_export_key_images

- export signed key images from charlie wallet - an array of key images and ephemeral signatures
- input:
- all - defaults to true - otherwise only new key images since the last call

fred_balance

- get fred wallet balance details
- inputs: None

fred_refresh_wallet

- update fred's wallet from the daemon latest info
- inputs: None

fred_build_tx

- build a signed tx for later broadcasting using alpha_send
- inputs:
- amount in in atomic units 1e12 - e.g. 1230000000000 = 1.23 XMR
- address - recipient primary address - account index 0, subaddr_indeces [0]
- unlock_time - unlock after n blocks and make spendable - defaults to 0 (no lock)
-outputs:
- signed tx_blob
- tx_hash

fred_incoming_transfers

- get a list of incoming mined transfers to fred wallet
- inputs: None

fred_transfer_to

- build, sign and broadcast a transaction from bill wallet to another address
- inputs
- amount in in atomic units 1e12 - e.g. 1230000000000 echo = 1.23 XMR
- address - recipient primary address - account index 0, subaddr_indeces [0]
- unlock_time - unlock after n blocks and make spendable - defaults to 0 (no lock)

wallets

- wallet details exported to the harness environment - useful for building commands in the harness window 0

help

- this help

quit

- shutdown daemons and quit the harness

```
Loading
Loading