Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hrossik

Pages: 1 [2] 3
16
General Discussion / Re: Privatizing BitAssets
« on: April 16, 2015, 02:04:06 pm »
Guys, you are stuck with the idea of alternative BitUSDs. In this point of time, nobody would even try to compete with the original BitUSD. It just makes no sense.

Instead try to imagine User Pegged Assets as a feature, which enables creation of BitIndexes and BitStocks. Wouldn't this be useful?

17
General Discussion / Re: Privatizing BitAssets
« on: April 16, 2015, 11:37:48 am »
For now this feature could offload work from devs while allowing users to introduce the assets they want (stocks, indexes, ...). I think nobody would dare to go into competition with BitUSD atm. Maybe in the future, after the market grows.

18
General Discussion / Re: Privatizing BitAssets
« on: April 16, 2015, 10:48:34 am »
Pegged BitAssets with private feed are great idea! I am not so sure about all fees going to one entity, but it should be safe, as long as there is competition with internal BitAssets with the original burning strategy of fees.

19
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 13, 2015, 07:41:33 pm »
So what seems to be the consensus on this affair?

@bytemaster : do you need any additional analysis, improvement, info?

20
I will take advantage of this thread being used for showing what people want in bs and add my opinion: Originally I came to BitShares because I was looking for a platform allowing easy trading of stocks (particulary indexes). BitUSD is a huge thing, I love it, but it needs merchant adoption to be useful. Trading stocks would be hugely beneficial alone, because the cost for an ordinary mortal to enter the stock market is quite big. If we had (pegged) stocks trading platform, we would get plenty of users AND we would have a use case for bitUSD. Also when trading bitUSD <=> bitStocks, you don't need gateways as desperately as we do now, because you only enter once, then gamble the market or hold for an extended period of time, and leave once a while after making some profit.

tldr> BitShares were supposed to be a trading platform. Trading currencies is a gamble, nobody (few) wants to do that. We need bitStocks! bitIndexes in particular..

 +5% +5% +5% +5% +5%

finally something gave me hope again just reading it!

PS we need CFDs like trading and the option for leverage in general ...
Totally agree. options would be great.

 +5% +5% +5% +5%

Do we have enough liquidity to hold the pegs though?

I am glad I am not the only one, who finds this idea attractive. Is there enough liquidity? I don't know, but I will tell my perspective: I am a conservative investor in BTS terms, but I trust the bitUSD peg to hold and I believe, it would hold also for other assets (if they were useful - such as indexes). And indexes are far less speculative investment than BTS, so I could invest like 2x - 3x more than I am currently in BTS

To me, a referral program is completely worthless. At present I don't tell my friends/family about BitShares, because there is nothing useful for them here (I just discuss with them the theoretical aspects of BS, mostly without mentioning it). And a referral program won't change it. On the other hand, as soon as there appears something useful for them in BitShares, I will begin spreading the word WITH or WITHOUT the referral program.

My priorities:

1) Finish 1.0 and introduce other pegged assets (stocks, indexes, commodities)
2) Wait for the word to spread + use ordinary marketing channels
3) If this doesn't help, start referral program

21
I will take advantage of this thread being used for showing what people want in bs and add my opinion: Originally I came to BitShares because I was looking for a platform allowing easy trading of stocks (particulary indexes). BitUSD is a huge thing, I love it, but it needs merchant adoption to be useful. Trading stocks would be hugely beneficial alone, because the cost for an ordinary mortal to enter the stock market is quite big. If we had (pegged) stocks trading platform, we would get plenty of users AND we would have a use case for bitUSD. Also when trading bitUSD <=> bitStocks, you don't need gateways as desperately as we do now, because you only enter once, then gamble the market or hold for an extended period of time, and leave once a while after making some profit.

tldr> BitShares were supposed to be a trading platform. Trading currencies is a gamble, nobody (few) wants to do that. We need bitStocks! bitIndexes in particular..

22
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 10, 2015, 08:33:12 am »
Only transactions that update BTS votes are allowed in failover blocks (...)

Doesn't every transaction update votes? Or you want to allow only transactions to yourself for this case?

23
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 08, 2015, 09:42:30 pm »
Ok, I added the binary search and removed the unnecessary set. Overall speedup is around 27% (measured on 10k runs of the old and new approach). New implementation is in "delegate_shuffle", the old one is in "delegate_shuffle_linear".

Code: [Select]
/*
 * File:   main.cpp
 * Author: Hrossik
 *
 * Created on April 7, 2015, 11:27 PM
 */

#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>

#include <stdio.h>
#include <time.h>
#include <algorithm>

#define NUM_DELEGATES 101
#define INVALID_DELEGATE -1
#define delegate_id int
#define sha256 int

using namespace std;

vector<delegate_id> delegate_shuffle(vector<delegate_id>, vector<delegate_id>, sha256);
vector<delegate_id> delegate_shuffle_linear(vector<delegate_id>, vector<delegate_id>, sha256);
int binary_search(vector<delegate_id>, delegate_id);
void print_vec(vector<delegate_id>);

/*
 *
 */
int main(int argc, char** argv) {

    vector<delegate_id> prev_delegate_order;

    for (int i = 0; i < NUM_DELEGATES; i++) {
        prev_delegate_order.push_back(i);
    }

    vector<delegate_id> top_101_delegates_sorted_by_vote;

    for (int i = 0; i < NUM_DELEGATES; i++) {
        top_101_delegates_sorted_by_vote.push_back(i);
    }

    const int num_of_tests = 100000;

    struct timespec start, stop;

    double time_bin = 0;
    for (int i = 0; i < num_of_tests; i++) {
        clock_gettime(CLOCK_REALTIME, &start);
        delegate_shuffle(prev_delegate_order, top_101_delegates_sorted_by_vote, time(NULL));
        clock_gettime(CLOCK_REALTIME, &stop);
        time_bin += (stop.tv_sec - start.tv_sec)*1000.0 + (stop.tv_nsec - start.tv_nsec) / 1000000.0;
    }

    double time_lin = 0;
    for (int i = 0; i < num_of_tests; i++) {
        clock_gettime(CLOCK_REALTIME, &start);
        delegate_shuffle_linear(prev_delegate_order, top_101_delegates_sorted_by_vote, time(NULL));
        clock_gettime(CLOCK_REALTIME, &stop);
        time_lin += (stop.tv_sec - start.tv_sec)*1000.0 + (stop.tv_nsec - start.tv_nsec) / 1000000.0;
    }

    printf("time_bin = %.6lf, time_lin = %.6lf", time_bin, time_lin);

    // test of binary_search
    /*int count = 0;
    for (int i = 0; i < prev_delegate_order.size(); i++) {
        int ind = binary_search(prev_delegate_order, i);
        if(ind == i) {
            count++;
        }       
    }
    printf("count = %d\n",count);*/

    return 0;
}

vector<delegate_id> delegate_shuffle(vector<delegate_id> prev_delegate_order, vector<delegate_id> top_101_delegates_sorted_by_vote, sha256 random_seed) {

    // init
    srand(random_seed);
    vector<delegate_id> result;
    const int lower_half = floor(NUM_DELEGATES / 2);
    const int upper_half = ceil(NUM_DELEGATES / 2);
   
    // sort top_101_delegates_sorted_by_vote by delegates
    sort(top_101_delegates_sorted_by_vote.begin(),top_101_delegates_sorted_by_vote.end());

    // prefill with empty/invalid delegates
    for (int i = 0; i < NUM_DELEGATES; i++) {
        result.push_back(INVALID_DELEGATE);
    }

    vector<delegate_id> constrained_delegates;

    // find the delegates, which are constrained by the n/2 distance and are at top_101_delegates_sorted_by_vote so should be placed in the result
    for (int i = NUM_DELEGATES; i > lower_half; i--) {
        int actual = binary_search(top_101_delegates_sorted_by_vote, prev_delegate_order[i]);
        if (actual != -1) {
            top_101_delegates_sorted_by_vote.erase(top_101_delegates_sorted_by_vote.begin() + actual);
            constrained_delegates.push_back(prev_delegate_order[i]);
        }
    }

    // init free slots for constrained delegates
    vector<int> free_slots;
    for (int i = 0; i < upper_half; i++) {
        free_slots.push_back(NUM_DELEGATES - 1 - i);
    }

    // fill the result with constrained delegates. Each of them has n/2 possible locations
    for (int i = 0; i < constrained_delegates.size(); i++) {
        int uniform_rand_free_slot = rand() % free_slots.size();
        result[free_slots[uniform_rand_free_slot]] = constrained_delegates[i];

        // erase used slot
        free_slots.erase(free_slots.begin() + uniform_rand_free_slot);

        // add new slot, because next delegate's constraint is lower
        free_slots.push_back(lower_half - i);
    }

    // fill free slots for the rest of the delegates
    for (int i = lower_half - constrained_delegates.size(); i > -1; i--) {
        free_slots.push_back(i);
    }

    // place the rest of the delegates. i-th delegate has X possible locations, where X = NUM_DELEGATES - constrained_delegates.size() - i
    for (int i = 0; i < top_101_delegates_sorted_by_vote.size(); i++) {
        int uniform_rand_free_slot = rand() % free_slots.size();
        result[free_slots[uniform_rand_free_slot]] = top_101_delegates_sorted_by_vote[i];
        free_slots.erase(free_slots.begin() + uniform_rand_free_slot);
    }

    return result;
}

void print_vec(vector<delegate_id> vec) {
    for (int i = 0; i < vec.size(); i++) {
        printf("%d ", vec[i]);
    }
    printf("\n");
}

int binary_search(vector<delegate_id> sorted_vec, delegate_id wanted) {
    int lower_bound = 0;
    int upper_bound = sorted_vec.size() - 1;
    while (lower_bound < upper_bound) {
        int mid = (lower_bound + upper_bound) / 2;
        if (wanted > sorted_vec[mid]) {
            lower_bound = mid + 1;
        } else {
            upper_bound = mid;
        }
    }
    if (sorted_vec[lower_bound] != wanted) {
        lower_bound = -1;
    }
    return lower_bound;
}

vector<delegate_id> delegate_shuffle_linear(vector<delegate_id> prev_delegate_order, vector<delegate_id> top_101_delegates_sorted_by_vote, sha256 random_seed) {

    // init
    srand(random_seed);
    vector<delegate_id> result;
    const int lower_half = floor(NUM_DELEGATES / 2);
    const int upper_half = ceil(NUM_DELEGATES / 2);
    std::set<delegate_id> remaining(top_101_delegates_sorted_by_vote.begin(),
            top_101_delegates_sorted_by_vote.end());

    // prefill with empty/invalid delegates
    for (int i = 0; i < NUM_DELEGATES; i++) {
        result.push_back(INVALID_DELEGATE);
    }

    vector<delegate_id> constrained_delegates;

    // find the delegates, which are constrained by the n/2 distance and are at top_101_delegates_sorted_by_vote so should be placed in the result
    for (int i = NUM_DELEGATES; i > lower_half; i--) {
        set<delegate_id>::iterator actual = remaining.find((delegate_id) prev_delegate_order[i]);
        if (actual != remaining.end()) {
            remaining.erase(actual);
            constrained_delegates.push_back(prev_delegate_order[i]);
        }
    }

    // init free slots for constrained delegates
    vector<int> free_slots;
    for (int i = 0; i < upper_half; i++) {
        free_slots.push_back(NUM_DELEGATES - 1 - i);
    }

    // fill the result with constrained delegates. Each of them has n/2 possible locations
    for (int i = 0; i < constrained_delegates.size(); i++) {
        int uniform_rand_free_slot = rand() % free_slots.size();
        result[free_slots[uniform_rand_free_slot]] = constrained_delegates[i];

        // erase used slot
        free_slots.erase(free_slots.begin() + uniform_rand_free_slot);

        // add new slot, because next delegate's constraint is lower
        free_slots.push_back(lower_half - i);
    }

    // fill free slots for the rest of the delegates
    for (int i = lower_half - constrained_delegates.size(); i > -1; i--) {
        free_slots.push_back(i);
    }

    // place the rest of the delegates. i-th delegate has X possible locations, where X = NUM_DELEGATES - constrained_delegates.size() - i
    for (set<delegate_id>::iterator it = remaining.begin(); it != remaining.end(); ++it) {
        int uniform_rand_free_slot = rand() % free_slots.size();
        result[free_slots[uniform_rand_free_slot]] = *it;
        free_slots.erase(free_slots.begin() + uniform_rand_free_slot);
    }

    return result;
}

24
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 08, 2015, 09:10:25 am »
1) and 3) are easily evaluated empirically.
2) needs to be better defined.

Actually I think 2) is pretty clear. With 1) and 3) I can not help that much, because c++ is not my native programming language. From algorithmical point of view the only unpredictable part of my code is the intersection of the set of constrained delegates and the top_101_delegates_sorted_by_vote. You never know, how big the intersection will be. But I agree, that it could be computed in a more efficient way. Top_101_delegates are sorted, so we could use binary search for the lookup instead of find(), which has linear complexity. It would have to be tested, because I am not sure if my implementation of binary search on just 101 elements will beat native find, however it has worse asymptotic complexity.

From the c++ implementation point of view there also might be a better approach of tracking unused indexes in the result. I like the free_slots in my implementation, because it allows not only the tracking, but also generating the correct random index.


Edit: Hehe, delegates are sorted by votes, not id :) Still it might be reasonable to sort them by id in order to speed up their lookup. But this really depends on implementation- and number of delegates..

Edit2: To sum up the worst case analysis for intersection, we have (n * n/2) complexity with linear find, which gives 5101 operations for 101 delegates. With logarithmic find it's n*log n + n/2 * log n , which gives approx 304 operations. This might be worth the try.

25
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 07, 2015, 11:45:27 pm »
Ok, I finally got to implement my former idea.

I separate the delegates to those which are constrained by the n/2 condition and to the rest. Each constrained delegate is placed to a random place chosen out of n/2 allowed positions (which is the max randomization allowed by the constraint). i-th unconstrained delegate can be placed at X positions, where X = NUM_DELEGATES - NUM_CONSTRAINED_DELEGATES - i (which is the classical way of generating permutations, so it is also optimal). I also account for the fact that delegates to be shuffled can (but don't have to) be different than the previous delegates.

Code: [Select]
/*
 * File:   main.cpp
 * Author: Hrossik
 *
 * Created on April 7, 2015, 11:27 PM
 */

#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>

#define NUM_DELEGATES 101
#define INVALID_DELEGATE -1
#define delegate_id int64_t
#define sha256 int

using namespace std;

vector<delegate_id> delegate_shuffle(vector<delegate_id>, vector<delegate_id>, sha256);
void printVec(vector<delegate_id>);

vector<delegate_id> delegate_shuffle(vector<delegate_id> prev_delegate_order, vector<delegate_id> top_101_delegates_sorted_by_vote, sha256 random_seed) {

    // init
    srand(random_seed);
    vector<delegate_id> result;
    const int lower_half = floor(NUM_DELEGATES / 2);
    const int upper_half = ceil(NUM_DELEGATES / 2);
    std::set<delegate_id> remaining(top_101_delegates_sorted_by_vote.begin(),
            top_101_delegates_sorted_by_vote.end());

    // prefill with empty/invalid delegates
    for (int i = 0; i < NUM_DELEGATES; i++) {
        result.push_back(INVALID_DELEGATE);
    }

    vector<delegate_id> constrained_delegates;

    // find the delegates, which are constrained by the n/2 distance and are at top_101_delegates_sorted_by_vote so should be placed in the result
    for (int i = NUM_DELEGATES; i > lower_half; i--) {
        set<delegate_id>::iterator actual = remaining.find((delegate_id)prev_delegate_order[i]);
        if (actual != remaining.end()) {
            remaining.erase(actual);
            constrained_delegates.push_back(prev_delegate_order[i]);
        }
    }

    // init free slots for constrained delegates
    vector<int> free_slots;
    for (int i = 0; i < upper_half; i++) {
        free_slots.push_back(NUM_DELEGATES - 1 - i);
    }

    // fill the result with constrained delegates. Each of them has n/2 possible locations
    for (int i = 0; i < constrained_delegates.size(); i++) {
        int uniform_rand_free_slot = rand() % free_slots.size();
        result[free_slots[uniform_rand_free_slot]] = constrained_delegates[i];

        // erase used slot
        free_slots.erase(free_slots.begin() + uniform_rand_free_slot);

        // add new slot, because next delegate's constraint is lower
        free_slots.push_back(lower_half - i);
    }

    // fill free slots for the rest of the delegates
    for (int i = lower_half - constrained_delegates.size(); i > -1; i--) {
        free_slots.push_back(i);
    }

    // place the rest of the delegates. i-th delegate has X possible locations, where X = NUM_DELEGATES - constrained_delegates.size() - i
    for (set<delegate_id>::iterator it = remaining.begin(); it != remaining.end(); ++it) {
        int uniform_rand_free_slot = rand() % free_slots.size();
        result[free_slots[uniform_rand_free_slot]] = *it;
        free_slots.erase(free_slots.begin() + uniform_rand_free_slot);
    }

    return result;
}

26
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 07, 2015, 04:18:09 pm »

0 ->{0, 100}
1 ->{0, 100}
...
50 ->{0, 100}
51 ->{1, 100}
...
99 ->{49, 100}
100 ->{50, 100}

Yes, I have exactly this on my mind, except for you start from the end.
If we have the previous order a, and the next order b, then we do this mapping f:
f: a_100 -> <b_50, b_100>
a_99 -> <b_49, b_100> \ f(a_100)
...
a_(n-x) -> < b_(n/2 - x + 1), b_(n-1)> \ all previously generated fs
a_0 -> <0, b_(n-1)> \ all previously generated fs

where "\" is the set subtraction.

You have a probability 2/n for the first half of the elements. For the other half the probability follows the geometric serie with quotient 1/2. With element a_0 having only one number to map to => probability = 1.

I am not sure yet, but it also looks like a proof you can't find any better algorithm for it.

I am leaving from work now and don't have time to put it to code... Can do it later, if it is desirable.

27
General Discussion / Re: Shuffle Bounty $200 BitUSD
« on: April 07, 2015, 03:49:11 pm »
(...) it means that you require |n - m| >= N/2 = 101/2 = 50.5?

I understood it the same way at the beginning and came to the same conclusion - it's impossible to make the shuffling random this way.

However, I think BM meant the word "distance" this way: If a delegate X has index i in the previous order and index j in the next order, then | (n - i) + j | >= n/2. Imagine it as 2 sequences one after another and there should be a gap of n/2 other delegates before X can go again.

28
General Discussion / Re: Don't Rush to Register Your Identity
« on: April 02, 2015, 10:47:23 am »
The point is that they would have to put something at risk which to you is of equal value to the information they possess.

What will happen if the value of the information changes? You have no way of restoring the equilibrium, unless the other party is willing to increase their stake, which might not be the case.

29
This referal program would make it so easy to earn money in a way so different from the original idea of BitShares, that its ponziness would defeat BitShares' original purpose. Yes, it would probably bring many new people to the system. But what kind of people? People, who will suddenly realize how good BitShares are, or people who just want to get rich on the referal program?

From wikipedia:
Quote
Ponzi schemes occasionally begin as legitimate businesses, until the business fails to achieve the returns expected. The business becomes a Ponzi scheme if it then continues under fraudulent terms. Whatever the initial situation, the perpetuation of the high returns requires an ever-increasing flow of money from new investors to sustain the scheme.

I would prefer to stick to the original values we wanted to promote, not the "get rich fast" values. Once the original ideas get implemented, we will earn profit from the right thing instead of this obscure mechanism.

30
They are working with Ethereum...

http://www.augur.net/blog/why-ethereum

Pages: 1 [2] 3