Author

Topic: Bitcoin Address Generation? (Read 1015 times)

sr. member
Activity: 854
Merit: 272
March 20, 2017, 12:28:19 AM
#3
I am not sure if I am on the right sub forum for this.

I am planning to create a website that could generate a web bitcoin wallet. The problem is, I don't know where to start.
Then you probably shouldn't be creating a web wallet since you will be in control of people's money.

1. How do I generate a bitcoin wallet address?
Generate a 256-bit ECDSA private key. Derive the ECDSA public key from that private key. Hash the public key with SHA256. Hash the SHA256 hash with RIPEMD160. The resulting hash is called the hash160. Prepend the hash160 with a 0x00 byte. Hash the that with SHA256, and hash that hash again with SHA256. Take the first four bytes of the resulting hash and stick it onto the end of the modified hash160. Encode the result with Base58. Note that Bitcoin uses a slightly different Base58 encoding than the normal Base58 conversion.

See https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses for more details and an example.

2. How do I know if it's a valid address?
When you decode the Base58 address, hash everything but the last 4 bytes twice with SHA256. Then compare the first 4 bytes of the hash to the last 4 bytes of the Base58 decoded address. If they match, the address is valid.

3. Can I use a website, like bitaddress.org to the job for me?
Yes, but you probably want to have something that happens on your server instead of someone else's.

4. What else do I need to know about building a website that generates bitcoin wallets?
You need to know how ECDSA works. If you are planning on making a fully fledged web wallet, you will need to know how transaction signing works, how transactions are serialized, how to calculate proper transaction fees, how to handle double spends, how to handle transaction malleability, among a ton of other things. If you are asking these kinds of questions, I advise you to first study existing wallet software and how they work before you even consider making your own.

Thanks for answering my questions. I am now locking this thread. I am going to take it from here. Thanks again!
staff
Activity: 3374
Merit: 6530
Just writing some code
March 20, 2017, 12:11:33 AM
#2
I am not sure if I am on the right sub forum for this.

I am planning to create a website that could generate a web bitcoin wallet. The problem is, I don't know where to start.
Then you probably shouldn't be creating a web wallet since you will be in control of people's money.

1. How do I generate a bitcoin wallet address?
Generate a 256-bit ECDSA private key. Derive the ECDSA public key from that private key. Hash the public key with SHA256. Hash the SHA256 hash with RIPEMD160. The resulting hash is called the hash160. Prepend the hash160 with a 0x00 byte. Hash the that with SHA256, and hash that hash again with SHA256. Take the first four bytes of the resulting hash and stick it onto the end of the modified hash160. Encode the result with Base58. Note that Bitcoin uses a slightly different Base58 encoding than the normal Base58 conversion.

See https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses for more details and an example.

2. How do I know if it's a valid address?
When you decode the Base58 address, hash everything but the last 4 bytes twice with SHA256. Then compare the first 4 bytes of the hash to the last 4 bytes of the Base58 decoded address. If they match, the address is valid.

3. Can I use a website, like bitaddress.org to the job for me?
Yes, but you probably want to have something that happens on your server instead of someone else's.

4. What else do I need to know about building a website that generates bitcoin wallets?
You need to know how ECDSA works. If you are planning on making a fully fledged web wallet, you will need to know how transaction signing works, how transactions are serialized, how to calculate proper transaction fees, how to handle double spends, how to handle transaction malleability, among a ton of other things. If you are asking these kinds of questions, I advise you to first study existing wallet software and how they work before you even consider making your own.
sr. member
Activity: 854
Merit: 272
March 19, 2017, 11:42:37 PM
#1
I am not sure if I am on the right sub forum for this.

I am planning to create a website that could generate a web bitcoin wallet. The problem is, I don't know where to start.
1. How do I generate a bitcoin wallet address?
2. How do I know if it's a valid address?
3. Can I use a website, like bitaddress.org to the job for me?
4. What else do I need to know about building a website that generates bitcoin wallets?

This sounds like a big project for me, but I am testing my skills.
Jump to: