<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rohit</title>
    <description>The latest articles on DEV Community by Rohit (@mxmaster2s).</description>
    <link>https://dev.to/mxmaster2s</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F462485%2Fb9826067-465e-493e-b1f5-d44ed7266c0a.jpeg</url>
      <title>DEV Community: Rohit</title>
      <link>https://dev.to/mxmaster2s</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mxmaster2s"/>
    <language>en</language>
    <item>
      <title>Top consensus algorithms to know in blockchain</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 02 Sep 2020 21:42:16 +0000</pubDate>
      <link>https://dev.to/mxmaster2s/top-consensus-algorithms-to-know-in-blockchain-5bf8</link>
      <guid>https://dev.to/mxmaster2s/top-consensus-algorithms-to-know-in-blockchain-5bf8</guid>
      <description>&lt;p&gt;Consensus algorithm may refer to one of several proposed protocols for solving the consensus problem. In case of blockchain,  consensus algorithm is a protocol through which all the parties of the blockchain network come to a common agreement (consensus) on the present data state of the ledger and be able to trust unknown peers in a distributed computing environment.&lt;/p&gt;

&lt;p&gt;There are more than a dozen consensus algorithms but some very famous ones are below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Proof of Work: use case = Bitcoin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This explanation will focus on proof of work as it functions in the bitcoin network. The way that users detect tampering in practice is through hashes, long strings of numbers that serve as proof of work. Put a given set of data through a hash function (bitcoin uses SHA-256), and it will only ever generate one hash. Due to the "avalanche effect," however, even a tiny change to any portion of the original data will result in a totally unrecognizable hash. Whatever the size of the original data set, the hash generated by a given function will be the same length. The hash is a one-way function: it cannot be used to obtain the original data, only to check that the data that generated the hash matches the original data.&lt;/p&gt;

&lt;p&gt;Generating just any hash for a set of bitcoin transactions would be trivial for a modern computer, so in order to turn the process into "work," the bitcoin network sets a certain level of "difficulty." This setting is adjusted so that a new block is "mined" – added to the blockchain by generating a valid hash – approximately every 10 minutes. Setting difficulty is accomplished by establishing a "target" for the hash: the lower the target, the smaller the set of valid hashes, and the harder it is to generate one. Since a given set of data can only generate one hash, how do miners make sure they generate a hash below the target? They alter the input by adding an integer, called a nonce ("number used once"). Once a valid hash is found, it is broadcast to the network, and the block is added to the blockchain.&lt;/p&gt;

&lt;p&gt;Mining is a competitive process, but it is more of a lottery than a race. On average, someone will generate acceptable proof of work every ten minutes, but who it will be is anyone's guess. Miners pool together to increase their chances of mining blocks, which generates transaction fees and, for a limited time, a reward of newly-created bitcoins.&lt;/p&gt;

&lt;p&gt;Proof of work makes it extremely difficult to alter any aspect of the blockchain since such an alteration would require re-mining all subsequent blocks. It also makes it difficult for a user or pool of users to monopolize the network's computing power, since the machinery and power required to complete the hash functions are expensive.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Proof of Stake: use case = Ethereum Casper
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Proof of stake is a type of consensus algorithm by which a cryptocurrency blockchain network aims to achieve distributed consensus. A person can mine or validate block transactions according to how many coins he or she holds. This means that the more Bitcoin or altcoin owned by a miner, the more mining power he or she has. The proof of stake (PoS) seeks to address this issue by attributing mining power to the proportion of coins held by a miner. &lt;/p&gt;

&lt;p&gt;This way, instead of utilizing energy to answer PoW puzzles, a PoS miner is limited to mining a percentage of transactions that is reflective of his or her ownership stake. For instance, a miner who owns 3% of the Bitcoin available can theoretically mine only 3% of the blocks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Practical Byzantine Fault Tolerance: use case = Hyperledger
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Byzantine Fault Tolerance(BFT) is the feature of a distributed network to reach consensus(agreement on the same value) even when some of the nodes in the network fail to respond or respond with incorrect information. The objective of a BFT mechanism is to safeguard against the system failures by employing collective decision making(both – correct and faulty nodes) which aims to reduce to influence of the faulty nodes. BFT is derived from Byzantine Generals’ Problem.&lt;/p&gt;

&lt;p&gt;pBFT tries to provide a practical Byzantine state machine replication that can work even when malicious nodes are operating in the system.&lt;br&gt;
Nodes in a pBFT enabled distributed system are sequentially ordered with one node being the primary(or the leader node) and others referred to as secondary(or the backup nodes). Note here that any eligible node in the system can become the primary by transitioning from secondary to primary(typically, in the case of primary node failure). The goal is that all honest nodes help in reaching a consensus regarding the state of the system using the majority rule.&lt;/p&gt;

&lt;p&gt;A practical Byzantine Fault Tolerant system can function on the condition that the maximum number of malicious nodes must not be greater than or equal to one-third of all the nodes in the system. As the number of nodes increase, the system becomes more secure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Federated Byzantine Agreement: use case = Ripple
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Similar to pBFT but with one change, users can vote for a group to provide consensus. The group can be dynamically changed according to the policies. Example users can code the top 10% stakeholders of the network to provide consensus to the rest 90%&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Quick Guide to Different Types of Function in Solidity</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 02 Sep 2020 21:41:00 +0000</pubDate>
      <link>https://dev.to/mxmaster2s/quick-guide-to-different-types-of-function-in-solidity-1i43</link>
      <guid>https://dev.to/mxmaster2s/quick-guide-to-different-types-of-function-in-solidity-1i43</guid>
      <description>&lt;p&gt;&lt;strong&gt;Constructor function&lt;/strong&gt;: A constructor function is either public or Internal. This is the first function that is automatically called only when the smart contract is deployed on the network. It cannot be called afterwards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;View function&lt;/strong&gt;: A view function can only perform reading from the state or from another view function. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pure function&lt;/strong&gt;: A pure function does not perform any reading or viewing on the state of the blockchain. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Function Visibility&lt;/strong&gt;: Who can call the function defines its visibility. Depending on who do you want your function to call, the visibility fo the function changes. There are four types of function visibility: &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public Visibility&lt;/strong&gt; (can be called externally and internally), &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Private Visibility&lt;/strong&gt; (can be called only internally, only for the contract), &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;External Visibility&lt;/strong&gt; (can be called from other contracts and can be called externally) &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Internal Visibility&lt;/strong&gt; (can be called from the contract itself or from the derived contracts, they cant be invoked by transactions)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fallback function&lt;/strong&gt;: A fallback function is always external. It is called when a transaction without a function-call is sent to the smart contract OR when the function-call in the smart contract isn't found.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;UPDATE Solidity 0.6&lt;/strong&gt;: There are two different types of fallback function now&lt;/p&gt;

&lt;p&gt;The “&lt;strong&gt;fallback&lt;/strong&gt;” function is called when no other function matches and no money is sent along.&lt;/p&gt;

&lt;p&gt;The “&lt;strong&gt;receive&lt;/strong&gt;” function matches when no other function matches and money is sent along.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pragma solidity ^0.6.0;
contract FunctionsExample {

 mapping(address =&amp;gt; uint) public balanceReceived;
 address payable owner;

//Constructor function: A constructor function is either public or Internal. This is the first function that is automatically called only when the smart contract is deployed on the network. It cannot be called afterwards.
 constructor() public {
 owner = msg.sender;
 }

//Public Visibility (can be called externally and internally)
 function destroySmartContract() public {
 require(msg.sender == owner, "You are not the owner");
 selfdestruct(owner);
 }

 function receiveMoney() public payable {
 assert(balanceReceived[msg.sender] + msg.value &amp;gt;= balanceReceived[msg.sender]);
 balanceReceived[msg.sender] += msg.value;
 }

 function withdrawMoney(address payable _to, uint _amount) public {
 require(_amount &amp;lt;= balanceReceived[msg.sender], "not enough funds.");
 assert(balanceReceived[msg.sender] &amp;gt;= balanceReceived[msg.sender] - _amount);
 balanceReceived[msg.sender] -= _amount;
 _to.transfer(_amount);
 }

//The receive function matches when no other function matches and money is sent along
 receive () external payable {
 receiveMoney();
 }

//View function: A view function can only perform reading from the state or from another view function 
 function getOwner() public view returns(address) {
 return owner;
 }

//Pure function: A pure function does not perform any reading or viewing on the state of the blockchain
 function convertWeiToEth(uint _amountInWei) public pure returns(uint) {
 return _amountInWei / 1 ether;
 }

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Quick Guide to the "Checks Effect Interactions" Pattern to Remember when writing your Smart Contracts!</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 02 Sep 2020 21:39:03 +0000</pubDate>
      <link>https://dev.to/mxmaster2s/quick-guide-to-the-checks-effect-interactions-pattern-to-remember-when-writing-your-smart-contracts-gfk</link>
      <guid>https://dev.to/mxmaster2s/quick-guide-to-the-checks-effect-interactions-pattern-to-remember-when-writing-your-smart-contracts-gfk</guid>
      <description>&lt;p&gt;Although it is commonly understood that data in a blockchain cannot be edited or deleted once it is added (which is true!) that does not mean a blockchain network is completely secure! Knowing the vulnerability of the blockchain network and taking measures to block illicit activity is still needed.  &lt;/p&gt;

&lt;p&gt;A possible attack vector is a re-entrancy attack, in which the malicious contract is reentering the initial contract before the first instance of the function containing the call is finished. Example is&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function widthdrawAllMoney(address payable _to) public {
//checking the balance of user in the network (check)
         unit balanceToSend = balanceReceived[msg.sender];             

//transferring the balance to the user (interaction with smart contract)
         _to.transfer(balanceToSend);                                                     

//setting balance of user to zero (effect on the network)
        balanceReveived[msg.sender] = 0;                                           
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;In the above simple scenario, we have to transfer all the money of the user back to the account the user passes to the function. The function then checks the balance of the user who is initiating the function, transfers the balance in his account to the requested address and then eventually sets the balance of the user to zero.&lt;/p&gt;

&lt;p&gt;Here, we are first checking the balance, transferring the crypto and then setting the balance to zero. This is a check-interact-effect method. And this is where a malicious user can perform a re-entrancy attack in a way that the crypto can be transferred to the address multiple times - called as recursive send pattern. And this has happened in the past! You can read all about this  &lt;a href="https://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/"&gt;here&lt;/a&gt;. The DAO was hacked for a whopping $150M!&lt;/p&gt;

&lt;p&gt;There is a simple and trivial way out, we can edit the code as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function widthdrawAllMoney(address payable _to) public {
//checking the balance of user in the network (check)
         unit balanceToSend = balanceReceived[msg.sender];             

//setting balance of user to zero (effect on the network)
        balanceReveived[msg.sender] = 0;  

//transferring the balance to the user (interaction with smart contract)
         _to.transfer(balanceToSend);                                                     
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The difference here is that we first perform the check (how much balance is in users account), perform the necessary effect FIRST (bring the balance of user back to zero) and THEN we interact with the blockchain to transfer the crypto!&lt;/p&gt;

&lt;p&gt;This is the check-effect-interaction best practice. &lt;/p&gt;

&lt;p&gt;Found it interesting? You can read more about it  &lt;a href="https://fravoll.github.io/solidity-patterns/checks_effects_interactions.html"&gt;here!&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Don't know anything about software development but want to learn Blockchain Development? Here's what to do:</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 02 Sep 2020 21:37:49 +0000</pubDate>
      <link>https://dev.to/mxmaster2s/don-t-know-anything-about-software-development-but-want-to-learn-blockchain-development-here-s-what-to-do-2gfm</link>
      <guid>https://dev.to/mxmaster2s/don-t-know-anything-about-software-development-but-want-to-learn-blockchain-development-here-s-what-to-do-2gfm</guid>
      <description>&lt;p&gt;Are you interested in learning blockchain? but unfortunately, you don't know anything about software development? &lt;strong&gt;I know the feeling!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not having a software development background and still wanting to learn blockchain is really scary - I know the feeling! There are a few online courses on blockchain certification from Upgrad, Blockchain Council, IIT Hyderabad and SOO MANY INSTITUTES! but they ask for a lot of money (I have paid INR 150,000 for an 11-month course myself) But if you are someone who is okay to spend some money and get 'the certificate', okay - good for you. You can stop reading ahead, sorry to waste your time! &lt;/p&gt;

&lt;p&gt;Honestly, the blockchain industry is asking for projects rather than those fancy certificates (believe me, I have a few and it does not work!) So I am going to tell you my plan =&amp;gt; what I did to learn software development and blockchain development in hyperledger fabric and ethereum!&lt;/p&gt;

&lt;p&gt;Here are some of the "BEST" Udemy courses under INR 500&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Everything &lt;strong&gt;Javascript&lt;/strong&gt;: &lt;a href="https://www.udemy.com/course/javascript-the-complete-guide-2020-beginner-advanced/"&gt;https://www.udemy.com/course/javascript-the-complete-guide-2020-beginner-advanced/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Everything &lt;strong&gt;Node.Js&lt;/strong&gt;: &lt;a href="https://www.udemy.com/course/nodejs-the-complete-guide/learn/lecture/11738940#overview"&gt;https://www.udemy.com/course/nodejs-the-complete-guide/learn/lecture/11738940#overview&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Everything &lt;strong&gt;Ethereum&lt;/strong&gt;: &lt;a href="https://www.udemy.com/course/blockchain-developer/learn/lecture/18410154#content"&gt;https://www.udemy.com/course/blockchain-developer/learn/lecture/18410154#content&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Everything &lt;strong&gt;Hyperledger Chaincodes 2.0&lt;/strong&gt;: &lt;a href="https://www.udemy.com/course/golang-chaincode-development/"&gt;https://www.udemy.com/course/golang-chaincode-development/&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The above list is more than 100 hours and should keep you busy for a few weeks!&lt;/p&gt;

&lt;p&gt;You should also follow some of the speakers on Youtube who talk a lot about the latest and greatest in blockchain and programming - &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Academind&lt;/strong&gt;: &lt;a href="https://www.youtube.com/channel/UCSJbGtTlrDami-tDGPUV9-w"&gt;https://www.youtube.com/channel/UCSJbGtTlrDami-tDGPUV9-w&lt;/a&gt; (before buying the course on Udemy, watch his EXTENSIVE videos on youtube)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DAppUniversity&lt;/strong&gt;: &lt;a href="https://www.youtube.com/channel/UCY0xL8V6NzzFcwzHCgB8orQ"&gt;https://www.youtube.com/channel/UCY0xL8V6NzzFcwzHCgB8orQ&lt;/a&gt; (Great guy to follow ethereum)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MITOpenCourses&lt;/strong&gt;: &lt;a href="https://www.youtube.com/channel/UCEBb1b_L6zDS3xTUrIALZOw"&gt;https://www.youtube.com/channel/UCEBb1b_L6zDS3xTUrIALZOw&lt;/a&gt; (your basics of programming - all free courses from MIT)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Telusko&lt;/strong&gt;: &lt;a href="https://www.youtube.com/channel/UC59K-uG2A5ogwIrHw4bmlEg"&gt;https://www.youtube.com/channel/UC59K-uG2A5ogwIrHw4bmlEg&lt;/a&gt; (great person to learn basic programming)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of course, &lt;strong&gt;I am not an expert&lt;/strong&gt;, but if you are like me who does not know anything about software development and want to start learning blockchain, I can relate to what you have in mind! So I can suggest you do the following to get started:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;See the courses I mentioned on Javascript and Node.js on Udemy (do not buy)&lt;/li&gt;
&lt;li&gt;Search that EXACT course on Youtube and watch the first 7-10 hours for free!!&lt;/li&gt;
&lt;li&gt;Go through the youtube of DAppUniversity (he is a good guide for Ethereum)&lt;/li&gt;
&lt;li&gt;Go through the ethereum course I mentioned on Udemy (maybe even buy it)&lt;/li&gt;
&lt;li&gt;Solve your basics that you don't understand using MITOpencourses, Academind and Telusko on youtube&lt;/li&gt;
&lt;li&gt;Take the nodejs and Javascript course on Udemy now (since you are somewhat confident with the &lt;em&gt;basics&lt;/em&gt; of basics)&lt;/li&gt;
&lt;li&gt;Checkout the Hyperledger fabric course I mentioned on Udemy&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The above 7 steps are more than 100 hours of learning for less than INR 2,000!! This should give you a very good background of software development and blockchain (especially Ethereum and Hyperledger Fabric)&lt;/p&gt;

&lt;p&gt;Once you start, you will be really confused for the first few weeks! *&lt;em&gt;But hold on! *&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CHEAT CODE&lt;/strong&gt; =&amp;gt; Open the Udemy links on Incognito Mode in Google Chrome to save your money!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FEELING LUCKY?&lt;/strong&gt; =&amp;gt; Uninstall your Windows OS and load a Linux Distro! Totally worth learning!&lt;/p&gt;

&lt;p&gt;Everything you need to do after installing Linux: &lt;a href="https://youtu.be/MNX7HgcWqHc"&gt;https://youtu.be/MNX7HgcWqHc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some 'must-have' applications for your new Linux: &lt;a href="https://www.youtube.com/watch?v=a5cvg9XKEL8&amp;amp;feature=youtu.be"&gt;https://www.youtube.com/watch?v=a5cvg9XKEL8&amp;amp;feature=youtu.be&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Again, I am not an expert - I have just gone through the struggle and I would like to save your money LOL :)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Connect OnePlus Bullet Wireless Z Bluetooth earphones to Ubuntu 16.04 / Linux</title>
      <dc:creator>Rohit</dc:creator>
      <pubDate>Wed, 02 Sep 2020 21:35:41 +0000</pubDate>
      <link>https://dev.to/mxmaster2s/connect-oneplus-bullet-wireless-z-bluetooth-earphones-to-ubuntu-16-04-linux-4dgp</link>
      <guid>https://dev.to/mxmaster2s/connect-oneplus-bullet-wireless-z-bluetooth-earphones-to-ubuntu-16-04-linux-4dgp</guid>
      <description>&lt;p&gt;I received the new OnePlus Bullet Wireless Z (Black) earphones today as a gift. I tried to connect the device with my POCO F1 phone and it connected without a problem. Although POCO F1 does not support AAC codec - which means the earphones are connected to my phone via SBC codec. You can read more about Bluetooth codec  &lt;a href="https://www.soundguys.com/understanding-bluetooth-codecs-15352/" rel="noopener noreferrer"&gt;here&lt;/a&gt; . Basically, my POCO F1 will only be able to send data on Sub-band Codec (SBC!) and with lower quality. But it works on the phone! &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666744316%2F8jcg9X3YT.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666744316%2F8jcg9X3YT.png" alt="Screenshot from 2020-07-25 14-15-29.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, the problem came when I tried to connect the earphones with my Ubuntu 16.04 distro. While connecting the earphones, you can pair the device with the OS easily by simply searching for the Bluetooth and selecting the earphones. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666803914%2F2b3Y0TBGq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666803914%2F2b3Y0TBGq.png" alt="2.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But when trying to play some music, the system played the sound via the laptop (in-built sound system). &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666828860%2FPV0pH_evK.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666828860%2FPV0pH_evK.png" alt="3.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When you connect the Bluetooth earphones to your laptop, it sometimes does not show as an output device in your sound settings. We basically need to tell the system that this earphone is indeed are an output device. This is the most common problem that people will face - with any Bluetooth device trying to connect to Linux, however, there can be problems in your drivers too.&lt;br&gt;
You can find any missing drivers using &lt;code&gt;dmesg&lt;/code&gt; command on the terminal: I found out some problems in the output like &lt;code&gt;Bluetooth: hci0: unexpected event for opcode 0xfc2f&lt;/code&gt; and &lt;code&gt;Couldn't get size: 0x800000000000000e&lt;/code&gt;  &lt;a href="https://gist.github.com/MXmaster2s/7dd341ce7339da105c10dd1d1dea2475" rel="noopener noreferrer"&gt;Here&lt;/a&gt;  is a complete output from the terminal if you want to check and compare with yours. The drivers can be found  &lt;a href="https://github.com/winterheart/broadcom-bt-firmware" rel="noopener noreferrer"&gt;here&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;However, If you are able to use other Bluetooth headsets on your device, most probably the drivers are working fine and we can go ahead. For me, I was able to use Apple Bluetooth earphones without any problem, hence I knew the errors in the &lt;code&gt;dmesg&lt;/code&gt; output were not really serious.&lt;br&gt;
Now connect your earphones to the laptop and make sure you can see the earphones in the list. We can check the Bluetooth devices connected to the system using the &lt;code&gt;bluetoothctl&lt;/code&gt; command on the terminal:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666958648%2FFivI4H0uw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666958648%2FFivI4H0uw.png" alt="4.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can use the command info  and we can see that the earphones are connected to the system. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666987677%2FhrSZ-XGdS.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595666987677%2FhrSZ-XGdS.png" alt="5.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But still, the sound system is still unable to recognise the device as an output device&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595667015517%2FdmRz3GuA0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595667015517%2FdmRz3GuA0.png" alt="6.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can download a Bluetooth manager by entering the command &lt;code&gt;sudo apt-get install&lt;/code&gt; and &lt;code&gt;sudo apt-get install blueman&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Inside Bluetooth manager (blueman) you need to right-click on the device and disconnect it. Now again connect the device using the option ‘headset’ and you should be able to see that the device now has been recognised as a sound output device &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595667058924%2Fi53iIZWeY.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595667058924%2Fi53iIZWeY.png" alt="7.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can now go back to the sound settings and select the earphones as an output device &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595667087420%2FDL0gx4xZG.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcdn.hashnode.com%2Fres%2Fhashnode%2Fimage%2Fupload%2Fv1595667087420%2FDL0gx4xZG.png" alt="8.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure to select the mode as ‘High Fidelity Playback’ and test the sound. You should now be able to play music on your new Bluetooth earphones.&lt;/p&gt;

&lt;p&gt;The above method was successful for me. Do let me know if this helps you or not by commenting below!&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
