Showing posts with label tutorial. Show all posts
Showing posts with label tutorial. Show all posts

Saturday, 16 April 2016

Making Profit with Decred - Noob Friendly



In this guide I will show you how to make money with Decred. I will explain how to use the official Proof of Stake (PoS) pool. If you are a total newcomer you will have to learn a lot of new things. No worries, most of your questions will be answered in the Links and Forum Discussions that I will refer to. In case you have any specific questions, feel free to reach out to me via Twitter. Let's get started!









Background

Decred uses a hybrid PoW/PoS system. The process of creating blockchain consensus is thus balanced between miners and stakeholders. Miners 'mine' to validate blocks, and stakeholders 'vote' to decide if the block is indeed valid. Both miners and stakeholders can count on a reward. Even users with small amounts of coins will be able to participate in creating consensus by joining PoS pools. For a detailed explanation of how the hybrid PoW/PoS system of Decred works, check out: http://cryptotales.blogspot.in/2016/02/pow-pos-whats-going-on.html


Rationale

How do we make profit? We will invest our DCR funds in the PoS process by joining a PoS pool. The PoS process is designed as a lottery with a guaranteed reward. How do we invest? By buying lottery tickets. The tickets will grant us voting rights via the PoS pool. Each time one of our tickets is called to vote on a block, we will obtain a reward after the vote is confirmed. The pool is always online, so we will never miss a vote. It is designed in a way that both you and the pool have voting rights, so you can leave your wallet online as a backup to the pool if you want.

The best pool to start stake mining Decred for now is: https://dcrstakes.com


Getting Started

The first step is to get yourself some DCR funds. If you don't have any coins (or stake) yet, please follow this blog post on how to obtain DCR. If you have a wallet with funds available, write down your seed and let's get started with setting up a desktop wallet. The command line interface is very easy once you've used it. These guides explains everything in great detail:
http://cryptotales.blogspot.in/2016/02/how-to-start-mining-decred.html
http://cryptotales.blogspot.in/2016/04/decred-basic-commands-with-explaination.html

IMPORTANT! Download the latest software: https://github.com/decred/decred-release/releases


Follow steps of the how-to-start-mining guide to set up your wallet by importing your seed. After unpacking the software in a map dedicated to Decred, hold Shift and Rightclick in that map to open a new command line window. The commands that you will need are listed below (my comments between brackets). Hit enter after each line.


In command window #1:
dcrd -u [...] -P [...]
(choose username and password for the dcrdaemon)
Example: dcrd -u noahdcrd -P mynewpass1@

Your deamon should now start downloading the Decred blockchain.

IMPORTANT! Let the blockchain sync completely before moving to the next step. For the most recent block height you can check: https://mainnet.decred.org/


In command window #2:
dcrwallet --create

- The wallet will ask you to input a private passphrase for your wallet. While entering, the passphrase will look blank, but actually you are typing (remember this). Confirm by typing it again.
- Now, it will ask you if you want to add an additional encryption layer for public data. Say 'yes', type the public passphrase and confirm by typing again (it will look blank as well).
- Next, when it asks if you have an existing wallet seed, enter 'yes' and type the 33-word text carefully (without any mistakes or CasE eRrOrs).
It should now say: The wallet is successfully created.


In command window #2:
dcrwallet -u [...] -P [...] --walletpass [publicpassphrase] --dcrdusername=[user] --dcrdpassword=[pass]
(choose a user and pass for the wallet, and fill out the other data)
Example: dcrwallet -u noahwallet -P mynewpass2# --walletpass mypubpassphra --dcrdusername=noahdcrd --dcrdpassword=mynewpass1@

Your wallet should now start processing the Decred blockchain.


In command window #3:
dcrctl -u [user] -P [pass] --wallet getbalance
(to check if your wallet funds are correct)
Example: dcrctl -u noahwallet -P mynewpass2# --wallet getbalance

Congratulations, you are ready to start! Keep your command windows running as we proceed.


The PoS pool

Now, we need to sign up for the PoS pool. Go to the website and create an account. If you have registered at the stake pool, it will tell you to generate a public key address. Follow the steps as displayed. The commands that you'll need are listed below. From now on you should stop using your web wallet, to prevent syncing problems between web and desktop wallets.


In command window #3:


dcrctl -u [user] -P [pass] --wallet getnewaddress
dcrctl -u [u] -P [p] --wallet validateaddress [yournewdaddress]

If you copy and paste the 'pubkeyaddr' into the form on the website, it will generate a P2SH address that you can use to purchase tickets via the PoS pool. Go to the Tickets tab and follow the instructions. The pool has generated a script that you will need to import.


In command window #3:
dcrctl -u [u] -P [p] --wallet walletpassphrase [privatepassphrase] 1800
(this unlocks your wallet for 1800 seconds, or 0.5 hour ; set it to 0 to keep it unlocked indefinately).
dcrctl -u [u] -P [p] --wallet importscript [yourRedeemScript]

Once your script has been successfully imported, you are ready to go!


Buying tickets

Personally, I always buy my tickets manually. This allows me to have full control over my spending. This command allows you to buy tickets and transfer it to your account in the PoS pool.


In command window #3:
dcrctl -u [u] -P [p] --wallet purchaseticket "default" [maxTicketPrice] [minConfirmation] [P2SHAddress]
Example: dcrctl -u noahwallet -P mynewpass2# --wallet purchaseticket "default" 20 1 Dcsgdz1randomexampleaddressVrzf

In the example we are buying a ticket for maximum 20 DCR. The transaction has to be confirmed by exactly one block before we can make a new transaction or buy a new ticket. During this time your funds will be send to a change address that you control. The ticket price will then be send to the pool address, and the remainder of your funds will be transferred back. During this time, you won't be able to buy new tickets, as you have no spendable balance. After the block is confirmed and your balance is back, you can use it again to purchase new tickets. Determine the best price to buy by checking the current, average, and estimated price here: https://dcrstakes.com/price


Final remarks

It is good to know that this pool absolutely cannot control your funds. It does not have your private keys, so there is no possibility. By using the PoS pool, you don't need to keep you wallet up and running after you've bought the tickets: the pool will vote on your behalf and your reward will be transferred automatically. In the future there will be more PoS pools, operated by community members. This way Decred will remain a truly Decentralised cryptocurrency.

Some useful forum threads that will help to answer many of your further questions:
http://cryptotales.blogspot.in/2016/04/1.html

Tuesday, 12 April 2016

Decred - Proof of Stake mining [FAQ]

1. How do I start PoS mining?

Answer - Check This Out!

2. What hardware do I need to PoS mine?

Answer - The hardware doesnt really matter. You can use a laptop, desktop, VPS, Amazon AWS or even a Raspberry Pi 2 or other newer SoC. It simply needs to be online and connected to the internet 24x7x365. If your PoS wallet is unable to reach the internet you will miss calls to stake vote, your ticket will be revoked and you will not get the stake vote reward.

3. How much DCR do I get for PoS voting / mining?

Answer - The current PoS reward is 1.853DCR per vote. The reward will change over time. It will slowly get lower and lower. As of 13MAR16, block 10035, the total block reward is 30.88. This is broken down into 60% PoW reward, 18.532DCR. 30% PoS reward, 1.853DCR X 5 votes or 9.265DCR and 10% developer funds reward 3.088DCR.

3.1 How long does it take to get the PoS reward?
Answer - It takes 256 blocks (~1 day) for your stake reward to be returned and spendable.

4. How much does a stake ticket cost?
Answer - The price changes every 144 blocks. The amount of sstx purchased in the 144 blocks between price changes influences sstx price moreso than the target 40960 pool number. 144 blocks * 5 votes/block = 720. If less than 720 sstx are purchased in 144 blocks then the overall direction is down in price. Even if the total amount of sstx is still above the target 40960 sstx in the pool. If the amount of sstx tickets is <720 then the sstx price goes up. If there are more or less than 40960 stakes in the pool this will also affect the price direction of movement. Currently at block 10035 13MAR16 1 stake vote ticket requires you pledge or lock 14.39DCR. Previous stake ticket costs have been in the range of 5DCR-30DCR based on demand as above. The average sstx price at this time is 9dcr.

4. Do I get my stake back or do I lose it?

Answer - Buying a stake vote is really not the correct term. What you are really doing is pledging an amount of DCR to have the right to vote. There are 3 outcomes after you purchase a stake ticket. 1 - Your ticket is voted. You get your stake pledge 14.39DCR + reward 1.853DCR currently. 2.Your stake vote is called and you miss the vote. Your ticket is revoked. Your stake pledge 14.39DCR currently is returned. No reward given. 3.Your ticket is not voted for 142 days(approximately) and your stake pledge is returned at the end of 142 days. No reward given.

5. How often does the stake ticket price adjust or change?

Answer - The stake ticket price or pledge adjusts every 144 blocks or about 12 hours.

6. How much DCR do I need to PoS?

Answer - You can start with any amount as long as you have enough to purchase a stake vote ticket. How much is that? It changes. It can be anywhere from 2DCR to 1000DCR. Currently 13MAR16 at block 10035 a stake vote costs 14.39DCR and will return 1.853DCR reward. Knowing that it will probably take 28 days to get the stake pledge and the reward back you can calculate how much you want to vote each day. For example - 2 votes per day X 28 days = 56 stake tickets * 14.39 = 805DCR. The 56 votes will return 107.3DCR reward after about 28 days.

7. What are the commands to PoS?

Answer - There are quite a few commands related to PoS. We have started to flesh them out here:
Useful PoS commands

7.1 How can I connect DCRD to more nodes?

Answer - add the --maxpeers=X switch to your dcrd config or at start. 1-? is the range for X. Why would I want to do this? Outbound connections are HARD SET to 8. This has been extensively tested to be the ideal amount and cannot be changed. Inbound connections are good for the network. If you are running a public node you can up the amount of allowed inbound connections to whatever your system will handle. The default max is 125. You can raise it higher if you like but do not adjust lower. This can result in missed tickets as your hop count, in effect latency, increases. There are also bandwidth considerations. If you pay for data $/per MB raising this can increase the data you use.
For a concrete example, assume that at some point in the future there are a million nodes on the network. You would be able to reach any given node on the network with a maximum of ceil(log8(1000000)) = 7 hops. In practice, it works out to be even less than that on average because there are inbound nodes too which are notified and thus the net effect is that it raises the base of the logarithm which of course in turn reduces the hops.

8. How do I know if I have voted?

Answer - You will see something like this in your dcrwallet screen:

13:28:35 2016-01-25 [INF] WLLT: Voted on block 0034dafbc7969fd5f1c5a3cbbf1ddd48ec78109d103457b3bb5b101c71db3657 (height 4143) using ticket 2030e3978322bac2466146ccf955c32afd86ccf85f1356ab54cd091513b6f9ad (vote hash: cb8c498f1c6fb9255076655b21394733a4d1f078687c751860d8dd93e7599d57)

You can also see current tickets held by using the getstakeinfo command.


dcrctl -u -P --wallet getstakeinfo
{
"poolsize": 41768,
"difficulty": 8.49962772,
"allmempooltix": 6,
"ownmempooltix": 0,
"immature": 6,
"live": 241,
"proportionlive": 0.005769967439187895,
"voted": 151, <--Total number of votes you have cast
"totalsubsidy": 280.91069628, <-- Total reward subsidy you have received for votes
"missed": 12,
"proportionmissed": 0.0002872187649593107,
"revoked": 12
}


9. How do I know if I bought a stake vote ticket?

Answer - You will see something like this in your dcrwallet screen:

14:51:09 2016-03-13 [INF] TMGR: Inserting unconfirmed transaction b06cfe0a13f6e62c095b71308d310a6a63c18ad52f9b6650a3d6e469a4894699
14:51:09 2016-03-13 [INF] WLLT: Successfully sent SStx purchase transaction b06cfe0a13f6e62c095b71308d310a6a63c18ad52f9b6650a3d6e469a4894699

You can also see how many stake tickets you currently have by using the getstakeinfo command.


dcrctl -u -P --wallet getstakeinfo
{
"poolsize": 41768,
"difficulty": 8.49962772, <-- Current stake ticket price
"allmempooltix": 6, <-- All tickets waiting to be included in next block
"ownmempooltix": 0, <--Your tickets waiting to be included in next block
"immature": 6, <--Purchased tickets not ready to vote yet.
"live": 241, <--Tickets waiting to vote
"proportionlive": 0.005769967439187895, <--Your % of tickets in PoS (poolsize: 41768 above) % chance to vote? .576%
"voted": 151,
"totalsubsidy": 280.91069628,
"missed": 12,
"proportionmissed": 0.0002872187649593107,
"revoked": 12
}


10. Should I raise my txfee to buy stake votes faster?

Answer - See also #14. This is more opinion than fact so here goes - No you should not. You have 144 blocks to purchase a stake vote before the next change. Several thousand stake votes( up to 2880 stakes I think?) can be purchased in that amount of blocks. The only reason to adjust your txfee higher would be to make sure your stake purchase gets put in to the last few blocks before an adjustment is made. To adjust your txfee above .5 or even .025 right after a stake price adjustment is wasting DCR.


11. How do I know if I have a missed / revoked ticket?
Answer - You will see something like this is your dcrwallet screen:

19:24:56 2016-02-24 [INF] WLLT: Voted on block 0000000000000624cd8375a6889a3ef2eda66b58d29029f2d69111cd687102c2 (height 5001) using ticket c20113ebc1a7c1bf875a60fcdd71baf86c007c8603cf34cac33377badbdf7420 (vote hash: acad50383933a19d63d6e3a5d6c8f05e45e6b934b299a934c3795c8b5cff7e9f)
19:25:51 2016-02-24 [INF] WLLT: Connecting block 0000000000001226676a67f5ccbf1ba8f063e1a4016e50e5822934acb0f7f78f, height 5002
19:25:54 2016-02-24 [INF] WLLT: Revoked missed ticket c20113ebc1a7c1bf875a60fcdd71baf86c007c8603cf34cac33377badbdf7420 (tx hash: 003f7c81c92bbc2a4999b783c6188e76dbf6c359e6b1c19b212a55006d216cc8)

You can also use the getstakeinfo command.


dcrctl -u -P --wallet getstakeinfo
{
"poolsize": 41768,
"difficulty": 8.49962772,
"allmempooltix": 6,
"ownmempooltix": 0,
"immature": 6,
"live": 241,
"proportionlive": 0.005769967439187895,
"voted": 151,
"totalsubsidy": 280.91069628,
"missed": 12, <-- Total votes you missed
"proportionmissed": 0.0002872187649593107, <-- Total % of overall(?) voted tickets you missed
"revoked": 12 <-- Total votes you had revoked
}


12. Why does my missed and revoke vote count not match. How do I fix?
Answer - Why? Something is out of sync. It happens. Use the command rebroadcastmissed. It will not post any output. After running it rerun getstakeinfo and missed / revoked should sync up.

dcrctl -u -P --wallet rebroadcastmissed


13.My DCR balances for all, locked, spend dont match/cant use spend and other account balance issues.

Answer - I have found that most of these issues can be resolved buy A)restarting DCRD then B)restarting DCRWALLET with the --prunetickets --reuseaddresses flags set.
You can also try running the consolidate command below. Beware this will cost you some DCR as it creates transactions. Typically not more than a few transaction fees. The last time I did it cost 1.2dcr and consolidated about 25 transactions. This should help clear up any stuck funds where you dont have enough to purchase any sstx.


dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet consolidate 99999 default

After this completes you should see a transaction insert(if any were needed) and also something similar to 'Successfully consolidated funds' along with a transaction ID you can check at https://mainnet.decred.org to see what actually happened and exactly how much it cost.

14.What should I set my txfee to? How many tickets are available during each period between changes? How does my txfee amount influence ticket buys?

Answer - See also #10. There are 20 slots per block to insert/buy a stake ticket(sstx). If there are more than 20 pending sstx in the mempool it will take mulitple blocks to clear the mempool. Stake ticket purchases are also placed in order of txfee. For example - There are 30 tickets in the mempool all with txfee of .025, requiring 2 blocks to complete. Block 1 with 20 sstx, block 2 with 10 sstx. You insert/buy another sstx into the mempool with a txfee of .026 before block 1 is processed. Your sstx now goes to the front of the line and is processed in block 1. Block 2 will now have 11 sstx in it. But your sstx was placed at the front of the line because it had a higher txfee. The reverse is also true. If you do not specify a high enough txfee your sstx will keep getting pushed to the end of the line. This is no big deal when there are 2800 slots available until the next sstx price change. It is a big deal when there are only a few blocks left, maybe 60-80 slots and there are 200 sstx in the mempool. If the sstx price goes from say 10 to 15 then those who had lower txfees set will not get sstx at 10 because they kept getting pushed back to the end of the line.

Now that this has been clearly (I hope) explained lets not go crazy and start doing .5 txfees! .01 to maybe .075 should be more than enough to get everyone in that wants in. Remember you have 144 blocks or 2880 slots over the next 12 hours to get your sstx. You dont have to have them in right after the price change. You have time, relax. Have a beer. We have yet to see all 2880 slots filled. There is room for everyone so far.

Monday, 8 February 2016

How to start mining Decred?

Here are are talking about PoW mining.

For Stake mining guide go here.

Prerequisites i.e. Things you should have ready to use this guide:

  1. Your airdrop seed you saved when confirming your airdrop registration. If you didn't register for airdrop just ignore this.
  2. Already created username & passwords for dcrd & dcrwallet, both should be different for maximum security.
  3. Already created public & private passphrase for wallet, both should be different for maximum security.
  4. Mainnet binaries & key/password to unzip it. You will need 7zip (for windows) or p7zip (for linux) software to unzip this file.
  5. Latest version of cgminer.
  6. Register on a pool if you don't want to do solo mining & create workers.
Running Daemon i.e. dcrd.exe
  1. Extract the mainnet binaries. Goto the folder where you extracted the binaries.
  2. Open a command window in folder.
  3. enter following command:

  4. This will start the daemon & it will start syncing the mainnet blockchain.

Importing the Airdrop seed & Creating an address for solo mining
  1. open a new command window in folder where you extracted mainnet binaries. Enter this command in the command window
  2. Command window will ask you to input a wallet passphrase. Enter a passphrase you created as prerquisite for dcrwallet & Press enter. Note: While entering the passphrase, command window will show no activity but it is accepting your input.
  3. Confirm your passphrase by typing it again & press enter
  4. Now it will ask you for a passphrase for public data. Choose yes, and enter the public passphrase you created as prerequisite. Remember this passphrase as you will need it for staking in the future.
  5. Note: Make sure you enter your seed with only spaces (no line breaks). Total of 32 space-separated words. Also seed is case sensitive. If you want to verify a seed, use "verify.bat" included with dcraddrgen utility you used to create your airdrop address.
  6. It will now ask if you have existing wallet seed.
    Choose Yes (If you have a AirDrop wallet seed). Now is the time to get your airdrop seed, the one that you saved when you confirmed your airdrop registration. Enter your seed with only spaces (no line breaks). Now press enter only when you have typed the whole seed.
    Choose No. (If you dont have AirDrop wallet seed. Then just continue to follow the prompts. 
  7. Congrats! You have now imported your airdrop hopefully.
    Or, have generated a new wallet!!
  8. Now run your wallet using following command:

  9. Skip following steps if you don't need a new address for mining or already created one.
  10. This will start the wallet & connect it to daemon so that wallet becomes upto date.
  11. Now that wallet is running & connected to daemon.
  12. Open a new command window & run :

  13. Copy the address shown, you will need it for solo mining.
Creating new wallet & address if you missed the Airdrop

  1. open a new command window in folder where you extracted mainnet binaries. Enter this command in the command window
    • Command window will ask you to input a wallet passphrase. Enter a passphrase of your choice & Press enter. Note: While entering the passphrase, command window will show no activity but it is accepting your input.
    • Confirm your passphrase by typing it again & press enter
    • Now it will ask you for a passphrase for public data. Choose yes, and enter the public passphrase you created as prerequisite. Remember/store this passphrase as you will need it for staking in the future.
    • It will now ask if you have existing wallet seed. As this is your first wallet, choose no.
    • This will create a wallet file save your seed in a safe place and type OK.
       
  2. After that enter this command:

  3. This will start the wallet & connect it to daemon so that wallet becomes upto date.
  4. Now that wallet is running & connected to daemon.

  5. Open a new command window & run:
  6. Copy the address shown, you will need it for solo mining.
Check screenshots of the steps till now: https://imgur.com/a/CaJ4M

Mining Solo
  1. Now goto command window running daemon that we started in step1 of "Running Daemon" & press ctrl+c. This will stop the daemon.

  2. Restart the daemon with following command. (you can use the same command window) :

  3. Now that both wallet and daemon are running & synced, its time to mine.
  4. Unzip cgminer. You will find start_local.bat file in the unzipped folder.
  5. Open it using a text editor & change -u & -p to your username & password used with daemon. Also change the port to 9109 instead of 19109 Save it.
  6. IMPORTANT: change http to https
  7. Run start_local.bat and your gpus will start solo mining.

Mining on the pool
  1. Follow Mining solo guide until step 4.
  2. After that open start_local.bat in a text editor.
  • For MaxMiners pool, use:
         Diff 1: http://dcr.maxminers.net:7727
         Diff 4: http://dcr.maxminers.net:7728

           Diff 1: http://dcr.suprnova.cc:9110
           Diff 4: http://dcr.suprnova.cc:9111
           Diff 8: http://dcr.suprnova.cc:9112
           Diff 64: http://dcr.suprnova.cc:9115



  • Here "webloginID" is your username you chose on the pool while creating your account. You can click the name of a pool above to see their Getting started Guide.
    Create your workers. workername & workerpassword are explained there.

    Try the high-diff port if you're having lots of rejects.

Thanks @sambiohazard for the help!