mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-03 09:19:26 +00:00
guix: Add guix.scm
This commit is contained in:
parent
ba5339d8bd
commit
d15cf3dd6f
7 changed files with 202 additions and 34 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
old/
|
old/
|
||||||
|
build/
|
||||||
*.pyc
|
*.pyc
|
||||||
__pycache__
|
__pycache__
|
||||||
/dist/
|
/dist/
|
||||||
|
|
20
README.md
20
README.md
|
@ -1,6 +1,7 @@
|
||||||
|
|
||||||
# Simple Atomic Swap Network - Proof of Concept
|
# Simple Atomic Swap Network - Proof of Concept
|
||||||
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Simple atomic swap experiment, doesn't have many interesting features yet.
|
Simple atomic swap experiment, doesn't have many interesting features yet.
|
||||||
|
@ -13,8 +14,27 @@ Other nodes can be run in pruned mode.
|
||||||
A node must be run for each coin type traded.
|
A node must be run for each coin type traded.
|
||||||
In the future it should be possible to use data from explorers instead of running a node.
|
In the future it should be possible to use data from explorers instead of running a node.
|
||||||
|
|
||||||
|
|
||||||
## Currently a work in progress
|
## Currently a work in progress
|
||||||
|
|
||||||
Not ready for real-world use.
|
Not ready for real-world use.
|
||||||
|
|
||||||
Discuss development and help with testing in the matrix channel [#basicswap:matrix.org](https://riot.im/app/#/room/#basicswap:matrix.org)
|
Discuss development and help with testing in the matrix channel [#basicswap:matrix.org](https://riot.im/app/#/room/#basicswap:matrix.org)
|
||||||
|
|
||||||
|
|
||||||
|
## Guix
|
||||||
|
|
||||||
|
Start a development environment
|
||||||
|
|
||||||
|
guix shell --pure -D -f guix.scm
|
||||||
|
|
||||||
|
|
||||||
|
Run tests
|
||||||
|
|
||||||
|
export PYTHONPATH=$(pwd)
|
||||||
|
|
||||||
|
# Prepare coin binaries - required once
|
||||||
|
python ./bin/basicswap-prepare.py -preparebinonly --withcoins=monero,bitcoin,particl,litecoin
|
||||||
|
|
||||||
|
pytest -vs tests/basicswap/test_run.py::Test::test_02_part_ltc
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ CONFIG_FILENAME = 'basicswap.json'
|
||||||
BASICSWAP_DATADIR = os.getenv('BASICSWAP_DATADIR', '~/.basicswap')
|
BASICSWAP_DATADIR = os.getenv('BASICSWAP_DATADIR', '~/.basicswap')
|
||||||
DEFAULT_ALLOW_CORS = False
|
DEFAULT_ALLOW_CORS = False
|
||||||
TEST_DATADIRS = os.path.expanduser(os.getenv('DATADIRS', '/tmp/basicswap'))
|
TEST_DATADIRS = os.path.expanduser(os.getenv('DATADIRS', '/tmp/basicswap'))
|
||||||
DEFAULT_TEST_BINDIR = os.path.expanduser(os.getenv('DEFAULT_TEST_BINDIR', '~/tmp/bin'))
|
DEFAULT_TEST_BINDIR = os.path.expanduser(os.getenv('DEFAULT_TEST_BINDIR', '~/.basicswap/bin'))
|
||||||
|
|
||||||
bin_suffix = ('.exe' if os.name == 'nt' else '')
|
bin_suffix = ('.exe' if os.name == 'nt' else '')
|
||||||
PARTICL_BINDIR = os.path.expanduser(os.getenv('PARTICL_BINDIR', os.path.join(DEFAULT_TEST_BINDIR, 'particl')))
|
PARTICL_BINDIR = os.path.expanduser(os.getenv('PARTICL_BINDIR', os.path.join(DEFAULT_TEST_BINDIR, 'particl')))
|
||||||
|
|
|
@ -890,38 +890,38 @@ def printVersion():
|
||||||
|
|
||||||
|
|
||||||
def printHelp():
|
def printHelp():
|
||||||
logger.info('Usage: basicswap-prepare ')
|
print('Usage: basicswap-prepare ')
|
||||||
logger.info('\n--help, -h Print help.')
|
print('\n--help, -h Print help.')
|
||||||
logger.info('--version, -v Print version.')
|
print('--version, -v Print version.')
|
||||||
logger.info('--datadir=PATH Path to basicswap data directory, default:{}.'.format(cfg.BASICSWAP_DATADIR))
|
print('--datadir=PATH Path to basicswap data directory, default:{}.'.format(cfg.BASICSWAP_DATADIR))
|
||||||
logger.info('--bindir=PATH Path to cores directory, default:datadir/bin.')
|
print('--bindir=PATH Path to cores directory, default:datadir/bin.')
|
||||||
logger.info('--mainnet Run in mainnet mode.')
|
print('--mainnet Run in mainnet mode.')
|
||||||
logger.info('--testnet Run in testnet mode.')
|
print('--testnet Run in testnet mode.')
|
||||||
logger.info('--regtest Run in regtest mode.')
|
print('--regtest Run in regtest mode.')
|
||||||
logger.info('--particl_mnemonic= Recovery phrase to use for the Particl wallet, default is randomly generated,\n'
|
print('--particl_mnemonic= Recovery phrase to use for the Particl wallet, default is randomly generated,\n'
|
||||||
+ ' "auto" to create a wallet automatically - No mnemonic.'
|
+ ' "auto" to create a wallet automatically - No mnemonic.'
|
||||||
+ ' "none" to disable wallet initialisation.')
|
+ ' "none" to disable wallet initialisation.')
|
||||||
logger.info('--withcoin= Prepare system to run daemon for coin.')
|
print('--withcoin= Prepare system to run daemon for coin.')
|
||||||
logger.info('--withoutcoin= Do not prepare system to run daemon for coin.')
|
print('--withoutcoin= Do not prepare system to run daemon for coin.')
|
||||||
logger.info('--addcoin= Add coin to existing setup.')
|
print('--addcoin= Add coin to existing setup.')
|
||||||
logger.info('--disablecoin= Make coin inactive.')
|
print('--disablecoin= Make coin inactive.')
|
||||||
logger.info('--preparebinonly Don\'t prepare settings or datadirs.')
|
print('--preparebinonly Don\'t prepare settings or datadirs.')
|
||||||
logger.info('--nocores Don\'t download and extract any coin clients.')
|
print('--nocores Don\'t download and extract any coin clients.')
|
||||||
logger.info('--usecontainers Expect each core to run in a unique container.')
|
print('--usecontainers Expect each core to run in a unique container.')
|
||||||
logger.info('--portoffset=n Raise all ports by n.')
|
print('--portoffset=n Raise all ports by n.')
|
||||||
logger.info('--htmlhost= Interface to host html server on, default:127.0.0.1.')
|
print('--htmlhost= Interface to host html server on, default:127.0.0.1.')
|
||||||
logger.info('--wshost= Interface to host websocket server on, disable by setting to "none", default:127.0.0.1.')
|
print('--wshost= Interface to host websocket server on, disable by setting to "none", default:127.0.0.1.')
|
||||||
logger.info('--xmrrestoreheight=n Block height to restore Monero wallet from, default:{}.'.format(DEFAULT_XMR_RESTORE_HEIGHT))
|
print('--xmrrestoreheight=n Block height to restore Monero wallet from, default:{}.'.format(DEFAULT_XMR_RESTORE_HEIGHT))
|
||||||
logger.info('--noextractover Prevent extracting cores if files exist. Speeds up tests')
|
print('--noextractover Prevent extracting cores if files exist. Speeds up tests')
|
||||||
logger.info('--usetorproxy Use TOR proxy during setup. Note that some download links may be inaccessible over TOR.')
|
print('--usetorproxy Use TOR proxy during setup. Note that some download links may be inaccessible over TOR.')
|
||||||
logger.info('--enabletor Setup Basicswap instance to use TOR.')
|
print('--enabletor Setup Basicswap instance to use TOR.')
|
||||||
logger.info('--disabletor Setup Basicswap instance to not use TOR.')
|
print('--disabletor Setup Basicswap instance to not use TOR.')
|
||||||
logger.info('--usebtcfastsync Initialise the BTC chain with a snapshot from btcpayserver FastSync.\n'
|
print('--usebtcfastsync Initialise the BTC chain with a snapshot from btcpayserver FastSync.\n'
|
||||||
+ ' See https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md')
|
+ ' See https://github.com/btcpayserver/btcpayserver-docker/blob/master/contrib/FastSync/README.md')
|
||||||
logger.info('--initwalletsonly Setup coin wallets only.')
|
print('--initwalletsonly Setup coin wallets only.')
|
||||||
logger.info('--keysdirpath Speed up tests by preloading all PGP keys in directory.')
|
print('--keysdirpath Speed up tests by preloading all PGP keys in directory.')
|
||||||
|
|
||||||
logger.info('\n' + 'Known coins: %s', ', '.join(known_coins.keys()))
|
print('\n' + 'Known coins: {}'.format(', '.join(known_coins.keys())))
|
||||||
|
|
||||||
|
|
||||||
def finalise_daemon(d):
|
def finalise_daemon(d):
|
||||||
|
@ -1452,6 +1452,11 @@ def main():
|
||||||
else:
|
else:
|
||||||
with open(config_path) as fs:
|
with open(config_path) as fs:
|
||||||
settings = json.load(fs)
|
settings = json.load(fs)
|
||||||
|
|
||||||
|
# Add temporary default config for any coins that have not been added
|
||||||
|
for c in with_coins:
|
||||||
|
if c not in settings['chainclients']:
|
||||||
|
settings['chainclients'][c] = chainclients[c]
|
||||||
else:
|
else:
|
||||||
for c in with_coins:
|
for c in with_coins:
|
||||||
withchainclients[c] = chainclients[c]
|
withchainclients[c] = chainclients[c]
|
||||||
|
|
144
guix.scm
Normal file
144
guix.scm
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
(use-modules
|
||||||
|
(guix packages)
|
||||||
|
((guix licenses) #:prefix license:)
|
||||||
|
(guix build-system python)
|
||||||
|
(guix build-system gnu)
|
||||||
|
(guix git-download)
|
||||||
|
(guix download)
|
||||||
|
(gnu packages)
|
||||||
|
(gnu packages pkg-config)
|
||||||
|
(gnu packages autotools)
|
||||||
|
(gnu packages certs)
|
||||||
|
(gnu packages check)
|
||||||
|
(gnu packages databases)
|
||||||
|
(gnu packages finance)
|
||||||
|
(gnu packages gnupg)
|
||||||
|
(gnu packages protobuf)
|
||||||
|
(gnu packages python)
|
||||||
|
(gnu packages python-build)
|
||||||
|
(gnu packages python-crypto)
|
||||||
|
(gnu packages python-xyz)
|
||||||
|
(gnu packages libffi)
|
||||||
|
(gnu packages license))
|
||||||
|
|
||||||
|
(define libsecp256k1-anonswap
|
||||||
|
(package
|
||||||
|
(name "libsecp256k1-anonswap")
|
||||||
|
(version "anonswap_v0.1")
|
||||||
|
(source (origin
|
||||||
|
(method git-fetch)
|
||||||
|
(uri (git-reference
|
||||||
|
(url "https://github.com/tecnovert/secp256k1")
|
||||||
|
(commit version)))
|
||||||
|
(sha256
|
||||||
|
(base32
|
||||||
|
"1lrcc5gjywlzvrgwzifva4baa2nsvwr3h0wmkc71q0zhag9pjbah"))
|
||||||
|
(file-name (git-file-name name version))))
|
||||||
|
(build-system gnu-build-system)
|
||||||
|
(arguments
|
||||||
|
'(#:configure-flags '("--enable-shared"
|
||||||
|
"--disable-dependency-tracking"
|
||||||
|
"--with-valgrind=no"
|
||||||
|
"--enable-experimental"
|
||||||
|
"--enable-module-recovery"
|
||||||
|
"--enable-module-ecdh"
|
||||||
|
"--enable-benchmark=no"
|
||||||
|
"--enable-tests=no"
|
||||||
|
"--enable-module-ed25519"
|
||||||
|
"--enable-module-generator"
|
||||||
|
"--enable-module-dleag"
|
||||||
|
"--enable-module-ecdsaotves"
|
||||||
|
)))
|
||||||
|
(native-inputs
|
||||||
|
(list autoconf automake libtool))
|
||||||
|
(synopsis "C library for EC operations on curve secp256k1")
|
||||||
|
(description
|
||||||
|
"Optimized C library for EC operations on curve secp256k1.\n")
|
||||||
|
(home-page "https://github.com/bitcoin-core/secp256k1")
|
||||||
|
(license license:unlicense)))
|
||||||
|
|
||||||
|
|
||||||
|
(define python-coincurve-anonswap
|
||||||
|
(package
|
||||||
|
(name "python-coincurve-anonswap")
|
||||||
|
(version "anonswap_v0.1")
|
||||||
|
(source
|
||||||
|
(origin
|
||||||
|
(method git-fetch)
|
||||||
|
(uri
|
||||||
|
(git-reference
|
||||||
|
(url "https://github.com/tecnovert/coincurve")
|
||||||
|
(commit version)))
|
||||||
|
(file-name
|
||||||
|
(git-file-name name version))
|
||||||
|
(sha256
|
||||||
|
(base32 "0vyzvpp2s21js01185qbm1lgs4ps4hki2d6yzprfsjqap1i5qhmp"))))
|
||||||
|
(build-system python-build-system)
|
||||||
|
(arguments
|
||||||
|
'(#:tests? #f ;XXX fails to load "libsecp256k1.dll"
|
||||||
|
#:phases (modify-phases %standard-phases
|
||||||
|
(add-after 'unpack 'patch-libsec256k1-path
|
||||||
|
(lambda _
|
||||||
|
(substitute* "setup.py"
|
||||||
|
(("if has_system_lib\\(\\)")
|
||||||
|
"if True")
|
||||||
|
((", 'requests'")
|
||||||
|
"")
|
||||||
|
(("download_library\\(self\\)")
|
||||||
|
"")))))))
|
||||||
|
(propagated-inputs
|
||||||
|
(list
|
||||||
|
libsecp256k1-anonswap
|
||||||
|
python-asn1crypto
|
||||||
|
python-cffi))
|
||||||
|
(native-inputs
|
||||||
|
(list
|
||||||
|
python-setuptools
|
||||||
|
pkg-config
|
||||||
|
))
|
||||||
|
(synopsis "Python libsecp256k1 wrapper")
|
||||||
|
(description "Python libsecp256k1 wrapper.")
|
||||||
|
(home-page "https://github.com/tecnovert/coincurve")
|
||||||
|
(license license:bsd-3)))
|
||||||
|
|
||||||
|
(define python-sqlalchemy-1.4.39
|
||||||
|
(package
|
||||||
|
(inherit python-sqlalchemy)
|
||||||
|
(version "1.4.39")
|
||||||
|
(source
|
||||||
|
(origin
|
||||||
|
(method url-fetch)
|
||||||
|
(uri (pypi-uri "SQLAlchemy" version))
|
||||||
|
(sha256
|
||||||
|
(base32 "09sx2lghywnm7qj1xm8xc3xrgj40bndfh2hbiaq4cfvm71h8k541"))))))
|
||||||
|
|
||||||
|
(package
|
||||||
|
(name "basicswap")
|
||||||
|
(version "0.11.49")
|
||||||
|
(source #f)
|
||||||
|
(build-system python-build-system)
|
||||||
|
(propagated-inputs
|
||||||
|
(list
|
||||||
|
gnupg
|
||||||
|
nss-certs
|
||||||
|
python-coincurve-anonswap
|
||||||
|
python-pycryptodome
|
||||||
|
python-pylint
|
||||||
|
python-pyflakes
|
||||||
|
python-pytest
|
||||||
|
python-protobuf
|
||||||
|
python-sqlalchemy-1.4.39
|
||||||
|
python-pyzmq
|
||||||
|
python-gnupg
|
||||||
|
python-jinja2
|
||||||
|
python-pysocks
|
||||||
|
python-mnemonic
|
||||||
|
))
|
||||||
|
(native-inputs
|
||||||
|
(list
|
||||||
|
python-setuptools
|
||||||
|
))
|
||||||
|
(synopsis "Simple Atomic Swap Network - Proof of Concept")
|
||||||
|
(description #f)
|
||||||
|
(home-page "https://github.com/tecnovert/basicswap")
|
||||||
|
(license license:bsd-3))
|
|
@ -4,7 +4,6 @@ protobuf
|
||||||
sqlalchemy==1.4.39
|
sqlalchemy==1.4.39
|
||||||
python-gnupg
|
python-gnupg
|
||||||
Jinja2
|
Jinja2
|
||||||
requests
|
|
||||||
pycryptodome
|
pycryptodome
|
||||||
PySocks
|
PySocks
|
||||||
mnemonic
|
mnemonic
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -37,7 +37,6 @@ setuptools.setup(
|
||||||
"sqlalchemy==1.4.39",
|
"sqlalchemy==1.4.39",
|
||||||
"python-gnupg",
|
"python-gnupg",
|
||||||
"Jinja2",
|
"Jinja2",
|
||||||
"requests",
|
|
||||||
"pycryptodome",
|
"pycryptodome",
|
||||||
"PySocks",
|
"PySocks",
|
||||||
"mnemonic",
|
"mnemonic",
|
||||||
|
|
Loading…
Reference in a new issue