HarukaMa / aleo-pool-server

GNU Affero General Public License v3.0
77 stars 79 forks source link

Building a mining pool and mining #19

Open johncc19870120 opened 2 months ago

johncc19870120 commented 2 months ago

Building a mining pool and mining My company currently has 300 mining machines and is preparing to start aleo mining. My boss asked me to learn, and I want to use your open source server and client for deployment, and I want to understand the relevant workflow. I have now downloaded the aleo-prover and aleo-pool-server projects, and compiled them on the server using the cargo command. What else needs to be done to start, and how to set the parameters in the startup command? I look forward to your reply, which will be of great help to my work. Thank you.

HuangCaiJin commented 1 month ago

aleo-pool-server cargo run --release -- --address aleo1xxxxx --port 33001 --api-port 33002 --node 127.0.0.1:3030 aleo-prover cargo run --release -- --private-key APrivateKeyxxxxxx --pool '127.0.0.1:33001'

I use these two commands to run the project normally

HuangCaiJin commented 1 month ago

127.0.0.1:3030 represents the full node url

chne2001 commented 1 month ago

aleo-pool-server aleo-provercargo run --release -- --address aleo1xxxxx --port 33001 --api-port 33002 --node 127.0.0.1:3030 cargo run --release -- --private-key APrivateKeyxxxxxx --pool '127.0.0.1:33001'

I use these two commands to run the project normally

Is your code running and mining normally?

HarukaMa commented 1 month ago

Hmm, I think with pooled prover, you shouldn't have to use private keys anymore? You shouldn't really use aleo-prover at all though.

chne2001 commented 1 month ago

@HarukaMa "I can contact you separately? I would like to get guidance on setting up an Aleo mining pool, and I can offer some compensation."

HarukaMa commented 1 month ago

I'm not planning to accept paid consultation right now. Please note that you must provide your own high-performance GPU provers in order to use this pool implementation.

chne2001 commented 1 month ago

I'm not planning to accept paid consultation right now. Please note that you must provide your own high-performance GPU provers in order to use this pool implementation.

"Yes, we have over 100 RTX 4090s and urgently need support for this project. My boss is about to fire me. Could you please provide me with a simple run guide? Thank you very much."

HarukaMa commented 1 month ago

I can't provide prover for GPUs. You must source that yourself.

HuangCaiJin commented 1 month ago

Hmm, I think with pooled prover, you shouldn't have to use private keys anymore? You shouldn't really use aleo-prover at all though.

I have just come into contact with the Aleo network in recent days and there are many things I don't understand. I usually use golang for development, so I don't know much about rust. I wonder if there are any problems. The following steps Aleo mining pool construction steps:

  1. Build and run the Aleo full node, waiting for the node to complete synchronization with the Aleo network
    1. A Stratum protocol service needs to be implemented (communication according to the rules is a bit like jsonrpc), which is responsible for distributing mining tasks and verifying the results submitted by miners a. The miner sends a mining.subscribe request to inform the mining pool that it wants to connect and start mining b. The miner sends a mining.authorize request with a username and password, and the mining pool authorizes the miner to mine according to its identity c. The mining pool sends mining.notify to provide the miner with a new mining task, including block header information and the range of work shares d. The miner uses mining.submit to submit a solution to the mining pool e. Set the address for receiving the non-payment fee f. Stratum service implementation function
      1. Generate mining tasks and send them to miners
      2. Verify whether the proof of work submitted by the miner meets the requirements
      3. Submit new blocks and package them to the Aleo blockchain
  1. Stratum mining pool service obtains transaction information that needs to be packaged from the full node transaction pool a. Full nodes are connected to other nodes on the blockchain network and continuously synchronize the latest blocks and transactions in the blockchain b. Full nodes are responsible for maintaining a transaction pool, which contains pending transactions that have not yet been packaged into blocks. Full nodes will periodically receive new transactions and store them in the transaction pool, waiting to be packaged by miners c. Stratum mining pool service obtains transactions from the memory pool through jsonrpc GET /mainnet/memoryPool/transactions

  2. Implement aleo mining client a. Miners connect to the Stratum mining pool service b. Perform identity authentication c. Generate zero-knowledge proof d. Submit zero-knowledge proof

HuangCaiJin commented 1 month ago

I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

chne2001 commented 1 month ago

/> I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

"How do I run a full node? Is it with the command cargo run --release -- start --nodisplay --dev 0 --validator, orcargo run --release start --client --nodisplay? I currently have a fully synchronized node using these two commands. However, running cargo run --release -- --address aleo1****** --port 33001 --api-port 33002 --node 127.0.0.1:3030

returns

thread 'tokio-runtime-worker' panicked at src/prover_peer.rs:80:68: called 'Result::unwrap()' on an 'Err' value: Invalid block metadata: {"network":0,"round":0,"height":0,"cumulative_weight":0,"cumulative_proof_target":0,"coinbase_target":536870911,"proof_target":134217728,"last_coinbase_target":536870911,"last_coinbase_timestamp":1696118400,"timestamp":1696118400} note: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace.

HuangCaiJin commented 1 month ago

/> I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

"How do I run a full node? Is it with the command cargo run --release -- start --nodisplay --dev 0 --validator, orcargo run --release start --client --nodisplay? I currently have a fully synchronized node using these two commands. However, running cargo run --release -- --address aleo1****** --port 33001 --api-port 33002 --node 127.0.0.1:3030

returns

thread 'tokio-runtime-worker' panicked at src/prover_peer.rs:80:68: called 'Result::unwrap()' on an 'Err' value: Invalid block metadata: {"network":0,"round":0,"height":0,"cumulative_weight":0,"cumulative_proof_target":0,"coinbase_target":536870911,"proof_target":134217728,"last_coinbase_target":536870911,"last_coinbase_timestamp":1696118400,"timestamp":1696118400} note: run with 'RUST_BACKTRACE=1' environment variable to display a backtrace.

Can the full node access the data in the path /mainnet/memoryPool/transactions? This data should be the pending transactions in the transaction pool, right?

HuangCaiJin commented 1 month ago
  1. Generate zero-knowledge proof
  2. Verify zero-knowledge proof These should be the two most important steps. The rest can be achieved as long as the communication rules are followed. I have the idea of ​​redeveloping this function with golang, but I don’t know if it can be realized.
chne2001 commented 1 month ago
  • Generate zero-knowledge proof
  • Verify zero-knowledge proof

Can I add your contact information? I hope to have a more in-depth discussion with you. TG or Discord ?

HuangCaiJin commented 1 month ago

tg

HuangCaiJin commented 1 month ago

ok

HarukaMa commented 1 month ago

I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

The reason why you shouldn't use aleo-prover directly is that is has no GPU support.

OuIChien commented 1 month ago

I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

Hi, I have a full node of Aleo, we can verify it together, what do you say?

OuIChien commented 1 month ago

I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

The reason why you shouldn't use aleo-prover directly is that is has no GPU support.

Hi HarukaMa, your project has great potential. I'm trying to build the mining pool and the supported GPUs prover miner client. I found your aleo-prover v0.3.0 has GPU support, right?

HarukaMa commented 1 month ago

Okay, I'm deleting all existing releases.

HarukaMa commented 1 month ago

I have a question I want to confirm. If the aleo-pool-server and aleo-prover projects are running normally and packaged, can the miner install the aleo-prover client normally for mining? Because I don’t have a full node now and cannot verify it, do I need to do anything else?

The reason why you shouldn't use aleo-prover directly is that is has no GPU support.

Hi HarukaMa, your project has great potential. I'm trying to build the mining pool and the supported GPUs prover miner client. I found your aleo-prover v0.3.0 has GPU support, right?

You obviously don't know what you are reading. That repo is useless for you.

OuIChien commented 1 month ago

Sorry about that, I put my best effort into building up a mining pool, and I may be I not smart enough; but I finally found the CUDA on snarkVM, keep going forward, and thank your project is very inspiring for me!

OuIChien commented 1 month ago

I modified the snarkvm rev to the latest commit in the Cargo.toml file and uncomment the cuda feature, cargo build with cuda, but an error occurs: "nvcc did not execute successfully (status code exit code: 2)."

The nvcc --version prints:

nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2022 NVIDIA Corporation Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.31833905_0

OuIChien commented 1 month ago

image I compiled on ubuntu 22 on Windows 11 subsystem, running with nothing.

HarukaMa commented 1 month ago

image update cargo.toml to use latest snarkvm instead of current values