Coder Social home page Coder Social logo

layters / testshop Goto Github PK

View Code? Open in Web Editor NEW
41.0 6.0 9.0 82.93 MB

Decentralized P2P marketplace for Monero users (proof of concept)

Home Page: https://matrix.to/#/#neroshop:matrix.org

License: GNU General Public License v3.0

CMake 3.44% C++ 67.31% QML 29.19% GLSL 0.05% Shell 0.01%
cpp ecommerce marketplace monero neroshop p2p xmr testshop qml decentralized

testshop's People

Contributors

layters avatar yuriio147 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

testshop's Issues

Port neroshop to Rust from C++

Details

This will help to make the code secure and memory safe. I generally suck at memory management so this may be needed but it's not a high priority goal at the moment.

Edit: Due to insufficient needed dependencies in Rust and a lack of time and resources, this issue will be totally scrapped and closed as not planned.

Implement catalog correctly with pagination and without lags we need to use QAbstractListModel and ListView/GridView instead of all these repeaters

Details
  • Replace Column and Grid with ListView and GridView
  • Use QAbstractListModel
  • Correct pagination in CatalogPage.qml
    • I'm stuck on this issue where I don't know how to apply proper pagination to the catalog listings except creating an endless scrolling of items.
Files

qml/pages/CatalogPage.qml
qml/components/CatalogGrid.qml
qml/components/CatalogList.qml
qml/components/PaginationBar.qml <- use this please

References

https://doc.qt.io/qt-6/qtwidgets-itemviews-fetchmore-example.html

Bounty reward

$0

This issue was suggested by @yuriio147

Fetch Monero price from web sources using QWebSocket

Currently, libcurl is solely used for this purpose but adding QWebSocket to the neroshop GUI will make libcurl an optional dependency. Libcurl will not be removed entirely since the neroshop CLI may need it for retrieving the Monero price.

Bounty reward: $50

error ZLIB_VERNUM != PNG_ZLIB_VERNUM

To fix this error one must delete "pnglibconf.h" from external/png, set the current directory to said path within the terminal and then re-generate pnglibconf.h by running the following commands:

./configure
make

Add language translations

Details

Language status:

  • English
  • Español (Spanish)
  • 中文 (Chinese)
  • 日本語 (Japanese)
  • हिन्दी (Hindi)
  • اَلْعَرَبِيَّةُ‎ (Arabic)
  • Portuguese
  • বাংলা (Bengali)
  • Français (French)
  • русский язык (Russian)
  • Deutsch (German)
  • italiano (Italian)
  • Kiswahili (Swahili)

Languages that are checked are currently supported More languages to come ...

Write product attributes as a JSON string using Qt

Details

I need to write and store JSON strings in the products table's "attribute" column inside of the database. Products with variations can have their attributes stored in a JSON array. Here is an example below:

{
	"attributes": {
	    "weight": 12.5,
		"color": ["red", "yellow", "blue"],
		"size": ["XS", "S", "M", "L", "XL"]
	}
}

Any feedback or suggestions on the format I've used would be appreciated!

Bounty reward

$20

Add support for Wownero

Details

Even though Monero is digital cash, I believe Wownero is the digital gold equivalent as it has a fixed supply of 184 million coins and maintains the same mandatory privacy and fungibility as Monero does.

WOW won't actually be used for payments but rather for tipping meme listings.

That said, feel free to donate to my wownero address 😁:
WW2pQTQWHpyJf2CHrCmZG7Tn3zBnYRZTH8g4U3pSZf5s6xsTXrZc9odDWmrWzjRc9MMQWrKXxjHsRdzH5JpJ7kzx1jZuSVSfi

References

https://wownero.org/

Style enhancment suggestions

I noticed that although the file: Style.qml has the colors defined, not all components use these variables. Also, there exist a standard way in QML for defining themes in this document

Additionally, I suggest adding typography for having a unified size of texts.

Consensus protocol implementation

Details

This is to ensure that local database files maintain their integrity. Raft can be used with cross-platform networking libraries such as libuv and libzmq for ordering and detecting duplications. This means you could use UDP for transmission.

Edit: According to ChatGPT, a p2p marketplace cannot function without any sort of consensus mechanism and the raft consensus protocol cannot scale to the millions, which is why I am proposing that we should choose a more scalable solution.

These are protocols that I am considering:

  • Sharding-based protocols - likely the most suitable for a decentralized P2P marketplace app that is intended to be scalable to billions of users, as they can significantly increase the network's throughput and transaction processing speed.

  • Hashgraph - does not require a blockchain and can handle hundreds of thousands of transactions per second and is suitable for applications that require high throughput and low latency.

  • PBFT - ensures all nodes in the network agree on the same order of transactions, making it well-suited for enterprise applications and private blockchain networks.

  • PoS - More decentralized and secure than DPoS and can scale in the thousands, but unfortunately, it does require a blockchain or a similar distributed ledger technology to function and may face challenges related to centralization if a small group of validators hold a large percentage of the cryptocurrency supply.

References

https://raft.github.io/
https://raft.github.io/raft.pdf
https://thesecretlivesofdata.com/raft/ (ELI5)
https://github.com/canonical/dqlite
https://github.com/rqlite/rqlite/
https://developer.mozilla.org/en-US/docs/Learn/Server-side/First_steps/Client-Server_overview

Server-Client Communication System and Design

Once we get peer discovery rolling then we'll need to move on to server-client communications.

The neroshop daemon will automatically be ran (as a separate child process) on the client being launched by the user (This is for the sake of convenience. And convenience gives the app a sense of user-friendliness)

I need the daemon to act as a server. Let's call it a daemon-server. The name of the executable will be called neromon (nero + daemon). This is because "neroshopd" and "neroshop" can be confusing at times.

So, the purpose of the daemon-server, neromon is to wait for and accept requests from the client and translate those requests into SQLite statements that write to the database (e.g CREATE, ALTER, INSERT, UPDATE, DELETE, etc.) that will be placed in a queue and then executed once all peers reach a consensus. The daemon-server will return the result of the statement's execution. After the execution succeeds, all peers will have the same data within their local database files. The raft consensus protocol will have a huge part to play in this.

The server will have two threads: a consensus thread which will handle the database replication, and a peer thread which will handle traffic from peers.

The client will send a request message that uses a custom-made format, akin to the HTTP request format, which includes:

A Request-line

Zero or more header (General|Request|Entity) fields followed by CRLF

An empty line (i.e., a line with nothing preceding the CRLF) 
indicating the end of the header fields

Optionally a message-body

But we can decide to use the JSON-RPC format instead.

NOTE: I have zero idea of what I'm talking about. I don't know a thing about network programming or server/clients, so If I made any mistakes let me know.

Comments

anarkiocrypto:

"Database ideas:

Buyers/sellers:
monero_address display_name user_signature

user_signature is required to avoid impersonation. If you set your address to 4abcdef... you need to sign this input with your 4abcdef... address.

Signing requires the mnemonic (i.e. it is done locally on the client and the mnemonic is not saved in the database). Verification requires the Monero address only (which is stored in the shared database). No view key required: https://monero.stackexchange.com/questions/6093/how-to-sign-a-message-with-my-public-monero-address-and-verify-it-using-the-cli

Any users/listings/orders with invalid signatures could be ignored by the software.

Listings:
listing_guid seller_address product_name product_description product_price product_photo listing_signature

Orders:
order_guid seller_address buyer_address listing_guid order_data order_status order_signature

order_data just contains the product name, price, payment address, etc.

For privacy, orders should be encrypted to the buyer's + seller's keys (any other nodes would just see encrypted data). Either seller_address + buyer_address are unencrypted (=metadata) or clients just try to decrypt all orders, to find out which belongs to them."

Scalability

We need the application to be as scalable as possible so that users will not have to use up too much memory/storage space storing data in their nodes. I will now explain the methods we can use to reduce database size.

  • We could purge orders after a certain frame of time has passed, say 2 years
  • Another method is pruning but I don't know too much about how pruning works
Bounty reward

$0

One-way Atomic Swap integration

Details

This will allow users of more easily accessible cryptocurrencies (e.g BTC, ETH, LTC, etc.) to convert their cryptocurrency of choice to XMR. There will come a time when Monero is delisted from all centralized exchanges, making it difficult for the average person to acquire some XMR which is the reason why I am proposing this feature.

With this addition, multiple cryptocurrencies will be supported by neroshop indirectly while XMR remains the primary cryptocurrency used for sales and purchases.

References

https://github.com/noot/atomic-swap
https://github.com/comit-network/xmr-btc-swap
https://github.com/UnstoppableSwap/unstoppableswap-gui

Todo: Remove unused dependencies and source files

Libraries
  • libbcrypt - removed and replaced with Monero's built-in hashing function
  • libpng + zlib - removed since Qt handles the image processing
Files
  • qr.cpp and qr.hpp have been removed and replaced by wallet_qr_provider.
  • item.cpp and item.hpp have been removed and replaced by product.cpp and product.hpp
  • catalog.cpp and catalog.hpp removed and replaced with listing.cpp and listing.hpp
  • buyer.cpp and buyer.hpp removed since it is not used at all since all users are sellers.

I2P integration

Details

By default all peers will be anonymized (hopefully 🙏🏿 ). I2P will be supported. Currently, I am using the low-level C API (POSIX) sockets provided by the operating system and I need urgent help with integration.

Tor is primarily focused on TCP-based traffic and does not provide native support for routing UDP traffic so i2p is the only way forward since the neroshop DHT is based on the UDP protocol.

i2pd and i2psam are already bundled with the code as submodules and can be built into static libraries. However, neither is currently being utilized due to a lack of documentation and understanding of the i2p network ☹️ .

i2pd vs i2psam
  1. libi2pd allows us to embed a router in an application (in this case, the neroshop daemon) so an external one is not required and it provides the SAMv3 API server.

  2. i2psam gives us socket-like abstractions of I2P connections, using the API server provided by an external router

Either library can be used, though i2pd is preferred.

Additional Information

The neroshop DHT node uses two separate UDP sockets for communication - one for listening to and responding to requests via the Node::run() function and the other is a temporary socket that is used for sending queries to other nodes in the network via the Node::send_query() function. I want to know how I can route both the inbound and outbound traffic of the Node using i2p.

You will most likely be using i2p's SAMv3 API

You may rewrite node.cpp if you have to!

The neroshop daemon should start the i2pd router the moment it is opened and the node should create a session (b32.i2p address) which can be hashed with sha3_256 and used as the node_id.
From there, the session can create multiple streams to communicate with other peers in the network.

Related links

neroshop networking stack:
https://github.com/larteyoh/testshop/blob/main/src/core/protocol/p2p/node.cpp
https://github.com/larteyoh/testshop/blob/main/src/daemon/main.cpp

libi2pd (SAMv3 API + router):
https://github.com/PurpleI2P/i2pd/blob/openssl/libi2pd_client/SAM.cpp
https://github.com/PurpleI2P/i2pd/blob/openssl/libi2pd_client/SAM.hpp

https://github.com/PurpleI2P/i2pd/tree/openssl/libi2pd

i2psam:
https://github.com/i2p/i2psam/blob/master/i2psam.cpp
https://github.com/i2p/i2psam/blob/master/i2psam.h

Examples

https://github.com/i2p/i2psam?tab=readme-ov-file#example

Related issues

#124
#228

Bounty reward 

$2500 USD (via crypto or cashapp)

Add Polyseed support

Details

Polyseed is a new format for seed phrases. Here are the features:

- 16 mnemonic words (36% shorter than the original 25-word seed)
- embedded wallet birthday to optimize restoring from the seed
- supports encryption by a passphrase
- can store up to 3 custom bits
- advanced checksum based on a polynomial code
- seeds are incompatible between different coins

A 16-word seed would be easier to memorize and store than a 25-word seed and it does help with making the app a bit more "user-friendly". Not only that, it will save the restore height so you won't have to enter it every time you open your wallet.

Edit: This issue may not be necessary after the Seraphis upgrade.

References

https://github.com/tevador/polyseed

Bounty reward

??

Multisignature escrow implementation

Details

Neroshop will provide three payment options:

  • 2-of-3 Multisignature wallet (escrow)
  • 2-of-2 Multisignature wallet (multisig)
  • direct or no escrow (finalize)

2-of-3 multisig will be more centralized than 2-of-2 as it will require an intermediary or arbitrator which is likely to be a member of the neroshop team and a 0.5% fee will be charged for using this option.

With 2-of-2 multisig, both the buyer and seller must agree on the transaction in order for funds to be released to the seller. If either party disagrees and chooses not to sign a transaction then neither the buyer nor seller will receive the funds and the funds will be lost forever.

The finalize option allows buyers to send funds directly to the seller's wallet address without the need to use an escrow, but this option should only be used if the seller has a really good reputation and can be trusted.

References

https://monerodocs.org/multisignature/
https://monero.stackexchange.com/questions/5646/how-to-use-monero-multisignature-wallets-2-2-2-3 (Very detailed explanation here)
https://moneroecosystem.org/monero-cpp/annotated.html (API Documentation)

Files

https://github.com/larteyoh/testshop/blob/main/test/escrow.cpp
https://github.com/larteyoh/testshop/blob/main/test/escrow.hpp

Bounty reward

$1500 USD

This task must only be worked on after i2pd integration is completed

Revise neroshop logo

Maybe I will host a contest with 1 XMR as the prize reward for whoever's logo/artwork gets picked to be used as the official neroshop logo.

Add basic or advanced search engine

Details

The search engine should be able to search for sellers by their display name or id, including products either by their name or UPC code and even search for products that fall within a specific category. All of this information can be retrieved from the sqlite3 database.

When a user searches the name or id of a seller, it will display the seller's profile along with their product listings

SQLite, with its full-text search features and whatnot should be sufficient for this task. There's no need to use another external library for this task.

References

This should give you a full look on how the database is structured and designed.

Bounty reward

$0

Artist/Graphics Designer for neroshop

Details

Your job will be to create and design promotional art relating to neroshop and create advertisement images for the homepage banner.

Payment details

$20 for each artwork that I request from you. You may discuss with me and make suggestions, but you will not be allowed to work on a piece that I have not requested.
Please, consult with me first before attempting to take on this task.

Multithreading/Concurrent and Asynchronous solutions to prevent certain functions from blocking main thread

Details

I need to run certain codes in separate threads without blocking or waiting for the main thread (which causes the GUI to freeze and become unresponsive). And for this task, I need someone who is highly experienced in multi-threading/concurrent and asynchronous programming.
The goal is to make the application as responsive as possible without blocking the GUI.

The things that need to be ran in a separate thread include: the currency conversion, database read and write operations (via INSERT, UPDATE, etc.), and others ...

Here is a complete list of things that need async so that the GUI is not blocked (Not sure if detaching threads is the right way to do it though it works):

  • currency conversion
  • wallet transfer function
  • wallet_controller getTransfers function
  • any or all functions that perform reads from and writes to the SQLite database, especially the loginWith* and getListings* functions
    - [ ] getMoneroNodeList function

Note: If this task is possible to do in plain C++17 then use that instead of Qt. I don't want to depend too much on Qt for everything - I only need Qt for the GUI not the backend/CLI

Search Suggestions List UI

Details

Create a popup list that is displayed underneath the search bar when text is entered in the search bar's TextField.

The items inside the popup list should be selectable.

Example:
Search-Text-Field-With-Icon-to-Search-Result-in-Card-UI

Bounty reward

$0

Memory Managament Person For Hire

Details

I am offering $10 for every memory leakage and other memory errors found and fixed within the neroshop code since I am terrible with memory management and I have no intention of switching to memory-safe programming languages such as rust.

Bounty reward

$10 per memory bug detected and repaired

Custom TableView component (QML)

Details

I need a custom TableView-like component that is reusable. It does not have to be created using a TableView and it can also be created using other Components, like Rectangle for example although using an ordinary TableView component would be ideal. The purpose of the tableview is to display a organized list of products in a seller's inventory, display a list of Monero subaddresses and various other usecases.

I want the TableView to be similar to the example images below.

approve-product-admin1

eadb9c12fa489c6afb379ccf2b27bc8e_1

References

https://doc.qt.io/qt-5/qml-qtquick-tableview.html

Bounty reward

$0

Segfault when loading BLOB from database with ImageLoader or when loading image files with large resolutions

Details

The source of the error can be found in https://github.com/larteyoh/testshop/blob/main/src/gui/image_loader.cpp @ line 1668:
unsigned char * data = const_cast<unsigned char *>(static_cast<const unsigned char *>(sqlite3_column_blob(statement, 0)));

There is an example usage of the ImageLoader::getProductImage function @ line 1618 which has been commented out due to it causing a Segfault crash.

Edit: I thought this issue was just with BLOBs but it affects images with larger resolutions (ex. 4096 pixels wide)

QML-based GUI development

Details

Update: I will be working on the GUI on my own from now on with technical support from yuriio whenever he's free and willing to lend a hand.

Todo
  • Product page
  • Cart page (redesign)
  • Order checkout page
  • Seller Hub/Dashboard page
  • Account page
  • Orders page
  • User Profile page
  • Messages page

The only thing I struggle with is making certain components visible, anchoring/positioning, making the ScrollView work properly (often a PITA), and knowing which QML Component Types are suitable for my needs. That's where I'd like some help in.

After the front-end and GUI is completed, I will release the project for beta testing on the front-end only. Then later on I will create a second release containing both the front-end and the back-end.

GUI Structure/Hierarchy:

CartPage.qml
|_ items/product images
|_ name
|_ quantity
|_ unit price
|_ total/subtotal
|_ delete button (trash icon button)

** 10 is the max unique items carts can hold **


MessagesPage.qml
|_ inbox
    |_ read
    |_ unread 


SellersHubPage.qml
|_ dashboard containing sales-related statistics
|_ list item
|_ delist item  
|_ manage stock
|_ sales stats


CatalogPage.qml
|_ filter box:
    |_ condition (new, used, etc.), 
    |_ price
    |_ material
    |_ color
    |_ size
    |_ popularity
    |_ count (number of items that match the filter tags)
|_ sort by
    |_ latest (or most recent)
    |_ oldest
    |_ alphabetical order
    |_ low to high price
    |_ high to low price
|_ view toggle
    |_ grid view (default)
    |_ list view
|_ page results count (total number of results)

ProductPage.qml
|_ product image
|_ product name
|_ seller price (sales price)
|_ seller name or id (contains link to seller's profile)
|_ product description and specs
|_ buttons (buy, chat, rate)
|_ quantity spinbox
|_ add to cart button
|_ product reviews/ratings


SettingsDialog.qml
|_ general settings tab
    |_ theme
        |_ appearance ("PurpleDust", "DefaultDark", "DefaultLight")
    |_ currency 
        |_ preffered local currency (e.g USD)
        |_ show/hide fiat price
        |_ show/hide monero price
    |_ language
    |_ product filter
        |_ show/hide illegal products (illegal products will be hidden by default)
    |_save button (this save button will rewrite the configuration file with the changed settings)


WalletPage.qml
|_ balance (locked and unlocked)
|_ send (transfer)
|_ receive (show addresses and selected address qr and user can set a used/unused/all filter to display specific addresses - this should be a tableview I think)
|_ history (tx history)
|_ wallet settings
    |_ change wallet password
    |_ show seed phrase (requires password in order to be displayed)
|_ block explorer
    |_ xmrchain.net

    
OrderPage.qml
|_ my orders
|_ customer orders (only displayed if you are a seller)
    
AccountSettingsPage.qml
|_ convert to/revert from seller (this may not be needed as all users are both buyers and sellers by default)
|_ upload/remove avatar, (name cannot be changed in order to reduce scams from sellers)
|_ my favorites
|_ my reviews
|_ delete account
|_ logout

OrderCheckoutPage
|_ choose payment method (xmr)
|_ choose payment transfer method (direct pay or escrow)
|_ choose delivery method (delivery or pick-up)
|_ shipping method - only displayed if "delivery" is selected (USPS, FedEx, UPS, etc.)
|_ delivery address (will be encrypted)
|_ order summary
    

main.qml:
Header
|_ search bar and button
|_ navigational bar

Footer
|_ show XMR/USD rate
|_ show available updates
|_ monero wallet daemon sync status (progressbar - orange)
|_ neroshop daemon sync status (progressbar - purple)
|_ configuration settings - load from settings.lua
|_ tor settings?
|_ theme switcher

HomePage.qml
|_ homepage_banner -
        show featured products
        recent news from reddit, revuo monero newsletter
        BUY monero Now promotional messages with links to official website
        feature monerochan and other artworks
|_ other sections -
        recently listed products
        deals and discounted products
        recommendations

Example GUI Templates:

Screenshot from 2022-11-01 03-40-39

a1f612a7439d7d3cbd10f88d44c757a8

shopping-cart

shopping-cart-ui-design-3

Bitcoin-Qt-GUI-Wallet-Receiving-Addresses

dba7ec381d84e2bf71bf28779a7186be

agFNa

Seller Profile:
Seller-favorite

Create official website

Details:
I will need help creating static webpages, hosting the website, and designing the website.
Keep it minimal and not too bloated, and it should be adapted for both mobile and desktop.
This website would be good for marketing/advertising the neroshop project and also for hosting the neroshop codebase and executable files.

This issue also includes creating an onion address for the official neroshop website after the clearnet website has been created.

Bounty reward: $250-$500 (negotiations are allowed)

Improve code quality and remove unnecessary comments

My code is messy and I leave "wierd" comments all over the place. Would be a good idea to clean up some of the unnecessary comments, organize the code, and improve the quality of the code.

Bounty reward: $10

Custom ComboBox component (QML)

Details

I need you to create a combo box similar to the example below, but replace the cyan color with the neroshop theme color (#6b5b95)

ListBulkImport_03_1

Bounty reward

$20

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.