Repository navigation
[Verify] How it works #245
sbounmy
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hey there,
Bitcoiners have this famous "Don't trust, verify" which also applies to us if you send us funds.
However for non-techies it could be challenging to verify.
So I decided to do a quick write down on how it works, especially the bitcoin keys generation part which is important to understand that :
Thus : if you happen to loose your bill (paper wallet) : we can't help you !
1. AI image generation
HongBao takes an image of you (2) and transform it with your style (1).
When you generate a bill (3), we use ruby_llm with
gpt-image-1in a background job to process it.It takes around 60s to process 1 image for 1 style
hongbao_bitcoin/app/jobs/process_paper_job.rb
Lines 26 to 35 in ffb099a
The result image does not contain any Bitcoin keys or data. Just the design with some empty spaces so we can place them later.
2. Bitcoin keys
When you click on a bill (4) it takes you to the part where we generate bill.
Starting from here everything is offline except top up with mt pelerin (next step) but you can turn off internet (offline mode) if you want maximum security.
When you click on the generate button
hongbao_bitcoin/app/views/hong_baos/new/steps/_print.html.erb
Lines 11 to 12 in ffb099a
We call this WalletFactory because when we started HongBao we used legacy keys (starting with 1...) but since Segwit we want to support it also (less transaction fees)
hongbao_bitcoin/app/javascript/controllers/bitcoin_controller.js
Lines 20 to 24 in ffb099a
Then this is the important part : where we generate the mnemonic (24 words phrase)
hongbao_bitcoin/app/javascript/services/bitcoin/master.js
Lines 44 to 47 in ffb099a
and from the Mnemonic we create the seed then the private key, public address etc and it is set as the current wallet
https://github.com/sbounmy/hongbao_bitcoin/blob/main/app/javascript/services/bitcoin/master.js#L49-L57
https://github.com/sbounmy/hongbao_bitcoin/blob/main/app/helpers/qr_code_helper.rb#L8-L14
3. Top up
Todo
All reactions