Giter Club home page Giter Club logo

anydex-core's Introduction

Tribler

Pytest Documentation Status Codacy Coverage Contributors Pull Requests Issues

python_3_8 python_3_9

Downloads(7.0.2) Downloads(7.1.3) Downloads(7.2.2) Downloads(7.3.2) Downloads(7.4.1) Downloads(7.5.1) Downloads(7.6.1) Downloads(7.7.0) Downloads(7.8.0) Downloads(7.9.0) Downloads(7.10.0) Downloads(7.11.0) Downloads(7.12.1) Downloads(7.13.0) Downloads(7.13.1)

DOI number openhub Join Discord chat

Towards making Bittorrent anonymous and impossible to shut down.

We use our own dedicated Tor-like network for anonymous torrent downloading. We implemented and enhanced the Tor protocol specifications. Tribler includes our own Tor-like onion routing network with hidden services based seeding and end-to-end encryption.

Tribler aims to give anonymous access to content. We are trying to make privacy, strong cryptography, and authentication the Internet norm.

For the past 11 years we have been building a very robust Peer-to-Peer system. Today Tribler is robust: "the only way to take Tribler down is to take The Internet down" (but a single software bug could end everything).

Obtaining the latest release

Just click here and download the latest package for your OS.

Obtaining support

If you found a bug or have a feature request, please make sure you read our contributing page and then open an issue. We will have a look at it ASAP.

Contributing

Contributions are very welcome! If you are interested in contributing code or otherwise, please have a look at our contributing page. Have a look at the issue tracker if you are looking for inspiration :).

Running Tribler from the repository

We support development on Linux, macOS and Windows. We have written documentation that guides you through installing the required packages when setting up a Tribler development environment.

Packaging Tribler

We have written guides on how to package Tribler for distribution on various systems.

Docker support

Dockerfile is provided with the source code which can be used to build the docker image.

To build the docker image:

docker build -t triblercore/triblercore:latest .

To run the built docker image:

docker run -p 20100:20100 --net="host" triblercore/triblercore:latest

Note that by default, the REST API is bound to localhost inside the container so to access the APIs, network needs to be set to host (--net="host").

To use the local state directory and downloads directory, the volumes can be mounted:

docker run -p 20100:20100 --net="host" -v ~/.Tribler:/state -v ~/downloads/TriblerDownloads:/downloads triblercore/triblercore:latest

The REST APIs are now accessible at: http://localhost:20100/docs

Docker Compose

Tribler core can also be started using Docker Compose. For that, a docker-compose.yml file is available on the project root directory.

To run via docker compose:

docker-compose up

To run in detached mode:

docker-compose up -d

To stop Tribler:

docker-compose down

Get in touch!

We like to hear your feedback and suggestions. To reach out to us, you can join our Discord server or create a post on our forums.

License

This file is part of Tribler, Copyright 2004-2023. Tribler is licensed under the GNU General Public License, version 3 (GPL-3.0), as published by the Free Software Foundation on 29 June 2007. Tribler is free software: you can redistribute it and/or modify it under the terms of this license. Tribler is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details, see the full terms and conditions in the LICENSE.txt file at the root of this repository, or visit https://www.gnu.org/licenses/gpl-3.0.html.

anydex-core's People

Contributors

devos50 avatar egbertbouman avatar solomon1732 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anydex-core's Issues

AssertionError: Received data from unregistered address

The last three builds failed in the same test: "FAIL: Test a full trade with (dummy assets), where both traders are not connected to each other". This is the stack traceback:
https://gist.github.com/Solomon1732/1cbbffdd589c797ef2c82157c4839d6e

The specific port and IP address change of course between tests.
The builds in question:
https://jenkins-ci.tribler.org/job/anydex/job/test_anydex_linux/191/console
https://jenkins-ci.tribler.org/job/anydex/job/test_anydex_linux/193/console
https://jenkins-ci.tribler.org/job/anydex/job/test_anydex_linux/192/console

Remove json_util.py since it's currently unneeded

def _scan_iterable(obj, context=None):

As it stands, this function unites a number of disparate functionalities. Not only that, but the functionalities depend on the type of the first parameter object. It might be possible for it to benefit from breaking it up via @functools.singledispatch. The single dispatch decorator operates on the first parameter's type, which looks to me to be what the function in question does.

The flip side is that I'm not sure about the performance costs of doing such a thing. Having a new branch can be a cheap way to test it, since a branch can always be ignored/deleted later on.

Even if single dispatch turns out to not be worth it, I still think that, for code maintenance, the function might benefit from breaking it up into sub-functions (which are then called from the "head" function).

Edit: If such a move will be deemed as beneficial I don't mind making a PR for it.

Possible minor code improvements

In mind I have a small number of possible (minor) improvements:

Replace % string operators with f-strings

Using the % operator is somewhat brittle AFAIK, and can arguably be less readable.
Example:
https://github.com/Tribler/anydex-core/blob/master/anydex/core/tickentry.py#L144

Replace list comprehensions in str.join with generator expressions

Building a list for a str.join statement is an operation which can be skipped. Instead it can be replaced with a generator expression.
Example:
https://github.com/Tribler/anydex-core/blob/master/anydex/core/match_queue.py#L13

# This
return ' '.join([str(i) for i in self.queue])
# Can be replaced with this
return ' '.join(str(i) for i in self.queue)

Remove object as parent class

Since the default parent class of new classes in Py3 is object by default, such a declaration became redundant. Such declarations can be deleted with no adverse effects.
Example:
https://github.com/Tribler/anydex-core/blob/master/anydex/core/settings.py

Are points 1 and 3 artifacts from transitioning from Py2 to Py3?

I know these are all minor points. I don't mind creating one or more PRs for what I suggested, and in fact I'll be glad to make them since I am aware that such issues are of a low priority.

Edit:

Replace two argument form calls to super() with the zero argument form when appropriate

https://docs.python.org/3/library/functions.html#super
https://stackoverflow.com/a/576183
Code such as

class Cls:
    def __init__(*args, **kwargs):
        super(Cls, self).__init__():

can be replaced with

class Cls:
    def __init__(*args, **kwargs):
        super().__init__():

The two are equivalent.
Example:
https://github.com/Tribler/anydex-core/blob/master/anydex/core/message.py#L13

Cannot trade dummy coins

I am trying to trade dummy coins between two computers. Every time I try, I get one of these two errors. I tried trading between a windows and an ubuntu machine and between a windows and arch machine.

INFO:MarketTestnetCommunity:Inserting tick <Ask P: 1.000000, Q: 10 DUM1, O: 8a0e5a3cb1cfa273111bfae72950c651ddfc4abe.2> from 8a0e5a3cb1cfa273111bfae7295
0c651ddfc4abe.2, asset pair: 10 DUM1 10 DUM2
INFO:MarketTestnetCommunity:Sending match message for order id 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14.1 and tick order id 8a0e5a3cb1cfa273111bfae72950
c651ddfc4abe.2 to trader 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14
INFO:MarketTestnetCommunity:Sending match message for order id 8a0e5a3cb1cfa273111bfae72950c651ddfc4abe.2 and tick order id 6b218e7fd93c78d3bf7bb43c4f79
25e8fa2f2e14.1 to trader 8a0e5a3cb1cfa273111bfae72950c651ddfc4abe
INFO:TrustChainCommunity:Received crawl request from node b'f9379cf2' for range -1--1
INFO:TrustChainCommunity:Sent 1 blocks
ERROR:MarketTestnetCommunity:Task resulted in error: '>=' not supported between instances of 'Price' and 'Price'
INFO:TrustChainCommunity:Signed block to b'30303030' (Block b'7902134c' from ...b'f0fd55f8':1 links ...b'30303030':0 for {'tick': {'trader_id': 'ac1f1500a78cd34818befe97e658a11495928ef9', 'order_number': 1, 'assets': {'first': {'amount': 10, 'type': 'DUM1'}, 'second': {'amount': 10, 'type': 'DUM2'}}, 'timeout': 3600, 'timestamp': 1589812211204, 'traded': 0}, 'version': 4} type b'bid') validation result (<function ValidationResult.partial_next at 0x7f02591d30e0>, [])
INFO:MarketTestnetCommunity:Bid created with asset pair 10 DUM1 10 DUM2
INFO:MarketTestnetCommunity:Sending match message for order id ac1f1500a78cd34818befe97e658a11495928ef9.1 and tick order id 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14.1 to trader ac1f1500a78cd34818befe97e658a11495928ef9
INFO:MarketTestnetCommunity:We received a match message from 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14 for order ac1f1500a78cd34818befe97e658a11495928ef9.1 (matched against 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14.1)
INFO:MatchCache:Scheduling batch match of order ac1f1500a78cd34818befe97e658a11495928ef9.1
INFO:MatchCache:Processing incoming matches for order ac1f1500a78cd34818befe97e658a11495928ef9.1
INFO:MarketTestnetCommunity:We received a match message from ac1f1500a78cd34818befe97e658a11495928ef9 for order ac1f1500a78cd34818befe97e658a11495928ef9.1 (matched against 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14.1)
INFO:SingleTradeClearingPolicy:Starting crawl of chain of trader 6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14
INFO:TrustChainCommunity:Requesting crawl of node b'b5bfecff' (blocks -1 to -1) with id 57829
INFO:TrustChainCommunity:Block validation result <function ValidationResult.partial_next at 0x7f02591d30e0>, [], (Block b'579e5da4' from ...b'b5bfecff':1 links ...b'30303030':0 for {'tick': {'trader_id': '6b218e7fd93c78d3bf7bb43c4f7925e8fa2f2e14', 'order_number': 1, 'assets': {'first': {'amount': 10, 'type': 'DUM1'}, 'second': {'amount': 10, 'type': 'DUM2'}}, 'timeout': 3600, 'timestamp': 1589812077520, 'traded': 0}, 'version': 4} type b'ask')
INFO:TrustChainCommunity:Received crawl request from node b'b5bfecff' for range -1--1
INFO:TrustChainCommunity:Sent 1 blocks
ERROR:MarketTestnetCommunity:Task resulted in error: 'b"b\'DUM1\'"'

Integrate Litecoin and Dash in the market

Now that we are using bitcoinlib, we should extend our BitcoinWallet to also support the Litecoin and Dash cryptocurrencies. Fortunately, this is trivial to do since bitcoinlib supports creation of these wallets already. Theoretically, it should be as easy as subclassing the BitcoinWallet class (although I would prefer to rename BitcoinWallet to something like BitcoinlibWallet and create subclasses from this superclass).

Besides mainnet wallets, we should also have some testnet wallets for these networks (bitcoinlib also supports this).

bitcoin wallet

Tribler version/branch+revision:

7.3.2

Operating system and version:

ubuntu 18.04

Steps to reproduce the behavior:

try create a bitcoin wallet

Expected behavior:

makes a wallet

Actual behavior:
bitcoinlib could not be located on your system. Please install it using the following command: pip install bitcoinlib --user

tried the command suggested command and also

sudo apt-get install -y python3-bitcoinlib

API tests failing

This API tests are failing with the following stack trace:

======================================================================
ERROR: Test whether an error is returned when we try to cancel an order that has expired
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/jenkins/.local/lib/python3.7/site-packages/asynctest/case.py", line 297, in run
    self._run_test_method(testMethod)
  File "/home/jenkins/.local/lib/python3.7/site-packages/asynctest/case.py", line 354, in _run_test_method
    self.loop.run_until_complete(result)
  File "/home/jenkins/.local/lib/python3.7/site-packages/asynctest/case.py", line 224, in wrapper
    return method(*args, **kwargs)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/home/jenkins/ci/workspace/AnyDex/test_anydex_linux/anydex/anydex/test/util.py", line 114, in wrapper
    await wait_for(coro(*args, **kwargs), timeout)
  File "/usr/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
    return fut.result()
  File "/home/jenkins/ci/workspace/AnyDex/test_anydex_linux/anydex/anydex/test/restapi/test_market_endpoints.py", line 214, in test_cancel_order
    json_response = await self.do_request('orders/1/cancel', request_type='POST', expected_code=200)
  File "/home/jenkins/ci/workspace/AnyDex/test_anydex_linux/anydex/anydex/test/restapi/base.py", line 88, in do_request
    async with session.request(request_type, url, data=post_data, headers=headers) as response:
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/client.py", line 483, in _request
    timeout=real_timeout
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 859, in _create_connection
    req, traces, timeout)
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 986, in _create_direct_connection
    req=req, client_error=client_error)
  File "/home/jenkins/.local/lib/python3.7/site-packages/aiohttp/connector.py", line 943, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host localhost:49763 ssl:default [Connect call failed ('127.0.0.1', 49763)]

This is most likely the result of the refactoring efforts of the IPv8 REST API.

Backport improvements from the experiments

For the experiments, I made a few improvements, including:

  • A full implementation of incremental settlement
  • Using orjson serialization for TrustChain blocks
  • Only fetching the last TrustChain block

These changes should be included in the master branch.

Add a web-based GUI

Currently, the only GUI around the market components is integrated into Tribler and written with PyQt. We might want to move to a web-based (JS?) GUI with more customization options and features that Qt can offer.

DAS5 validation test

We should have a validation test (using a real database) that checks whether we can successfully trade dummy coins.

Replace bare excepts with specified excepts

Remove old_round functionality

Add typing hints

Since the code of AnyDex is particularly error-prone (a single mistake can result in lost money), it would be helpful to add typing hints throughout the code base. #58 did add typing to some files, but there are many files left that require typing to be implemented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.