Author

Topic: Creating Bitcoin addresses in OpenCL (Read 163 times)

jr. member
Activity: 77
Merit: 7
November 04, 2022, 08:30:43 AM
#6
You should be able to complete the whole process on GPU so quickly that the communication overhead in any intermediary steps will impact the address generation throughput a lot.
Do you have a source of entropy that you'd like to use? If not, you may even be able to sample the private key on the GPU.

Why not to use any build-in RNG? Or you may generate them on CPU (using your favorite method), copy to GPU and then generate addresses.

Maybe look at that project: https://github.com/bstatcomp/RandomCL (https://link.springer.com/article/10.1007/s11227-019-02756-2)


I was actually looking at going for an RNG implementation, but I did not know whether to create the whole key or just part of the key on the GPU but it appears the whole key is better.

You can't directly collect entropy from OpenCL's device memory. That requires some *SSL call followed by a copy-from-host-to-device call.

I got curious and did quick google search. I found presentation file which state there are 5 OpenCL RNG library/implementation (Random123, MTGP, OpenCLRNG, RANLUXCL, MWC64X). But i don't know whether it directly collect entropy from GPU or not.

[1] https://dotneststatic.com/media/gpuday/GPUDay2019/talks/thursday/7_IstvanKiss.pdf, page 20

Thanks for looking, I will check them out also.
legendary
Activity: 952
Merit: 1385
November 04, 2022, 04:16:17 AM
#5
You should be able to complete the whole process on GPU so quickly that the communication overhead in any intermediary steps will impact the address generation throughput a lot.
Do you have a source of entropy that you'd like to use? If not, you may even be able to sample the private key on the GPU.

Why not to use any build-in RNG? Or you may generate them on CPU (using your favorite method), copy to GPU and then generate addresses.

Maybe look at that project: https://github.com/bstatcomp/RandomCL (https://link.springer.com/article/10.1007/s11227-019-02756-2)
jr. member
Activity: 77
Merit: 7
November 04, 2022, 03:49:50 AM
#4
A more important question would be, how are you going to move those addresses back to host memory? CUDA has a copy-memory-between-device-and-host function, but I am not so sure about OpenCL - at any rate, calling such a function for each address would be very slow, and I advise you to fill up a block of device memory with address bytes before copying it to the host RAM.

@n0nce

You can't directly collect entropy from OpenCL's device memory. That requires some *SSL call followed by a copy-from-host-to-device call.

Thank you I will check them out.

A more important question would be, how are you going to move those addresses back to host memory? CUDA has a copy-memory-between-device-and-host function, but I am not so sure about OpenCL - at any rate, calling such a function for each address would be very slow, and I advise you to fill up a block of device memory with address bytes before copying it to the host RAM.

@n0nce

You can't directly collect entropy from OpenCL's device memory. That requires some *SSL call followed by a copy-from-host-to-device call.

I am working with Rust but for example sake, on PyOpenCL I have previously used "enqueue_copy" to copy a GPU Buffer back to host Memory, you are correct however that to make the program more streamlined and faster I should really fill this buffer before pulling anything back to the host otherwise I will be wasting precious time.
legendary
Activity: 1568
Merit: 6660
bitcoincleanup.com / bitmixlist.org
November 04, 2022, 03:20:18 AM
#3
A more important question would be, how are you going to move those addresses back to host memory? CUDA has a copy-memory-between-device-and-host function, but I am not so sure about OpenCL - at any rate, calling such a function for each address would be very slow, and I advise you to fill up a block of device memory with address bytes before copying it to the host RAM.

@n0nce

You can't directly collect entropy from OpenCL's device memory. That requires some *SSL call followed by a copy-from-host-to-device call.
hero member
Activity: 882
Merit: 5834
not your keys, not your coins!
November 03, 2022, 09:50:22 PM
#2
You should be able to complete the whole process on GPU so quickly that the communication overhead in any intermediary steps will impact the address generation throughput a lot.
Do you have a source of entropy that you'd like to use? If not, you may even be able to sample the private key on the GPU.

Simply do the EC math to receive a public key, as well as the SHA256 and RIPEMD160 all on GPU.

This is a Python (CPU) version of what I believe you're trying to make; maybe it can help as orientation: https://github.com/Isaacdelly/Plutus
And some GPU bruteforcing tools: https://github.com/bkerler/opencl_brute
jr. member
Activity: 77
Merit: 7
November 03, 2022, 06:26:00 PM
#1
Hi,

I am looking at creating Bitcoin addresses in OpenCL but I am wondering what is the best way to go about it.

Should I look to do all the computation of the address on the GPU starting with the secp256k1 keypair or should I only be looking at creating the keypair on GPU and the other functions on the CPU once returned?

I am new to GPU programming and I am trying to understand the costly part of the process. If anyone experienced with either OpenCL or Cuda could point me in the right direction I would really appreciate that.

Dly
Jump to: