Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Kazimir on December 10, 2013, 08:41:12 AM



Title: How to generate an address starting with 3 (instead of 1) ?
Post by: Kazimir on December 10, 2013, 08:41:12 AM
I noticed there are also valid Bitcoin addresses that start with 3 instead of 1.

According to this List of address prefixes (https://en.bitcoin.it/wiki/List_of_address_prefixes) such an address is called a "Bitcoin script hash" rather than a "Bitcoin pubkey hash". But they seem to act like normal addresses nonetheless.
Examples: 3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX (https://blockchain.info/address/3EktnHQD7RiAE6uzMj2ZifT9YgRrkSgzQX) or 3M8XGFBKwkf7miBzpkU3x2DoWwAVrD1mhk (https://blockchain.info/address/3M8XGFBKwkf7miBzpkU3x2DoWwAVrD1mhk)

How do I generate these addresses? Or actually: how do I generate a private key whose corresponding public addres starts with a 3?


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: coastermonger on December 10, 2013, 08:47:32 AM
Addresses that start with a 3 are a script hash, rather than a public key hash.  https://en.bitcoin.it/wiki/List_of_address_prefixes


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: Remember remember the 5th of November on December 10, 2013, 08:48:23 AM
I believe that is https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki P2SH, you can generate those with vanitygen I think.


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: empoweoqwj on December 10, 2013, 09:07:27 AM
from https://en.bitcoin.it/wiki/Vanitygen

"While all "normal" bitcoin addresses start with a "1" (one) (except multi-signature addresses that start with "3")"


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: Kazimir on December 10, 2013, 09:34:46 AM
Thanks. Not sure if I fully understand this. I managed to create some addresses starting with 3 using Vanitygen, for example:

Address: 3KUAyfRbc3oB7pdhrDtvSnKWwjgDrDVp92
Privkey: 5TxoTCCeTLwXDGSmWtezzBSmDde2zqAkNkboVh8KE3HXrpdAxKL

But I can't seem to send payments to 3KUAyfRbc3oB7pdhrDtvSnKWwjgDrDVp92. And if I import this private key in my wallet, it actually seems to correspond with a different address: 1JnA47wA49Uo2ewGj8EL29xaoDPWFY7bpM.

Can I have an address that starts with a 3 (whether that be a multisig or script address or whatever) so that I can receive and spend coins, similar to a normal 1-address? Or are these 3-address really for entirely different purposes.



Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: empoweoqwj on December 11, 2013, 12:46:14 AM
Thanks. Not sure if I fully understand this. I managed to create some addresses starting with 3 using Vanitygen, for example:

Address: 3KUAyfRbc3oB7pdhrDtvSnKWwjgDrDVp92
Privkey: 5TxoTCCeTLwXDGSmWtezzBSmDde2zqAkNkboVh8KE3HXrpdAxKL

But I can't seem to send payments to 3KUAyfRbc3oB7pdhrDtvSnKWwjgDrDVp92. And if I import this private key in my wallet, it actually seems to correspond with a different address: 1JnA47wA49Uo2ewGj8EL29xaoDPWFY7bpM.

Can I have an address that starts with a 3 (whether that be a multisig or script address or whatever) so that I can receive and spend coins, similar to a normal 1-address? Or are these 3-address really for entirely different purposes.



As vanityGen says, the ones that start with "3" are for multi-sig purposes so no, you can't send one if you are using a single sig.


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: theymos on December 11, 2013, 02:24:06 AM
In Bitcoin-Qt, open the debug console and enter:
Code:
createmultisig 1 '["full public key or address in your wallet"]'

It'll give you a "multisig" P2SH address starting with 3 (but requiring only one signature). If you have the private key for the given public key, you'll be able to spend transactions sent to this address, but only using the raw transactions API currently. (You probably want to use addmultisigaddress instead of createmultisig if you're actually going to use the address.)


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: TierNolan on December 11, 2013, 01:22:12 PM
Can the reference client spend from those addresses too?


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: Kazimir on December 11, 2013, 11:57:30 PM
As vanityGen says, the ones that start with "3" are for multi-sig purposes so no, you can't send one if you are using a single sig.
Hmmm, I guess I don't understand what you mean. Somehow I always thought multi-sig meant depending on multiple signatures, i.e. multiple people have to sign it. So I assumed this related to transactions, e.g. if there are multiple input addresses owned by different people, who all have to sign before the tx can be sent.

Apparently I'm misinformed about this, but I can't really figure out what "multi-sig" means in the context of a single address, rather than a transaction?

The thing is, I want other people to be able to send money to this 3-address. But I guess that ain't possible? Or at least not by letting them create a normal tx from their wallet to my 3-address, without jumping through hoops? (if I have to jump through some technical hoops to spend it, that's OK)


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: empoweoqwj on December 12, 2013, 01:17:22 AM
As vanityGen says, the ones that start with "3" are for multi-sig purposes so no, you can't send one if you are using a single sig.
Hmmm, I guess I don't understand what you mean. Somehow I always thought multi-sig meant depending on multiple signatures, i.e. multiple people have to sign it. So I assumed this related to transactions, e.g. if there are multiple input addresses owned by different people, who all have to sign before the tx can be sent.

Apparently I'm misinformed about this, but I can't really figure out what "multi-sig" means in the context of a single address, rather than a transaction?

The thing is, I want other people to be able to send money to this 3-address. But I guess that ain't possible? Or at least not by letting them create a normal tx from their wallet to my 3-address, without jumping through hoops? (if I have to jump through some technical hoops to spend it, that's OK)

Can I just ask why this desperate need to have addresses starting with 3? Is it your lucky number or something ?  :)


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: Kazimir on December 12, 2013, 08:23:03 AM
Can I just ask why this desperate need to have addresses starting with 3? Is it your lucky number or something ?  :)
Something like that, yeah. It's supposed to be a donation address for a music band whose name starts with a 3 ;D

That, and also curiosity. You know, this deep need to fully understand everything related to Bitcoin :)


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: empoweoqwj on December 12, 2013, 02:07:22 PM
Can I just ask why this desperate need to have addresses starting with 3? Is it your lucky number or something ?  :)
Something like that, yeah. It's supposed to be a donation address for a music band whose name starts with a 3 ;D

That, and also curiosity. You know, this deep need to fully understand everything related to Bitcoin :)

Thanks for the explanation. Bit more from the Bitcoin Wiki:

---------
Multi-signature addresses

Addresses can be created that require a combination of multiple private keys. Since these take advantage of newer features, they begin with the newer prefix of 3 instead of the older 1. These can be thought of as the equivalent of writing a check to two parties - "pay to the order of somebody AND somebody else" - where both parties must endorse the check in order to receive the funds.
The actual requirement (number of private keys needed, their corresponding public keys, etc.) that must be satisfied to spend the funds is decided in advance by the person generating this type of address, and once an address is created, the requirement cannot be changed without generating a new address.
What's in an address

Most Bitcoin addresses are 34 characters. They consist of random digits and uppercase and lowercase letters, with the exception that the uppercase letter "O", uppercase letter "I", lowercase letter "l", and the number "0" are never used to prevent visual ambiguity.
Some Bitcoin addresses can be shorter than 34 characters (as few as 27 in theory) and still be valid. A significant percentage of Bitcoin addresses are only 33 characters, and some addresses may be even shorter. Every Bitcoin address stands for a number - somewhat like an account number. These shorter addresses are valid simply because they stand for numbers that happen to start with zeroes, and when the zeroes are omitted, the encoded address gets shorter.
Several of the characters inside a Bitcoin address are used as a checksum so that typographical errors can be automatically found and rejected. The checksum also allows Bitcoin software to confirm that a 33-character (or shorter) address is in fact valid and isn't simply an address with a missing character.
-----------

Just thought of a cool idea. Why not name a band using a bitcoin address? Be a bit "random" but a vanity address could reduce that. Then you could self-publish your work and nobody would have to ask how to buy it :)


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: genjix on December 12, 2013, 02:49:50 PM
http://sx.dyne.org/multisig.html


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: bittyfree on May 04, 2015, 05:03:57 PM
I used oclvanitygen from https://bitcointalk.org/index.php?topic=25804.0
But when I try to generate an address with 3, it says it is an invalid prefix etc
Can I generate these addresses somewhere online or directly through some application/programme? I dont really know how multisig works, but will I be able to use this address like normal through the Bitcoin Client?


Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: altcoinex on May 06, 2015, 12:05:53 PM
I used oclvanitygen from https://bitcointalk.org/index.php?topic=25804.0
But when I try to generate an address with 3, it says it is an invalid prefix etc
Can I generate these addresses somewhere online or directly through some application/programme? I dont really know how multisig works, but will I be able to use this address like normal through the Bitcoin Client?

Please understand the risk and danger of doing things you don't understand with these technologies. It will be your own fault if you lose money doing so.
It very much seems like you haven't read anyone in this threads posts, as they all directly answer your questions that your asking after they had posted...

First, Read and understand what multisig is, and how it works:
http://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions
https://en.bitcoin.it/wiki/Multisignature (This link includes an easy brief example for generating a multisig address with bitcoin-cli)

Then as far as generating it, you can easily generate one from the official bitcoin-cli command line. In regards to 'can I use this address like normal', the answer is yes and no, but mostly No. Yes it can send and receive funds, but no it will not work by default inside your core graphical client wallet, it requires command line knowledge/use or a specific client. This kind of thing can be tricky for someone who doesn't understand whats happening though, so you should really bother to understand this stuff before going any further.



Title: Re: How to generate an address starting with 3 (instead of 1) ?
Post by: virtualx on May 06, 2015, 09:17:33 PM
I used oclvanitygen from https://bitcointalk.org/index.php?topic=25804.0
But when I try to generate an address with 3, it says it is an invalid prefix etc
Can I generate these addresses somewhere online or directly through some application/programme? I dont really know how multisig works, but will I be able to use this address like normal through the Bitcoin Client?

Please understand the risk and danger of doing things you don't understand with these technologies. It will be your own fault if you lose money doing so.
It very much seems like you haven't read anyone in this threads posts, as they all directly answer your questions that your asking after they had posted...

First, Read and understand what multisig is, and how it works:
http://bitcoin.stackexchange.com/questions/3718/what-are-multi-signature-transactions
https://en.bitcoin.it/wiki/Multisignature (This link includes an easy brief example for generating a multisig address with bitcoin-cli)

Then as far as generating it, you can easily generate one from the official bitcoin-cli command line. In regards to 'can I use this address like normal', the answer is yes and no, but mostly No. Yes it can send and receive funds, but no it will not work by default inside your core graphical client wallet, it requires command line knowledge/use or a specific client. This kind of thing can be tricky for someone who doesn't understand whats happening though, so you should really bother to understand this stuff before going any further.


Most bitcoin wallets do not support multisignature. Armory supports multisignature but probably only partially.  I do not recommend generating multisignature online  because you do not know if the server is trustable. Command line is the best for this feature.