{"id":655,"date":"2019-10-25T10:22:24","date_gmt":"2019-10-25T17:22:24","guid":{"rendered":"https:\/\/blogs.ubc.ca\/cpen442\/?page_id=655"},"modified":"2022-11-14T18:22:24","modified_gmt":"2022-11-15T01:22:24","slug":"coin-mining-contest","status":"publish","type":"page","link":"https:\/\/blogs.ubc.ca\/cpen442\/assignments\/coin-mining-contest\/","title":{"rendered":"Coin Mining Contest"},"content":{"rendered":"<p>&nbsp;<\/p>\n<hr \/>\n<p>The goal of this contest is for students to mine and claim as many CPEN442 coins as they can.<\/p>\n<h1>Instructions:<\/h1>\n<ol>\n<li>Chose a private miner ID (referred to as <strong>private_id) <\/strong>for yourself. This can be any random string. Then, compute your public miner ID (a.k.a., <strong>public_id<\/strong>) in the following way:\n<pre> <strong>public_id<\/strong> <strong>= SHA256(private_id) <\/strong><\/pre>\n<p>Keep in mind that your <strong>private_id\u00a0<\/strong>should not be publicly known. You should keep it secret until the contest is over. Its knowledge by other CPEN 442 students will allow them to claim the coins mined by the corresponding <strong>public_id<\/strong>.<\/li>\n<li>Start mining CPEN442 coins. To mine a coin, you have to find a <strong>coin_blob\u00a0<\/strong>such that the hash\n<pre><strong>SHA256(\u201cCPEN 442 Coin\u201d + \u201c2022\u201d + hash_of_preceding_coin + coin_blob + id_of_miner)<\/strong>\r\n<\/pre>\n<p>starts with a certain number of &#8220;0&#8221; characters in the hexadecimal notation. The number of required leading &#8220;0&#8221;s, which we refer to as <strong>difficulty_level<\/strong>, changes overtime based on how quickly coins are being mined. At each point in time, the current <strong>difficulty_level <\/strong>can be retrieved using the <strong>difficulty<\/strong> API of the coin website (accessible <a href=\"http:\/\/cpen442coin.ece.ubc.ca\/difficulty\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>).<br \/>\n<span style=\"font-size: 1rem;\">In the hash above, <\/span><strong style=\"font-size: 1rem;\">id_of_miner <\/strong><span style=\"font-size: 1rem;\">should be your <\/span><strong style=\"font-size: 1rem;\">public_id\u00a0 <\/strong><span style=\"font-size: 1rem;\">and <\/span><strong style=\"font-size: 1rem;\">hash_of_preceding_coin <\/strong><span style=\"font-size: 1rem;\">should be retrieved using the <\/span><strong style=\"font-size: 1rem;\">last_coin<\/strong><span style=\"font-size: 1rem;\"> API (accessible <\/span><a style=\"font-size: 1rem;\" href=\"http:\/\/cpen442coin.ece.ubc.ca\/last_coin\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a><span style=\"font-size: 1rem;\">). Keep in mind that this is a competition and if someone claims a coin before you, <\/span><strong style=\"font-size: 1rem;\">hash_of_preceding_coin <\/strong><span style=\"font-size: 1rem;\">and<\/span><strong style=\"font-size: 1rem;\"> difficulty_level <\/strong><span style=\"font-size: 1rem;\">will change and you have to start the mining process over.<\/span><\/li>\n<li>Once you successfully mine a coin, be quick to claim it using the <strong>claim_coin<\/strong> API (available <a href=\"http:\/\/cpen442coin.ece.ubc.ca\/claim_coin\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>) and start mining a new coin using the new <strong>hash_of_preceding_coin\u00a0<\/strong>value.<\/li>\n<li>Once the contest ends, you need to claim rewards for your coins by submitting your <strong>private_id<\/strong>s to the teaching staff through Canvas. They will compute all of your <strong>public_id<\/strong>s (by hashing your private_ids)<strong>\u00a0<\/strong>and calculate your reward based on the number of coins that has been claimed by your <strong>public_id<\/strong>s<strong><strong>.<\/strong><\/strong><\/li>\n<li>Lastly, as a learning opportunity for all students, if any student (or group of students sharing the same miner id) claim more than 30% of all coins, they are required to give a <strong>5-minute in-class presentation<\/strong>\u00a0in class on how they did so. The presentation should explain (1) how their miner worked (e.g., what programming language was used, how the code was optimized) and (2) what resources were used to mine coins (i.e., what was the hardware specifications of the computer(s) that ran the miner).<\/li>\n<\/ol>\n<h1>Rules of the contest:<\/h1>\n<ol>\n<li>Attacking the coin website (e.g., DDoS, DoS, web attacks) is not allowed and will result in disqualification. The server also limits the number of requests you can make in a minute.<\/li>\n<li>CPEN 442 students are allowed to share miner IDs (i.e., a group of CPEN 442 students can use a single <strong>miner_id<\/strong> for mining coins). This may allow them to aggregate hardware resources and mine more coins.<\/li>\n<li>Each student can claim rewards for any number of <strong>miner_id<\/strong>s during the reward claiming period. The coins will be evenly divided among all the students who submit the corresponding <strong>private_id<\/strong>s.<\/li>\n<li>Any coins that you claim (or might have claimed already) before the start of the contest or after the end of the contest will not count towards your reward. We will reset the coin database before the start of the contest.<\/li>\n<li>You are allowed to discuss the details of the coin-mining implementation with others.<\/li>\n<li>To claim a coin, it has to be accepted by the claim coin API (available <a href=\"http:\/\/cpen442coin.ece.ubc.ca\/claim_coin\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>). <span style=\"color: #ff0000;\"><strong>The teaching staff will not be able to give you feedback for why your coin is not accepted by the API<\/strong><\/span>.<\/li>\n<\/ol>\n<h1>Award:<\/h1>\n<ol>\n<li>The contest participants will collectively get the total award (<strong>total_award<\/strong>) of bonus <strong>5%<\/strong> to the final marks in the course.<\/li>\n<li>Each <strong>miner_id<\/strong> will receive an award proportional to the number of coins they mined. To claim an award, the student needs to demonstrate that the corresponding <strong>miner_id<\/strong>s belong(s) to them, by providing the corresponding <strong>private_id<\/strong>. Each <strong>miner_id<\/strong> will receive a share of the total prize <strong>proportionate to the number of coins that claimed by that miner_id<\/strong>. To compute the prize for each <strong>miner_id<\/strong>, we will use the following formula:\n<pre><strong>C_i<\/strong> = total number of coins mined by miner i (0 \u2264 Y_i \u2264 X)\r\n<strong>C<\/strong> = the grand total of number of coins mined <em><strong>and<\/strong><\/em> claimed for award.\r\n<strong>A_i<\/strong> = award of miner i\r\n\r\n<strong>A_i = (C_i \/ C) * total_award<\/strong><\/pre>\n<\/li>\n<li>If <em><strong>n<\/strong><\/em> students claim award for the same <strong>miner_id i<\/strong>, the award for <strong>i<\/strong> will be equally divided among all the claiming students, i.e., <strong>A_i\/<em>n<\/em><\/strong>.<\/li>\n<li>You can visit <a href=\"http:\/\/cpen442coin.ece.ubc.ca\/\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/cpen442coin.ece.ubc.ca\/<\/a> to check the total number of coins mined so far, top 5 miners, and the number of coins mined by a particular miner.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; The goal of this contest is for students to mine and claim as many CPEN442 coins as they can. Instructions: Chose a private miner ID (referred to as private_id) for yourself. This can be any random string. Then, compute your public miner ID (a.k.a., public_id) in the following way: public_id = SHA256(private_id) Keep in [&hellip;]<\/p>\n","protected":false},"author":54380,"featured_media":0,"parent":53,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-655","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/pages\/655","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/users\/54380"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/comments?post=655"}],"version-history":[{"count":81,"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/pages\/655\/revisions"}],"predecessor-version":[{"id":1481,"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/pages\/655\/revisions\/1481"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/pages\/53"}],"wp:attachment":[{"href":"https:\/\/blogs.ubc.ca\/cpen442\/wp-json\/wp\/v2\/media?parent=655"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}