cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 28, 2023, 06:26:44 AM Last edit: July 28, 2023, 07:37:06 PM by cfbtcman Merited by NotATether (2) |
|
Hi,
I'd like to know if there is ppl that would like to help to develop a Javascript Taproot Address Generator for Browser.
I have been working on that since some time and the idea is to make the simplest address generator possible in a standalone file, without using complicated libraries full of code that makes any guy just want to trust and not verify.
I'm trying to find ppl that have full knowledge of the process since the X-only coordinate until the final bech32m encoding to generate the BC1P... address.
As I said the idea is not just use some public libraries and make it work, that I already have, the idea is to isolate all the code and explain it step by step for any newbie that understands or pretend to learn coding could understand fully what is being done.
Someone would like to help?
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 28, 2023, 06:37:29 AM |
|
I will lunch first doubt to see if someone could help.
From this x-only form coordinate point:
X= 60376045308133502588319041039213905409191423390227563583774073057371619898448 (decimal) X= 857BA1721C71D8F80F9C208B513BEEAC46816A4123FB7DB11A3CF6833D58B450 (hexadecimal)
What is the next step to get this final taproot address:
BC1PY5VKU7TV8A39WPE6LQF3P6W5JMC3CMHTWCQ3WHYTW59MCH7542JSFYEMK9
?
|
|
|
|
FatFork
Legendary
Offline
Activity: 1778
Merit: 2664
Crypto Swap Exchange
|
|
July 28, 2023, 12:10:39 PM |
|
Taproot support was added in the v6.1.0-rc.0 version of BitcoinJS-lib, so I don't see what your problem is. To clarify, I'm not advocating for bloatware or using libraries for tasks that can be done manually. However, considering the complexity of the problem you're trying to solve and the potential pitfalls, especially if you're not an experienced coder, this is a perfect example of where using a professionally made and thoroughly tested library makes sense and is justified.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 28, 2023, 07:34:37 PM Last edit: July 29, 2023, 12:35:57 AM by cfbtcman |
|
I'm trying to make bitcoin not only for nerds.
One example of a bitcoin JS library terms and conditions of use, that is already used by many that don't understand it:
"Be aware: this library is Apache licensed. By using it, you agree with the terms of that license. In particular pay attention to section 7 and 8, which assert there is NO WARRANTY that this library is safe to use or bug free, and in fact that by using this code you accept that none of the contributors shall be liable for any damages or monetary loss that results from your use of their code, even if due to bugs in that code. In short, according to the license the library is distributed under, there are no situations in which you could sue any of the developers (it's as if you wrote the entire library yourself). If you can't handle that, don't use this library."
The bitcoin slogan is: "Don't trust, verify!"
First step is to make a step by step manual as easier as possible, with only the code to generate addresses and forget everything else.
Generating secure addresses is the heart/core of bitcoin and nobody is doing it, a beginner can forget everything else as how to mine, how to run a node, can't forget how to generate safe addresses and many, many are mining and running nodes that don't know how to generate safe addresses, even the code of bitcoin core is questionable about the security of generating addresses safely.
The news about robberies come to the internet every single day, so, we need to have simple manual step by step for the ones that would like to learn.
I'm here ready to learn and teach what I already know, if somebody could help many will appreciate.
|
|
|
|
FatFork
Legendary
Offline
Activity: 1778
Merit: 2664
Crypto Swap Exchange
|
|
July 28, 2023, 07:53:20 PM |
|
I'm trying to made bitcoin not only for nerds.
One example of a bitcoin JS library terms and conditions of use, that is already used by many that don't understand it:
Sorry to say, but that's a stupid argument. Find me a single piece of open source software or license that doesn't include a "NO WARRANTY" clause. Even if you choose not to use the open source BitcoinJS-lib, you'll still be using a web browser and its underlying JS engine. Have you bothered checking what their licenses say?
|
|
|
|
bitmover
Legendary
Offline
Activity: 2478
Merit: 6317
bitcoindata.science
|
|
July 28, 2023, 08:51:13 PM |
|
Hi,
I'd like to know if there is ppl that would like to help to develop a Javascript Taproot Address Generator for Browser.
I have been working on that since some time and the idea is to make the simplest address generator possible in a standalone file, without using complicated libraries full of code that makes any guy just want to trust and not verify.
The lines of code contained in popular libraries are complex and very extensive. But there is a reason for that. They aren't complex to make you confused when verifying. They are complex because they are tested, secure, efficient and accurate. You shouldn't spend your time reinventing the wheel. This is not how new techs evolve. By doing what those professional libraries do in your own way, you will probably create an insecure and inefficient software. For learning purposes you are making a nice initiative. But only for that.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 29, 2023, 12:56:29 AM |
|
Even the wheel continues to evolve in practice.
Almost all base code of all OS's etc will be rewritten by IA and will be more efficient.
For now I'm just concentrated in libraries that don't belong to JS engine and have much more code than what I need.
Maybe in future I'll make a movie step by step how to generate a taproot address only with pen and paper for Guiness records !
To understand all the process I need to isolate the less code possible to start studying it.
All the code have bugs or can be improved, If there is nobody reading, it can't evolve.
For some reason we are using Taproot now and we don't became forever on Legacy.
There is not only one library for same features, the idea is to select the best approach of each one.
When I started learning to code I was taught that the most important was algorithm.
That was a universal language that could be converted in any code language.
Any big work need to have a project, so, one algorithm is the best project for bitcoin, where is that algorithm for next generations could learn about bitcoin and maybe improve it?
With this type of approach I think we should change the slogan to: "Don't verify, just trust!"
|
|
|
|
pooya87
Legendary
Offline
Activity: 3626
Merit: 11029
Crypto Swap Exchange
|
|
July 30, 2023, 05:19:28 AM |
|
If you don't have an advanced understanding of the Bitcoin protocol you should not attempt implementing any part of it, specially security critical parts like address generation. Not to mention that using it in browser and using Javascript is already a terrible idea. Case in point: From this x-only form coordinate point:
X= 60376045308133502588319041039213905409191423390227563583774073057371619898448 (decimal) X= 857BA1721C71D8F80F9C208B513BEEAC46816A4123FB7DB11A3CF6833D58B450 (hexadecimal)
What is the next step to get this final taproot address:
BC1PY5VKU7TV8A39WPE6LQF3P6W5JMC3CMHTWCQ3WHYTW59MCH7542JSFYEMK9
Creating Taproot addresses is slightly different from other addresses. It is not a simple matter of pubkey to address since a Taproot address can be both a "pay to key" and a "pay to script" at the same time (imagine a combination of both P2PKH and P2SH but with only one address format). So there are also two ways of creating the address. One is the simple and quick way of "pay to key" where the address encodes the pubkey you have: bc1ps4a6zusuw8v0sruuyz94zwlw43rgz6jpy0ahmvg68nmgx02ck3gq7xmyug
The other is creating a "dummy" script with the single key to use that for spending. This requires computing the tweak hash t = SHA256(SHA256("TapTweak") || SHA256("TapTweak") || pub_bytes)
and tweak key pub_tweak = pub + (t * G).
and computing the address using the tweaked pubkey bc1py5vku7tv8a39wpe6lqf3p6w5jmc3cmhtwcq3whytw59mch7542jsfyemk9
This means depending on how you created the address, the way you spend the coins sent to the address is going to be different.
|
|
|
|
bitmover
Legendary
Offline
Activity: 2478
Merit: 6317
bitcoindata.science
|
|
July 30, 2023, 09:36:33 PM |
|
Even the wheel continues to evolve in practice.
But you should evolve from where people left, not from zero. When I started to learn how to code I was also resistant to use libraries. Later on I understood that a programmer who ignores them is making a worse software. Libraries are code written by specialists. You cannot be a specialist in everything, so you use code other people wrote.your softwares will be better when you understand the importance of libraries Sometime you can ignore libraries because you are in a hurry or because you have a limited environment... but when you can you should use them. Maybe in your project you may not use them. But you should be aware of the limitations you are imposing to your project (specially in security and efficiency) Almost all base code of all OS's etc will be rewritten by IA and will be more efficient.
This not happening. And probably will never be done from scratch by ai. Thks is not how ai works. even AI look at current libraries before trying to write a better code. AI might improve code.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 31, 2023, 02:43:39 AM |
|
If you don't have an advanced understanding of the Bitcoin protocol you should not attempt implementing any part of it, specially security critical parts like address generation. Not to mention that using it in browser and using Javascript is already a terrible idea. Case in point: From this x-only form coordinate point:
X= 60376045308133502588319041039213905409191423390227563583774073057371619898448 (decimal) X= 857BA1721C71D8F80F9C208B513BEEAC46816A4123FB7DB11A3CF6833D58B450 (hexadecimal)
What is the next step to get this final taproot address:
BC1PY5VKU7TV8A39WPE6LQF3P6W5JMC3CMHTWCQ3WHYTW59MCH7542JSFYEMK9
Creating Taproot addresses is slightly different from other addresses. It is not a simple matter of pubkey to address since a Taproot address can be both a "pay to key" and a "pay to script" at the same time (imagine a combination of both P2PKH and P2SH but with only one address format). So there are also two ways of creating the address. One is the simple and quick way of "pay to key" where the address encodes the pubkey you have: bc1ps4a6zusuw8v0sruuyz94zwlw43rgz6jpy0ahmvg68nmgx02ck3gq7xmyug
The other is creating a "dummy" script with the single key to use that for spending. This requires computing the tweak hash t = SHA256(SHA256("TapTweak") || SHA256("TapTweak") || pub_bytes)
and tweak key pub_tweak = pub + (t * G).
and computing the address using the tweaked pubkey bc1py5vku7tv8a39wpe6lqf3p6w5jmc3cmhtwcq3whytw59mch7542jsfyemk9
This means depending on how you created the address, the way you spend the coins sent to the address is going to be different. Thanks for the answer, that helped me a lot. I had already got the first address with some node.js scripts that I thought they were wrong, because so many different scripts was giving different results and because when tested some of them with some satoshis I just lost the access to them. About doing it on browser or nodejs is probably one of the best ways to teach how the things work, because the facility, fame and for does not need to be compiled fits perfectly. About security everything can be put on check, even a node or hardware wallet. Bitcoin will be attacked by all sides, there is a hacker/scam community growing everyday pointing to bitcoin/crypto, they will use methods that today we don't even imagine. Each wallet generated should have a security level matching the quantity of money it have, if I was CZ from Binance, for sure I would have generated it with pen and paper. To do something like that we need to know the algorithm and test it before in some environment, so Javascript Engine, because the facility, fame and for does not need to be compiled fits perfectly. I'll focus on the code for the first example and try to understand it, thanks again for the help.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 31, 2023, 02:59:52 AM |
|
Even the wheel continues to evolve in practice.
But you should evolve from where people left, not from zero. When I started to learn how to code I was also resistant to use libraries. Later on I understood that a programmer who ignores them is making a worse software. Libraries are code written by specialists. You cannot be a specialist in everything, so you use code other people wrote.your softwares will be better when you understand the importance of libraries Sometime you can ignore libraries because you are in a hurry or because you have a limited environment... but when you can you should use them. Maybe in your project you may not use them. But you should be aware of the limitations you are imposing to your project (specially in security and efficiency) Almost all base code of all OS's etc will be rewritten by IA and will be more efficient.
This not happening. And probably will never be done from scratch by ai. Thks is not how ai works. even AI look at current libraries before trying to write a better code. AI might improve code. Sometimes the best way of evolve something is start from scratch, one example is quantic computing. If you go to the bases you can read that almost all ppl is using CSPRNG's to generate the "random" numbers for bitcoin addresses, every CSPRNG is like a casino roulette, there is none perfect and maybe can be exploited someday, nobody need to use a CSPRNG to generate his own addresses.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
July 31, 2023, 08:54:33 PM |
|
If you don't have an advanced understanding of the Bitcoin protocol you should not attempt implementing any part of it, specially security critical parts like address generation. Not to mention that using it in browser and using Javascript is already a terrible idea. Case in point: From this x-only form coordinate point:
X= 60376045308133502588319041039213905409191423390227563583774073057371619898448 (decimal) X= 857BA1721C71D8F80F9C208B513BEEAC46816A4123FB7DB11A3CF6833D58B450 (hexadecimal)
What is the next step to get this final taproot address:
BC1PY5VKU7TV8A39WPE6LQF3P6W5JMC3CMHTWCQ3WHYTW59MCH7542JSFYEMK9
Creating Taproot addresses is slightly different from other addresses. It is not a simple matter of pubkey to address since a Taproot address can be both a "pay to key" and a "pay to script" at the same time (imagine a combination of both P2PKH and P2SH but with only one address format). So there are also two ways of creating the address. One is the simple and quick way of "pay to key" where the address encodes the pubkey you have: bc1ps4a6zusuw8v0sruuyz94zwlw43rgz6jpy0ahmvg68nmgx02ck3gq7xmyug
The other is creating a "dummy" script with the single key to use that for spending. This requires computing the tweak hash t = SHA256(SHA256("TapTweak") || SHA256("TapTweak") || pub_bytes)
and tweak key pub_tweak = pub + (t * G).
and computing the address using the tweaked pubkey bc1py5vku7tv8a39wpe6lqf3p6w5jmc3cmhtwcq3whytw59mch7542jsfyemk9
This means depending on how you created the address, the way you spend the coins sent to the address is going to be different. Hi, I found this on internet: To create a P2TR (Pay-to-Taproot) address for a single public key, you need to:
1º Check that the y-coordinate of your public key is even, if not, negate the public key. Taproot requires that the y coordinate of the public key is even.What is the meaning of this? In this example I gave you, Y was odd and it worked perfectly! Can you help ? !
|
|
|
|
pooya87
Legendary
Offline
Activity: 3626
Merit: 11029
Crypto Swap Exchange
|
|
August 01, 2023, 05:32:52 AM Merited by NotATether (1) |
|
~ Hi,
I found this on internet:
To create a P2TR (Pay-to-Taproot) address for a single public key, you need to:
1º Check that the y-coordinate of your public key is even, if not, negate the public key. Taproot requires that the y coordinate of the public key is even.
What is the meaning of this? In this example I gave you, Y was odd and it worked perfectly!
Can you help ? !
That does not matter for address generation because your x value does not change when negating a public key meaning P(x,y) = -P(x,y) = P(x,-y) and we only use the x coordinate in the address. Even y coordinate is something you should check and take some extra steps when signing and verifying ECSDSA signatures.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
August 01, 2023, 06:27:01 AM |
|
Understood !
Thanks again for the help, I'll keep my job.
Sorry, I have 0 merit points to give you, we need to ask admins to change merit points for LN Satoshis and anyone could send it as much as he wants.
Forum could win a fee too, it would be awesome.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
August 11, 2023, 02:41:39 AM |
|
Hi,
I'd like to know if there is ppl that would like to help to develop a Javascript Taproot Address Generator for Browser.
I have been working on that since some time and the idea is to make the simplest address generator possible in a standalone file, without using complicated libraries full of code that makes any guy just want to trust and not verify.
The lines of code contained in popular libraries are complex and very extensive. But there is a reason for that. They aren't complex to make you confused when verifying. They are complex because they are tested, secure, efficient and accurate. You shouldn't spend your time reinventing the wheel. This is not how new techs evolve. By doing what those professional libraries do in your own way, you will probably create an insecure and inefficient software. For learning purposes you are making a nice initiative. But only for that. Look how they are tested, secure, efficient and accurate: https://cointelegraph.com/news/newly-discovered-bitcoin-wallet-loophole-let-hackers-steal-funds-slow-mistThat is what I have being trying to explain, we can always do it better if we study it enough, we need one simple, auditable official core APP just to generate addresses, not a core with gigas and gigas and using CSPNG's.
|
|
|
|
NotATether
Legendary
Offline
Activity: 1778
Merit: 7372
Top Crypto Casino
|
|
August 11, 2023, 04:40:19 AM |
|
I'm trying to make bitcoin not only for nerds.
One example of a bitcoin JS library terms and conditions of use, that is already used by many that don't understand it:
"Be aware: this library is Apache licensed. By using it, you agree with the terms of that license. In particular pay attention to section 7 and 8, which assert there is NO WARRANTY that this library is safe to use or bug free, and in fact that by using this code you accept that none of the contributors shall be liable for any damages or monetary loss that results from your use of their code, even if due to bugs in that code. In short, according to the license the library is distributed under, there are no situations in which you could sue any of the developers (it's as if you wrote the entire library yourself). If you can't handle that, don't use this library."
The bitcoin slogan is: "Don't trust, verify!"
All that license text is saying is: - This library is licensed under the Apache License https://www.apache.org/licenses/LICENSE-2.0- and that you cant sue developers for bugs (your standard "no liability" and "no warranty" sections).
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
August 24, 2023, 02:12:45 PM |
|
~ Hi,
I found this on internet:
To create a P2TR (Pay-to-Taproot) address for a single public key, you need to:
1º Check that the y-coordinate of your public key is even, if not, negate the public key. Taproot requires that the y coordinate of the public key is even.
What is the meaning of this? In this example I gave you, Y was odd and it worked perfectly!
Can you help ? !
That does not matter for address generation because your x value does not change when negating a public key meaning P(x,y) = -P(x,y) = P(x,-y) and we only use the x coordinate in the address. Even y coordinate is something you should check and take some extra steps when signing and verifying ECSDSA signatures. I have another doubt in the hands, after google and ChatGPt the doubt subsist, is there any hashed Taproot address that protects the public key identity until 1st transaction be done as in Legacy and Segwit addresses or every Taproot address simple or with tweak never protect the public key identity ?
|
|
|
|
albert0bsd
|
|
August 25, 2023, 03:03:24 PM |
|
.... because when tested some of them with some satoshis I just lost the access to them.
There is something called Testnet where you can learn and practice, if there are some error you will not lose anything because Testnet coins are worthless.
|
|
|
|
cfbtcman (OP)
Member
Offline
Activity: 264
Merit: 16
|
|
August 25, 2023, 05:01:07 PM |
|
.... because when tested some of them with some satoshis I just lost the access to them.
There is something called Testnet where you can learn and practice, if there are some error you will not lose anything because Testnet coins are worthless. I know, but testnet for itself dont teach us how to generate Taproot addresses with our own code.
|
|
|
|
albert0bsd
|
|
August 25, 2023, 06:04:11 PM Last edit: August 25, 2023, 08:40:24 PM by albert0bsd |
|
I know, but testnet for itself dont teach us how to generate Taproot addresses with our own code.
I don't buy it, the main difference between mainnet and testnet is that Testnet addresses have different byte prefix. So if you manage to do a code to generate a taproot address in testnet you only need to change the prefix to generate it on mainnet. Testnet can indeed be a valuable tool for learning how to generate Taproot addresses with your own code. Testnet is valuable for us as developers to experiment and test our code without using real funds. Please don't burn satoshis on mainnet. By the way I support you to learn to do it by yourself, that kind as self learning is good. Regards.
|
|
|
|
|