<?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: Supernova</title>
    <description>The latest articles on DEV Community by Supernova (@stellarhamza).</description>
    <link>https://dev.to/stellarhamza</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1039719%2F194bb208-a56a-4f66-8603-a6e3a9dce6ef.png</url>
      <title>DEV Community: Supernova</title>
      <link>https://dev.to/stellarhamza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stellarhamza"/>
    <language>en</language>
    <item>
      <title>interact with the Soroban smart contract and start betting on the outcome of events using Ethereum</title>
      <dc:creator>Supernova</dc:creator>
      <pubDate>Fri, 17 Mar 2023 18:45:30 +0000</pubDate>
      <link>https://dev.to/stellarhamza/interact-with-the-soroban-smart-contract-and-start-betting-on-the-outcome-of-events-using-ethereum-189a</link>
      <guid>https://dev.to/stellarhamza/interact-with-the-soroban-smart-contract-and-start-betting-on-the-outcome-of-events-using-ethereum-189a</guid>
      <description>&lt;p&gt;Soroban-CLI is a command-line interface (CLI) tool for interacting with the Soroban smart contract. The Soroban smart contract is a decentralized application (dApp) built on the Ethereum blockchain that allows users to bet on the outcome of events using cryptocurrency.&lt;/p&gt;

&lt;p&gt;Here is a beginner's tutorial on how to interact with the Soroban smart contract using the Soroban-CLI tool:&lt;/p&gt;

&lt;p&gt;Install Soroban-CLI: You can install Soroban-CLI using npm (Node Package Manager) by running the following command in your terminal:&lt;br&gt;
Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g soroban-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up your Ethereum wallet: Before you can interact with the Soroban smart contract, you need to set up your Ethereum wallet. You can use any Ethereum wallet that supports the ERC-20 token standard, such as MetaMask or MyEtherWallet.&lt;/p&gt;

&lt;p&gt;Connect to the Ethereum network: Once you have set up your Ethereum wallet, you need to connect to the Ethereum network. You can do this by running the following command in your terminal:&lt;/p&gt;

&lt;p&gt;perl&lt;br&gt;
Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban-cli network connect
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will prompt you to select your Ethereum wallet and connect it to the Ethereum network.&lt;/p&gt;

&lt;p&gt;Check your balance: You can check your Ethereum balance by running the following command in your terminal:&lt;br&gt;
Copy code&lt;br&gt;
soroban-cli balance&lt;br&gt;
This will display your current Ethereum balance.&lt;/p&gt;

&lt;p&gt;Place a bet: You can place a bet on the outcome of an event using the Soroban smart contract by running the following command in your terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban-cli bet &amp;lt;event&amp;gt; &amp;lt;outcome&amp;gt; &amp;lt;amount&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace  with the name of the event,  with the outcome you want to bet on, and  with the amount of Ethereum you want to bet. For example, if you want to bet 1 Ethereum on the outcome "heads" for the event "coin flip", you would run the following command:&lt;/p&gt;

&lt;p&gt;Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban-cli bet coinflip heads 1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;View your bets: You can view your current bets by running the following command in your terminal:&lt;br&gt;
Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban-cli bets
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will display a list of all your current bets, including the event name, the outcome you bet on, the amount of Ethereum you bet, and the current status of the bet.&lt;/p&gt;

&lt;p&gt;Withdraw your winnings: If your bet is successful, you can withdraw your winnings by running the following command in your terminal:&lt;br&gt;
php&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban-cli withdraw &amp;lt;betId&amp;gt;
Replace &amp;lt;betId&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;with the ID of the bet you want to withdraw your winnings from. You can find the bet ID by running the soroban-cli bets command. For example, if the bet ID is 1234, you would run the following command to withdraw your winnings:&lt;/p&gt;

&lt;p&gt;yaml&lt;br&gt;
Copy code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban-cli withdraw 1234
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it! With these simple steps, you can interact with the Soroban smart contract and start betting on the outcome of events using Ethereum.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>To deploy and invoke a Soroban smart contract using Soroban Python SDK, you can follow the steps below</title>
      <dc:creator>Supernova</dc:creator>
      <pubDate>Wed, 08 Mar 2023 00:01:27 +0000</pubDate>
      <link>https://dev.to/stellarhamza/to-deploy-and-invoke-a-soroban-smart-contract-using-soroban-python-sdk-you-can-follow-the-steps-below-4f70</link>
      <guid>https://dev.to/stellarhamza/to-deploy-and-invoke-a-soroban-smart-contract-using-soroban-python-sdk-you-can-follow-the-steps-below-4f70</guid>
      <description>&lt;p&gt;Install the Soroban Python SDK:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install soroban-sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Import the necessary modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from soroban_sdk import Soroban, Account
Create a Soroban instance:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;soroban = Soroban('https://api.soroban.co/', 'my-api-key')
Note: Replace 'my-api-key' with your actual Soroban API key.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create an Account instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;account = Account.from_private_key('my-private-key')
Note: Replace 'my-private-key' with your actual private key.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define the smart contract code:&lt;br&gt;
python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract_code = """
pragma solidity ^0.8.0;

contract MyContract {
    uint256 public value;

    function setValue(uint256 _value) public {
        value = _value;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"""&lt;br&gt;
Note: This is just an example contract code. You should replace it with your actual smart contract code.&lt;/p&gt;

&lt;p&gt;Compile the smart contract code:&lt;br&gt;
makefile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;compiled_contract = soroban.compile_contract(contract_code)
Deploy the smart contract:
css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;deployed_contract = soroban.deploy_contract(compiled_contract['bytecode'], account)
Get the contract address:
css
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;contract_address = deployed_contract['contractAddress']
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Invoke a function in the smart contract:&lt;br&gt;
makefile&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function_name = 'setValue'
function_args = [42]
soroban.invoke_contract_function(contract_address, function_name, function_args, account)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: Replace 'setValue' with the name of the function you want to call, and [42] with the arguments you want to pass to the function.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Step-by-Step Guide for Beginners: How to Set Up the Soroban Python SDK on Windows</title>
      <dc:creator>Supernova</dc:creator>
      <pubDate>Mon, 06 Mar 2023 15:18:14 +0000</pubDate>
      <link>https://dev.to/stellarhamza/download-and-connect-your-phythonsdk-to-sorobanphython-58a3</link>
      <guid>https://dev.to/stellarhamza/download-and-connect-your-phythonsdk-to-sorobanphython-58a3</guid>
      <description>&lt;p&gt;Setting up the Stellar Python SDK on Windows involves several steps, including installing Python, setting up a virtual environment, and installing the SDK. Here are the detailed steps:&lt;/p&gt;

&lt;p&gt;Install Python:&lt;br&gt;
Go to the Python website (&lt;a href="https://www.python.org/downloads/windows/"&gt;https://www.python.org/downloads/windows/&lt;/a&gt;) and download the latest version of Python for Windows.&lt;br&gt;
Run the installer and follow the instructions to install Python on your computer.&lt;br&gt;
Install Git:&lt;br&gt;
Go to the Git website (&lt;a href="https://git-scm.com/download/win"&gt;https://git-scm.com/download/win&lt;/a&gt;) and download the latest version of Git for Windows.&lt;br&gt;
Run the installer and follow the instructions to install Git on your computer.&lt;br&gt;
Open Command Prompt:&lt;br&gt;
Press the Windows key + R, then type cmd and press Enter.&lt;br&gt;
Alternatively, open the Start menu, type Command Prompt, and click on the Command Prompt app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install virtualenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the Command Prompt, type the following command and press Enter:&lt;br&gt;
Python.org&lt;br&gt;
Python Releases for Windows&lt;br&gt;
The official home of the Python Programming Language&lt;br&gt;
Image&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install virtualenv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a virtual environment:&lt;br&gt;
Navigate to the directory where you want to create the virtual environment. For example, if you want to create it in the Documents folder, type the following command and press Enter:&lt;br&gt;
cd Documents&lt;br&gt;
Create the virtual environment by typing the following command and pressing Enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;virtualenv stellar_env
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a new directory called "stellar_env" that contains the virtual environment.&lt;br&gt;
Activate the virtual environment:&lt;br&gt;
Type the following command and press Enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;stellar_env\Scripts\activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the name of the virtual environment appear in parentheses in the Command Prompt.&lt;br&gt;
Install the Stellar Python SDK:&lt;br&gt;
Type the following command and press Enter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install stellar-sdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will install the SDK and any necessary dependencies.&lt;br&gt;
Test the installation:&lt;br&gt;
Type the following command and press Enter:&lt;br&gt;
python&lt;br&gt;
This will open the Python interpreter.&lt;br&gt;
Type the following commands and press Enter after each one:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from stellar_sdk import Server
server = Server("https://horizon-testnet.stellar.org/%22)
print(server.fetch_base_fee())
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the current base fee on the Stellar network printed to the screen.&lt;br&gt;
Congratulations! You have successfully set up the Stellar Python SDK on Windows.&lt;/p&gt;

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