Bitcoin Forum
May 24, 2024, 06:47:33 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [25] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 ... 114 »
481  Economy / Speculation / Re: We will break $800 they said... on: July 18, 2016, 01:31:06 PM
I also am thinking that price of Bitcoin is at boiling points and any time soon they can explode to raise suddenly. I have eyes on the market and this recent movement in market is good sign. Just before halving till yesterday market was like constant. I will do agree there will one quick increase is due which can take place anytime in coming days.

Volume is getting lower while price is climbing slowly upwards. This is very bullish.
482  Economy / Speculation / Re: BTC to 5000$ soon on: July 15, 2016, 08:31:51 AM
The fact that we are consolidating near 666$ is real bullish. Remember, this rally started from 450$. If it was a normal bubble we'd be down to 450-500 range already. This was a genuine raise of demand and it's here to stay. In a month or two the halving effect is going to boost the price even higher, possibly to the ATH.
483  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 14, 2016, 07:56:34 PM
I know the topic has been solved, but here's something useful

http://rosettacode.org/wiki/Bitcoin/address_validation

could be buggy, though!

I actually link to this page in OP already. The solutions there are very buggy indeed.
484  Bitcoin / Development & Technical Discussion / Re: attaching messages on transactions and retrieving them from the blockchain on: July 14, 2016, 02:51:37 PM
You can check out http://cryptograffiti.info to get the idea.
485  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 14, 2016, 02:46:33 PM
Holy shit! Thanks for that!

Yep, that post by DannyHamilton indeed was very useful and educational.
486  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 14, 2016, 02:35:25 PM
For the sake of completeness, here's the self-contained C function that turns payload into a valid bitcoin address.

Code:
/* Based on libbase58, see https://github.com/luke-jr/libbase58 for reference.*/
/* Attempts to convert the binary input to a Base58 format and returns true   */
/* on success.                                                                */
static bool generate_bitcoin_address(const unsigned char *payload, char type, char *b58, size_t *b58sz) {
    unsigned char address[25];

    address[0] = ( type == '1' ? 0 :
                   type == '3' ? 5 : 111);
    memcpy(address+1, payload, 20);

    unsigned char d1[SHA256_DIGEST_LENGTH], d2[SHA256_DIGEST_LENGTH];
    SHA256(SHA256(address, 21, d1), SHA256_DIGEST_LENGTH, d2);
    memcpy(address+21, d2, 4);

    {
        static const char b58digits_ordered[] = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
        const uint8_t *bin = (const uint8_t *) address;
        int carry;
        ssize_t i, j, high, zcount = 0;
        size_t size;
        size_t uzcount = 0;

        while (uzcount < 25 && !bin[uzcount]) ++uzcount;
        zcount = uzcount;
        size =        (25 - zcount) * 138 / 100 + 1;
        uint8_t buf[ ((25 -      0) * 138 / 100 + 1) ];
        memset(buf, 0, size);
        for (i = zcount, high = size - 1; i < 25; ++i, high = j) {
            for (carry = bin[i], j = size - 1; (j > high) || carry; --j) {
                carry += 256 * buf[j];
                buf[j] = carry % 58;
                carry /= 58;
            }
        }

        for (j = 0; j < (ssize_t) size && !buf[j]; ++j);

        if (*b58sz <= zcount + size - j) {
            *b58sz = zcount + size - j + 1;
            return false;
        }

        if (zcount) memset(b58, '1', zcount);
        for (i = zcount; j < (ssize_t) size; ++i, ++j) b58[i] = b58digits_ordered[buf[j]];
        b58[i] = '\0';
        *b58sz = i + 1;
    }
    return true;
}
487  Economy / Speculation / Re: BTC to 5000$ soon on: July 13, 2016, 06:30:23 PM
Are we there yet, OP?
I'm having a 2 for 1 sale: Buy 1 BTC for $5,000, get one free. Offer open to everyone, but only while supplies last.
if you have a lot of bitcoin and wait for the price of $ 5000, then you're probably going to wait a longer time, because it will happen in a very long time. I suggest that you should sell what you have when the bitcoin bitcoin prices rose to $ 1,000. Well I think it is a reasonable thing to sell bitcoin, because I think it is an expensive price

Yes only holding for long term will never allow you to make profits, its better to sell when price goes higher and secure some profits rather then just holding it.

I've held tight to my BTC ever since 4$. If I didn't I'd be banging my head for the rest of my life. So stop spreading shit advice.
488  Economy / Speculation / Re: Timberrrrr !!!!!!!!!!!!!! on: July 09, 2016, 08:39:00 PM
See you in 3 months and BTC at ATH.
489  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 08, 2016, 08:00:22 PM
Below is the C code I just finished for the purpose described in OP.

Code:
#include <stdio.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <openssl/sha.h>

/* Based on libbase58, see https://github.com/luke-jr/libbase58 for reference.*/
/* Returns the version of a valid Bitcoin address or a negative value if the  */
/* address is invalid.                                                        */
int validate_bitcoin_address(const char *address) {
    static const int8_t b58digits_map[] = {
        -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
        -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
        -1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,
        -1, 0, 1, 2, 3, 4, 5, 6,  7, 8,-1,-1,-1,-1,-1,-1,
        -1, 9,10,11,12,13,14,15, 16,-1,17,18,19,20,21,-1,
        22,23,24,25,26,27,28,29, 30,31,32,-1,-1,-1,-1,-1,
        -1,33,34,35,36,37,38,39, 40,41,42,43,-1,44,45,46,
        47,48,49,50,51,52,53,54, 55,56,57,-1,-1,-1,-1,-1,
    };

    unsigned char addrbin[25];
    size_t addrbinsz = sizeof(addrbin);

    void *bin = (void *) addrbin;
    size_t *binszp = &addrbinsz;
    const char *b58 = address;
    size_t b58sz = strlen(address);

    {
        const unsigned char *b58u = (void *) b58;
        unsigned char *binu = bin;
        uint32_t outi[(25 + 3) / 4];
        size_t outisz=(25 + 3) / 4;
        uint64_t t;
        uint32_t c;
        size_t i, j;
        uint8_t bytesleft = 25 % 4;
        uint32_t zeromask = bytesleft ? (0xffffffff << (bytesleft * 8)) : 0;
        unsigned zerocount = 0;

        if (!b58sz) b58sz = strlen(b58);
        memset(outi, 0, sizeof(outi));

        /* Leading zeros, just count */
        for (i = 0; i < b58sz && b58u[i] == '1'; ++i) ++zerocount;
        for ( ; i < b58sz; ++i) {
            if (b58u[i] & 0x80) return -1; /* High-bit set on invalid digit */
    if (b58digits_map[b58u[i]] == -1) return -2; /* Invalid base58 digit */
           
            c = (unsigned)b58digits_map[b58u[i]];
            for (j = outisz; j--; ) {
                t = ((uint64_t)outi[j]) * 58 + c;
                c = (t & 0x3f00000000) >> 32;
                outi[j] = t & 0xffffffff;
            }

            if (c) return -3; /* Output number too big (carry to the next int32) */
            if (outi[0] & zeromask) return -4; /* Output number too big (last int32 filled too far) */
        }

        j = 0;
        switch (bytesleft) {
            case 3: *(binu++) = (outi[0] &   0xff0000) >> 16;
    case 2: *(binu++) = (outi[0] &     0xff00) >>  8;
    case 1: *(binu++) = (outi[0] &       0xff);  ++j;
    default: break;
        }

        for (; j < outisz; ++j) {
            *(binu++) = (outi[j] >> 0x18) & 0xff;
            *(binu++) = (outi[j] >> 0x10) & 0xff;
            *(binu++) = (outi[j] >>    8) & 0xff;
            *(binu++) = (outi[j] >>    0) & 0xff;
        }

        binu = bin; /* Count canonical base58 byte count */
        for (i = 0; i < 25; ++i) {
            if (binu[i]) break;
            --*binszp;
        }
        *binszp += zerocount;
    }

    if (addrbinsz != 25) return -5;
    if (addrbin[0] != 0 && addrbin[0] != 5) return -6;

    {
        unsigned char d1[SHA256_DIGEST_LENGTH], d2[SHA256_DIGEST_LENGTH];
        SHA256(SHA256(addrbin, 21, d1), SHA256_DIGEST_LENGTH, d2);
        if (memcmp(addrbin + 21, d2, 4)) return -7;
    }

    return addrbin[0];
}

int main( int argc, char * argv [] ) {
    int i;

    for (i = 1; i < argc; ++i ) {
        bool valid = (validate_bitcoin_address(argv[i]) >= 0);
        printf( "%s is %s\n", argv[i], valid ? "VALID." : "INVALID!");
    }

    return 0;
}
490  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 08, 2016, 06:26:25 PM
I don't have time to write the C code for you right now, but if you are capable of writing your own, the process to validate a bitcoin address (both P2PKH and P2SH) would be:

1. Convert each leading "one" to a single byte of value 0
2. Convert the remaining digits from base58 to hex
3. The result should be exactly 25 bytes long, if not you have an invalid address.
4. Make sure that the leading byte is either a value of 0 or a value of 5, if not you have an invalid address.
5. Remove the trailing 4 bytes, leaving you with a 21 byte hex value.
6. Calculate SHA256(SHA256()) on the 21 bytes.
7. Make sure the first 4 bytes of step 6 are equal to the 4 bytes removed in step 5, if not you have an invalid address.
8. If you get this far without determining that the address is invalid, then the address is valid.

(programmatically, you may find it easier to reverse the order of the first two steps)

Thank you so much for that explanation earlier and for these instructions. I think I can now understand the process fully and am able to implement the needed code. I will share it in this topic later when I'm finished. Also, seems that libbase58 library also has the necessary functionality included in it which I can slightly modify to meet my requirements.
491  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 08, 2016, 04:44:15 PM

What confuses me the most is that hex 0000000000000000000000000000000000000000 is 1111111111111111111114oLvT2 (27 characters) but hex 0000000000000000000000000000000000000001 is 11111111111111111111BZbvjr (26 characters).

20 zeroes in the beginning of the BTC address payoad results in an address of length 27.
19 zeroes in the beginning of the BTC address payload and then byte with decimal value of 1 results in an address of length 26.

But now all of sudden 17 zeroes in the beginning followed by the byte with value 1 results in an address of length 27 again.

What logic is there? It is said that the number of 1s in the beginning of the address depends on the number of zeroes in the beginning of the address payload but this dependency is no way trivial.
492  Bitcoin / Development & Technical Discussion / Re: C or C++ code for validating Bitcoin addresses on: July 08, 2016, 04:26:09 PM
Are you sure you want to limit yourself to Bitcoin only? Depending, you might want to support Dogecoin and other clones as well.

Anyway to solve this problem, the  official place to look for this would be Bitcoin Core.

Yes. Core has validateaddress RPC which is basically exactly what I need. However, Core's code is way too refactored. I need one function, self-contained, to do this all. Its only dependency would be SHA-256.
493  Bitcoin / Development & Technical Discussion / C or C++ code for validating Bitcoin addresses on: July 08, 2016, 03:37:01 PM
I have been searching the Internet for quite some time now and haven't found an ultimate C or C++ function that validates Bitcoin addresses. Sure there is one here but it gives so many false answers it's unacceptable.

I need the strictest possible most complete and fail-proof function written in either C or C++. It should correctly cope with addresses as short as 26 characters. Also, it should understand that addresses starting with 3 are also valid. If the address has not enough 1s or has too many 1s in the beginning then the function should return false.

I believe I'm not the last developer out there searching for such a self-contained function so if you can help, please contribute to this topic.
494  Economy / Speculation / BTC Giant Cup and Handle Forming! on: July 06, 2016, 10:39:59 PM


Quote
The Cup with Handle is a bullish continuation pattern that marks a consolidation period followed by a breakout.
495  Alternate cryptocurrencies / Service Announcements (Altcoins) / Re: CryptoGraffiti - Block Chain Message Encoder & Decoder on: July 06, 2016, 04:15:16 PM
Version 0.80 updates:
  • It is now possible to download block chain files (see screenshot).
  • Added protocol specification under the help tab.

496  Economy / Speculation / Re: BTC to 5000$ soon on: July 04, 2016, 11:22:54 AM
Yes possible to achieve the price of $1500 in this year but not possible to achieve the price of $5k very soon and it may take next 5 years to achieve that milestone.

Not even during 2007/2008-like financial crisis situation? Please educate yourself or you are about to lose a lot of wealth in the upcoming months. brexit was just the beginning. Silver has risen again and is now trading at its 2-year high!
497  Economy / Speculation / Re: BTC to 5000$ soon on: July 04, 2016, 11:05:30 AM
The value of the Bitcoin is not going to be $5000 any time soon now and I do not know why some people believe that something like this is going to happen soon.
We still need a couple more years before the price comes even close to this. First we need to hit $1000 before we are going to talk about $5000.

Then read the darn OP you mentally challenged person.

edit:
in addition to OP, stuff like brexit and halving are accelerating BTC price increase even more.
498  Economy / Speculation / Re: BTC to 5000$ soon on: July 03, 2016, 12:28:47 PM
It has a potential of getting to the moon, but that's not realistic when you are speculating. Tings like these go with tsteps and the fist step now is getting to 800 which has been proven a hard stpe.

false. in 2013 bubble 800$ was broken in no time. not hard at all.


BTW silver prices are already soaring. To all non-believers, read OP. My prophecy is manifesting.
499  Economy / Speculation / Re: BTC to 5000$ soon on: July 03, 2016, 11:58:16 AM
Bitcoin will never touch $5000 soon.

nice trolling
500  Economy / Speculation / Re: "Bitcoin is definitely the most advanced cryptocurrency out there" on: June 30, 2016, 01:19:35 PM
Jeff Berwick is a fucking loon.

And you're a fucking sheep.

But Berwick is a loon regardless. That has nothing to do with Bitcoin, the ancap philosophy, or anything else.

Well that's just like your opinion. No need to emphasize is in that sentence, it just makes you sound pathetic.
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 [25] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 ... 114 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!