Bitcoin Forum
February 22, 2020, 11:18:58 AM *
News: Latest Bitcoin Core release: [Torrent]
  Home Help Search Login Register More  
  Show Posts
Pages: [1] 2 3 4 »
1  Economy / Gambling discussion / How fair is Provably Fair? Do you verify every bet as a gambler? on: February 21, 2020, 04:56:25 PM
Provably Fair Script is one of the basic element of online gambling, especially for crypto based casinos. However, most of the gamblers don't give dime about it while some don't even know what is it and how it operates. I started crypto gambling in 2016 and didn't know about Provably Fair for most of my initial gambling days. But believe me in the absence of Provably Fair, you are not gambling, you are just being cheated by the house.

The basic idea of this thread is to share my views on PF script and how to make most out of it. I have spent few weeks developing unique logic for Provably Fair script for upcoming gambling site clubbing it with blockchain technology. While developing it, I visited around 20 casinos and tried their PF script to understand current practice. However, this thread is not about my script but about current practice.

If you are in this section, you probably have heard about Provably Fair script and may be verifying your bets too. But have you ever tried to understand the logic behind it? If not, let me give a brief explanation on how Provably Fair system works.

Different gambling sites use different Provably Fair implementation however the basic idea is to generate a random number based on three factors: client seed, server seed and nonce.

Client seed: It can be anything. It is up to player to choose anything as his client seed. For example, I can use 'webtricksClientSeed' as my client seed or 'thisIsMyRandomClientSeed'. However, while choosing client seed make sure three things:
(i) Always choose new seed for new bet (never try same client seed with new server seed).
(ii) Don't choose easily identifiable seeds like I mentioned above (close your eyes and type random numbers and alphabets. I do like this and it works Cheesy).
(iii) Site will generate random client seed for you but don't use it. Always choose your own.

Server Seed: It is generated by server. Server will choose random string of random length and convert it to sha256 hash which will provided to you. For example, if server picks 'thisIsRandomSeed' as server seed then this will be provide you: 45006cccc7e44ee0b6c0752469de2fe1ad6bff589fb789bfb60773224cf2cc0a.
Since sha256 is one-way hashing you will know sha256 hash before making bet but you cannot decipher server seed before betting. The site will show you unhashed server seed once you change your seeds. Then you can verify that the sha256 hash of server seed is similar to what was presented to you before bet.

Nonce: In context of Provably Fair, nonce is mostly regarded as the number of times you have made bet with the combination of same client and server seed. For example, if I make two bets with 'ClientSeed' as client seed and 'ServerSeed' as server seed then the result of bet will be generated on the basis of 'ClientSeed+1+ServerSeed' for first bet and 'ClientSeed+2+ServerSeed' for second bet.

Here is graphical illustration of what I just said:

(Some people say my drawings are as good as Picasso's.)

Now coming to how results are driven from these seeds. As I said earlier, different sites use different logic to determine result. However, there is one basic logic which is being used by around 80% of the casinos, notably Fortunejack, PrimeDice, Bitsler etc. This is how it works:

Step 1: First of all let's assume three variables. Server seed = 'ServerSeed', client seed = 'ClientSeed' and nonce = 1. Now we have to use hmac authentication by hashing our variables using sha512 hashing algorithm. Server seed will serve as a secret key to generate hash while client seed and nonce will be used as an input like this: 'ClientSeed-1' or 'client seed - nonce'.

Step 2: So the hash of the above seeds will look like this: 671e7387e26fa724d089521805430866b29f6849ad2928a26e5ed01101f72f57883b972f20f9464 d99ab13c2adcf37bd955863c69697739628d70969adba1ab3

Step 3: Not going into technical term and by simply sticking to layman's language, we have to take first 5 characters of hash i.e. 671e7. Now we have to convert these 5 characters from hex value to integer value which will be: 422375.

Step 4: If the integer value is between 0 and 1million (1,000,000) then it's ok. But if it is more than or equal to 1M then we will use next 5 characters from hash. But since in our case, 422375 is less than 1000000 so this number will determine the result.

Step 5: In this step, we will simply divide the value with 10000 and take the remainder for next step. In our case, 422375 when divided by 10000 will leave 2375 in remainder which will be consider for final step.

Step 6: In this step, we will simply divide the remainder by 100 and this will determine the final result. In our case it will be 23.75. This should match the dice roll. If not then site is most probably cheating you.

Now coming to the most important part. Probably this part is the main reason why I created this thread. Although, the above system is foolproof but site owners can easily fool you if you ain't paying enough attention. So here are the few points you should consider while gambling:

(i) Always copy server seed hash shown to you before betting.
(ii) After bet is complete, create new client seed. Make sure server seed is also changed along with it.
(iii) Once new client seed is created, site will show you unhashed server seed of previous bet. Copy it and convert it to sha256 hash using some third party online tool.
(iv) Match the server seed hash that you copied in step (i) to the one generated in step (iii) and make sure both are exactly same.

Two days ago, I tested my code with few people. I shown them different server seed hash before bet and after bet I kept first 6 characters same, last 3 characters same and few similar characters in the middle. It took just 30-40 seconds for my machine to generate such hash. With more powerful machine, I can speed up the process and create more matching characters. To my surprise, none of the tester noticed that they were shown different server hash before and after bet. It is human tendency that they only consider few letters (probably starting and ending ones) when presented random word like hexadecimal hash. So with bare eyes, no one was able to notice the difference. So be safe and make sure you verify every bet you make. Being a coding enthusiast, I can assure you that it is very much possible that house can easily manipulate results without player even noticing.

Another thing you can do is to use cross-casinos verification. For example, Fortunejack and Bitsler use same script, you can verify your fortunejack bets using bitsler's verification script.
2  Local / India / Binance finally integrated WazirX P2P (How good is it?) on: February 17, 2020, 06:33:45 AM
Hello guys,

So this morning I received a mail from Binance stating that they finally integrated much-awaited WazirX P2P on their site. Now it was time to test what benefits we gonna get from this hot acquisition.

So first step is to connect WazirX account with Binance account. This step is quite simple, you just have to click 'WazirX Wallet' from 'Wallet' dropdown in the menu like this image below:

Then you will be redirected to WazirX website. Here you will be asked to login with your Binance account. But since you are already logged in with Binance, you just have to click proceed and enter WazirX 2FA authentication code if you set any. That's it. First step is done.

Next step involves sending USDT from Binance to WazirX. Once again, click 'WazirX Wallet' from the menu and you will redirected to a form. You just have to mention the amount of USDT you want to send to WazirX then fill 2FA code if any and finally confirm withdrawal request email confirmation.

Here comes the magic part. You will receive exact USDT as you requested in a fraction of second (almost immediately) in your WazirX account.

So the biggest takeaway from this integration is that now we Indians can sell range of cryptos with high liquidity on Binance and then send the USD to WazirX at zero fees almost immediately where we can finally convert USDT to INR at good rates.
3  Other / Beginners & Help / How Bitcoin Addresses are generated? Understand the Math behind Bitcoin on: February 04, 2020, 05:05:40 PM
How Bitcoin Addresses are Generated

This thread will only cover P2PKH address i.e. the bitcoin address starting with '1', also known as Legacy Address. I will create another thread in future about how to create P2SH or Bech32 addresses.

Ok! So let's start with the topic. To use Bitcoin, user generally needs two keys: Private Key and Public Key. Public Key is the key that is shared to the sender and the world. Example: 18J6ai34uzGofUuzbiwhXJzKzdx1efDBqA. Whereas Private Key is the key which is used to access the funds received on Public Key.

You may be already knowing what I have just said above. But did you ever wonder how these pair of keys are generated? Let's dive deep into topic and create our own code for generating key pair. The main and the most important component of Bitcoin Address is Private Key. Let's discuss it first:

Private Key

In simple words, anything can be private key if it fulfills two conditions. Condition one, it must not be 0. Second, it must be lower than the value of N defined by SECG for secp256k1 curve. However, the value of N is very, very large so practically every 256-bits number is valid private key.

Now the question arises how to generate private key. As I said in the starting that anything can be private key. For example, this string: "I am a string to generate private key" can be converted into private key. All you have to do is, to convert this string into 256-bits value and check if it is lower than the N.

But is it suggested to generate private key this way? Actually no! It is popular saying that human is the worst random generator. If we use custom strings or numbers like this, it may be possible that someone else uses the exact same string which may result into compromise of private key. So better be safe than sorry and only rely on random generators to generate private key.

But again another problem arises. Most of the generators such as Math library of Javascript (Math.random() function) use fixed patterns to generate random number. So using such generators will generate more miseries than keys.  Cheesy

So what is the ultimate solution? The best way is to use the keys generated by wallets but if you want to independently dive into the quest, use secure generators like this one:  strong pseudorandom generator.

Enough said on private keys, let's go to and generate an address. First we will create address on and then try to create the same through our own code to learn the mathematics behind key generation.

Here is the key pair I generated. You may find that there are more than one format for both public key and private key. Let's discuss about them in brief before jumping to the coding part:

1. Public Address

This is the P2PKH format of public key. It is widely used for sending/receiving bitcoins. There are various rounds of different hashing algorithm involved to generate P2PKH key from hex of public key. We will try to achieve that later in this thread with real code.

2. WIF Private Key

WIF or Wallet Import Format is the format of private key in which wallets such as Electrum import private key. If you paste the bare hex of private key then Electrum won't open the wallet. You have to convert private key into WIF format to use it in wallets. We will write code to convert private key into WIF too.

3. Uncompressed Public Key

Ok! So I haven't discussed so far how public key is generated. The process is actually complex. We take a special generator point defined as G by SECG which is located on secp256k1 curve i.e. one of the elliptic curve. Then we multiply this generator point with private key. The resulting multiplication will give us two coordinates, one is X and the other is Y. Uncompressed Public Key is nothing but : 04 + X + Y. So first two numbers of public key are 04 which signifies that key is uncompressed. Next 64 characters (32 bytes since every 2 characters of hex make 1 byte) are X coordinate and last 64 characters (32 bytes) are Y coordinate. Total length of uncompressed public key is 130 or 65 bytes.

4. Compressed Public Key

Since, it is possible to find Y coordinate if X coordinate is given. So we generally drop the Y coordinate from our public key. Hence, last 64 characters are removed. As a result, compressed public key is made up of 66 characters (32 bytes). First two characters can be either 02 or 03 (instead of 04) and the next 64 characters (32 bytes) will be X coordinate. If the value of Y coordinate is even then 02 is put. If the value of Y coordinate is odd then 03 is put. In the above photo, the value of Y-coordinate was odd so we have 03 in our key.

5. Private Key Hexadecimal Form

As we discussed earlier the private key must be 256-bits or 32 bytes (8 bits = 1 byte) which is when converted into hexadecimal form is of 64 characters. So you can convert any value into hex and it will be of 64 characters. This is very handy for our bitcoin code because we will use hex form of private key to start generating key pair. So as I was saying earlier that we can even use strings like "I am a string to generate private key" to generate private key, so here is the secret. We will first convert such strings into hex and then use 64 characters of hex to generate key pair.

6. Private Key Base64 Form

Not very popular format of private key. But we can even encode/decode our private key into Base64 using native conversion.

Enough for the head start. Now let's dive straight into code and generate the above key.

As I am fan of Javascript (because I think it is the easiest programming language and can be used in full-stack development), I will be using JS in Node.JS environment for this guide. But if you are comfortable with other language then you can easily interpret my JS code into your code. At last, if you aren't comfortable with coding at all then leave that, just read the text and pictures below and I promise you will have the best idea on how keys are generated.

Before starting let's prepare the setup. First step is to create a folder. Inside folder create a file with .js extension. File name can be anything like index.js or app.js.
Next step is to download node.js on your computer. It is very easy to download node.js, it is similar to downloading any other computer software. Next step is to download some code editor, I suggest Visual Studio Code (easy to use IDE).

Once the above steps are done, open the folder in Visual Studio Code and head to your terminal. There is inbuilt terminal in Visual Studio Code, you can use that too. If not, you can use native terminal of Mac or Windows but make sure you have opened the folder in terminal. Once folder is opened in both Visual Studio Code and terminal, run the following commands in terminal to install 2 dependencies for the project:

npm init -y
npm i ripemd160 --save
npm i bs58 --save

We need three hashing functions in our code namely sha256, ripemd160 and base58 apart from elliptic curve cryptography. sha256 is already present in native crypto library of nodejs. We can either code other two on our own or just import them. For the simplicity of this guide, we installed ripemd160 and bs58 npm packages above and will use these in our code. I have verified the source code of both packages and it's completely safe to use these in code.

Now let's start the real fun. Open your file and start with the code. The code is in chronological order. The Step 1 code will go at the top of file and step 2 code will start where step one code ends and so on:

Step 1. Creating hashing functions

const crypto = require('crypto');
const RIPEMD160 = require('ripemd160');
const BS58 = require('bs58');

const sha256 = input => crypto.createHash('sha256').update(input).digest();

const ripemd160 = input => new RIPEMD160().update(input).digest();

const bs58 = input => BS58.encode(input);

Ok! So in first three lines of code, we have imported the code of all three hashing functions in our file. Next, we created functions for these. It is not mandatory to create functions but in that case we have to write whole code again and again whenever we need to hash something. For example, if we don't write these three functions then every time we have to create sha256 hash of something we have to write crypto.createHash('sha256').update(something).digest() but with above code, we just have to write sha256(something) from next time. Cool? Let's move forward.

Step 2. Creating Elliptic Curve Function

const generateECPoints = privateKey => {


    const Gx = BigInt('55066263022277343669578718895168534326250603453777594175500187360389116729240');
    const Gy = BigInt('32670510020758816978083085130507043184471273380659243275938904335757337482424');

    const G = [Gx, Gy];

    const modInverse = (a, n) => {

        a = (a % n + n) % n

        const dArray = [];
        let b = n;

        while(b) {
        [a, b] = [b, a % b];
        dArray.push({a, b});

        if (a !== BigInt(1)) {
        return null;

        let x = BigInt(1);
        let y = BigInt(0);

        for(let i = dArray.length - 2; i >= 0; --i) {
        [x, y] = [y,  x - y * BigInt(dArray[i].a / dArray[i].b)];

        return (y % n + n) % n;

    const modOf = (a,b) => {
        const r = ((a % b) + b)% b;
        return r;

    const ECAdd = (a,b) => {
        const lamAdd = modOf((b[1] - a[1]) * BigInt(modInverse(b[0] - a[0], Pcurve)), Pcurve);
        const x = modOf((lamAdd*lamAdd - a[0] - b[0]), Pcurve);
        const y = modOf((lamAdd*(a[0] - x) - a[1]), Pcurve);
        return [x, y];

    const ECDouble = a => {
        const lamda = modOf(((BigInt(3)*a[0]*a[0])*(modInverse(BigInt(2)*a[1], Pcurve))), Pcurve);
        const x = modOf((lamda*lamda - BigInt(2)*a[0]), Pcurve);
        const y = modOf((lamda*(a[0] - x) - a[1]), Pcurve);
        return [x, y];

    const ECMultiply = (genPoint, pvtKey) => {
        const scalarBinary = BigInt('0x'+pvtKey).toString(2);
        let GP = genPoint;

        for (let i=1; i < scalarBinary.length; i++) {
            GP = ECDouble(GP)
            if (scalarBinary[i] === '1') {
                GP = ECAdd(GP, genPoint);
        return GP;
    return ECMultiply(G, privateKey);

The above code is my version of Elliptic Curve Multiplication. This maybe only pure Javascript coding of elliptic curve you will find on the entire internet. I think it would be inappropriate to explain the whole above code in this thread as the main motive of this thread is to generate key pair. So for now use the above code as it is. I will create separate thread for Elliptic Curve Cryptography after 3-4 days and explain the same above code in that thread. 

Step 3. Generating X and Y coordinates of Public Key from above function and Private Key

const privateKey = "6EBD5FAB742ED0734B37C63BD2A3CE8797FE4AC63C9A99781F8BEDDF6307094E";
const publicKey = generateECPoints(privateKey);

In this step we have taken the hex value of private key (5th item from the image) and put it in generateECPoints function as created in Step 2. This will give us X and Y coordinates of Public Key which will look like this:
[26552980488606060638326679080566574626825610331305555186819497546906082384636n, 106820354128014061768597493909158935631153585355120117243602895828064095418195n]

You may notice n at the last of each coordinate. This n means we are dealing with extra large numbers here, known as Big Integers in Javascript. Also you may notice that these coordinates are not matching the X and Y in the image above. Well, we have generated numbers for now. We have to convert these into hexadecimals to get uncompressed key and compressed key. Let's do that in next step.
4  Other / Meta / The state of Euphoria has been hit by YoBit Participant! on: January 27, 2020, 03:07:54 PM
So today is the last day of YoBit Campaign, I understand the excitement participants have to earn the last bit of money before the campaign is closed. But this user hit the whole new level of euphoria and thought it would be great idea to reply to this 9 years old post:

YoBit campaign and its wonderful participants will be missed.  Embarrassed

PS: I myself did YoBit campaign for few weeks so no offense to legit participants.  Smiley
5  Other / Beginners & Help / How to create Blockchain? Build your own chain (Easy-Peasy Guide) on: January 17, 2020, 01:11:14 PM
Header designed by: HBKMusiK                               

You may have read lots of theoretical posts on how cryptocurrencies work, how blockchain works and several other related concepts like Proof of Work, sha256. etc. But such theoretical posts can only give you basic idea about working and lots of things still remain mystery to you. So, the goal of this thread is to give you firsthand experience about how Blockchain works using real coding.

Before I start the guide, I would like to clear few things:

First, this thread is for learning purpose only. The code below is not production ready and have several vulnerabilities. If you plan to use it for production, make sure to contact me first and I will tell you the necessary additions you have to make in order to make it ready for production.
Second, this guide will use Javascript/Node.JS environment so if you have basic idea about how Javascript works then this guide is cake-walk for you. If not, even then you can learn so much as I tried to remain as descriptive as possible. But if you get stuck somewhere, just PM me or post here and I will solve every doubt I receive. Enough said, let's start:


Part 1(a): Constructor Class

Ok! So block as we all know is fundamental unit of Blockchain. Series of interconnected blocks make blockchain. Let me give you an example: Suppose 10 children are playing in a park. Each one of them is holding the hand of another child thus forming the structure of human chain, children on both extreme ends will be holding the hand of one other child while rest 8 will be holding the hands of 2 children, one on each side. Blockchain works on the same concept. The first block of the chain (known as genesis block) will be holding the hand of second block only while the most recent block will be holding the hand of last second block only. All the other blocks will be holding the hands of blocks previous and next to them.

A small pictorial representation of what I just said:

(I am bad artist, I know. Cheesy)

Ok! So now one thing is clear that every block must hold the hand of other block to form chain. In order to ensure that, blockchain uses the concept of hash and previous hash (I like to call it last hash). Every block has unique hash which is generated through SHA256 algorithm (will explain that in detail later). This hash act as the hand of every block. Second block will save hash of genesis block, third block will save hash of second block and so on...This brings us to the basic design of block, a block should have hash, lastHash (hash of previous block), data (something unique stored in block), timestamp (the timing of the creation of block) and nonce (will explain what nonce is with PoW). Before starting with the code, please make sure you have following things ready:

(i) install Node.js on your system
(ii) download any code editor (I would suggest Visual Studio Code)
(iii) create a new file with any name but with .js extension, example: app.js or index.js
(iv) open the file in visual studio code

Here comes the first snippet of code:
class Block {
    constructor(timestamp, lastHash, hash, data, nonce) {
        this.timestamp = timestamp;
        this.lastHash = lastHash;
        this.hash = hash; = data;
        this.nonce = nonce;

Boom! Here is the code for Part: 1(a). Now let me explain what we just did. Starting with the word 'class'. Class is actually a skeleton. We have created skeleton of name 'Block'. Like every human have same skeleton but different muscles and organs. Similarly, every block in the chain will have this Block skeleton. Timestamp, lastHash, hash, data and nonce are the bones. Every block must have these bones in order to form a skeleton. Moving forward, word 'constructor' refers to the function which will take the bones as input and create skeleton out of that. So we are actually inputting the value of timestamp, lastHash, hash, data and nonce into constructor function which in turn is setting the value of timestamp, lastHash, hash, data and nonce of Block’s instance equivalent to that.
Great? Let's move forward to Part: 1(b).

Part 1(b): Genesis Block

Here goes the code for Part: 1(b), this code will come after constructor function :
   static createGenesis() {
        return new this("17/01/2020", "dummy-last-hash", "dummy-hash", "data in genesis block", 0)

Great! So, let me tell you what we just did, we have created a static function in Block class which will create a genesis block for us. You may be noticing that we have created a hard-coded value for this block (anything inside '' " is string or hard-coded value, not code). We are doing this way because genesis block cannot have lastHash, so it is not viable to create hash for it, which makes it risky to store any data in genesis block. So, it is better if we define the properties of genesis block on our own and don't use it for any storage.

Moving forward, let me describe what above code is doing. Starting with the word 'static'. We can create two types of functions in class, normal functions and static functions. Normal functions could be used with every instance of class (for example, every block created with Block class can use normal function) but it is not possible to use static function with every instance. In our chain, we only want one genesis block so it would be bad if we create normal function for this. Therefore, static function will make sure that createGenesis() function can be called only once in blockchain.
You maybe noticing 'return' in the code above. Return actually means return (smart, ehh). It makes sure that whenever this function is called, the function returns the value of genesis block. 'new' refers to the instance of Block class. Whenever, we create instance of any class, we have to use new keyword. ‘this’ refers to Block class’s constructor. If we are using constructor within the class then we have to refer it with ‘this’.

Enough said, let’s move forward and create the most important function i.e. createBlock.

Part 1(c): Create Block function and Proof of Work
Code will go after createGenesis() function:
   static createBlock(previousBlock, data) {
        let hash, timestamp, nonce=0;
        const lastHash = previousBlock.hash;
        do {
            timestamp =;
            hash = hashGenerator(timestamp, lastHash, data, nonce);
        } while (hash.substr(0,4) !== ‘0’.repeat(4));
        return new this(timestamp, lastHash, hash, data, nonce);

Neat! Now time to understand what we did above. The function takes two inputs: previousBlock which is the block previous to the one we are creating and data i.e. the actual data we want to save in the block. Then, we are letting the starting value of hash = nothing, timestamp = nothing and nonce = 0. In Javascript ‘let’ and ‘const’ are two ways of defining variables. We refer variables that don’t change their value with ‘const’ and those which change their value by ‘let’. Next, we extracted the value of lastHash from previous Block which is equal to previousBlock’s hash.

Cool! Next comes the mighty concept of Proof of Work. We have tried to achieve it via do/while loop. ‘While’ part of the do/while loop takes condition and the loop keeps running the code in ‘do’ part until the condition in while statement fulfils. So the condition we mentioned in while statement is: hash.substr(0, 4) !== ‘0’.repeat(4). Now let’s break this statement. hash.substr(0,4) means first 4 characters of hash starting from 0 i.e. first character then second, third and fourth. ‘0’.repeat(4) means four zeros or ‘0000’. So we are actually stating that keep running the loop as far as first four characters of the hash are not 0. Once the first 4 characters of hash becomes 0, the loop will break and the resultant value will become the hash of the block. This is not exactly how proof of system works but basic idea is same. We are finding hash with four zeros in the starting like 0000vddvd5vd4dv5dvdXXXXXXXXXX. If you want to increase the difficulty of Proof of Work system, increase the number of zeros to 5 or more and blocks will be mined slower. If you want to lower the difficulty then reduce the number of zeros to 3 or lower and blocks will be mined faster.

Now coming to code inside ‘do’ statement. First is timestamp which we have taken equals to which is javascript function to generate current date. Next is nonce. Nonce is the number which keeps on incrementing by 1 at every loop so that the value of hash keeps changing, if nonce remain stagnant then it is not possible to generate new hash at every loop. The final thing in the code is hashGenerator which intakes the value of timestamp, lastHash, data and nonce and generate hash by combining all the 4 values as a single string using sha256 algorithm. We will write hashGenerator function in next part. Let’s move to it.

Part 1(d): SHA256
Let’s write the code first, this will go at the top of the file before Block class:
const crypto = require(‘crypto’);
const hashGenerator = (...inputs) => {
    const hash = crypto.createHash(‘sha256’);
    hash.update( => JSON.stringify(item)).join(‘’));
    return hash.digest(‘hex’);

Lovely! Time for explanation. Crypto is in-built library of Node.js. So, we have simply called it into our file by requiring it. Next comes hashGenerator function. First, we are taking inputs i.e. if you remember from Part: 1(c) are timestamp, lastHash, data and nonce. Next you must be noticing three dots in front of inputs. Those dots aren’t by mistake, these dots convert all 4 inputs into Array like this: [timestamp, lastHash, data, nonce]. Bingo! Now let’s enter into the hashGenerator function. In first line we defined the value of hash equals to createHash(‘sha256’) function of crypto library. Then we are inputting each item of inputs Array through update method. We first mapping over inputs array which means looping over item of array, converting every item to string through JSON.stringify method and then joining everything as single string. Finally, we are returning the value of function through digest method but first converting generated value from line two to hex.

If you are having hard time understanding hashGenerator function then don’t worry, it’s because we have used the native syntax of crypto library and which is different from generic Javascript syntaxes.

This brings us to the end of first part of our two parts guide on creating Blockchain. We have successfully created Block class. Next we will create Blockchain class and add blocks to our blockchain.
6  Bitcoin / Bitcoin Discussion / How would you define Blockchain Technology in a single phrase? on: January 07, 2020, 03:34:00 PM
Most of the people had their first encounter with blockchain technology only after they started using cryptocurrencies like Bitcoin. Many of the crypto users are still buying/selling or investing in cryptocurrencies without having slightest idea about what blockchain technology is and how it works.

In my opinion, every forum member should learn and understand about blockchain technology and thereafter contribute to this decentralized revolution by building something new. Why should we all stop at Bitcoin, right?

But more importantly, I want to know how you guys treat Blockchain Technology. The answer to this very specific question will determine what the future of blockchain tech will be. So vote in the poll. If you have any other definition then feel free to elaborate in a reply.
7  Bitcoin / Bitcoin Technical Support / A question regarding Timestamp on: January 01, 2020, 06:36:17 AM
As we all know nonce is the number that keeps on changing until the hash generated with the joint string of nonce and other block data matches the target difficulty requirement.
Other block data such as data, last hash and difficulty remain constant but what about timestamp? Does timestamp also changes alongside nonce at every iteration until required hash is found or it remains constant?
8  Other / Meta / Demanding additional [li] tags in list !! on: December 25, 2019, 04:35:18 PM
I mean seriously! Just 2!  Angry Angry
Why would I create a list for just 2 items!
Increase it to 4 at least.

Reason for demand:
  • 1. Because I am too lazy to type/paste more.
  • 2. Because it's Christmas

Wait! Did I just create list with two items?
9  Local / India / People pay your Taxes - 2.0 on: December 03, 2019, 04:48:10 PM

People Pay Your Taxes - v2.0
Details on taxation of Bitcoin in India

This thread is a newer version of old thread which can be found here. As Crypto Economy has grown exponentially in last few years, a thread was needed with much more detailed information about taxation than the last one so here it is.

I will start the thread with the rule of thumb:

"Since bitcoin has no legal/illegal status in India, you don't have to pay tax on keeping/holding bitcoin. You may have 0.001 or 100 BTC in your wallet but no tax to be levied as far as amount is kept in the form of Bitcoin. Bitcoin is currently considered at par with securities such as shares for taxation purpose.

So when tax has to be paid?

Whenever you convert your crypto holding to Indian Rupee and you have made some profit/income, you have to pay tax. As simple as this. For more clarification, check image below:

Note: You have to file return irrespective of whether you made profits or not. Paying tax and file return are not the same thing.

Ok! So we have discussed when to pay tax, now is the time to discuss how and how much tax to pay. In order to discuss that we first have to ascertain various instances or possible scenarios where one make income or profits in bitcoin (or altcoins).

Case 1 (rarest case): I receive salary in Bitcoins
You may be receiving salary in Bitcoin either from local business or foreign business. If local business is paying you salary in Bitcoins, there can be two possibilities - business claims same as expense in its books or it doesn't show salary paid as expense. The treatment done by business will directly impact your treatment. In case business claims salary paid as expense, it has to pay ESI/PF (if applicable) and deduct TDS (if applicable). If business does so, you too have to file income as 'Income under the head Salary'. Calculate tax applicable as per basic slabs and minus TDS deducted by your employer. In ninety nine percent cases, you tax payable will come 0 and you just have to file nil return if you don't have any other income.
If your employer doesn't claim salary paid as expense or you receive salary from foreign employer, don't file the income under the head Salary. Rather treat the same as freelancing treatment. I will discuss this in detail in few seconds.

Case 2 (common case): I earn Bitcoins from Sig Campaigns, Bounties, misc. sources
Well, this case covers me and most of the members here. You may be receiving signature payments, campaign management payments, ambassador payments, social media payments and what not. Just remember one thing - this is your freelancing income and you are professional. You have to show it as Technical Consultancy/Marketing business under 'Profit and gains from business and profession'. This way you can take advantage of Section 44ADA of Income Tax. Section states that you don't have to maintain any record or books. Just consider your total receipts and pay tax on minimum 50% of your receipts.
Example: I withdrew Rs. 10,00,000 during the financial year in my bank. Then I will show Rs. 10,00,000 as receipts from my consultancy business. As per Section 44ADA, I have to show my profits to be Rs. 5,00,000 or more (52-55% recommended), let say I show profit to be Rs. 5,20,000. Then I have to pay tax on Rs. 5,20,000 which will be around Rs. 14,000 or zero if I claim deductions of Rs. 20,000 or more (such as LIC premium paid, etc.).

Case 3 (most common case): I earn profits by buying/selling Bitcoins (or Altcoins)
So the largest portion of Indians associated with Bitcoins are those who invest in Bitcoins. You purchase Bitcoins from your bank, sell those, make profits and withdraw that to bank. Now investors can be of two types - Core Investors or Traders. Core Investors occasionally buy/sell Bitcoins, let's say I bought Bitcoins 8 times during last financial year and sold 4 times. Whereas traders are those who are continuously buying/selling Bitcoins, say 5-10 times in a day. If you are core investors - show your profits under the head Capital Gains. It can be long-term or short-term depending upon your holding duration. In case your made loss (when you bought high and sold for less), you need not pay tax. However, you have to file return with nil tax.
If you are trader, better show your profits under the head Profit and Gains from Business and Profession as calculating capital gains on such large number of transactions will be very tedious. So what you have to do, prepare your account books, treat all your buy transactions as purchases, treat all sell transactions as sales, you can also claim expenses like electricity, accounting charges, depreciation on laptops/mobiles, internet charges, etc. Ascertain your final profit and pay tax on the same as per basic slabs.


(I will list more FAQs as they are asked in this thread here)

Q1. I am already in employment or a government employee, am I allowed to show my signature earnings as profit from business?
Ans. Yes! Since you are showing your earnings as freelancing income, there is no restriction on that. Most of the MNCs and government allow employees to do sideway freelancing business  or be a dormant (non-active) partner in partnership firm.

Q2. I bought Bitcoin from my bank balance, sold it for profit then bought Ethereum for Bitcoin and sold Eth at loss and withdrew money to bank. Do I have to pay tax?
Ans. You actually did two capital gain transactions here. First, selling Bitcoins. Second, selling Ethereum. Suppose you bought 1 BTC for Rs. 5,00,000 and sold it for Rs. 6,00,000. Then bought 30 ETH for Rs. 6,00,000 and sold those for Rs. 5,50,000. Now you made Capital gain on first transaction of Rs. 1,00,000 and Capital Loss of Rs. 50,000 on second transaction. So you have to pay tax on net capital gain i.e. 1,00,000 - 50,000 = Rs. 50,000.

Important Advice

Although as a Bitcoin supporter, I support the adoption of Bitcoin as utility and increasing the use of Bitcoin as currency. But I strongly suggest you all to not spend Bitcoins directly for buying expensive assets like house and cars. Since status of Bitcoin is still not clear, you may land in big trouble if Income Tax Department tracks your transaction, it may be considered as money laundering. So always withdraw amount to bank first, pay tax if applicable and then spend on whatever you like.

Feel free to ask anything else or more details on any specific point.

10  Alternate cryptocurrencies / Altcoin Discussion / How to create a valuable altcoin without conducting ICO? on: December 02, 2019, 03:28:37 PM
So we are almost heading towards 2020 and altcoin is no longer a stranger term to people. In past 8 years, we have seen all types of altcoins. Famous, forgotten, altcoin gaining 10000x value, altcoin losing 99% value, almost every type of coin.

So new altcoins no longer excite investors like they used to do in 2015-16. Now people expect much more from a coin. ICO is one way of giving value to a coin. A coin with successful ICO is likely to be listed at higher price than a coin with failed ICO.

But what if someone wants to launch a coin without doing ICO? How do you think it is possible to create a valuable altcoin in 2019-2020?

Features? Well, at present we have all sort of altcoins. PoS, PoW, privacy coin, anonymous coin, no-fees coin, instant confirmation, unlimited supply, limited supply, ERC-20, independent chain, coin with dapp platform, altcoins today have all kind of features. I don't think investors care about features at all while buying coins.

Big Names? A coin backed by big name may have a higher chance of getting valuable even without conducting ICO. Roger Ver and BCH is one such example. But not everyone is as famous as RV, so?

Airdrop and distributed ownership? This took me back to the days of e-altcoins. I literally used to hate coins like e-BTC. As a new trend, people shamelessly created copy of existing high-valued coin on ERC-20 chain and distributed it among people via airdrops. I still wonder how and why e-BTC used to have volume as high as $7M!!! But this trend was a mere bubble and shattered very soon. Now it is not at all possible to create a valuable coin by simply copying a coin on Ethereum chain and distributing it freely to people.

Strong Project? I have learnt one thing in my life - Do not trust the promises of two people - Government and ICO. If I take a sample of say, 100 random ICOs launched in 2017 and raised their cap successfully, only 10-15 would have actually deliver what they promised. And I am talking about ICOs launched 2 years ago! Projects hardly contribute to the value of coin. Investors mostly ignore what problem a coin is solving, they are only concerned with the value and that's it.

So I repeat my question. How can one create a valuable altcoin without conducting ICO in 2019-2020?
11  Other / Meta / Face-Off v0.1 - The Original Game for Bitcointalk Members on: November 26, 2019, 04:31:42 PM
If you liked this game and/or my custom card creator, you can vote for me if you want in 10th anniversary badge voting: Vote for webtricks!

This project is an extension of my previous work: BTCTalk Cards. Did you try creating your own custom card? Do you think your card is strong enough to challenge top 1000 Bitcointalk profiles? Why not find out now...

Face-Off is an interactive gaming experience where player has to input his bitcointalk ID. Once ID is input, a real-time custom card for the player is generated. Then the player has to face different challengers in three-rounds game. The cards of challengers will also be generated in real-time. In first round, popularity of the players will be tested. In second round, one having more reputation will win. Third and final round is about merits. If you got more merits than challenger, you win.

Who are challengers?
Challengers are the three random profiles picked from the top 1000 most recognized profiles on Bitcointalk as per BPIP.

Is there a chance that I face myself in clash?
Yeah! If you are one among top 1000 users, there is a chance that you face yourself in game.

Then who will win?
Of-course, you! How can you lose from your own self! In case of equal stats, player will win.

12  Other / Meta / I'm Hero Member Now - Thank You Everyone on: November 20, 2019, 05:32:16 AM
So I was only 2 weeks (14 activity) away from becoming Hero Member when theymos introduced merit system. It was like someone reset my downloading progress from 99% to 50%.  Cheesy

Then came the giant leap of inactivity due to some personal reasons and real-life commitments for most of the part of 2018 and early 2019. Then in second quarter of 2019, I once again started giving time to Bitcointalk and earned like 40-50 merits in some short span. That motivated me to believe that I still got some posting quality left in me. And then 10th Anniversary Contest happened and it changed the due course of everything! After reading the thread, the idea of custom btctalk cards spring immediately in my mind and here I am : 160 merits on two btctalk cards posts combined.

I would like to thank everyone who liked the idea and gave their valuable merits to me and been instrumental in my journey to become Hero Member.

So what's next:

It would be wrong if I don't acknowledge that I made some good fortune during late 2017 boom. There was a time when grands were floating in my bank account almost every week alone from my Twitter account marketing. All this was possible due to one name - Bitcointalk.

So now it's my duty to give back something to bitcoin community. So here is my course of plan for coming days:
  • Development of Indian Board. I would like to acknowledge Heisenberg_Hunter who is doing his best for the upliftment of Indian Board. He united us all Indians on forum on Telegram and now his becoming of Merit Source is cherry on the top. I will try to write some informative threads in Indian section which will serve as guide for existing and future bitcoin users on various issues.
  • Lately I am occupying myself with coding skills. Now the time has come that I use these skills to develop something valuable for Bitcoin Community. My first try would be to make open-source free payment gateway (merchants tool) ending fee charging tyranny of businesses like Bitpay. Many more to go thereafter.
  • I have been contacted by various investors recently who want to collaborate for gambling site with me. But I am very cautious on this one because Gambling Business is no joke. However, my recent potential partnership with Vod supersedes the gambling site idea if we both reach to any consensus on our potential idea.

So that's it. Thank you once again. I would end the thread with specimen of my own work, show-casing my Hero Member rank Cheesy :

13  Other / Meta / BTCTALK CARDS - The Real-time Custom Cards for Bitcointalk Members (Check Poll) on: November 17, 2019, 09:45:22 PM
If you like my work, you can merit my submission in 10th anniversary art contest here: webtricks's submission in Art Contest

On the occasion of 10th anniversary of the forum, I am pleased to present you all BTCTalk Cards. With BTCTalk Cards, you can generate your own very-custom cards in real-time. Just fill your Bitcointalk ID, choose your specifications and your card will be generated in the matter of seconds.

Some Examples:

14  Economy / Economics / The Impact of Change in Prices on Bitcoin's utility as Currency on: November 09, 2019, 05:49:12 PM
One of the biggest on-going debate about Bitcoin is whether it can be used as currency or is it just a sort of investment? On the micro level, Bitcoin can surely be used as a currency. Since it has value, it can easily solve the problem of double-coincidence of wants by becoming the medium of transaction. But when we consider it at macro level, the story doesn't remain the same. There are several factors come into play when we consider the whole community, the prominent of which is Change in Prices.

The main reason why people won't use Bitcoin as currency is because its value (I'm not talking about fiat value but the real value) in the eyes of investors keep changing radically. Hence making sellers hesitant to accept Bitcoin as payment and buyers hesitant to spend Bitcoin for payment.

I have created following graph to show the impact of Change in Prices on the people's tendency to spend Bitcoin as payments:


Explanation: The above graph assumes that x number of Transactions (for payment purposes) take place when the price of Bitcoin is y. Now two things can happen, either the price of Bitcoin can increase or the price of Bitcoin can decrease. Both  cases can impact the normal behavior of holder. In the case of price rise i.e. increase from y to 2y, bitcoin holder will become optimistic that prices will increase further, this will lead to fall in number of transactions where bitcoin is used for payment purposes from x to x/2. Similarly, in case of price fall from y to y/2, holder may postpone his expenditure or may use other form of payments like general fiat currency for expenditure purposes in the hope that prices of Bitcoin will rise again. Therefore, the number of bitcoin-payments will decrease to x/2.

Overall Outcome: Higher the change in prices, lesser will the use of Bitcoin for payment purpose.

When we talk about Bitcoin prices, another topic comes to play i.e. Speculation! The above chart clearly shows the impact of current prices on Bitcoin's utility as currency but what about the future price? We all know that Bitcoin community loves to speculate. Hence, the speculation also have considerable impact upon the bitcoin's utility as currency. This brings us to our second graph:


Explanation: Unlike the chart #1, future expected price rather have two-ways impact on the number of times Bitcoin is used for payment purposes. Suppose Bitcoin community is expecting the increase in price of bitcoin in coming months. In such case, rather than spending bitcoins for payment purposes, people at large will hold their bitcoins. In other words, if the price increases from y to 2y, the transactions will fall from x to x/2 (it could be anything but I took 50% fall for the sake of simplicity).  Vice-versa, in case if people are expecting the fall in the prices of bitcoin, they may rush to spend bitcoins for utilities. This may pump the number of transactions from x to 2x.

Overall Outcome: If the future expected price of Bitcoin is higher, lower will be the use of Bitcoin for payment purpose. On the contrary, lower the future expected price, higher will be the use of Bitcoin for payment purpose.
15  Economy / Economics / The Economic Analysis of Demand for Bitcoin on: October 27, 2019, 05:29:47 PM
It's been a while since I had a reasonable discussion in Economics section. Hence, I decided to create my own thread. In this thread, I am using the Keynesian Theory of Demand for Money to highlight the similarities as well as differences between the demand for Money and demand for Bitcoin. This thread will be little longer as I am going in full-depths but this is not copy/paste material so don't ignore it on that grounds. This is my personal analysis and every bit of it is my original work except obviously the contents from Keynesian Theory:

According to Keynesian theory of demand for money, also known as Liquidity Preference Theory, people prefer holding money for three motives:

1. Transactions Motive

The transaction motive for holding cash relates to the need for cash for current transactions for personal and business exchange. Such need arises because there is lack of synchronization between receipts and expenditure. You may receive money at different point but spend it at different point. The transaction demand for money is directly related to the level of income. Higher the income, higher the transaction demand for money. The equation could be written as:

Lr = kY

where Lr is the transaction demand for money, k is ratio of income kept as money for transactions purpose and Y is total income.

Now coming to Bitcoin. Since we are talking about transaction motive, it is very short-term utility of money so we have to assume return on Bitcoin as constant. But the difference between buying price and selling price surely effects the transaction motive for holding Bitcoins. For example, I receive my income in Bitcoin on 1st of every month and I visit my grocery store on 10th of every month. But the price on 1st was $8K which drops to $6K on 10th, I may postpone my expenditure for few days expecting bitcoin to rise again. Thus difference in buy-sell price has manipulative effect on transaction motive of Bitcoin. Hence, I reached to following equation for demand for Bitcoin for transaction motive:

Lr = k(Y*X)
X = |(S-B)/B|

where Lr, k and Y are same as above equation and S is the btc price when bitcoin was used for expenditure whereas B is price when bitcoin was received as income. According to my analysis, higher the value of X, longer the person will hold bitcoin.

2. The Precautionary Motive

Many unforeseen and unpredictable contingencies involving money payments occur in our day to day life. Thus people keep a portion of their income to meet such unanticipated expenditures. The portion of money kept by individual depends upon various factor such as income, political and economical conditions, personal characteristics of individual, etc. Keynes wasn't much clear on the factors, hence didn't give any equation.
Now coming to Bitcoin. In precautionary demand for money, income was the biggest determinant but in case of Bitcoin, personal characteristics and market condition are the more prominent ones. Since Bitcoin is High-Risk, High-Yielding investment, conservative person is less keen to hold bitcoins for precautionary motive than the radical one. Also, person will be more inclined to hold Bitcoins for precautionary motive if the market condition is favorable and bitcoin is in green zone for long.

3. Speculative Demand for Money

To analyse the Speculative demand for money, Keynes has taken two factors into consideration:
  • Interest rate on market securities
  • The expected rate of capital gain

According to Keynes, people have notion regarding the interest rate of securities which they consider to be normal. Such interest rate is known as critical interest rate. When the current interest rate is more than the critical interest rate, people convert all their money into securities because:
  • 1. They can earn more due to high rate of interest.
  • 2. Interest rate and the market value of security have an inverse relationship. So when the current rate of interest fall below critical rate, people will make capital gain as the market value of security will rise as compared to the price at which they bought the security.

On the contrary, if the current rate of interest is lower than the critical rate, people will convert all their securities into cash.
Now coming to Bitcoin. Bitcoin does not follow the principle of speculative demand as laid down by Keynes because its characteristics are very much similar to the securities considered by Keynes for this analysis. Hence speculation demand for bitcoin has different approach. Its speculation demand depends upon the relative rate of return. If the anticipated return on Bitcoin is higher than other securities, people will hold Bitcoins for speculation motive and vice-versa.

Any suggestions, questions, different approaches, views, doubts are welcome.
16  Other / Meta / Why am I getting error while uploading gif? on: October 19, 2019, 06:13:47 PM
I tried uploading gif but it's showing proxy error. What's wrong?

Here's the link for reference:

Does image size matters too?
17  Alternate cryptocurrencies / Service Announcements (Altcoins) / DogeDraw - Dogecoin Lottery - Win upto 25x - (Faucet, Free DOGE & more) on: September 16, 2019, 09:10:26 PM
After considering the views and suggestions of all community members, we have come to the conclusion that our product is sub-par and needed complete overhaul. Therefore, we are closing current DogeDraw website at 20th October, 00:00 (+5:30). We will launch new website with new branding, new design, new features, on-chain betting and much more. The release of new site is scheduled after Christmas. A reminder for current members, if you have any outstanding balance on site, please withdraw it before 20th October.

18  Economy / Gambling discussion / Which coding language does gambling sites use? on: August 30, 2019, 06:58:50 PM
I am looking for the most popular coding language that the developers use to develop Casino games in cryptocurrency niche. Looking forward for your insights guys.
19  Local / Regional Languages (India) / SportsBet- क्रिप्टो जुआ खेलने की सबसे भरोसेमंद साइट on: June 20, 2019, 05:48:19 PM
नोट: यह वास्तविक सूत्र नहीं है, अपितु अंग्रेजी धागे का हिंदी रूपांतरण है। वास्तविक सूत्र का लिंक यह है:

क्या आपको क्रिप्टो-मुद्रा जैसे कि बिटकॉइन, एथेरेयम, वगैरह में जुआ खेलना पसंद है? मुझे तो क्रिप्टो-जुआ बहुत पसंद है क्यूंकि सरकार-RBI की नज़रों से दूर हम इत्मीनान से, बिना किसी रोक-टोक के जुआ खेल सकते हैं और साथ-ही-साथ अज्ञात भी रह सकते हैं ।
पर जहाँ क्रिप्टो-जुए के फायदे हैं, वहीं यह भी है कि अधिकतम जुआ-साइट स्कैम होती हैं और खिलाड़ियों की रकम लेकर फरार हो जाती है। ऐसे में क्रिप्टो-जुआ साइट्स पर विश्वास करना थोड़ा कठिन हो जाता है। इसी समस्या को दूर करता हैं -

पिछले ३ साल से कार्यरत यह सट्टे की साइट की विश्वसनीयता इससे ही पता लगती है कि SportsBet ने हाल में ही वाटफोर्ड फुटबॉल क्लब के साथ करोड़ों का करार किया है। इस करार के तहत SportsBet वाटफोर्ड का अगले तीन वर्ष तक मुख्य टाइटल-स्पांसर रहेगा। किसी क्रिप्टो-आधारित जुए-साइट का इतने बड़े स्तर पर विज्ञापन करना पहले कभी नहीं देखा गया है।
यदि आप बिना किसी फ़िक्र के क्रिप्टो-जुआ खेलना चाहते हैं तो अभी SportsBet पर जाएँ:

20  Economy / Currency exchange / (CLOSED) (W) $21 in PayPal urgently (H) Bitcoin on: May 28, 2019, 04:17:08 PM
Due to some issue with my debit card, I cannot add funds to my PayPal account for next few weeks. I need to make payment to one freelancer urgently (within next 1-2 hours). The payment is $21. I will pay in Bitcoin.
Please post your offers, you can PM me or message me on Telegram: @webtricky.

PS: Since it's small fund, I don't want frauds or trolls. Only serious people, I will pay $21+commission according to preev rates at the time of transaction.

Pages: [1] 2 3 4 »
Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!