avatarCaleb

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

5582

Abstract

alcoholics, for reasons yet obscure, have lost the power of choice in drink. Our so-called will power becomes practically nonexistent. We are unable, at certain times, to bring into our consciousness with sufficient force the memory of the suffering and humiliation of even a week or a month ago. We are without defense against the first drink.</p></blockquote><blockquote id="b97c"><p>~ The Big Book, page 24.</p></blockquote><p id="2733">I mumbled something about doing more therapy sessions to stay in touch with my baseline feelings, but my new sponsor was having none of it.</p><p id="e1c9">‘This isn’t an emotional issue!’ he said, cutting in. ‘This is a memory issue that no amount of therapy you chose to throw money at will solve.’</p><p id="1800">He even suggested that the mental blank spot could be similar to a form of amnesia or dementia that science hasn’t picked up on yet.</p><p id="4ad6">‘But why hasn’t science picked up on it?’ I asked, holding the phone tightly.</p><p id="26fb">‘Probably because this blank spot only happens at certain times. Most of the time, it lays dormant.’ he replied before warning,</p><p id="337a">‘And unfortunately, this dormancy feature gives us an illusion of power. We think we’ve got sobriety now because our memory and willpower function normally again. Until, the condition randomly comes back online, and we relapse, leaving us totally baffled as to why it happened.’</p><p id="a3e9">My new sponsor sighed deeply.</p><p id="f455">‘It’s heartbreaking,’ he said softly. ‘Especially if you’ve relapsed after being multiple years clean. But it is sadly needed to show you that you are genuinely powerless, regardless of how much you desire and want to be sober.’</p><p id="969d">My head was spinning. Every sentence felt like the jolt of an electric cattle prod.</p><p id="8e0a">Later that day, I looked back at my recent relapses. I found no real conscious memory of consequences before any of them.</p><p id="352f">It appeared relapse was happening to me, not by me.</p><blockquote id="8aba"><p>As soon as I regained my ability to think, I went carefully over that evening in Washington. Not only had I been off guard, I had made no fight whatever against the first drink. This time I had not thought of the consequences at all. I had commenced to drink as carelessly as though the cocktails were ginger ale. I now remembered what my alcoholic friends had told me, how they prophesied that if I had an alcoholic mind, the time and place would come — I would drink again. They had said that though I did raise a defense, it would one day give way before some trivial reason for having a drink. Well, just that did happen and more, for what I had learned of alcoholism did not occur to me at all. I knew from that moment that I had an alcoholic mind. I saw that will power and self-knowledge would not help in those strange mental blank spots. I had never been able to understand people who said that a problem had them hopelessly defeated. I knew then. It was a crushing blow.</p></blockquote><blockquote id="93f7"><p>~ The Big Book, page 41.</p></blockquote><figure id="7922"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/0*n4r4HuNFWSnCD_WU"><figcaption>Photo by <a href="https://unsplash.com/@alicealinari?utm_source=medium&amp;utm_medium=referral">Alice Alinari</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h2 id="287c">A Belief That It Will All Be Alright.</h2><p id="baea">Sadly, the ‘blank spot’ wasn’t all that was happening.</p><p id="7c3e">My new sponsor later explained that something else was happening in my mind, a kind of twisting of my thinking that I couldn’t see either.</p><p id="02a0">This is the other main feature of the relapse condition.</p><p id="da70">The Big Book explains it as follows:</p><blockquote id="f067"><p>But there was always the curious mental phenomenon that parallel with our sound reasoning, there inevitably ran some insanely trivial excuse for taking the first drink. Our sound reasoning failed to hold us in check. The insane idea won out.</p></blockquote><blockquote id="4ad8"><p>~ The Big Book, page 37.</p></blockquote><p id="da58">Anytime the ‘good idea’ of relapsing suddenly popped into my head, part of me would start to minimise the lunacy of this thought.</p><p id="e2c7">I would begin to rationalise this catastrophic idea with excuses and reasons why it would be, in fact, okay to relapse despite being in recovery.</p><p id="432a">No matter how insignificant and non-sensical those reasons were, they quickly became plausible and seemingly rational.</p><p id="6997">At the same time, the urge to want to relapse would start to surge.</p><p id="cdc4">A fear of missing out would relentlessly come crashing in like waves rolling in and out of my consciousness.</p><p id="b225">Thoughts and narratives of why it would be okay this time would dominate my thinking.</p><p id="fe2d">Finally, a tidal wave of justification would smother me into deep unconsciousness.</p><p id="c65b">Convinced of my rationale, I would carry out my plan, only to revert back to type and do everything I said I wouldn’t do, and again, find myself powerless to stop once I started.</p><p id="34a2">This twisted thinking was nothing more than a lie, but I believed the lie and didn’t see the flaw in the logic in light of my track record with partying.</p><p id="888a">To any average person, this kind of thinking and decision-making would be termed irrational, unsound, or even insa

Options

ne.</p><p id="d880">The Big Book calls this thinking an <i>‘obsession to beat the game’</i>.</p><p id="9087">Whether it’s a vague idea that this time it would be different, that I would do it differently and party like a gentleman.</p><p id="b075">Or the well-loved excuse that this will be my last relapse. After this final time, I’ll be done for good. I’ll get on with my life.</p><p id="be67">But, it never was different and that last time never did happen.</p><p id="149d">My new sponsor would remind me often,</p><p id="a62b" type="7">‘You aren’t changing your mind when you’ve decided to give in and party; your mind has been changed for you.’</p><h2 id="4c19">It Centers In Our Minds</h2><p id="f0e7">Of course, there is a body element for the addict.</p><p id="86b6">Naturally, as a consequence of the constant extreme usage of powerfully addictive substances and processes that are designed by their very nature to make you want more and more, addicts have developed a sky-high tolerance.</p><p id="2d70">But there’s this annihilation approach to our acting out and using once we start, which the Big Book describes as the <i>‘phenomenon of craving’</i>.</p><p id="01c2">In the Doctor’s opinion in the Big Book, Dr. Silkworth calls the phenomenon of craving an ‘allergy’, but my new sponsor wasn’t too keen on that idea.</p><p id="10af" type="7">‘If it’s an allergy, then why doesn’t the phenomenon of craving happen every time?’</p><p id="ae75">Regardless of whether it is an allergy, the body part becomes irrelevant, as most people with a severe peanut allergy don’t tend to keep repeating the total lost cause of trying to have another peanut to see if they will react differently.</p><p id="2e48">They don’t touch or go anywhere near peanuts because they remember how terrible it was last time.</p><p id="436a">Once or twice is enough.</p><p id="3796">Not so with the real addict because of the first two features of the disease; they will not only be back gorging on peanuts, but they will eventually take up residence in a peanut factory.</p><blockquote id="e3f6"><p>There is a complete failure of the kind of defence that keeps one from putting his hand on a hot stove. The alcoholic may say to himself in the most casual way, “It won’t burn me this time, so here’s how!” Or perhaps he doesn’t think at all.</p></blockquote><blockquote id="d5e6"><p>~ The Big Book, page 24.</p></blockquote><p id="5cb9">That’s why the Big Book says the real problem ‘centers in our mind’, not our bodies.</p><p id="22d4">‘What will happen now,’ my new sponsor forewarned, ‘as the relapses get worse, the time between them will get shorter and shorter.’</p><p id="6f0b">This condition is progressive.</p><p id="e8f1">Therefore, the blanking and twisting will naturally grow in scope and reach until you can no longer differentiate the true from the false.</p><h2 id="869b">Turning To Something Else</h2><p id="922a">If you believe in the disease concept of addiction, that this is a disease, a fatal illness precisely like any other life-threatening condition, then you have it for life.</p><p id="a2d8">There is <b>nothing </b>you can do to change that.</p><p id="d5f6">If you constantly can’t remember why or how you relapsed despite your honest desire not to.</p><p id="9aaf">Or if you continually relapse, believing some trivial reason or silly excuse to relapse while dismissing the genuine consequences, then you are a real addict.</p><p id="a47a">You have this relapse condition.</p><p id="840d">You <b>crossed a threshold </b>where, at certain times, your inability to use reasoning and rational thinking won’t even register for you.</p><p id="d8c6">The tragic truth is that once that threshold has been crossed, you have <b>no choice</b> but to relapse.</p><p id="0564">A compromised part of your brain will always fire the thought of using or acting out. That will never change. It’s wired like that for life.</p><p id="5fb0">There is no cure.</p><p id="fcca">Even this information won’t save you, as at certain times, you won’t be able to recall any of it when it matters.</p><p id="7fc5">So, let go of trying to change that.</p><p id="59f9">Let go of any old ideas around fighting it and instead get out of the way and <b>trust in something else</b>.</p><p id="b722">After all, that’s all you’ve got.</p><p id="5065">There’s nothing you or anyone else can do to stop this relapse condition.</p><p id="d1dd">But there’s everything you can do about everything else.</p><p id="5e51">There’s everything you can do about building a <b>spiritual dimension</b> to your life, by giving back, helping others, living in genuine faith and trusting in something greater than you.</p><p id="3096">There’s everything you can do to improve your awareness and intuition, raise your consciousness and develop another part of your brain.</p><p id="7598">And let this part of your brain grow bigger and stronger than that addictive part so that it can embrace and look after that compromised part.</p><p id="d2e3">Just like a bigger and wiser older sibling can care for and comfort a much younger upset sibling by giving that stressed child a big hug.</p><p id="da93">There’s everything you can do about deciding to take on a new attitude, direction, and way of life that will keep this condition dormant one day at a time.</p><p id="e415">If this article speaks to you, please follow, share and subscribe to me for more.</p><p id="fc50">Click <a href="https://twitter.com/TheDarrenJames">here</a> to follow me on <a href="https://twitter.com/TheDarrenJames">X</a>.</p></article></body>

Step-by-Step Tutorial: Developing and Deploying Decentralized Applications (dApps) on the Polygon Platform

In a world where technology is taking over traditional systems, the era of centralized servers is fading away. In its place, the revolution of decentralization has begun. And right at the heart of this revolution are Decentralized Applications (dApps). This tutorial will guide you, step by step, through the process of developing your first dApp on the Polygon platform, the key to unlocking a whole new world of possibilities.

A Brief Introduction

Before diving in, let’s quickly go over what exactly dApps and Polygon are.

Decentralized applications, or dApps, are applications that run on a P2P network of computers rather than a single computer. Imagine playing a game of chess where each move is determined and verified by hundreds of observers instead of just two players. This is the concept of decentralization in a nutshell.

On the other hand, Polygon (formerly known as Matic Network) is a protocol and a framework for building and connecting Ethereum-compatible blockchain networks. Think of it as a bridge that connects isolated Ethereum-compatible blockchain networks, allowing them to work together as a single unified network.

Required Tools

Let’s gather our tools. Here’s what we need:

  1. MetaMask: This is a crypto wallet that will allow us to interact with the Ethereum network.
  2. Truffle: It’s a development environment, testing framework and asset pipeline for Ethereum.
  3. Polygon Mumbai Testnet: We will use this for testing our dApp.

For this tutorial, I am assuming that you have a basic understanding of JavaScript, Solidity, Ethereum, and blockchain technology.

Step 1: Setting Up the Environment

First things first, let’s install Truffle:

npm install -g truffle

With Truffle in place, let’s configure MetaMask to use the Polygon Mumbai Testnet. Follow these instructions from the official Polygon documentation to do so.

Great! You should see something like this when you open your Metamask:

Step 2: Configuring Truffle

Let’s initialize Truffle in our project:

truffle init

The truffle init command creates a new Truffle project with the necessary configuration files and directories. Among these is the truffle-config.js file, which is essential for configuring Truffle's behavior.

Open the truffle-config.js file. You will see various configurations commented out. For now, we're interested in setting up our project to use the Polygon Mumbai Testnet.

Find the networks section in the configuration file and add the following configuration:

networks: {
  matic: {
    provider: () => new HDWalletProvider(mnemonic, `https://rpc-mumbai.maticvigil.com`),
    network_id: 80001,
    gas: 8000000, 
    confirmations: 2,  
    timeoutBlocks: 200, 
    skipDryRun: true
  },
},

You’ll need to replace mnemonic with your MetaMask wallet's mnemonic phrase.

Please note that your mnemonic phrase should be kept secret. Do not share it with anyone or publish it online. Also, in a real-world production setting, you would not hardcode the mnemonic phrase in the truffle-config.js file for security reasons. You might use environment variables or a secure secret management system.

Also, update your Truffle configuration to match the Solidity version we’ll use:

compilers: {
  solc: {
    version: "^0.8.0", 
  },
},

Finally, you’ll need to install HDWalletProvider, a Truffle package that allows us to connect to different Ethereum networks:

npm install @truffle/hdwallet-provider

At the top of your truffle-config.js file, require the HDWalletProvider:

const HDWalletProvider = require("@truffle/hdwallet-provider");

With these configurations, you’re now ready to compile and migrate your smart contracts using Truffle on the Polygon Mumbai Testnet.

Step 3: Writing a Smart Contract

Let’s create a simple smart contract. This contract will just store and retrieve a string. In the root of your project directory, create a new file called HelloWorld.sol in the contracts directory and copy the following Solidity code into it:

pragma solidity ^0.8.0;

contract HelloWorld {
    string public message;
    function setMessage(string memory newMessage) public {
        message = newMessage;
    }
    function getMessage() public view returns (string memory) {
        return message;
    }
}

Step 4: Compiling the Smart Contract

Let’s compile our smart contract using Truffle:

truffle compile

Step 5: Deploying the Smart Contract to the Polygon Mumbai Testnet

We create a migration script in the migrations directory:

const HelloWorld = artifacts.require("HelloWorld");

module.exports = function(deployer) {
  deployer.deploy(HelloWorld);
};

You should name the file with a number followed by a description. For example, if your contract’s name is HelloWorld, you might create a new file named 2_deploy_hello_world.js for example. The number at the beginning indicates the order in which the migration should run.

And finally, deploy your contract:

truffle migrate --network matic
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.


Starting migrations...
======================
> Network name:    'matic'
> Network id:      80001
> Block gas limit: 20235543 (0x134c517)


2_deploy_hello_world.js
=======================

   Deploying 'HelloWorld'
   ----------------------
   > transaction hash:    0x4e5081f75cdc0082d61ad375b3636bf66a22fb88278f9a254b318d5ebffdbfc1
   > Blocks: 2            Seconds: 4
   > contract address:    0xe53F9E3671B631A61a26A6Cc54e46da781323311
   > block number:        37673287
   > block timestamp:     1688762067
   > account:             0xeAE0666664347AdaE0Bd3a107713D11a610B3f10
   > balance:             0.136666589580666176
   > gas used:            333364 (0x51634)
   > gas price:           2.500000016 gwei
   > value sent:          0 ETH
   > total cost:          0.000833410005333824 ETH

   Pausing for 2 confirmations...

   -------------------------------
   > confirmation number: 2 (block: 37673289)
   > Saving artifacts
   -------------------------------------
   > Total cost:     0.000833410005333824 ETH

Summary
=======
> Total deployments:   1
> Final cost:          0.000833410005333824 ETH

Our Smart Contract is deployed to the Polygon Mumbai Testnet:

https://mumbai.polygonscan.com/address/0xe53F9E3671B631A61a26A6Cc54e46da781323311

Step 6: Interacting with the Smart Contract

First, let’s create a basic HTML file called index.html in the root of your project directory:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>HelloWorld dApp</title>
</head>
<body>
    <h1>HelloWorld dApp</h1>
    <input id="message-input" type="text" placeholder="Type a message...">
    <button id="message-button">Set Message</button>
    <div id="message-output"></div>
    
    <!-- Include web3.js -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/web3/1.2.9/web3.min.js"></script>
    <!-- Include our JavaScript file -->
    <script src="app.js"></script>
</body>
</html>

Next, we create a JavaScript file called app.js:

// replace with your contract's ABI (can be found in the JSON file in the build/contracts directory)
const contractABI = [...]; 

// replace with your contract's deployed address
const contractAddress = '...'; 

const web3 = new Web3(window.ethereum);
const helloWorldContract = new web3.eth.Contract(contractABI, contractAddress);

window.ethereum.enable().then((accounts) => {
    const account = accounts[0];

    const messageButton = document.getElementById('message-button');
    const messageOutput = document.getElementById('message-output');

    // Display current message
    helloWorldContract.methods.getMessage().call()
        .then(result => {
            messageOutput.innerText = result;
        });

    // Set new message
    messageButton.addEventListener('click', () => {
        const messageInput = document.getElementById('message-input');

        helloWorldContract.methods.setMessage(messageInput.value)
            .send({ from: account })
            .on('transactionHash', () => {
                messageOutput.innerText = messageInput.value;
            });
    });
});

Please remember to replace the contractABI and contractAddress with your actual contract's ABI and the address where it was deployed. Also, ensure that MetaMask is installed in your browser, or else window.ethereum will be undefined.

You can now open the index.html file in your browser. Don't forget to connect your MetaMask to the Polygon Mumbai Testnet and the correct account.

After connecting, you can interact with your deployed HelloWorld contract by typing a new message and clicking the 'Set Message' button. You should see the message updated.

MetaMask confirmation
http://127.0.0.1:5500/index.html
https://mumbai.polygonscan.com/tx/0x0d1bc5727a731aeb7bc9bcef4e2dc6d123e59d841a229d4c23257fad5c91c39e

Conclusion

Congratulations! You’ve now developed and interacted with your first decentralized application (dApp) on the Polygon platform, directly from your browser.

Developing dApps can be a challenging journey, but remember, it’s about learning, experimenting, and gradually enhancing your skills. Keep exploring and soon you’ll be creating more complex dApps contributing to the vibrant blockchain ecosystem.

  1. Polygon Wiki— This is the official documentation by Polygon Network. It covers in detail the various aspects of the Polygon Network and its development tools.
  2. Truffle Suite — Truffle Suite’s official website with extensive documentation and tutorials on using Truffle for Ethereum development.
  3. Remix Ethereum — This is an online compiler and Solidity IDE. It’s a quick way to write, test, debug, and deploy smart contracts on Ethereum networks.
  4. OpenZeppelin — This library provides secure and community-audited smart contract components for Solidity.
  5. Web3.js — This is the Ethereum compatible JavaScript API which implements the Generic JSON RPC spec. It’s used for interacting with Ethereum blockchain and smart contracts on it.
  6. Solidity Documentation — This is the official Solidity documentation, a great place to get a deep understanding of Solidity language.
  7. Etherscan — It allows you to explore the Ethereum and Polygon blockchains, transactions, addresses, and more.
  8. Hardhat — A development environment to compile, deploy, test, and debug your Ethereum software.
  9. Polygon Faucet — This is a faucet for the Polygon Mumbai Testnet. You can use it to request Matic tokens for testing your dApps on the test network.
  10. PolygonScan — This is the equivalent of Etherscan but for the Polygon Network. You can use it to explore transactions, addresses, blocks, and other activities happening on the Polygon Network.

Enjoyed the read? For more on Web Development, JavaScript, Next.js, Cybersecurity, and Blockchain, check out my other articles here:

If you have questions or feedback, don’t hesitate to reach out at [email protected] or in the comments section.

[Disclosure: Every article I pen is a fusion of my ideas and the supportive capabilities of artificial intelligence. While AI assists in refining and elaborating, the core thoughts and concepts stem from my perspective and knowledge. To know more about my creative process, read this article.]

Blockchain
Cryptocurrency
Polygon
Dapps
Ethereum
Recommended from ReadMedium