What Is Merged Mining? - The Bitcoin News

RESEARCH REPORT ABOUT ARYACOIN

RESEARCH REPORT ABOUT ARYACOIN
Author: Gamals Ahmed, CoinEx Business Ambassador

https://preview.redd.it/a7jv4azk86u51.jpg?width=1600&format=pjpg&auto=webp&s=e4a4dbb5afacd5747076beaa59e6343b805c3392

ABSTRACT

Aryacoin is a new cryptocurrency, which allows for decentralized, peer to peer transactions of electronic cash. It is like Bitcoin and Litecoin, but the trading of the coin occurs on sales platforms that have no restriction to use. Further, it was created with the goal of addressing the double spend issues of Bitcoin and does so using a timestamp server to verify transactions. It works by taking the hash of a block of items to be timestamped and widely publishing the hash. The timestamp proves that the data must have existed at the time in order to get the hash. Each timestamp then includes the previous timestamp in its hash, forming a chain.
The Aryacoin team is continuously developing new use cases for the coin, including exchanges where users can exchange the coins without any fees or restrictions, and offline options where the coins can be bought and sold for cash. The coins can also be used on the company’s other platform, mrdigicoin.io. Along with the coin, there is a digital wallet that can be created and controlled by the user entirely, with no control being retained by the Aryacoin team.

1.INTRODUCTION

The concept of Blockchain first came to fame in October 2008, as part of a proposal for Bitcoin, with the aim to create P2P money without banks. Bitcoin introduced a novel solution to the age-old human problem of trust. The underlying blockchain technology allows us to trust the outputs of the system without trusting any actor within it. People and institutions who do not know or trust each other, reside in different countries, are subject to different jurisdictions, and who have no legally binding agreements with each other, can now interact over the Internet without the need for trusted third parties like banks, Internet platforms, or other types of clearing institutions.
When bitcoin was launched it was revolutionary allowing people to transfer money to anytime and anywhere with very low transaction fees . It was decentralized and their is no third party involved in the transaction , only the sender and receiver were involved.
This paper provide a solution to the double-spending problem using a peer-to-peer distributed timestamp server to generate computational proof of the chronological order of transactions.The system is secure as long as honest nodes collectively control more CPU power than any cooperating group of attacker nodes. Bitcoin was made so that it would not be controlled or regulated but now exchanges and governments are regulating bitcoin and other cryptocurrencies at every step. Aryacoin was developed to overcome these restrictions on a free currency.
Aryacoin is a new age cryptocurrency, which withholds the original principle on which the concept of cryptocurrency was established. Combining the best in blockchain technology since the time of its creation, Aryacoin strives to deliver the highest trading and mining standards for its community.

1.1 OVERVIEW ABOUT ARYACOIN

Aryacoin is a new age cryptocurrency, which withholds the original principle on which the concept of cryptocurrency was established. Combining the best in blockchain technology since the time of its creation, Aryacoin strives to deliver the highest trading and mining standards for its community.
Aryacoin is a blockchain based project that allows users to access their wallet on the web and mobile browsers, using their login details.
Aryacoin can be mined; it also can be exchanged by other digital currencies in several world-famous exchanges such as Hitbtc, CoinEx, P2pb2b, WhiteBit, Changelly and is also listed in reputable wallets such as Coinomi and Guarda.
Aryacoin is a coin, which can be used by anyone looking to use cryptocurrency which allows them to keep their privacy even when buying/selling the coin along with while using the coin during transactions. Proof of work and cryptographic hashes allows transactions to verified.
Stable Fee Per AYA is a unique feature of Aryacoin, so by increasing the amount or volume of the transaction, there is no change in the fee within the network, which means that the fee for sending an amount less than 1 AYA is equal to several hundred million AYA. Another unique feature of Aryacoin is the undetectability of transactions in Explorer, such as the DASH and Monero, of course, this operation is unique to Aryacoin.
Using Aryacoin digital currency, like other currencies, international transactions can be done very quickly and there are no limitations in this area as the creators claim.
Aryacoin aims to allow users to access the Aryacoin wallet via the web and mobile browsers using their login details.
Aryacoin is a peer-to-peer electronic cash system that enables users to send and receive payments directly from one party to another, and allow them to transfer funds across borders with no restriction or third party involvement. The blockchain-based system embraces the digital signature, which prevents double spending and low transfer fees, which enables users to transfer huge amounts with very low fees. The proof-of-work consensus mechanism allows each transaction to be verified and confirmed, while anonymity enables users to use the coin anywhere at any time.
According to the website of the operation, each wallet is divided into 2 or more AYA wallet addresses for each transaction, and depending on the volume of the transaction block, the origin, and destination of transactions in the network can not be traced and displayed to the public.
In fact, each wallet in Aryacoin consists of a total of several wallets. The number of these wallets increases per transaction to increase both security and privacy. Aryacoin also uses the dPoW protocol. In the dPoW protocol, a second layer is added to the network to verify transactions, which makes “51% attack” impossible even with more than half of the network hash, and blocks whose Blockchain uses this second layer of security never run the risk of 51% attacks.
AYA has been listed on a number of crypto exchanges, unlike other main cryptocurrencies, it cannot be directly purchased with fiats money. However, You can still easily buy this coin by
first buying Bitcoin from any large exchanges and then transfer to the exchange that offers to trade this coin.

1.1.1 ARYACOIN HISTORY

Aryacoin (AYA) is a new cryptocurrency, which has been created by a group of Iranian developers, is an altcoin which allows for decentralised, peer to peer transactions of electronic cash without any fees whatsoever. Along with the coin, there is a digital wallet that can be created and managed by the user entirely, with no control being retained by the Aryacoin team.
Aryacoin’s founder, Kiumars Parsa, has been a fan of alternative currencies and particularly Bitcoin.
We see people from all around the world using Blockchain technology and the great benefits that came with it and it then that I decided to solve this puzzle for find a way of bringing the last missing piece to the jigsaw. The idea for Aryacoin was born.” Parsa said.
Parsa and his team of Iranian ex-pats not only persevered but expedited the project and just a year later, in the summer of 2019, the first version of Aryacoin was released. In 2020, Aryacoin is the first and only Iranian coin listed on CMC.
Parsa goes on to state that it is now the strength of the community that has invested in the coin that will ultimately drive its success, alongside its robust technology and appealing 0% network fees.
We have thousands of voices behind Aryacoin. People for the people make this coin. It is a massive shout out for democracy. This had made us base the whole team strategy on the benefits for both our users and our traders.
One key example is that the network fee on AYA Blockchain is 0%. Yes, absolutely nothing, which which differentiates us from other networks. What also differentiates us from other coins is that we have AYAPAY which is the first cryptocurrency Gateway in the world which does not save funds on third party storage with all funds being forwarded directly to any wallet address that the Gateway owner requests”.
So for the first time ever, and unlike other gateways, incoming funds will be saved on the users account with submitted withdrawal requests then made on the Gateway host website. In AYAPAY which has also been developed by the Aryacoin team, all funds without extra fees or extra costs will directly forwarded to users wallets. We have named this technology as CloudWithdrawal.
We are continuously challenging ourselves as it is a crowded marketplace. We are striving to have a safer Blockchain against 51% attacks, faster confirmations speeds of transactions, cheaper network fee, growing the market by cooperation with Top tier Exchangers.

1.1.2 ARYACOIN’S MAIN GOAL

Aryacoin’s main goal is to educate people and give them the freedom to use cryptocurrency in any way they want. Aryacoin empowers the users to transfer, pay, trade cryptocurrency from any country around the globe.
Platforms that have been created by Aryacoin Team, as well as those that will go live in future, operate on the same principle and exclude absolutely no one.

1.1.3 PROBLEM ARYACOIN SEEKS TO SOLVE

Aryacoin aims to provide a long-term solution to the problem of double spending, which is still common in the crypto market. The developers of the system have created a peer-to-peer distributed timestamp server that generates computational proof of the transactions as they occur.
Besides, the system remains secure provided honest nodes control more CPU power than any cooperating group of attacker nodes. While Bitcoin was designed not to be regulated or controlled, many exchanges and governments have put regulatory measures on the pioneer cryptocurrency at every step. Aryacoin aims to overcome these restrictions as a free digital currency.

1.1.4 BENEFITS OF USING ARYACOIN

Aryacoin solution offers the following benefits:
  • Real-time update: whether you’re going on a holiday or a business trip, no problem. You can access your coins all over the world.
  • Instant operations: Aryacoin makes it quite easy for you to use your digital wallet and perform various operations with it.
  • Safe and secure: all your data is stored encrypted and can only be decrypted with your private key, seed, or password.
  • Strong security: The system has no control over your wallet. You are 100% in charge of your wallet and funds.

1.1.5 ARYACOIN FEATURES

1. Anonymity
The coin provides decent level of anonymity for all its users. The users can send their transactions to any of the public nodes to be broadcasted , the transaction sent to the nodes should be signed by the private key of the sender address . This allows the users to use the coin anywhere any time , sending transactions directly to the node allows users from any place and country .
2. Real Life Usage
aryacoin’s team is continuously developing new and innovative ways to use the coins , they are currently developing exchanges where the users can exchange the coins without any fees and any restrictions . They also are currently developing other innovative technologies, which would allow users to spend our coins everywhere and anywhere.
3. Offline Exchanges
They are also working with different offline vendors which would enable them to buy and sell the coins directly to our users on a fixed/variable price this would allow easy buy/sell directly using cash . This would allow the coins to be accessible to users without any restrictions which most of the online exchanges have, also increase the value and number of users along with new ways to spend the coin. This would increase anonymity level of the
coin. In addition, introduce new users into the cryptomarket and technology. Creating a revolution, which educates people about crypto and introduce them to the crypto world, which introduces a completely new group of people into crypto and a move towards a Decentralized future!
4. Transactions
When it comes to transactions, Aryacoin embraces a chain of digital signatures, where each owner simply transfers the coin to the next person by digitally signing a hash of the previous transaction and the public key of the next owner. The recipient can then verify the signatures to confirm the chain of ownership. Importantly, Aryacoin comes with a trusted central authority that checks every transaction for double spending.
5. Business Partner with Simplex
Aryacoin is the first and only Iranian digital currency that managed to obtain a trading license in other countries.
In collaboration with the foundation and financial giant Simplex, a major cryptocurrency company that has large companies such as Binance, P2P, Changelly, etc. Aryacoin has been licensed to enter the world’s major exchanges, as well as the possibility of purchasing AYA through Credit Cards, which will begin in the second half of 2020.
Also, the possibility of purchasing Aryacoin through Visa and MasterCard credit cards will be activated simultaneously inside the Aryacoin site. plus, in less than a year, AYA will be placed next to big names such as CoinCapMarket, Coinomi, P2P, Coinpayments and many other world-class brands today.

1.1.6 WHY CHOOSE ARYACOIN?

If you want to use a cryptocurrency that allows you to keep your privacy online even when buying and selling the coins, the Aryacoin team claims that AYA is the way to go. Aryacoin is putting in the work: with more ways to buy and sell, and fixing the issues that were present in the original Bitcoin, plus pushing the boundaries with innovative solutions in cryptocurrencies. You can get started using Aryacoin (AYA) payments simply by having a CoinPayments account!

1.1.7 ARYANA CENTRALIZED EXCHANGE

Aryana, the first Iranian exchange is a unique platform with the following features:
  • The first real international Persian exchange that obtains international licenses and is listed in CoinMarketCap.
  • The first Iranian exchange that has been cooperating with a legal and European exchange for 3 years.
  • The possibility of trading in Tomans (available currency in Iran) at the user’s desired price and getting rid of the transaction prices imposed by domestic sites inside Iran.
  • There is an internal fee payment plan by Iranian domestic banks for depositing and withdrawing Tomans for Aryacoin holders in Aryana Exchange.
  • The number that you see on the monitor and in your account will be equal to the number that is transferred to your bank account without a difference of one Rial.
  • The last but not least, noting the fact that there is a trading in Tomans possibility in Aryana exchange.
Aryana Exchange is using the most powerful, fastest, and most expensive server in the world, Google Cloud Platform (GCP), which is currently the highest quality server for an Iranian site, so that professional traders do not lag behind the market even for a second.
The feature of Smart Trading Robots is one of the most powerful features for digital currency traders. Digital cryptocurrency traders are well aware of how much they will benefit from smart trading robots. In the Aryana exchange, it is possible to connect exchange user accounts to intelligent trading bots and trade even when they are offline.
The injection of $ 1 million a day in liquidity by the WhiteBite exchange to maintain and support the price of Tether and eliminate the Tether fluctuations with Bitcoin instabilities used by profiteers to become a matter of course.

1.1.8 HOW DOES ARYACOIN WORK?

Aryacoin (AYA) tries to ensure a high level of security and privacy. The team has made sure to eliminate any trading restrictions for the network users: no verification is required to carry out transactions on AYA, making the project truly anonymous, decentralized, and giving it a real use in day-to-day life. The Delayed-Proof-of-Work (dPoW) algorithm makes the Aryacoin blockchain immune to any attempts of a 51% attack. AYA defines a coin as a chain of digital signatures — each owner transfers the coin to the next owner by digitally signing the hash of the previous transaction and the public key of the next owner, and the receiver verifies the signatures and the chain of ownership.

2. ARYACOIN TECHNOLOGY

2.1 PROOF-OF-WORK

They use a proof-of-work system similar to Adam Back’s Hashcash to implement a distributed timestamp server on a peer-to-peer basis, rather than newspaper or Usenet publications. The proof-of-work involves scanning for a value that when hashed, such as with SHA-256, the hash begins with a number of zero bits. The average work required is exponential in the number of zero bits required and can be verified by executing a single hash.
For their timestamp network, they implement the proof-of-work by incrementing a nonce in the block until a value is found that gives the block’s hash the required zero bits. Once the CPU effort has been expended to make it satisfy the proof-of-work, the block cannot be changed without redoing the work. As later blocks are chained after it, the work to change the block would include redoing all the blocks after it.
The proof-of-work also solves the problem of determining representation in majority decision making. If the majority were based on one-IP-address-one-vote, it could be subverted by anyone able to allocate many IPs. Proof-of-work is essentially one-CPU-one-vote. The majority decision is represented by the longest chain, which has the greatest proof-of-work effort invested in it. If honest nodes control a majority of CPU power, the honest chain will grow the fastest and outpace any competing chains. To modify a past
block, an attacker would have to redo the proof-of-work of the block and all blocks after it, then catch up with, and surpass the work of the honest nodes.

2.2 NETWORK

The steps to run the network are as follows:
  • New transactions are broadcast to all nodes.
  • Each node collects new transactions into a block.
  • Each node works on finding a difficult proof-of-work for its block.
  • When a node finds a proof-of-work, it broadcasts the block to all nodes.
  • Nodes accept the block only if all transactions in it are valid and not already spent.
This is a very simple system that makes the network fast and scalable, while also providing a decent level of anonymity for all users. Users can send their transactions to any of the public nodes to be broadcast, and the private key of the sender’s address should sign any transaction sent to the nodes. This way, all transaction info remains strictly confidential. It also allows users to send transactions directly to the node from any place at any time and allows the transferring of huge amounts with very low fees.

2.3 AYAPAY PAYMENT SERVICES GATEWAY:

According to creators Aryacoin, the development team has succeeded in inventing a new blockchain technology for the first time in the world, which is undoubtedly a big step and great news for all digital currency enthusiasts around the world.
This new technology has been implemented on the Aryacoin AYAPAY platform and was unveiled on October 2. AYAPAY payment platform is the only payment gateway in the world that does not save money in users’ accounts and transfers incoming coins directly to any wallet address requested by the gateway owner without any additional transaction or fee.
In other similar systems or even systems such as PayPal, money is stored in the user account.

2.4 CONSENSUS ALGORITHM IN ARYACOIN

The devs introduced the Delayed-Proof-of-Work (dPoW) algorithm, which represents a hybrid consensus method that allows one blockchain to take advantage of the security provided by the hashing power of another blockchain. The AYA blockchain works on dPoW and can use such consensus methods as Proof-of-Work (PoW) or Proof-of-Stake (PoS) and join to any desired PoW blockchain. The main purpose of this is to allow the blockchain to continue operating without notary nodes on the basis of its original consensus method. In this situation, additional security will no longer be provided through the attached blockchain, but this is not a particularly significant problem. dPoW can improve the security level and reduce energy consumption for any blockchain.

2.5 DOUBLE-SPEND PROBLEM AND SOLUTION

One of the main problems in the blockchain world is that a receiver is unable to verify whether or not one of the senders did not double-spend. Aryacoin provides the solution, and has established a trusted central authority, or mint, that checks every transaction for double-spending. Only the mint can issue a new coin and all the coins issued directly from the mint are trusted and cannot be double-spent. However, such a system cannot therefore
be fully decentralized because it depends on the company running the mint, similar to a bank. Aryacoin implements a scheme where the receiver knows that the previous owners did not sign any earlier transactions. The mint is aware of all transactions including which of them arrived first. The developers used an interesting solution called the Timestamp Server, which works by taking a hash of a block of items to be ‘timestamped’ and publishing the hash. Each timestamp includes the previous timestamp in its hash, forming a chain. To modify a block, an attacker would have to redo the proof-of-work of all previous blocks, then catch up with, and surpass the work of the honest nodes. This is almost impossible, and makes the network processes more secure. The proof-of-work difficulty varies according to circumstances. Such an approach ensures reliability and high throughput.

3. ARYACOIN ROADMAP

April 2019: The launch of Aryacoin; AYA ICO, resulting in over 30BTC collected
December 2019: The launch of AYA Pay
April 2020: The successful Hamedan Hardfork, supported by all AYA exchanges, aimed at integrating the dPoW algorithm, improving the security of the AYA blockchain.
June 2020: Aryana Exchange goes live, opening more trading opportunities globally
July 2020: The enabling of our Coin Exchanger
November 2020: The implementation of Smart Contracts into the Aryacoin Ecosystem
Q1 2021: Alef B goes live (more details coming soon)

4. THE NUCYBER NETWORK COMMUNITY & SOCIAL

Website: https://aryacoin.io/
Explorer: https://explorer.aryacoin.io/
Github: https://github.com/Aryacoin/Aryacoin
Twitter: 1.1k followers https://twitter.com/AryacoinAYA
Reddit: 442 members https://github.com/nucypher
Instagram: 3.8k followers https://www.instagram.com/mrdigicoin/ Telegram: 5.9k subscribers https://t.me/AYA_Global

5. SUMMARY

Aryacoin (AYA) is a new age cryptocurrency that combines the best of the blockchain technology and strives to deliver high trading and mining standards, enabling users to make peer-to-peer decentralized transactions of electronic cash. Aryacoin is part of an ecosystem that includes payment gateway Ayapay and the Ayabank. AYA has a partnership with the Microsoft Azure cloud platform, which provides the ability to develop applications and store data on servers located in distributed data centers. The network fee for the AYA Blockchain is 0%. In Ayapay service, which has been developed by the Aryacoin team, all funds without extra fees or costs are directly forwarded to users’ wallets with technology called CloudWithdrawal. The devs team is introducing new use cases including exchanges where users will exchange AYA without any restrictions. You can buy AYA on an exchange of your choice, create an Aryacoin wallet, and store it in Guarda.

6. REFERENCES

1) https://coincodex.com/crypto/aryacoin/
2) https://www.icosandstos.com/coin/Aryacoin%20AYA/YuXO60UPF3
3) https://www.publish0x.com/iran-and-cryptocurrency/a-brief-introduction-of-aryacoin-first-ever-iranian-cryptocu-xoldlom
4) https://techround.co.uk/cryptocurrency/aryacoin-the-digital-currency-created-by-iranians/
5) https://bitcoinexchangeguide.com/aryacoin/
6) https://blog.coinpayments.net/coin-spotlight/aryacoin
7) https://guarda.com/aryacoin-wallet
submitted by CoinEx_Institution to Coinex [link] [comments]

Looking for Technical Information about Mining Pools

I'm doing research on how exactly bitcoins are mined, and I'm looking for detailed information about how mining pools work - i.e. what exactly is the pool server telling each participating miner to do.
It's so far my understanding that, when Bitcoins are mined, the following steps take place:
  1. Transactions from the mempool are selected for a new block; this may or may not be all the transactions in said mempool. A coinable transaction - which consists of the miner's wallet's address and other arbitrary data - that will help create new Bitcoin will also be added to the new block.
  2. All of said transactions are hashed together into a Merkle Root. The hashing algorithm is Double SHA-256.
  3. A block header is formed for the new block. Said block header consists of a Version, the Block Hash of the Previous Block in the Blockchain, said Merkle Root from earlier, a timestamp in UTC, the target, and a nonce - which is 32 bits long and can be any value from 0x00000000 to 0xFFFFFFFF (a total of 4,294,967,296 nonce values in total).
  4. The nonce value is set to 0x00000000, and said block header is double hashed to get the Block Hash of the current block; and if said Block Hash starts with a certain number of zeroes (depending on the difficulty), the miner sends the block to the Bitcoin Network, the block successfully added to the blockchain and the miner is awarded with newly created bitcoin.
  5. But if said Block Hash does not start with the required number of zeroes, said block will not be accepted by the network, and the miner Double Hashes the block again, but with a different nonce value; but if none of the 4,294,967,296 nonce values yields a Block Hash with the required number of zeroes, it will be impossible to add the block to the network - and in that case, the miner will either need to change the timestamp and try all 4,294,967,296 nonce values again, or the miner will need to start all over again and compose a new block with a different set of transactions (either a different coinable transaction, a different set of transactions from the mempool, or both).
Now, what I'm trying to figure out is what exactly each miner is doing differently in a mining pool, and if it is different depending on the pool.
One thing I've read is that a mining pool gives each participating miner a different set of transactions from the mempool.
I've also read that, because the most sophisticated miners can try all 4,294,967,296 nonce values in less than a fraction of a second, and since the timestamp can only be updated every second, the coinbase transaction is used as a "second nonce" (although, it is my understanding that, being part of a transaction, if this "extra nonce" is changed, all the transactions need to be double hashed into a new Merkle Root); and I may have read someplace that miners could also be given the same set of transactions from the mempool, but are each told to use a different set of "extra nonce" values for the coinbase transaction.
Is there anything else that pools tell miners to do differently? Is each pool different in the instructions it gives to the participating miners? Did I get anything wrong?
I want to make sure I have a full technical understanding of what mining pools are doing to mine bitcoin.
submitted by sparky77734 to Bitcoin [link] [comments]

Upcoming Updates to Bitcoin Consensus

Price and Libra posts are shit boring, so let's focus on a technical topic for a change.
Let me start by presenting a few of the upcoming Bitcoin consensus changes.
(as these are consensus changes and not P2P changes it does not include erlay or dandelion)
Let's hope the community strongly supports these upcoming updates!

Schnorr

The sexy new signing algo.

Advantages

Disadvantages

MuSig

A provably-secure way for a group of n participants to form an aggregate pubkey and signature. Creating their group pubkey does not require their coordination other than getting individual pubkeys from each participant, but creating their signature does require all participants to be online near-simultaneously.

Advantages

Disadvantages

Taproot

Hiding a Bitcoin SCRIPT inside a pubkey, letting you sign with the pubkey without revealing the SCRIPT, or reveal the SCRIPT without signing with the pubkey.

Advantages

Disadvantages

MAST

Encode each possible branch of a Bitcoin contract separately, and only require revelation of the exact branch taken, without revealing any of the other branches. One of the Taproot script versions will be used to denote a MAST construction. If the contract has only one branch then MAST does not add more overhead.

Advantages

Disadvantages

submitted by almkglor to Bitcoin [link] [comments]

Over the last 6 weeks I've written a functioning Crypto trading bot in VB.NET and here are some of the important tips & things I've learned and some VB.NET code for you to use.

I started on December 18th when I was playing about with Google Sheets and pulling prices from exchanges using the CRYPTOFINANCE() plugin... it was slow, clunky and the data was wildly old - I knew I could do something better in VB.NET but at this point had absolutely no idea where to start, no idea about trading, no idea how exchanges or API's worked and no idea just how bad I was at programming. I've asked a lot of dumb questions, I've lost a bunch of money making mistakes & learning as I go... Fast forward to today however and I have a fully functioning, cross-exchange trading bot. Sweet!
1) Truncate your numbers, don't round.**
Hindsight makes this seem so obvious to me now, but when you're working with Bitcoin balances to 8 decimal places, exchange rates to 5 decimal places and sums that can increase your decimal places exponentially, it helps to be precise. Even an extra 0.00000001 in the wrong place can cause an exchange to reject your request. Honestly if I'd have realised this sooner I'd be about 2 weeks ahead right now and nowhere near as bald.
The below functions in will truncate any decimal number with no rounding:
Public Function Trunc8(numbertoTuncate As Decimal) As Decimal Return Math.Truncate(numbertoTuncate * 100000000) / 100000000 End Function Public Function Trunc5(numbertoTuncate As Decimal) As Decimal Return Math.Truncate(numbertoTuncate * 100000) / 100000 End Function 
** Absolutely do round when exchange such as Bitstamp does it's fee calculations in spot USD price. Below is the logic I use to do this:
Dim amount_btc As Decimal = BTCtoSpend / ASK ' Full amount in BTC Dim fee_btc As Decimal = amount_btc * 0.0025 ' Get 0.25% of the BTC amount Dim fee_USD As Decimal = fee_btc * BitstampBTCUSD ' Convert to USD Dim round_USD As Decimal = Math.Round(fee_USD, 2, MidpointRounding.AwayFromZero) ' Round up Dim round_BTC As Decimal = round_USD / BitstampBTCUSD ' Convert back to BTC Dim amount = amount_btc - round_BTC ' minus the fee 
2) Websockets are your friend.
It's really easy to query Bitstamp or GDAX's API for the prices(Last/Bid/Ask). The query might take a 3rd of a second to get there, a 3rd of a second to get back - by the time your software has interpreted it it may have been nearly a full second. The prices you end up being sent back can some times be stale/out of date. Couple this with the API rate limits (Once a second on Bitstamp if you end up polling it continuously) and you can soon end up with stale information. The websockets allow the exchanges to push information to you, in real-time, as it happens. Seriously, they're fucking rad and you can query that data til the cows come home. Millisecond timers FTW!
Bitstamp uses Pusher, GDAX is a plain old web socket. It took me an age to figure it out, and honestly I've done it rather arse-about-tit, but here's the code I ended up using:
Bitstamp:(You'll need PusherClient from Nuget)
Imports PusherClient Imports Newtonsoft.Json.Linq Public WithEvents pusherClient As New Pusher("de504dc5763aeef9ff52") Public WithEvents BitstampLTCBTCOrderbook As Channel Public WithEvents BitstampLTCBTCTrades As Channel Public WithEvents BitstampBTCUSDTrades As Channel Public WithEvents BitstampEURUSDTrades As Channel pusherClient.Connect() Public Sub pusher_Connected() Handles pusherClient.Connected BitstampLTCBTCTrades = pusherClient.Subscribe("live_trades_ltcbtc") End Sub Public Sub BitstampLTCBTCTrades_Subscribed(Sender As Object) Handles BitstampLTCBTCTrades.Subscribed BitstampLTCBTCTrades.Bind("trade", AddressOf BitstampLTCBTCTrade) End Sub Public Sub BitstampLTCBTCTrade(data) Dim jss = JObject.Parse(data.ToString) BitstampPrice = CDec(jss("price_str").ToString) BitstampLastAmount = CDec(jss("amount_str").ToString) End Sub 
That's basically it - the different channels are all documented in the API and you can format the JSON til your little crypto heart's content.
GDAX:(You'll need Websocket4NET from Nuget) P.S. I know my sending raw JSON is a fucking abomination.
Imports WebSocket4Net Imports Newtonsoft.Json.Linq Public WithEvents websocketGDAX As WebSocket websocketGDAX = New WebSocket("wss://ws-feed.gdax.com") websocketGDAX.Open() Public Sub gdax_Connect() Handles websocketGDAX.Opened Dim Data As String = "{ ""type"": ""subscribe"", ""product_ids"":[""BTC-EUR""], ""channels"": [""heartbeat"", { ""name"": ""ticker"", ""product_ids"": [""LTC-BTC""] }]}" websocketGDAX.Send(Data) End Sub Public Sub gdax_Data(sender As Object, args As WebSocket4Net.MessageReceivedEventArgs) Handles websocketGDAX.MessageReceived Dim jss = JObject.Parse(args.Message) Try If jss("type").ToString = "ticker" Then Select Case jss("product_id") Case "LTC-BTC" GDAXPrice = CDec(jss("price")) GDAXBid = CDec(jss("best_bid")) GDAXAsk = CDec(jss("best_ask")) GDAXLastSize = CDec(jss("last_size")) Case "EUR-USD" GDAXEURUSD = CDec(jss("price")) Case "BTC-USD" End Select End If Catch ex As Exception Exit Sub End Try End Sub 
Again, that's kind of it. Some proper error handling wouldn't go amiss, but I'm lazy and I use GOTO's all over the shop anyway so I'm basically a terrible human being.
3) Hashing. Fucking Hashing.
Ok so basically when sending authenticated/private API calls you need to hash bits of the message in order to prove authenticity. This was a bitch to try and cobble together the right code. Here, have it. It's yours:
Imports System.Security.Cryptography Imports System.Text Module Hashing Public Function HMACSHA256_Encrypt(ByVal message As String, secret As String) As String Try Dim secretkey As String = secret Dim sha As New System.Security.Cryptography.HMACSHA256(System.Text.ASCIIEncoding.ASCII.GetBytes(secretkey)) Dim Hash() As Byte = sha.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(message)) Dim sb As New StringBuilder(Hash.Length * 2) For Each B As Byte In Hash sb.Append(Hex(B).PadLeft(2, "0")) Next Return sb.ToString.ToUpper Catch ex As Exception Debug.Print(Date.Now & " SHA256_Encrypt error " & ex.Message) Return Nothing End Try End Function Public Function HashString(ByVal str As String, ByVal secret As Byte()) As String Dim bytes As Byte() = Encoding.UTF8.GetBytes(str) Using hmac = New HMACSHA256(secret) Dim hash As Byte() = hmac.ComputeHash(bytes) Return Convert.ToBase64String(hash) End Using End Function End Module 
Top one for Bitstamp, Bottom one for GDAX. They differ slightly in the way they do things and the output they provide, hence there being two. Don't ask me what they do, couldn't tell you. Not a clue.
4) Verbose logging. Verbose logging. Verbose logging.
So you've made your bot, hit the button and....nothing. Now these things don't happen instantly; Even if you place an order at Ask or Bid, it might be minutes, even hours until it gets filled. Maybe your bot keeps erroring out and you don't know why. Write yourself a little logging function that you can copy and paste into your functions & subs that outputs the data you're sending and the data you're receiving along with a timestamp so you can debug if stuff isn't working. Again, I'm lazy and shit and this took me way longer to realise than it should have.
5) Don't be afraid to ask questions.
One of the biggest things that totally blew my mind was just how closed up some people are; on Reddit, forums, discord rooms... you name it. There's this weird stigma about people who trade & write bots that if they share their knowlege they'll somehow be doing themselves out of returns. Don't be afraid to ask questions. Ask enough, and eventually someone will come along and help. For every 10 people who chastised me for asking for coding help, trading help or whatever, 1 person would help out - it's worth enduring the rough for that... also, fuck those 10 people.
6) God damn Nonce generation.
A nonce is basically a unique, yet increasing number. Again, this was all massive trial and error. Bitstamp nonces and GDAX nonces work slightly differently and are interpreted slightly differently. Here's the code I use:
Module Nonces Public Function GenerateStampNonce() As String Static lastnonce As String Dim newNonce As String = Replace(Math.Round((DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds / 1000, 1).ToString("#0.0"), ".", "") Do While lastnonce = newNonce Threading.Thread.Sleep(10) newNonce = Replace(Math.Round((DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds / 1000, 1).ToString("#0.0"), ".", "") Loop lastnonce = newNonce Return newNonce End Function Public Function GenerateGDAXNonce() As Decimal Static lastnonce As Decimal Dim newNonce As Decimal = (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds / 1000 Do While lastnonce = newNonce Threading.Thread.Sleep(10) newNonce = (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds / 1000 Loop lastnonce = newNonce Return newNonce End Function End Module 
It's dirty...I know (I like it that way) - however it just simply works. I'm sure there's a more elegant way of generating these but honestly I ran out of patience on this because it's so simple when you look at it once it works.
7) Don't bog yourself down with a GUI.
Seems kind of daft, but running a bot as a console app forced me not only to be more verbose, but also helped really train my though process in terms of what all the timers in the background are doing. Not to mention, if you're anything like me you'll probably end up bogging it right down with all kinds of unnecessary GUI crap... in fact my first bot that was a total failure had more code to make the GUI whistle and pop than it did quality trading code.
You need so little input for a trading bot besides a config file full of preferences that your only real commands for any kind of interaction are quite simply:
 Console.WriteLine() Console.ReadKey() 
7.5) Limit orders on GDAX - FREE! As in... no fees!
Some people act like this is some kind of trade secret (haha, puns) but if you put a limit order on GDAX you almost always pay absolutely no fees. If you want to GUARANTEE you pay no fees, have your order set to post_only=true. This forces the order onto the books, which means you MUST place it AT Bid/Ask (depending on direction) or above/below, it'll get rejected if you try and eat into the other side of the spread.
8) Async/Multithread your requests to the API's.
I haven't done this, so I have no code to share. But if you suddenly lose connection or there's a blip or whatever, there's often no way of specifying a timeout and it could potentially freeze/crash your application.
-----------------------------------------
I guess that's all I can think of. It might seem like simple, trivial stuff but when it comes to writing something in a language like VB.NET there's very little resources out there at all... I went through some pretty mind-bending trial and error that while fun and now rewarding, was very frustrating at the time.
All in all, writing a program that can interact with an exchange is a wholly steep learning experience and I've learned more in terms of my general programming ability and my knowlege and understanding of trading & exchanges in general than I had in months or even years before doing this.
Feel free to ask any questions, I'll try to answer them as best I can.
submitted by DotNetBarry to BitcoinMarkets [link] [comments]

EasyMine: WTF Happened?

UPDATE: VTC mining on Easymine back to normal, payouts have resumed. Zero fees for the rest of the month.
Here's a more detailed response to https://old.reddit.com/vertcoin/comments/96z77t/psa_easy_mine_problem/ - bear with me and put on your nerd hat for a few mins.
The stratum server for all EasyMine pools is node-merged-pool - a merge mining fork of node-stratum-pool. See my repo here @ https://github.com/nzsquirrell/node-merged-pool
This is what miners connect to for work and to submit valid shares on the search for blocks. The information that is exchanged in hex digits, and the data coming back from the miner includes the time, the job, ExtraNonce2 and nonce (see https://en.bitcoin.it/wiki/Stratum_mining_protocol#mining.submit). All of these fields are used to notify the server of valid work exceeding a specific difficulty.
Hex digits are not case-sensitive. So 'FF00AA11' is the same as 'ff00aa11'. Both equate to decimal 4278233617. So for the purposes of construction a block header, it doesn't matter if the hex digits are uppercase, lowercase, or a mixture of both - it all works out the same, and produces the same hash. Hold this thought.
The stratum server knows what shares each miner has submitted, it keeps a track of all of the data in an array. It checks every time that work is submitted that the same work hasn't been submitted before whilst searching for the next block. If it was submitted, then the new submission is rejected as duplicate work.
Now, where this has all gone wrong is that the way the data is stored in this array was a string containing the four fields mentioned above. Strings are case-sensitive and when making comparisons 'FF00AA11' != 'ff00aa11', as well as 'ff00aA11' and 'ff00AA11' and so on.... This allowed our attacker to submit the same work many many times, altering only the case of the hex digits (he was doing it to the nonce, but the other fields are also susceptible to the attack), so the logic to check for duplicate work wasn't firing, the shares were valid (as they produced a valid hash above difficulty), and our attacker was faking most of his hash-rate. A lot. A shit-ton of it.
I have fixed this in my fork of node-stratum-pool - the fix is very easy, we just make all the characters lower case before testing for duplicate shares. See https://github.com/nzsquirrell/node-merged-pool/commit/9d068535d042516835f565a859852c7cf715da98 for my fix.
My big concern is that the other forks I've seen for node-stratum-pool are susceptible to the attack, and quite possibly other pool software is too possibly even p2pool? I've not looked. If someone can check and let me know and I'll update this. p2pool has been confirmed as resilient to this type of attack.
So, Who-The-F&*k did this. This is what I have so far:
He's used the following VTC and NIX addresses:
I've seen connections coming in from the following IP addresses:
He is still attacking EasyMine, but it's not having any effect now. Actually the server keeps banning him now as it's detecting that he's submitting too many invalid shares. Take that.
The path forward
I have a big mess to clean up, he's made off with about 652 VTC and about 3576 NIX, essentially stolen from you miners. I will see what I can do to recover some of this (not all of it has been paid to him yet), but there is going to be a substantial shortfall. Mr Attacker, feel free to PM me and we can arrange a settlement :)
Payouts on both the VTC & NIX pools are suspended until i can clean this up, I hope this won't take more than a couple of days.
Thanks.
submitted by nzsquirrell to vertcoin [link] [comments]

Notes from Ethereum Core Devs Meeting #31 [1/12/18]

The next core dev meeting will be this Friday, January 26, 2018. The agenda and live stream link are located here.

Ethereum Core Devs Meeting 31 Notes

Meeting Date/Time: Friday 01/12/18 at 14:00 UTC

Meeting Duration: 1.5 hours

GitHub Agenda Page

Audio/Video of the meeting

Reddit thread

Agenda

  1. Testing Updates.
  2. Yellow paper update.
  3. EWASM update + update on the following related EIPs. a. EVM 2.0 - https://github.com/ethereum/EIPs/issues/48 b. Extend DUP1-16 / SWAP1-16 With DUPN / SWAPN - https://github.com/ethereum/EIPs/issues/174 c. Subroutines and Static Jumps for the EVM - https://github.com/ethereum/EIPs/issues/615
  4. Stateless client development.
  5. Add ECADD and ECMUL precompiles for secp256k1 - https://github.com/ethereum/EIPs/issues/603 [See this blog post for context].
  6. Introduce miner heuristic "Child pays for parent" (like in BTC) to combat the weird cases when transactions with 1000 Gwei stuck in the mempool (because they are dependent via nonce on transaction paying much less and not getting mined).
  7. Creating a relay network of nodes to mitigate issues described here and other transaction propagation issues.
  8. Fork release management/Constantinople.
  9. Client updates.
  10. Other non-agenda issues.

Notes

Video starts at [4:36].

[4:56] 1. Testing Updates

No updates.

[5:27] 2. Yellow paper update.

Gavin put the Yellow Paper under the Creative Commons Free Culture License CC-BY-SA. Yoichi and Nick Savers have been making progress handling the Yellow Paper PRs. There is still the somewhat unresolved issue of what should define the "formal standard" of Ethereum and should an update to the Yellow Paper or another specification be required for every new EIP. This can be discussed in more detail in future meetings when there is greater attendance.

[7:43] 3. EWASM update + update on the following related EIPs.

[7:55] General update

Ewasm contributors are currently meeting in person together in Lisbon. EWASM EIPs listed in the subpoints are not up to date and can be disregarded. People should use the github.com/EWASM/design repo. The design has been pretty much speced out in the last year. During the design phase there were 2 implementations done in parallel: Javascript and C++ (which can be integrated in cpp-ethereum and geth). Issues have been faced in building out EWASM including struggling with implementing synchronous code in Javascript/browser. Idea was to move to an asynchronous model. Currently there is not a full decision on using synchronous vs asynchronous, but we are leaning towards synchronous implementation in C++ to run a testnet in cpp-ethereum that can run pure Web Assembly contracts. Metering contract in Web Assembly is on the to-do list and doesn't rely on sync/async decision. Likely will take week to come to a decision on sync vs async. More technical discussion and a funny anecdote involving the asynchronous vs synchronous decision and the affects of the recent Spectre/Meltdown attacks start at [12:07].

[15:08] a. EVM 2.0 - https://github.com/ethereum/EIPs/issues/48

Martin Becze will be closing this EIP. It is outdated.

[15:28] b. Extend DUP1-16 / SWAP1-16 With DUPN / SWAPN - https://github.com/ethereum/EIPs/issues/174

This doesn't have to do with EWASM, it has to do with adding extra opcodes in the current EVM. It is an upgrade to EVM 1.0 which is not needed if we skip straight to EWASM.

[16:47] c. Subroutines and Static Jumps for the EVM - https://github.com/ethereum/EIPs/issues/615

Greg has been working with Seed (Gitter tag) who is writing an ELM formalization of the EIP. Greg says that there is no formal social process for deciding things like EVM 1.5 implementation so he is not sure if/when it would be implemented. Greg has been working on cleaning up the proposal for those who want to use it. Greg has some ideas around an EVM 3.0 that pulls everything together with transpilation that he hasn't started working on yet and is not sure if he will.

[20:14] 4. Stateless client development.

Piper left some comments about some development of a stateless client for sharding, but it is very early. Alexey had a blog post describing stateless clients he may re-approach later.

[21:46] 5. Add ECADD and ECMUL pre-compiles for secp256k1 - https://github.com/ethereum/EIPs/issues/603 [See this blog post for context].

This topic was brought up months ago with mixed commentary. Christian R. says that ECADD and ECMUL were never intended to be used for general purpose cryptography, but rather it was suppose to be used in conjunction with the pairing pre-compiles for a specific curve that is pairing friendly. Christian says that in the past it has been discussed that there must be a very compelling reason for adding a pre-compile to Ethereum. Silur mentioned that the Monero research team is working on a new ring signature (still unnamed) that can be viewed in the Monero repository. The EWASM team may run some tests to compare native running of the pre-compiles vs EWASM. Adding a new pre-compile would only give a constant speed-up or reduction in cost, but if we achieve the same thing in new virtual machine it will give us a constant speed-up for every conceivable routine and allows for building other schemes like Casper and TrueBit. This is easier with Web Assembly because we can use existing C code. For the moment it looks like focusing energy on adding these proposed pre-compiles would not be worth it compared to just waiting for the next VM (likely EWASM) which will allow far more speed-ups across all computational routines.

[37:00] 6. Introduce miner heuristic "Child pays for parent" (like in BTC) to combat the weird cases when transactions with 1000 Gwei stuck in the mempool (because they are dependent via nonce on transaction paying much less and not getting mined).

[Note: I tried my best to cover what was discussed here, but I am not an expert in Ethereum transactions. If you find a mistake please point it out to me. Thanks!] Agenda item brought up to get people's opinion on this topic. Currently in Ethereum there are transactions that are stuck in the mempool for a long time because of the way transaction ordering per account is handled. The nonce of a transaction must be greater than the previous mined transactions (or equal if you are trying to replace a transaction). For example you can't process transaction #27 before transaction #26 has been mined. Many of the stuck transactions are dependent on other transactions that pay a much smaller fee, but are not being mined. It seems people inadvertently send an initial transaction with too small of a fee and then more transactions at a higher nonce with a much higher fee that cannot be processed until the first small fee transaction is processed. Alexey wondered if this may pose an attack vector or if we would get a benefit from implementing "child pays for parent" like Bitcoin does. Peter explained even if you define the max amount of gas your transaction could potentially consume, there is no guarantee it will use that much and we won't know until the transaction is processed (the only guarantee is that 21,000 gas will be consumed - a plain ether transfer). The attack vector example would be someone pushing a transaction that truly consumes 3,000,000 gas and attach a transaction fee of 1 wei and then push another TX that claims to consume 3,000,000 gas but with a transaction fee of 1000gwei. From the outside it looks like I can both can be executed for profit from the miner's perspective, but in reality the 2nd transaction will be processed first and the 1st tx will be long running and indirectly punish the miner. Alexey was concerned about the mempool filling up and impact on clients due to the way nonces are handled. Peter clarified that transactions in the mempool in the go ethereum client only maintains the top 4,000 most expensive transactions. If your cheap transaction gets evicted, the expensive transactions you stacked on top of it get evicted as well because they are no longer executable due to the nonce.

[42:21] 7. Creating a relay network of nodes to mitigate issues described here and other transaction propagation issues.

A relay network in general is a group of peers and/or miners who use a peer list to quickly connect to a group of known peers before connecting to (or instead of connecting to) random peers using network discovery. Alexey conjectured that this may create a powerful ring of network players who can share transactions very quickly and hurt the little guys on the outside (hurting the idea of this being a mesh network of peers). Clarifications were made about the issues involving transaction propagation issues with nodes with high transaction throughput such as Infura and Bittrex. Clients suddenly stop pushing transactions or cannot keep up with the blockchain when they are pushing out so many transactions. Hudson will work towards exploring this issue more and connecting the people with the issues with the devs.

[49:45] 8. Fork release management/Constantinople.

Hudson will be working on writing up a starting plan to discuss potential release management issues. BitsBeTripping sent Hudson some good material about project management that he will review and bring to the next meeting. We need to start discussing Constantinople sooner rather than later.

[52:55] 9. Client updates.

10. Other non-agenda items

[1:05:42] Question: Will we see any scaling improvements from Constantinople?

Answer is no because it potentially includes the first steps of the Casper consensus protocol and some account abstraction EIPs, but both of those do not alleviate scaling issues. Sharding would alleviate some of the issues. We are currently mostly bound by database and processing speed due to the database. Short term there are a lot of client improvements that can be accomplished to improve disk I/O, but long term things like sharding will be necessary. The Eth Research site has a lot of interesting threads about sharding including merkle tree formats to be used and ideas around asynchronous accumulators

[1:09:57] Decision process for EIPs?

Needs to be improved. Hudson and others will work on updating EIP #1 and other improvements in Q1. Nick Savers has been added as an EIP editor. Yoichi has been added as an editor. Both are doing a great job.

Attendance

Alex Beregszaszi (EWASM/Solidity/ethereumJS), Alex Van de Sande (Mist/Ethereum Wallet), Alexey Akhunov (Turbo Geth), Ben Edgington (Consensys/Pegasys), Casey Detrio (Volunteer), Christian Reitwiessner (cpp-ethereum/Solidity), Daniel Ellison (Consensys/LLL), Greg Colvin (EVM), Hudson Jameson (Ethereum Foundation), Hugo de la Cruz (ethereumJS/EWASM), Jake Lang (EWASM), Jared Wasinger (ethereumJS/EWASM), Martin Becze (EWASM), Mikhail Kalinin (Harmony), Paweł Bylica (cpp-ethereum/EWASM), Péter Szilágyi (geth), Silur (ethereumJS / EWASM)
submitted by Souptacular to ethereum [link] [comments]

Non-Contentious Alternative to A Fork: Symbiosis Instead Of Quarrel: One-Way-Peg Sidechain: Good For "Small-Blockers" As Well As "Pragmatics"! The Best From Both Philosophies: Conservatism For Bitcoin-Core, Unleashing Full On-Chain Utility Of Bitcoin Unlimited. All Groups Mutually Benefit.

Sorry for the long post - but I think it should really be read and understood by everybody concerned with the idea of launching a "Higher-Capacity Bitcoin", by everybody concerned with Bitcoin security and decentralization, and by everybody concerned with Bitcoin price!
Description Of The Concept:
Consequences Of This Solution - Characteristics:
  1. Every user who owns BTC-c can directly "convert" it 1:1 to BTC-u by a simple transfer to unspendable address "1transferAddressToBitcoinUsab1eGh5W".
  2. Optionally, the user could of course "convert it" via a classical exchange market, if the exchange market allows trade in BTC-c and BTC-u.
  3. Every User who owns BTC-u can only convert it (back) to BTC-c via a normal crypto-currency exchange market (because we have a ONE way peg without any modifications of the Bitcoin-core protocol, we cannot do it on protocol level!). While this is not a big difference microscopically from individual user perspective (if exchanges are well-integrated in apps and exchange fees are low), it does make a difference macro-economically, because BTCs can only drain in one direction, long-term, and never back.
Some Thoughts On Market Dynamics To Be Expected:
(I assume that the following "phases" will span over MANY years)
Thoughts On Exchange Rate Evolutions To Be Expected:
  • Phase 1:
    • A BTC-u unit is expected to be valued less than BTC-c, because you cannot really do anything meaningful with BTC-u yet, and after all, each owner of BTC-c can exchange it for a unit of BTC-u 1:1, so there is no reason why the free markets should give BTC-u a higher valuation than a BTC-c! If this were the case traders would immediately exchange BTC-c for BTC-u on protocol level and take the arbitrage gains. So market forces alone will keep the price of BTC-u below the price of BTC-c, except for very short periods of time (which will probably not occur at all in this "phase 1").
    • Only some tech geeks and early adopters will hence exchange some BTC-c for BTC-u, more for idealistic reasons or for "trying things out" than for trading and financial reasons.
  • Phase 2:
    • BTC-u's advantage in terms of practical utility vs. BTC-c becomes more and more apparent, such that BTC-u price gets closer and closer to BTC-c price on the markets.
    • As BTC-c hodlers keep on standing by their BTC-c, the number of BTC-u in circulation remains low! Users who want to make use of BTC-u's new utility (high TX capacity) have to aquire BTC-u either via protocol-level exchange (destroy BTC-c to get BTC-u), or via the exchanges - whatever is more convenient and attractive. Since BTC-u is still valued lower than BTC-c, they would make the better deal by going via the exchanges (as long as the [small] exchange market fee is less than the difference between BTC-c and BTC-u exchange rate, which can be expected to be the case for quite a while)! This would keep BTC-u supply low and hence it would keep BTC-u price high. And of course, since price(BTC-c) >= price(BTC-u) due to the one-way peg, BTC-c price benefits equally from this!
  • Phase 3:
    • If BTC-u fails for technical or other reasons, its price collapses and the whole experiment becomes history. The number of BTC-c spendable has been reduced due to this experiment, so each BTC-c unit becomes more rare and hence more valuable in price.
    • Otherwise, the demand for BTC-u from practical usage gets even higher, while the total number of BTC-u units in existence are pretty limited. This puts enormous upwards price pressure to BTC-u, and thereby also to BTC-c, to lift up BTC valuation, such that all BTC-u real-world usages can be fulfilled. BTC-c and BTC-u prices are very close, and at certain times of very high demand for BTC-u it even happens that BTC-u is valued higher than BTC-c on some exchanges. When this happens, arbitrage traders will kick in and buy the currently cheaper BTC-c, convert them to higher valued BTC-u by protocol means, and cell the more expensive BTC-u on the market. So such situations won't endure very long and will only serve market pressures in case of severe shortages of BTC-u coins.
DIFFerences and ADVantages Of This Strategy Vs. A "Normal Fork":
  • Both in common: No Dillution or Inflation:
    • In case of a normal fork, the total number of Bitcoins will double from 21 Million to 42 Million, because both forked chains will eventually have 21 Million, respectively. This inflation of Bitcoins is compensated by the fact that each pre-fork Bitcoin owner will also double his owned Bitcoin, so there should be no net penalty by principle.
    • In contrast, with "Bitcoin-Usable", the total(!) number of spendable Bitcoins will never be higher than 21 Million, counting BTC-c and BTC-u together.
    • Hence, even if it looks different in nominal coin units, the net effect is the same: No coins are inflated or diluted and every owner of bitcoins keeps his/her stake, nobody is at a disadvantage.
  • Symbiosis instead of Competition:
    • With "Bitcoin-Usable", bitcoin-core price will fully benefit from the success of the "Bitcoin-Unlimited" or "bigger blocksize" approach of "Bitcoin-Usable". This means that Bitcoin-core hodlers have full self-interest that "Bitcoin-Usable" becomes a success!
    • This is in stark contrast to the "fork" scenario, where the two forks will be competitors and may continue propagating their different philosophies on the different media channels. This not always friendly atmosphere and way of discussion may harm both sides! In the "Bitcoin-Usable" solution instead, both sides can still propagate their own views positively, without any need to talk negatively about the other side, because there is no competition but on the contrary mutual benefit!
    • Hence there would be no incentive from Bitcoin-Core supporters to DoS the "competing" bigger-block-chain - on the contrary they have an interest for that chain to succeed.
  • All fully validating "Bitcoin-Usable" nodes are also fully validating "Bitcoin-core" nodes (but not vice versa). Hence the number of bitcoin-core nodes can only increase compared to today in case "Bitcoin-Usable" becomes a big success, thereby also making the Bitcoin-core network more stable and powerful. So Bitcoin-Core benefits from "Bitcoin-Usable" not only w.r.t. price, but also w.r.t. security! (apart from that, price rise alone has a positive effect on security [via hash power] on its own already)
  • Since Bitcoin-Usable's block sizes and blockchain size are expected to become significantly greater than that of bitcoin-core on the long term, the additional burden that "Bitcoin-Usable" has by also having to observe the Bitcoin-Core blockchain is rather negligible, so in this respect there is no relevant difference between the two solutions.
  • As explained above, the mechanism of the one-way-peg in combination with the market mechanisms on price (low supply of BTC-u vs. high demand as a utility, and the constraint price(BTC-c) >= price(BTC-u)) creates a strong up-force of the Bitcoin price (for both bitcoins), originated by the additional applications of "Bitcoin-Usable". Again, BTC-c fully benefits from this.
  • No replay attack is possible even for identical TX formats in the protocol, because "Bitcoin-Usable" does not share Bitcoin-Core's blockchain history. Hence even better code re-use is possible - the only differences being block size limit and address format (first digit 2/4 vs. 1/3) and the lack of a block reward. And of course the observation of the "other" blockchain and the coin generation after coin destruction (one way peg implementation).
submitted by 1MichaS1 to btcfork [link] [comments]

BIP proposal: Inhibiting a covert attack on the Bitcoin POW function | Gregory Maxwell | Apr 05 2017

Gregory Maxwell on Apr 05 2017:
A month ago I was explaining the attack on Bitcoin's SHA2 hashcash which
is exploited by ASICBOOST and the various steps which could be used to
block it in the network if it became a problem.
While most discussion of ASICBOOST has focused on the overt method
of implementing it, there also exists a covert method for using it.
As I explained one of the approaches to inhibit covert ASICBOOST I
realized that my words were pretty much also describing the SegWit
commitment structure.
The authors of the SegWit proposal made a specific effort to not be
incompatible with any mining system and, in particular, changed the
design at one point to accommodate mining chips with forced payout
addresses.
Had there been awareness of exploitation of this attack an effort
would have been made to avoid incompatibility-- simply to separate
concerns. But the best methods of implementing the covert attack
are significantly incompatible with virtually any method of
extending Bitcoin's transaction capabilities; with the notable
exception of extension blocks (which have their own problems).
An incompatibility would go a long way to explain some of the
more inexplicable behavior from some parties in the mining
ecosystem so I began looking for supporting evidence.
Reverse engineering of a particular mining chip has demonstrated
conclusively that ASICBOOST has been implemented
in hardware.
On that basis, I offer the following BIP draft for discussion.
This proposal does not prevent the attack in general, but only
inhibits covert forms of it which are incompatible with
improvements to the Bitcoin protocol.
I hope that even those of us who would strongly prefer that
ASICBOOST be blocked completely can come together to support
a protective measure that separates concerns by inhibiting
the covert use of it that potentially blocks protocol improvements.
The specific activation height is something I currently don't have
a strong opinion, so I've left it unspecified for the moment.
BIP: TBD
Layer: Consensus
Title: Inhibiting a covert attack on the Bitcoin POW function
Author: Greg Maxwell
Status: Draft
Type: Standards Track
Created: 2016-04-05
License: PD
==Abstract==
This proposal inhibits the covert exploitation of a known
vulnerability in Bitcoin Proof of Work function.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in RFC 2119.
==Motivation==
Due to a design oversight the Bitcoin proof of work function has a potential
attack which can allow an attacking miner to save up-to 30% of their energy
costs (though closer to 20% is more likely due to implementation overheads).
Timo Hanke and Sergio Demian Lerner claim to hold a patent on this attack,
which they have so far not licensed for free and open use by the public.
They have been marketing their patent licenses under the trade-name
ASICBOOST. The document takes no position on the validity or enforceability
of the patent.
There are two major ways of exploiting the underlying vulnerability: One
obvious way which is highly detectable and is not in use on the network
today and a covert way which has significant interaction and potential
interference with the Bitcoin protocol. The covert mechanism is not
easily detected except through its interference with the protocol.
In particular, the protocol interactions of the covert method can block the
implementation of virtuous improvements such as segregated witness.
Exploitation of this vulnerability could result in payoff of as much as
$100 million USD per year at the time this was written (Assuming at
50% hash-power miner was gaining a 30% power advantage and that mining
was otherwise at profit equilibrium). This could have a phenomenal
centralizing effect by pushing mining out of profitability for all
other participants, and the income from secretly using this
optimization could be abused to significantly distort the Bitcoin
ecosystem in order to preserve the advantage.
Reverse engineering of a mining ASIC from a major manufacture has
revealed that it contains an undocumented, undisclosed ability
to make use of this attack. (The parties claiming to hold a
patent on this technique were completely unaware of this use.)
On the above basis the potential for covert exploitation of this
vulnerability and the resulting inequality in the mining process
and interference with useful improvements presents a clear and
present danger to the Bitcoin system which requires a response.
==Background==
The general idea of this attack is that SHA2-256 is a merkle damgard hash
function which consumes 64 bytes of data at a time.
The Bitcoin mining process repeatedly hashes an 80-byte 'block header' while
incriminating a 32-bit nonce which is at the end of this header data. This
means that the processing of the header involves two runs of the compression
function run-- one that consumes the first 64 bytes of the header and a
second which processes the remaining 16 bytes and padding.
The initial 'message expansion' operations in each step of the SHA2-256
function operate exclusively on that step's 64-bytes of input with no
influence from prior data that entered the hash.
Because of this if a miner is able to prepare a block header with
multiple distinct first 64-byte chunks but identical 16-byte
second chunks they can reuse the computation of the initial
expansion for multiple trials. This reduces power consumption.
There are two broad ways of making use of this attack. The obvious
way is to try candidates with different version numbers. Beyond
upsetting the soft-fork detection logic in Bitcoin nodes this has
little negative effect but it is highly conspicuous and easily
blocked.
The other method is based on the fact that the merkle root
committing to the transactions is contained in the first 64-bytes
except for the last 4 bytes of it. If the miner finds multiple
candidate root values which have the same final 32-bit then they
can use the attack.
To find multiple roots with the same trailing 32-bits the miner can
use efficient collision finding mechanism which will find a match
with as little as 216 candidate roots expected, 224 operations to
find a 4-way hit, though low memory approaches require more
computation.
An obvious way to generate different candidates is to grind the
coinbase extra-nonce but for non-empty blocks each attempt will
require 13 or so additional sha2 runs which is very inefficient.
This inefficiency can be avoided by computing a sqrt number of
candidates of the left side of the hash tree (e.g. using extra
nonce grinding) then an additional sqrt number of candidates of
the right side of the tree using transaction permutation or
substitution of a small number of transactions. All combinations
of the left and right side are then combined with only a single
hashing operation virtually eliminating all tree related
overhead.
With this final optimization finding a 4-way collision with a
moderate amount of memory requires ~224 hashing operations
instead of the >228 operations that would be require for
extra-nonce grinding which would substantially erode the
benefit of the attack.
It is this final optimization which this proposal blocks.
==New consensus rule==
Beginning block X and until block Y the coinbase transaction of
each block MUST either contain a BIP-141 segwit commitment or a
correct WTXID commitment with ID 0xaa21a9ef.
(See BIP-141 "Commitment structure" for details)
Existing segwit using miners are automatically compatible with
this proposal. Non-segwit miners can become compatible by simply
including an additional output matching a default commitment
value returned as part of getblocktemplate.
Miners SHOULD NOT automatically discontinue the commitment
at the expiration height.
==Discussion==
The commitment in the left side of the tree to all transactions
in the right side completely prevents the final sqrt speedup.
A stronger inhibition of the covert attack in the form of
requiring the least significant bits of the block timestamp
to be equal to a hash of the first 64-bytes of the header. This
would increase the collision space from 32 to 40 or more bits.
The root value could be required to meet a specific hash prefix
requirement in order to increase the computational work required
to try candidate roots. These change would be more disruptive and
there is no reason to believe that it is currently necessary.
The proposed rule automatically sunsets. If it is no longer needed
due to the introduction of stronger rules or the acceptance of the
version-grinding form then there would be no reason to continue
with this requirement. If it is still useful at the expiration
time the rule can simply be extended with a new softfork that
sets longer date ranges.
This sun-setting avoids the accumulation of technical debt due
to retaining enforcement of this rule when it is no longer needed
without requiring a hard fork to remove it.
== Overt attack ==
The non-covert form can be trivially blocked by requiring that
the header version match the coinbase transaction version.
This proposal does not include this block because this method
may become generally available without restriction in the future,
does not generally interfere with improvements in the protocol,
and because it is so easily detected that it could be blocked if
it becomes an issue in the future.
==Ba...[message truncated here by reddit bot]...
original: https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2017-April/013996.html
submitted by dev_list_bot to bitcoin_devlist [link] [comments]

Study corroborates that Satoshi Nakamoto can own almost a million Bitcoins

The BitMEX platform conducted an investigation into the theory of the "dominant miner" attributed to Sergio Demian Lerner and that CoinCrispy had already covered, where they show more evidence that corroborates the possibility that Satoshi Nakamoto has mined a million of Bitcoins (BTC). Lerner, who conducted his analysis in 2013, concluded that the hashrate information in that year is consistent with a dominant miner.

In 2013, Lerner hypothesized that Satoshi Nakamoto in 2009 would have mined a million tokens and I endorse it by analyzing the hashrate of the Bitcoin blockchain during that year that constantly remained around 7 MH / Sec. Sergio assumes that in that period of time, Satoshi Nakamoto was the only miner but the community has taken this information with skepticism.

The community says that this evidence is not sustainable since the assumptions of the hardware used by Nakamoto were not correct; the estimate of 7 MH / Seg was from a small sample where the time stamps of the blocks are not reliable. The hypothesis also does not take into account the possibility that Satoshi was not mining alone.

Then, Lerner showed the most sustainable evidence of the "dominant miner" that is the tracking of the ExtraNonce, which was enough for the community to take the hypothesis of Nakamoto's mining work seriously. Although BitMEX also considered that Sergio's initial evidence was weak, the new data was the starting point for his own research.

Bitcoin could reverse the trend depending on its next support

BitMEX decided to replicate Lerner's analysis but with the difference that they would count the extracted blocks and assign the blocks of what they consider would be the Satoshi Nakamoto miner. Despite using a variety of methods to assign the blocks, this was not necessarily accurate, so they say that the research is far from perfect but considers that this is the first attempt to assign these blocks.

Did you like this article? Don’t forget to follow @braziocoin on instagram to stay up to date with all the news of the cryptoworld.

Enter to braz.io to know more about this revolutionary project.
submitted by Brazio to u/Brazio [link] [comments]

Great interview questions for bitcoin engineers

From here...
https://bitcointalk.org/index.php?topic=5006583.0
Questions. Chapter 1: Introduction 1. What are the main Bitcoin terms? 2. What is a Bitcoin address? 3. What is a Bitcoin transaction? 4. What is a Bitcoin block? 5. What is a Bitcoin blockchain? 6. What is a Bitcoin transaction ledger? 7. What is a Bitcoin system? What is a bitcoin (cryptocurrency)? How are they different? 8. What is a full Bitcoin stack? 9. What are two types of issues that digital money have to address? 10. What is a “double-spend” problem? 11. What is a distributed computing problem? What is the other name of this problem? 12. What is an election? 13. What is a consensus? 14. What is the name of the main algorithm that brings the bitcoin network to the consensus? 15. What are the different types of bitcoin clients? What is the difference between these clients? Which client offers the most flexibility? Which client offers the least flexibility? Which client is the most and least secure? 16. What is a bitcoin wallet? 17. What is a confirmed transaction and what is an unconfirmed transaction? Chapter 2: How Bitcoin works. 1. What is the best way to understand transactions in the Bitcoin network? 2. What is a transaction? What does it contain? What is the similarity of a transaction to a double entry ledger? What does input correspond to? What does output correspond to? 3. What are the typical transactions in the bitcoin network? Could you please name three of such transactions and give examples of each type of the transaction? 4. What is a QR and how it is used in the Bitcoin network? Are there different types of QRs? If so, what are the different types? Which type is more informational? What kind of information does it provide? 5. What is SPV? What does this procedure check and what type of clients of the Bitcoin network usually use this procedure? Chapter 3: The Bitcoin client. 1. How to download and install the Core Bitcoin client? 2. What is the best way to test the API available for the Core Bitcoin client without actually programming? What is the interface called? 3. What are the major areas of operations in the Bitcoin client? What can we do with the client? 4. What are the available operations for the Bitcoin addresses? 5. What are the available read operations for the Bitcoin transactions? How is a transaction encoded in the Bitcoin network? What is a raw transaction and what is a decoded transaction? 6. If I want to get information about a transaction that is not related to any address in my own wallet, do I need to change anything in the Bitcoin client configuration? If yes, which option do I need to modify? 7. What are the available read operation for the Bitcoin blocks? 8. What are the available operations for the creation of the transactions in the Bitcoin network? 9. How do you normally need to address the unspent output from the previous transaction in order to use it as an input for a new transaction? 10. What is the mandatory operation after creating a new transaction and before sending this new transaction to the network? What state does the wallet have to be in order to perform this operation? 11. Is the transaction ID immutable (TXID)? If not why, if yes, why and when? 12. What does signing a transaction mean? 13. What are the other options for Bitcoin clients? Are there any libraries that are written for some specific languages? What types of clients do these libraries implement? Chapter 4: Keys, Addresses and Wallets. 1. What is a PKC? When it was developed? What are the main mathematical foundations or functions that PKC is using? 2. What is ECC? Could you please provide the formula of the EC? What is the p and what is the Fp? What are the defined operations in ECC? What is a “point to infinity”? 3. What is a Bitcoin wallet? Does this wallet contain coins? If not, what does it contain then? 4. What is a BIP? What it is used for? 5. What is an encrypted private key? Why would we want to encrypt private keys? 6. What is a paper wallet? What kind of storage it is an example of? 7. What is a nondeterministic wallet? Is it a good wallet or a bad wallet? Could you justify? 8. What is a deterministic wallet? 9. What is an HD wallet? 10. How many keys are needed for one in and out transaction? What is a key pair? Which keys are in the key pair? 11. How many keys are stored in a wallet? 12. How does a public key gets created in Bitcoin? What is a “generator point”? 13. Could you please show on a picture how ECC multiplication is done? 14. How does a private key gets created in Bitcoin? What we should be aware of when creating a new private key? What is CSPRNG? What kind of input should this function be getting? 15. What is a WIF? What is WIF-Compressed? 16. What is Base58 encoding and what is Base58Check encoding? How it is different from Base64 encoding? Which characters are used in Base58? Why Base58Check was invented? What kind of problems does it solve? How is Base58Check encoding is created from Base58 encoding? 17. How can Bitcoin addresses be encoded? Which different encodings are used? Which key is used for the address creation? How is the address created? How this key is used and what is the used formula? 18. Can we visually distinguish between different keys in Base58Check format? If yes, how are they different from each other? What kind of prefixes are used? Could you please provide information about used prefixes for each type of the key? 19. What is an index in HD wallets? How many siblings can exist for a parent in an HD wallet? 20. What is the depth limitation for an HD wallet key hierarchy? 21. What are the main two advantages of an HD wallet comparing to the nondeterministic wallets? 22. What are the risks of non-hardened keys creation in an HD wallet? Could you please describe each of them? 23. What is a chain code in HD wallets? How many different chain code types there are? 24. What is the mnemonic code words? What are they used for? 25. What is a seed in an HD wallet? Is there any other name for it? 26. What is an extended key? How long is it and which parts does it consist of? 27. What is P2SH address? What function are P2SH addresses normally used for? Is that correct to call P2SH address a multi-sig address? Which BIP suggested using P2SH addresses? 28. What is a WIF-compressed private key? Is there such a thing as a compressed private key? Is there such a thing as a compressed public key? 29. What is a vanity address? 30. What is a vanity pool? 31. What is a P2PKH address? What is the prefix for the P2PKH address? 32. How does the owner prove that he is the real owner of some address? What does he have to represent to the network to prove the ownership? Why a perpetrator cannot copy this information and reuse it in the next transactions? 33. What is the rule for using funds that are secured by a cold storage wallet? How many times you can send to the address that is protected by the private key stored in a cold storage? How many times can you send funds from the address that is protected by the private key stored in a cold storage? Chapter 5: Transactions. 1. What is a transaction in Bitcoin? Why is it the most important operation in the Bitcoin ecosystem? 2. What is UTXO? What is one of the important rules of the UTXO? 3. Which language is used to write scripts in Bitcoin ecosystem? What are the features of this language? Which language does it look like? What are the limitations of this language? 4. What is the structure of a transaction? What does transaction consists of? 5. What are the standard transactions in Bitcoin? How many standard transactions there are (as of 2014)? 6. What is a “locking script” and what is an “unlocking script”? What is inside these scripts for a usual operation of P2PKH? What is a signature? Could you please describe in details how locking and unlocking scripts work and draw the necessary diagrams? 7. What is a transaction fee? What does the transaction fee depend on? 8. If you are manually creating transactions, what should you be very careful about? 9. Could you please provide a real life scenario when you might need a P2SH payment and operation? 10. What is the Script operation that is used to store in the blockchain some important data? Is it a good practice? Explain your answer. Chapter 6: The Bitcoin Network. 1. What is the network used in Bitcoin? What is it called? What is the abbreviation? What is the difference between this network architecture and the other network architectures? Could you please describe another network architecture and compare the Bitcoin network and the other network architectures? 2. What is a Bitcoin network? What is an extended Bitcoin network? What is the difference between those two networks? What are the other protocols used in the extended Bitcoin network? Why are these new protocols used? Can you give an example of one such protocol? What is it called? 3. What are the main functions of a bitcoin node? How many of them there are? Could you please name and describe each of them? Which functions are mandatory? 4. What is a full node in the Bitcoin network? What does it do and how does it differ from the other nodes? 5. What is a lightweight node in the Bitcoin network? What is another name of the lightweight node? How lightweight node checks transactions? 6. What are the main problems in the SPV process? What does SPV stand for? How does SPV work and what does it rely on? 7. What is a Sybil attack? 8. What is a transaction pool? Where are transaction pools stored in a Bitcoin network client? What are the two different transaction pools usually available in implementations? 9. What is the main Bitcoin client used in the network? What is the official name of the client and what is an unofficial name of this client? 10. What is UTXO pool? Do all clients keep this pool? Where is it stored? How does it differ from the transaction pools? 11. What is a Bloom filter? Why are Bloom filters used in the Bitcoin network? Were they originally used in the initial SW or were they introduced with a specific BIP? Chapter 7: The Blockchain. 1. What is a blockchain? 2. What is a block hash? Is it really a block hash or is it a hash of something else? 3. What is included in the block? What kind of information? 4. How many parents can one block have? 5. How many children can one block have? Is it a temporary or permanent state of the blockchain? What is the name of this state of the blockchain? 6. What is a Merkle tree? Why does Bitcoin network use Merkle trees? What is the advantage of using Merkle trees? What is the other name of the Merkle tree? What kind of form must this tree have? 7. How are blocks identified in the blockchain? What are the two commonly used identities? Are these identities stored in the blockchain? 8. What is the average size of one transaction? How many transactions are normally in one block? What is the size of a block header? 9. What kind of information do SPV nodes download? How much space do they save by that comparing to what they would need if they had to download the whole blockchain? 10. What is a usual representation of a blockchain? 11. What is a genesis block? Do clients download this block and if yes – where from? What is the number of the genesis block? 12. What is a Merkle root? What is a Merkle path? Chapter 8: Mining and Consensus. 1. What is the main purpose of mining? Is it to get the new coins for the miners? Alternatively, it is something else? Is mining the right or good term to describe the process? 2. What is PoW algorithm? 3. What are the two main incentives for miners to participate in the Bitcoin network? What is the current main incentive and will it be changed in the future? 4. Is the money supply in the Bitcoin network diminishing? If so, what is the diminishing rate? What was the original Bitcoin supply rate and how is it changed over time? Is the diminishing rate time related or rather block related? 5. What is the maximum number of Bitcoins available in the network after all the Bitcoins have been mined? When will all the Bitcoins be mined? 6. What is a decentralized consensus? What is a usual setup to clear transactions? What does a clearinghouse do? 7. What is deflationary money? Are they good or bad usually? What is the bad example of deflationary spiral? 8. What is an emergent consensus? What is the feature of emergent consensus? How does it differ from a usual consensus? What are the main processes out of which this emergent decentralized consensus becomes true? 9. Could you please describe the process of Independent Transaction Verification? What is the list of criteria that are checked against a newly received transaction? Where can these rules be checked? Can they be changed over time? If yes, why would they be changed? 10. Does mining node have to be a full node? If not, what are the other options for a node that is not full to be a mining node? 11. What is a candidate block? What types of nodes in the Bitcoin network create candidate blocks? What is a memory pool? Is there any other name of the memory pool? What are the transactions kept in this memory pool? 12. How are transactions added to the candidate block? How does a candidate block become a valid block? 13. What is the minimum value in the Bitcoin network? What is it called and what is the value? Are there any alternative names? 14. What is the age of the UTXO? 15. How is the priority of a transaction is calculated? What is the exact formula? What are the units of each contributing member? When is a transaction considered to be old? Can low priority transactions carry a zero fee? Will they be processed in this case? 16. How much size in each block is reserved for high priority transactions? How are transactions prioritized for the remaining space? 17. Do transactions expire in Bitcoin? Can transactions disappear in the Bitcoin network? If yes, could you please describe such scenario? 18. What is a generation transaction? Does it have another name? If it does, what is the other name of the transaction? What is the position of the generation transaction in the block? Does it have an input? Is the input usual UTXO? If not – what is the input called? How many outputs there are for the generation transaction? 19. What is the Coinbase data? What is it currently used for? 20. What is little-endian and big-endian formats? Could you please give an example of both? 21. How is the block header constructed? Which fields are calculated and added to the block header? Could you please describe the steps for calculation of the block header fields? 22. What is a mantissa-exponent encoding? How is this encoding used in the Bitcoin network? What is the difficulty target? What is the actual process of mining? What kind of mathematical calculation is executed to conduct mining? 23. Which hash function is used in the Bitcoin mining process? 24. Could you describe the PoW algorithm? What features of the hash function does it depend on? What is the other name of the hash function? What is a nonce? How can we increase the difficulty of the PoW calculation? What do we need to change and how do we need to change this parameter? 25. What is difficulty bits notation? Could you please describe in details how it works? What is the formula for the difficulty notation? 26. Why is difficulty adjustable? Who adjusts it and how exactly? Where is the adjustment made? On which node? How many blocks are taken into consideration to predict the next block issuance rate? What is the change limitation? Does the target difficulty depend on the number of transactions? 27. How is a new block propagated in the network? What kind of verification does each node do? What is the list of criteria for the new block? What kind of process ensures that the miners do not cheat? 28. How does a process of block assembly work? What are the sets of blocks each full node have? Could you please describe these sets of blocks? 29. What is a secondary chain? What does each node do to check this chain and perhaps to promote it to the primary chain? Could you please describe an example when a fork occurs and what happens? 30. How quickly forks are resolved most of the time? Within how many new block periods? 31. Why the next block is generated within 10 minutes from the previous? What is this compromise about? What do designers of the Bitcoin network thought about when implementing this rule? 32. What is a hashing race? How did Bitcoin hashing capacity has changed within years from inception? What kind of hardware devices were initially used and how did the HW utilization evolved? What kind of hardware is used now to do mining? How has the network difficulty improved? 33. What is the size of the field that stores nonce in the block header? What is the limitation and problem of the nonce? Why was an extra nonce created? Was there any intermediate solution? If yes, what was the solution? What are the limitations of the solution? 34. What is the exact solution for the extra nonce? Where does the new space come from? How much space is currently used and what is the range of the extra nonce now? 35. What is a mining pool? Why was it created? How are normally such pools operated? Do they pay regularly to the pool participants? Where are newly created Bitcoins distributed? To which address? How do mining pools make money? How do the mining pools calculate the participation? How are shares earned calculated? 36. What is a managed pool? How is the owner of the pool called? Do pool members need to run full nodes? Explain why or why not? 37. What are the most famous protocols used to coordinate pool activities? What is a block template? How is it used? 38. What is the limitation of a centralized pool? Is there any alternative? If yes, what is it? How is it called? How does it work? 39. What is a consensus attack? What is the main assumption of the Bitcoin network? What can be the targets of the consensus attacks? What can these attacks do and what they cannot do? How much overall capacity of the network do you have to control to exercise a consensus attack? Chapter 9: Alternative Chains, Currencies and Applications. 1. What is the name of alternative coins? Are they built on top of the Bitcoin network? What are examples of them? Is there any alternative approach? Could you please describe some alternatives? 2. Are there any alternatives to the PoW algorithm? If yes – what are the alternatives? Could you please name two or three? 3. What is the operation of the Script language that is used to store a metadata in Bitcoin blockchain? 4. What is a coloured coin? Could you please explain how it is created and how it works? Do you need any special SW to manage coloured coins? 5. What is the difference between alt coins and alt chains? What is a Litecoin? What are the major differences between the Bitcoin and Litecoin? Why so many alt coins have been created? What are they usually based on? 6. What is Scrypt? Where is it used and how is it different from the original algorithm from which it has been created? 7. What is a demurrage currency? Could you please give an example of one blockchain and crypto currency that is demurrage? 8. What is a good example of an alternative algorithm to PoW? What is it called and how is it different from the PoW? Why the alternatives to Bitcoin PoW have been created? What is the main reason for this? What is dual-purpose PoW algorithms? Why have they been created? 9. Is Bitcoin “anonymous” currency? Is it difficult to trace transactions and understand someone’s spending habits? 10. What is Ethereum? What kind of currency does it use? What is the difference from Bitcoin? Chapter 10: Bitcoin security. 1. What is the main approach of Bitcoin security? 2. What are two common mistakes made by newcomers to the world of Bitcoin? 3. What is a root of trust in traditional security settings? What is a root of trust in Bitcoin network? How should you assess security of your system? 4. What is a cold storage and paper wallet? 5. What is a hardware wallet? How is it better than storing private keys on your computer or your smart phone?
submitted by 5tu to BitcoinTechnology [link] [comments]

Answers to common questions about Ethereum (FAQ)

I'll try my best to answer some of the most common questions that I've seen around regarding Ethereum, if you've got any questions that I haven't covered here, feel free to ask in comments.
To protect the network again spam, without transaction fees one could effectively DoS attack the network by sending 0 Ethers to himself infinite times. Transaction fees is effectively DDoS protection as it would cost massive amounts of money to spam the network.
No, not really; for transfering Ether between normal wallets it can (usually 21000). However, for interacting with Smart Contracts it's impossible to know due to the famous Halting Problem. You can never know in advance whether a contract code could loop indefinitely; if it does you can lose your entire balance of Ethers without an upper limit specified (and loop whatever machine is attempting to mine the transaction). Gas Limit is effectively a safe-guard against infinite loops, without an upper limit an infinite amount of Ethers would be consumed as a fee for an infinite duration of time if a contract loops.
ERC20 tokens are "assigned" to wallets by their respective Smart Contracts. You do not "hold" your tokens as you do your Ethers; instead Token Trackers keep a track of all ERC20 transactions and know which wallet owns how many. Therefore, to move your ERC20 between wallets, you need to request their respective Smart Contract to do it for you (because only that contract can actually move them around). Additionally, you can approve other wallets (usually smart contracts belonging to decentralized exchanges) to access a specific portion of your tokens on your behalf. ERC20 tokens can only be moved on behalf of their owner address or approved addresses (up to the authorized amount).
Transactions are mined in numerical order, Nonce of each transaction is its position among the rest. For example, the 6th outgoing transaction from your wallet will be Nonce = 6. Sending a transaction with a Nonce lower than what's already confirmed will result in an Invalid transaction while sending one with a Nonce higher than what's already confirmed will result in that tranasction being stuck until every other transaction before it (lower nonces) are already confirmed.
Mined transactions that are confirmed can never be reversed under any circumstance. If you have sent Ethers or Tokens to the wrong address, they are permanently lost and there is no way to recover them. However, as long as a transaction is still Pending, you may be able to replace or overwrite it by sending another transaction with the same Nonce and (a much) higher Gas Price.
An invalid transaction would eventually get discarded and will never be mined/confirmed. However, interactions with Smart Contracts could end abruptly (you run out of gas to perform the processing) or have unexpected results (infinite loop, etc.). In such cases, the result would be a Failed transaction which still has to be mined and confirmed. Therefore Failed transactions still consume gas/fees while invalid transactions just get discarded (eventually). An example of an Invalid transaction would be one where the signature doesn't match the request (has been tampered with).
Resend that exact same transaction with the same Nonce and a higher Gas Price. Be careful not to confuse Gas Price with Gas Limit, setting them in reverse woud likely result in you losing massive amounts of Ether.
Transactions have to be confirmed in the order they were sent. If you have a pending transaction with a lower Nonce and Gas Price, new tranasctions (regardless of their Gas Price) cannot get confirmed until the previous one is. If you have a stuck transaction, sending new ones with higher Gas Price would only make things worse.
Currently, there's no direct way of scheduling transactions via your wallet. Additionally, there is no way to 100% accurately predict how long it will take for a transaction to be confirmed. But usually, if you pay a high enough Gas Price, there's a very good chance it would be confirmed quickly.
Ethers can be mined directly to a wallet, or be transferred to it via a Smart Contract called by a different address. For instance, a wallet could call the smart contract with a function that would result in Ether(s) being transferred to a different address. With token transfers, all such transactions would usually be visible on the Token Tracker. However, with direct Ether transfers, you would need to find the transaction on the history of the wallet that sent it to the Smart Contract (which then sent Ethers to a different wallet as a result).
1 GWei = 0.000000001 Ethers, either memorize that or remember that 109 GWeis make up one Ether. G is unit prefix: Giga. For the time being, it's easier to type 5 than 0.000000005.
If it was a personal wallet, simply use the private key of your ETC wallet as an ETH wallet as they're functionally the same thing. If it was an exchange, you would have to contact their support and hope they would help you out. The same Ethereum wallet can hold both ETH and ETC at the same time (although each is tracked on separate networks).
Explain how you did that first because it should be impossible. Bitcoin and Ethereum have different address structures, a Bitcoin wallet is not a valid Ethereum address. Actually being able to pull this off would likely result in an Invalid transaction.
Most common reasons for Failed transactions during ICOs are: ICO has already ended (and no longer accepts new payments); Only payments from whitelisted addresses are accepted (but you're not whitelisted); Smart Contract is Paused (most tokens are locked and cannot be transferred while ICO is active); or your Gas Limit was too low (and you ran out of gas).
submitted by R3TR1X to CryptoCurrency [link] [comments]

Byzantine Generals / Proof-of-Work for Dummies

Hi folks. I was going to publish this on bitcoin but those people don't take me seriously so I figured I'd share it with my friends here at buttcoin instead. This is not a critique of Bitcoin. I am simply going to explain the Byzantine Generals problem in laymen's terms.
When I went to college I learned about a seminal problem in computer science called the "Albanian Generals Problem." (That somewhat dates me: these days the PC crowd has turned it into the Byzantine Generals problem.) It is often called "Byzantine fault tolerance" because it was an attempt to address communication over an unreliable medium, such as a line with static.
However, it can also involve a case where a man-in-the-middle intentionally wants to confound communications by changing the messages. We'll get back to that notion later.
I: TWO ARMIES, ONE CITY
The premise of the Byzantine Generals story is this: there is a city in a valley, and two armies on high mountain tops on opposite sides. Illustration: http://imgur.com/to4qRaI
The generals and their armies want to attack the city. However, they need to attack at almost exactly the same time or they will fail. Therefore they send messengers (packets) to the other mountain saying something like "We attack at dawn on Saturday! Please send a messenger back to confirm that you received this."
But there's a problem: that city in the middle may either catch a messenger and throw him in jail, or even worse, replace the messenger with a spy who delivers a disastrously different message, such as "We attack at midnight! No need to reply!"
I was taught—in fact it was proved indisputably—that the problem has no true solution. That's not to say computers cannot communicate with each other reliably, but 100% certainty is not possible. Our best efforts simply make communication very very reliable but never foolproof.
For example, in the above example the general receiving the message is intended to send back a messenger to say "OK, noon on Saturday it is." What happens if the return messenger gets caught or modified? Of course the return message might say "Let me know that you got this confirmation with yet another messenger" but then that one might get caught or modified. This infinite regress lets us know that we're going to have to do something tricky to get the message across with some degree of certainty.
There are several practical "solutions" to the problem which are good enough to work in the real world where we know that nothing is certain.
Satoshi never claimed to have "solved" the problem, just proposed a method which makes it very difficult for the town to foil the plans of the generals by modifying the message. This has bearing on a digital currency, because "attack at dawn!" is the same thing as saying "I give Sue $10". It's important that the message gets through unaltered.
II: CRYPTOGRAPHIC HASH FUNCTIONS
Before we get into Satoshi's "solution" to the problem there's a tiny piece of technical understanding you need to grasp: what a hash function is.
Many of the the nerds reading this article probably already know this stuff like the back of their hands, but I titled this "for dummies" so I will explain what cryptographic hashing is. If you already understand the concept, feel free to skip ahead to part III.
A hash function will receive an input, whether a single number, or a string, or an entire text file, and come up with a large number based on the input. For example, I made a hash function h(s) that accepts a string and returns a number. Some example outputs:
h("X") = 1928102449468957222384 h("BOZO") = 8012800151273854626279 h("MARY HAD A LITTLE LAMB") = 1029916079814280347836 h("MARY HAD A LITTLE LAMP") = 6719333915074502386405 
What makes it cryptographic is that it is a "trapdoor function" that allows you to easily compute the hash given the string, but given the giant number it's virtually impossible to compute the string. It is possible to come up with a string that produces that number only by taking wild guesses until you just happen to luckily stumble upon a string with that property. Depending on how big the output number is, the more guesses you'll have to make (on the average) before you figure out the string.
Also it's important to note that the tiniest change to the input string will result in wild changes in the output.
Hash functions have all sorts of great real world applications. They ensure that your download was received correctly, they can be used to confirm that somebody knows their password even though you don't actually know their password, and much much more.
III: SOLVING THE PROBLEM WITH NONCES
So let's say the generals have modern computers. They have a really clever idea. They will make a message such as "ATTACK AT DAWN" and then add a little extra piece of nonsense at the end of the message. This little extra string is called a "nonce." For example, the message may now read "ATTACK AT DAWN e8Mgk10938". Then the generals agree to a policy: that the hash of the message (including the nonce) must yield a number that begins with at least ten sevens, lest it be regarded as a hoax. So when the generals run our hash function on the string they get this:
h("ATTACK AT DAWN e8Mgk10938") = 7777777777203851693271 
This is accomplished with computer power. The general broadcasting the message had his techies stay up all night running his computer trying all sort of different random nonces until they stumbled upon one, through sheer luck, that caused the hash to start with ten sevens. You can compute the average time it takes to do this: with 10 sevens you'll need to make about 5 billion guesses; sometimes more, sometimes less. Let's say that in this case it takes about 12 hours to get the job done.
This technique of setting computers to a task that will likely take a very long time to complete is called Proof-of-Work.
Now the general sends several messengers (to make sure one gets across) all with this weird message "ATTACK AT DAWN e8Mgk10938". The town attempts to foil the generals plan by catching some of the messengers and changing their message to "ATTACK AT NOON e8Mgk10938" but it's no use: the receiving general runs the hash function on the message and sees that the ones altered by the town no longer have that special property of all those sevens. Only the true message will hash to the sevens. Note that while it took 12 hours to compute the nonce, it takes a millisecond to confirm that the nonce is correct.
But our story doesn't end here. The town is now well aware of the tricks that these generals are using, so they simply purchase a giant supercomputer and when they catch a messenger they now have the computing resources to modify the nonce so that the 7s property is satisfied. Maybe it took the army 12 hours, but they have big computers, they can crack it in 5 minutes. Now the general on the other side is getting conflicting messages that all correctly hash to the sevens. It seems that their plan has been foiled. Or has it...?
IV: THERE IS POWER IN NUMBERS
Let's now say that there is not just two generals and one city, but lots of generals and lots of cities. I made a crude illustration with 3 cities, but keep in mind this idea works best when we have many, many cities.
Illustration: http://imgur.com/b2CzHN1
The generals all have the same desire: to send soldiers across the valley without fear of their messages being modified. The many cities would like to foil this plan, if they could. So here's Satoshi's idea in a nutshell: the generals all combine their many messages into a single giant message (a "block") which gets but a single nonce at the end of it.
Now the message-block might look like this:
GENERAL G^1 : WE ATTACK AT NOON! GENERAL G^2 : WE ATTACK AT DAWN! GENERAL G^3 : WE ATTACK AT DUSK! ... GENERAL G^174: WE ATTACK AT MIDNIGHT! h9Klemoa3DheeMqz9x77ebaomEqz12f3Ba3eO8e 
The new policy is that we need 16 sevens instead of only 10, so the hash of that entire message comes out to (say) 7777777777777777340291. That's a lot of sevens! (BTW, in Bitcoin the job is to have leading zeros; I picked 7s here instead just for aesthetic reasons. It's all the same concept.)
If the computing time to guess 10 sevens was 12 hours, the computing time for this job would be a million times more, or 1,369 years on a single computer. No single army or town is capable of doing that in any reasonable amount of time. However, all of the generals take the combined message-block and set all of their computers to go on the great nonce hunt. Perhaps there are a thousand armies, and each army has many computers, or at least can rent the service of companies who do have many computers. Their combined efforts may find a working nonce in a reasonable amount of time. And it only takes one of them finds the nonce that satisfies the requirements: once one finds it, they immediately share it with all the others.
From the point of view of any single city, the idea of outcomputing the combined efforts of the armies seems virtually impossible. In 1,369 years they will be long gone. And so they are incapable of modifying the messages between the armies.
You might be thinking: what if all of the cities bought supercomputers and did the same thing the generals did, team-up to find a nonce? Yes, they could do that, at considerable expense. (This is akin to what Bitcoin calls the "51% attack" — it works if the cities have as much or more computing power as all the armies combined.) It's not impossible to defeat this scheme, but the generals have made things very hard on attempts of the cities by teaming up.
IV: SUMMARY
Proof-of-work has had a long and speckled history. One might argue it began in the 1960s when universities would try to outdo each other by computing ridiculously difficult things, like gigantic prime numbers or millions of digits of pi. A sort of digital pissing-contest.
BTW, Satoshi's approach is a modification of Adam Back's idea behind Hashcash, the first POW cryptocurrency developed in 1997. But Satoshi's ideas are different enough to warrant giving him credit (blame?) for the notion.
Some practical applications for POW have been suggested, such as a way to discourage spam. In that application, the notion would be that all emails require a special nonce just like above, lest they be rejected. When an innocent email user like myself wants to send an email, I would set my computer to grind away until it finds the right nonce. Perhaps it takes me 60 seconds. No big deal, as this will be done in the background. It just means my email will be delivered a minute slower. But to the spammer who wants to send a million emails, a 60 second delay is unacceptable. This idea never took off, probably because it wasn't a very good one.
Part of the problem with proof-of-work is that by its very nature it requires us to spend a lot of computing power on "busywork". If you are a programmer you live and breathe efficiency. Making a function that takes 9 milliseconds to complete to take only 7 milliseconds is a coup. It's rather against the grain of programmers to design machines that grind away on problems that take 1000 computing years of work for no good reason. On the other hand, every programmer has a part of them who delights in those digital pissing-contests of the 1960s.
Bitcoin now offers us what claims to be the very first real world practical application of Proof-of-Work. Only time will tell how practical this really is.
(EDIT: Typos, clarity. Thanks for the gold!)
submitted by shortbitcoin to Buttcoin [link] [comments]

[uncensored-r/BitcoinMarkets] Over the last 6 weeks I've written a functioning Crypto trading bot in VB.NET and here are some o...

The following post by DotNetBarry is being replicated because some comments within the post(but not the post itself) have been silently removed.
The original post can be found(in censored form) at this link:
np.reddit.com/ BitcoinMarkets/comments/7tw2s5
The original post's content was as follows:
I started on December 18th when I was playing about with Google Sheets and pulling prices from exchanges using the CRYPTOFINANCE() plugin... it was slow, clunky and the data was wildly old - I knew I could do something better in VB.NET but at this point had absolutely no idea where to start, no idea about trading, no idea how exchanges or API's worked and no idea just how bad I was at programming. I've asked a lot of dumb questions, I've lost a bunch of money making mistakes & learning as I go... Fast forward to today however and I have a fully functioning, cross-exchange trading bot. Sweet!
1) Truncate your numbers, don't round.**
Hindsight makes this seem so obvious to me now, but when you're working with Bitcoin balances to 8 decimal places, exchange rates to 5 decimal places and sums that can increase your decimal places exponentially, it helps to be precise. Even an extra 0.00000001 in the wrong place can cause an exchange to reject your request. Honestly if I'd have realised this sooner I'd be about 2 weeks ahead right now and nowhere near as bald.
The below functions in will truncate any decimal number with no rounding:
Public Function Trunc8(numbertoTuncate As Decimal) As Decimal Return Math.Truncate(numbertoTuncate * 100000000) / 100000000 End Function Public Function Trunc5(numbertoTuncate As Decimal) As Decimal Return Math.Truncate(numbertoTuncate * 100000) / 100000 End Function 
** Absolutely do round when exchange such as Bitstamp does it's fee calculations in spot USD price. Below is the logic I use to do this:
Dim amount_btc As Decimal = BTCtoSpend / ASK ' Full amount in BTC Dim fee_btc As Decimal = amount_btc * 0.0025 ' Get 0.25% of the BTC amount Dim fee_USD As Decimal = fee_btc * BitstampBTCUSD ' Convert to USD Dim round_USD As Decimal = Math.Round(fee_USD, 2, MidpointRounding.AwayFromZero) ' Round up Dim round_BTC As Decimal = round_USD / BitstampBTCUSD ' Convert back to BTC Dim amount = amount_btc - round_BTC ' minus the fee 
2) Websockets are your friend.
It's really easy to query Bitstamp or GDAX's API for the prices(Last/Bid/Ask). The query might take a 3rd of a second to get there, a 3rd of a second to get back - by the time your software has interpreted it it may have been nearly a full second. The prices you end up being sent back can some times be stale/out of date. Couple this with the API rate limits (Once a second on Bitstamp if you end up polling it continuously) and you can soon end up with stale information. The websockets allow the exchanges to push information to you, in real-time, as it happens. Seriously, they're fucking rad and you can query that data til the cows come home. Millisecond timers FTW!
Bitstamp uses Pusher, GDAX is a plain old web socket. It took me an age to figure it out, and honestly I've done it rather arse-about-tit, but here's the code I ended up using:
Bitstamp:(You'll need PusherClient from Nuget)
Imports PusherClient Imports Newtonsoft.Json.Linq Public WithEvents pusherClient As New Pusher("de504dc5763aeef9ff52") Public WithEvents BitstampLTCBTCOrderbook As Channel Public WithEvents BitstampLTCBTCTrades As Channel Public WithEvents BitstampBTCUSDTrades As Channel Public WithEvents BitstampEURUSDTrades As Channel pusherClient.Connect() Public Sub pusher_Connected() Handles pusherClient.Connected BitstampLTCBTCTrades = pusherClient.Subscribe("live_trades_ltcbtc") End Sub Public Sub BitstampLTCBTCTrades_Subscribed(Sender As Object) Handles BitstampLTCBTCTrades.Subscribed BitstampLTCBTCTrades.Bind("trade", AddressOf BitstampLTCBTCTrade) End Sub Public Sub BitstampLTCBTCTrade(data) Dim jss = JObject.Parse(data.ToString) BitstampPrice = CDec(jss("price_str").ToString) BitstampLastAmount = CDec(jss("amount_str").ToString) End Sub 
That's basically it - the different channels are all documented in the API and you can format the JSON til your little crypto heart's content.
GDAX:(You'll need Websocket4NET from Nuget) P.S. I know my sending raw JSON is a fucking abomination.
Imports WebSocket4Net Imports Newtonsoft.Json.Linq Public WithEvents websocketGDAX As WebSocket websocketGDAX = New WebSocket("wss://ws-feed.gdax.com") websocketGDAX.Open() Public Sub gdax_Connect() Handles websocketGDAX.Opened Dim Data As String = "{ ""type"": ""subscribe"", ""product_ids"":[""BTC-EUR""], ""channels"": [""heartbeat"", { ""name"": ""ticker"", ""product_ids"": [""LTC-BTC""] }]}" websocketGDAX.Send(Data) End Sub Public Sub gdax_Data(sender As Object, args As WebSocket4Net.MessageReceivedEventArgs) Handles websocketGDAX.MessageReceived Dim jss = JObject.Parse(args.Message) Try If jss("type").ToString = "ticker" Then Select Case jss("product_id") Case "LTC-BTC" GDAXPrice = CDec(jss("price")) GDAXBid = CDec(jss("best_bid")) GDAXAsk = CDec(jss("best_ask")) GDAXLastSize = CDec(jss("last_size")) Case "EUR-USD" GDAXEURUSD = CDec(jss("price")) Case "BTC-USD" End Select End If Catch ex As Exception Exit Sub End Try End Sub 
Again, that's kind of it. Some proper error handling wouldn't go amiss, but I'm lazy and I use GOTO's all over the shop anyway so I'm basically a terrible human being.
3) Hashing. Fucking Hashing.
Ok so basically when sending authenticated/private API calls you need to hash bits of the message in order to prove authenticity. This was a bitch to try and cobble together the right code. Here, have it. It's yours:
Imports System.Security.Cryptography Imports System.Text Module Hashing Public Function HMACSHA256_Encrypt(ByVal message As String, secret As String) As String Try Dim secretkey As String = secret Dim sha As New System.Security.Cryptography.HMACSHA256(System.Text.ASCIIEncoding.ASCII.GetBytes(secretkey)) Dim Hash() As Byte = sha.ComputeHash(System.Text.ASCIIEncoding.ASCII.GetBytes(message)) Dim sb As New StringBuilder(Hash.Length * 2) For Each B As Byte In Hash sb.Append(Hex(B).PadLeft(2, "0")) Next Return sb.ToString.ToUpper Catch ex As Exception Debug.Print(Date.Now & " SHA256_Encrypt error " & ex.Message) Return Nothing End Try End Function Public Function HashString(ByVal str As String, ByVal secret As Byte()) As String Dim bytes As Byte() = Encoding.UTF8.GetBytes(str) Using hmac = New HMACSHA256(secret) Dim hash As Byte() = hmac.ComputeHash(bytes) Return Convert.ToBase64String(hash) End Using End Function End Module 
Top one for Bitstamp, Bottom one for GDAX. They differ slightly in the way they do things and the output they provide, hence there being two. Don't ask me what they do, couldn't tell you. Not a clue.
4) Verbose logging. Verbose logging. Verbose logging.
So you've made your bot, hit the button and....nothing. Now these things don't happen instantly; Even if you place an order at Ask or Bid, it might be minutes, even hours until it gets filled. Maybe your bot keeps erroring out and you don't know why. Write yourself a little logging function that you can copy and paste into your functions & subs that outputs the data you're sending and the data you're receiving along with a timestamp so you can debug if stuff isn't working. Again, I'm lazy and shit and this took me way longer to realise than it should have.
5) Don't be afraid to ask questions.
One of the biggest things that totally blew my mind was just how closed up some people are; on Reddit, forums, discord rooms... you name it. There's this weird stigma about people who trade & write bots that if they share their knowlege they'll somehow be doing themselves out of returns. Don't be afraid to ask questions. Ask enough, and eventually someone will come along and help. For every 10 people who chastised me for asking for coding help, trading help or whatever, 1 person would help out - it's worth enduring the rough for that... also, fuck those 10 people.
6) God damn Nonce generation.
A nonce is basically a unique, yet increasing number. Again, this was all massive trial and error. Bitstamp nonces and GDAX nonces work slightly differently and are interpreted slightly differently. Here's the code I use:
Module Nonces Public Function GenerateStampNonce() As String Static lastnonce As String Dim newNonce As String = Replace(Math.Round((DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds / 1000, 1).ToString("#0.0"), ".", "") Do While lastnonce = newNonce Threading.Thread.Sleep(10) newNonce = Replace(Math.Round((DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds / 1000, 1).ToString("#0.0"), ".", "") Loop lastnonce = newNonce Re... 
submitted by censorship_notifier to noncensored_bitcoin [link] [comments]

How to Gain Extra Darkmoon Faire Tickets and Reputation each Month - WoW Guide BetterHash - A True Profit Switching Miner Now? - YouTube Stream #WithMe  Games, Tutorials and Mystery Challenges ... I Went Homeless For 72 Hours (REAL CHALLENGE) - YouTube What Do Bitcoin Miners Actually Do? Bitcoin Mining Simplified ₿ How Bitcoin Mining Really Works?

Bookmark us for the latest bitcoin news, cryptocurrency trends, and insight to the state of blockchain technology. Why It’s Unlikely the 50 Bitcoin Transaction From the 2009 Address is Satoshi If you haven’t been living under a rock, you know that today, 50 Bitcoin from an address created one month after the cryptocurrency’s birth in January 2009 was just moved. Fifty coins is not a ... Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up. Sign up to join this community. Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Bitcoin . Home ; Questions ; Tags ; Users ; Jobs; Unanswered ; What is ExtraNonce2? Ask Question Asked 2 years, 5 months ago. Active 2 ... "[Bitcoin is] a purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution…Commerce on the Internet has come to rely almost exclusively on financial institutions serving as trusted third parties to process electronic payments". Die Kryptowährung Bitcoin geht zurück auf ein Whitepaper von Satoshi Nakamoto. Dieser war es letztendlich auch, der das Projekt umsetzte und den ersten Block (Genesis Block) gemind hat. Dabei ist nicht klar ob es sich bei Satoshi Nakamoto um eine einzelne Person handelt oder um eine Gruppe von Leuten. News.Bitcoin.com leveraged our message verification tool, in order to double-check the validity of the signed message. The message shows that the author is the owner of many of the 144 separate ...

[index] [17039] [11514] [19046] [31104] [39743] [10180] [32332] [51196] [32170] [45001]

How to Gain Extra Darkmoon Faire Tickets and Reputation each Month - WoW Guide

Tickets for RTX (first ever Dead Meat live show!) https://rtx2019.frontgatetickets.com/ Buy SLEEPAWAY CAMP on... DVD https://amzn.to/2xe6Cp3 Blu-ray ht... Skip navigation Sign in Just 16 days before he died, Tara Brown sat down with Mark ‘Chopper’ Read for his last ever interview. It quickly became a confessional in which he admitted ... Today 4pm BST 11am ET 8am PT Free live stream link here: https://www.youtube.com/watch?v=Pntmw76eQBc Tune in live to watch our epic four hour live stre... ENLACES MENCIONADOS! + EXODUS: https://www.exodus.io/ + Coinbase: https://bit.ly/2Jc8d0Y + Bitso: https://bit.ly/39ddPmp + Binance: https://bit.ly/3bu5UTl ...

#