Bitcoin Forum
May 26, 2024, 09:29:05 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Help me understand how CEX/P2P wallet works  (Read 175 times)
LordSamuel (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
May 20, 2022, 12:28:37 AM
 #1

Hello,

I have tried to read a lot of articles about Blockchain core and creating new addresses and how to install them and...
What I don't understand is how CEX or P2P or similar platforms are working!

They are providing a wallet address (On ETH or BTC or Tron or BSC networks) to each user and when users send the coin, they control the coin and they receive the coin.
It's totally centralized and those platforms control the coins.

Can someone explain to me or send me an article to understand, how can they create a wallet that is directly connected to their own wallet?

I tried to check Cryptoapis or alchemy but none of them explain much and especially couldn't find any info about Tron!

Thank you so much
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5829


not your keys, not your coins!


View Profile WWW
May 20, 2022, 01:08:00 AM
Merited by ABCbits (3), pooya87 (2), BlackHatCoiner (2)
 #2

I have tried to read a lot of articles about Blockchain core and creating new addresses and how to install them and...
Do you mean Bitcoin Core? Because the next sentence you typed had nothing to do with Bitcoin Core.

What I don't understand is how CEX or P2P or similar platforms are working!
The former refers to a centralized exchange, so a website where you register an account, send them coins and hope they give it back to you and don't close your account for whatever reason.
A DEX, or decentralized exchange, would be the polar opposite, in that there is no central authority that can steal your funds, lock you out of your account, demand KYC information or deanonymize and sell your data.

The term P2P is a general abbreviation for Peer 2 Peer, which just means you're doing something directly with another peer / person. In this context it refers to trading cryptocurrency directly with a human trading partner instead of trading with an automatic platform. This way of on- and off-ramping cryptocurrency as well as trading it, when used on a good DEX has the potential of being perfectly anonymous. Keep in mind this must not necessarily be the case, since some CEX somehow offer a 'P2P feature' where you trade with another person, but all through this platform, without any of the benefits of a DEX.

They are providing a wallet address (On ETH or BTC or Tron or BSC networks) to each user and when users send the coin, they control the coin and they receive the coin.
It's totally centralized and those platforms control the coins.
Correct; the deposit address they give you, is not actually 'your address', in the way that you don't have control over it. You can only send to it, not take anything back out. Whatever you send there will be credited to your account on this website / platform, but you rely on it working, being reachable, their system security and their honesty to be able to get those funds back out.

Can someone explain to me or send me an article to understand, how can they create a wallet that is directly connected to their own wallet?
I don't understand what you're trying to do. If you want to trade or buy cryptocurrency without giving someone your money and trusting them to be honest, you have to use bisq or another reputable decentralized exchange.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10589



View Profile
May 20, 2022, 03:08:25 AM
 #3

Can someone explain to me or send me an article to understand, how can they create a wallet that is directly connected to their own wallet?
You should be more clear about which part of wallets you don't understand.
The wallet centralized exchanges use is like any other wallet, it contains a bunch of keys and their respective addresses and works like a database. The child keys could be generated deterministically like any other wallet from a master key and then they watch their respective mempool for any changes involving these addresses (eg. receiving funds) to reflect that change in the wallet and your account.

DEX or P2P exchange is just like your desktop wallet with an additional feature that lets you connect to other peers and trade with them.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6761


bitcoincleanup.com / bitmixlist.org


View Profile WWW
May 20, 2022, 05:11:39 AM
 #4

Basically, [centralized] exchanges use a backend service to provide their services to their users, and behind thens cenes, a regular wallet is used to store the funds, both at intermediate stages of delivering money to/from the user, and also for the cold wallet that stores everyone's funds.

To communicate with the wallets, there are libraries in most programming languages to send commands to them.

Exchanges that provide other services likee spot-market trading will also hook up with the respective 3rd-party (non-crypto related) APIs to power those services.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
LordSamuel (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
May 20, 2022, 12:35:04 PM
 #5

Quote
Correct; the deposit address they give you, is not actually 'your address', in the way that you don't have control over it. You can only send to it, not take anything back out. Whatever you send there will be credited to your account on this website / platform, but you rely on it working, being reachable, their system security and their honesty to be able to get those funds back out.


This is exactly my question, how can they create a virtual address for a user and receive the fund?

Basically, they are marking public addresses based on a private key, but how does it possible?

What do they use or are there any services or API that I can use?

What I'm trying to do is, create a mobile app to provide some services to my users, but to allow users to pay their fees, I need to create a unique address (USDT TRC20, USDT ERC20, BTC, ETH, Tron, and...) for each user.
I could use some websites like coinpayments but it's a third party and I don't want my users to use third-party services.
Husires
Legendary
*
Offline Offline

Activity: 1596
Merit: 1287


View Profile WWW
May 20, 2022, 12:47:53 PM
 #6

When you talk about a Bitcoin wallet you are talking about client software that create and manage your private keys and help you to make Bitcoin transactions.
So the classifications come to an open source and closed source wallet and not centralized or decentralized because if someone else has access to your same key then it cannot be said that the client software is a wallet.

We can divide cryptocurrency exchanges into centralized and decentralized based on who controls and accesses the appropriate signatures to send the coins.

Central platforms, you receive money just as you receive money, and then you update their databases with your balance, then everything is related to database management, and when you withdraw, it is confirmed and the money is sent to you after everything is confirmed.

In the decentralized platforms there is the concept of escrow, where multi-signature keys are created and need a certain number of signatures to transfer funds from one address to another.
LordSamuel (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
May 20, 2022, 01:38:20 PM
 #7

Can someone explain to me or send me an article to understand, how can they create a wallet that is directly connected to their own wallet?
You should be more clear about which part of wallets you don't understand.
The wallet centralized exchanges use is like any other wallet, it contains a bunch of keys and their respective addresses and works like a database. The child keys could be generated deterministically like any other wallet from a master key and then they watch their respective mempool for any changes involving these addresses (eg. receiving funds) to reflect that change in the wallet and your account.

DEX or P2P exchange is just like your desktop wallet with an additional feature that lets you connect to other peers and trade with them.

How can I create a virtual address for my users (ETH, BTC, USDT TRC20, USDT ERC, TRX and ...)
I tried to use CryptoAPI.io but they have limited coins.

Is there any website or API or web service to create virtual wallet based on my own wallet?

I read that I need to create a node for each network.
NeuroticFish
Legendary
*
Offline Offline

Activity: 3682
Merit: 6406


Looking for campaign manager? Contact icopress!


View Profile
May 20, 2022, 01:52:17 PM
Merited by pooya87 (2), ABCbits (2), bitmover (2)
 #8

This is exactly my question, how can they create a virtual address for a user and receive the fund?

Basically, they are marking public addresses based on a private key, but how does it possible?

What do they use or are there any services or API that I can use?

What I'm trying to do is, create a mobile app to provide some services to my users, but to allow users to pay their fees, I need to create a unique address (USDT TRC20, USDT ERC20, BTC, ETH, Tron, and...) for each user.
I could use some websites like coinpayments but it's a third party and I don't want my users to use third-party services.

They don't create a virtual address. They do create very real and good addresses. Afaik all crypto wallets can create new addresses by request. And yes, their software works together with one or more wallet software (depending how many coins/chains they support).
Then they add an entry to a DB telling that addresss X1 on chain (for coin) C1 (possibly different row or table for each coin they support) is a deposit address for user U1. Whenever the wallet will receive funds to that address, a trigger will be called checking the number of confimrations. If a threshold is met, they put for U1 in their own database that he has +x coins in the table related to the deposited coin.

From that moment they can spend the coins from the deposit address (eg for U2 withdrawal on the same coin) and U1 account still remains credited.

Clearer?

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
bitmover
Legendary
*
Offline Offline

Activity: 2310
Merit: 5964


bitcoindata.science


View Profile WWW
May 20, 2022, 02:05:01 PM
 #9

Quote
Correct; the deposit address they give you, is not actually 'your address', in the way that you don't have control over it. You can only send to it, not take anything back out. Whatever you send there will be credited to your account on this website / platform, but you rely on it working, being reachable, their system security and their honesty to be able to get those funds back out.


This is exactly my question, how can they create a virtual address for a user and receive the fund?

Basically, they are marking public addresses based on a private key, but how does it possible?

This is not a virtual address.
They are simple generating a new address, inside their own wallet, and let you use that address to deposit.

There is nothing "virtual" about it.

You can use a software such as https://btcpayserver.org/ that will do stuff like that for you if you have a online store.
For example, this software will generate you a new address for each of your customers, inside your own wallet. You will receive funds there, and the software will tell you when the funds arrived and if the customer paid for what the asked for. Similar to what exchanges do

How can I create a virtual address for my users (ETH, BTC, USDT TRC20, USDT ERC, TRX and ...)
I tried to use CryptoAPI.io but they have limited coins.

Is there any website or API or web service to create virtual wallet based on my own wallet?

I read that I need to create a node for each network.

What exactly do you want to do?

There isn't such thing as "virtual address"

Do you want to create like a special labeled address? You can  buy a LordSamuel.eth domain/address and receive ETH on that address, which will be linked to your real address. This is most "virtual" you can get AFAIK.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
n0nce
Hero Member
*****
Offline Offline

Activity: 882
Merit: 5829


not your keys, not your coins!


View Profile WWW
May 20, 2022, 09:43:56 PM
Last edit: May 20, 2022, 09:57:29 PM by n0nce
 #10

The term P2P is a general abbreviation for Peer 2 Peer, which just means you're doing something directly with another peer / person. In this context it refers to trading cryptocurrency directly with a human trading partner instead of trading with an automatic platform. This way of on- and off-ramping cryptocurrency as well as trading it, when used on a good DEX has the potential of being perfectly anonymous. Keep in mind this must not necessarily be the case, since some CEX somehow offer a 'P2P feature' where you trade with another person, but all through this platform, without any of the benefits of a DEX.

On practice, some P2P platform act as escrow to reduce risks faced by buyer and seller. In this case, the platform would use multi-signature address. Depending on the platform, you either must install and configure wallet which support multi-signature feature or the platform simplify it for you where you only need to enter password to encrypt the private key.
Correct; Bisq, which I have most experience with, uses multisig like this. They changed the way it works a bit a while back, here's the latest wiki entry on disputes:

Sometimes Bisq trades don't go smoothly, and dispute resolution is required to determine an outcome.

Dispute resolution on Bisq has 3 formal levels: trader chat, mediation, and arbitration.

Most issues on Bisq are minor and easily resolved when traders communicate with each other. Mediation is intended to resolve the vast majority of remaining issues. Arbitration is a rare last resort measure for extreme scenarios.
~snip~



Quote
Correct; the deposit address they give you, is not actually 'your address', in the way that you don't have control over it. You can only send to it, not take anything back out. Whatever you send there will be credited to your account on this website / platform, but you rely on it working, being reachable, their system security and their honesty to be able to get those funds back out.
This is exactly my question, how can they create a virtual address for a user and receive the fund?
Normally, the same way you and I create Bitcoin addresses. It's not a virtual address, it's a normal Bitcoin address, just that they know the private keys needed to spend any Bitcoin received. They have their own custom backend software that periodically checks those addresses and when a payment arrives, it's credited in your account on an internal database on their servers.
Afterwards, they sweep those coins to some other address of theirs where they collect all the deposits.

Then you can use your 'virtual balance' to trade, stake, whatever and withdraw it. But you don't withdraw through the Bitcoin system, you withdraw through their platform, so you rely on their honesty, integrity, security and uptime. You need to give them a Bitcoin address you control (i.e. whose private keys you own) so they can send you back your balance. Then it is deducted from their internal database and that's it.

Basically, they are marking public addresses based on a private key, but how does it possible?
Yes, just the normal way Bitcoin works.
https://learnmeabitcoin.com/beginners/keys_addresses

What do they use or are there any services or API that I can use?
They use Bitcoin Core and proprietary, expensive software. Why do you want access to such software? Do you want to program your own exchange? For this I'm sorry, but it seems you lack the majority of technical knowledge right now.

What I'm trying to do is, create a mobile app to provide some services to my users, but to allow users to pay their fees, I need to create a unique address (USDT TRC20, USDT ERC20, BTC, ETH, Tron, and...) for each user.
I could use some websites like coinpayments but it's a third party and I don't want my users to use third-party services.
Oh I see. If I was in your position, I'd write something around Bitcoin Core by using its RPC interface to generate addresses on demand. I'd then save mappings between user accounts and addresses in a local database, like SQLite.

Make sure to also read about Proper Money Handling (JSON-RPC) while you're at it.



I read that I need to create a node for each network.
Yes, of course, each cryptocurrency network (not necessarily each token) has its own blockchain so you trivially need a node per network, with the whole blockchain of each network and everything it encompasses.



What exactly do you want to do?
He wants a system that generates deposit addresses for users and assigns deposits to their respective user accounts in a database. Just like on a centralized exchange.

Btw, the title is completely misleading; it appears as a question about the difference between CEX and DEX while it's not (at least to me).

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pooya87
Legendary
*
Offline Offline

Activity: 3458
Merit: 10589



View Profile
May 21, 2022, 03:02:54 AM
 #11

This is exactly my question, how can they create a virtual address for a user and receive the fund?
Basically, they are marking public addresses based on a private key, but how does it possible?
What do they use or are there any services or API that I can use?
How can I create a virtual address for my users (ETH, BTC, USDT TRC20, USDT ERC, TRX and ...)
Let me put it this way, maybe it helps you understand how things work.
If you install bitcoin core (or any other bitcoin wallet like Electrum) on your computer you can create a wallet that contains keys and their corresponding addresses. If I contact you and ask you to create an address for me in your wallet you can generate a new address in your wallet (or use one that was not used before) and write a description in front of it saying this belongs to pooya87 and then give me the address only.
Now I can send 0.1 bitcoin to that address that is in your custody (since I don't have its private key) and you tell me that my "balance" is 0.1BTC. If I wanted to spend my money I send you another message telling you that I want to withdraw 0.05BTC for example and you sign and broadcast the transaction in my place since it is your wallet and my money.

In this scenario you would be acting like the exchanges do. There is nothing virtual about the wallet or the address and there is no "API" used here.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
NotATether
Legendary
*
Offline Offline

Activity: 1610
Merit: 6761


bitcoincleanup.com / bitmixlist.org


View Profile WWW
May 21, 2022, 04:26:11 AM
 #12

This is exactly my question, how can they create a virtual address for a user and receive the fund?

Basically, they are marking public addresses based on a private key, but how does it possible?

The process for converting from the private key to the public key is elliptic curve cryptography (ECC). Using the private key as a number, it "draws" a particular curve using an algorithm and finds the point, crresponding to the private key number. This (X,Y) point is called the public key. T create the address the software simply hashes the public key using a hashing function. It's all open-source, and you don't need an API for any of that.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!