<?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: Roongroj Phetkheaw</title>
    <description>The latest articles on DEV Community by Roongroj Phetkheaw (@roongroj).</description>
    <link>https://dev.to/roongroj</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%2F871692%2Fd7e4fdff-eab7-4436-96dc-68422664d52e.png</url>
      <title>DEV Community: Roongroj Phetkheaw</title>
      <link>https://dev.to/roongroj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/roongroj"/>
    <language>en</language>
    <item>
      <title>uv cheatsheet 🦀🐍</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Sun, 19 Oct 2025 07:19:18 +0000</pubDate>
      <link>https://dev.to/roongroj/uv-cheatsheet-3ldk</link>
      <guid>https://dev.to/roongroj/uv-cheatsheet-3ldk</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9qoi3ma54unhyg2bfziy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9qoi3ma54unhyg2bfziy.png" alt=" " width="800" height="1131"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://mathspp.com/blog/uv-cheatsheet" rel="noopener noreferrer"&gt;https://mathspp.com/blog/uv-cheatsheet&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Deploy Token on SUI 🚀 (Move 2024 edition) and Tips and Trick.</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Mon, 13 May 2024 06:29:16 +0000</pubDate>
      <link>https://dev.to/roongroj/deploy-token-on-sui-move-2024-edition-and-tips-and-trick-gok</link>
      <guid>https://dev.to/roongroj/deploy-token-on-sui-move-2024-edition-and-tips-and-trick-gok</guid>
      <description>&lt;p&gt;Move the 2024 edition onwards&lt;/p&gt;

&lt;p&gt;Let’s start&lt;/p&gt;

&lt;p&gt;Install SUI&lt;/p&gt;

&lt;p&gt;brew&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;brew install sui&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Cargo 🦀&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cargo install --locked --git https://github.com/MystenLabs/sui.git --branch testnet sui&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Run the following command to create your Sui account:&lt;/p&gt;

&lt;p&gt;Set Up Sui on Devnet&lt;/p&gt;

&lt;p&gt;Configure the Sui CLI to use the DevNet environment. This typically involves setting the network configuration to point to DevNet endpoints.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sui config set --network devnet&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;p&gt;&lt;code&gt;sui client new-address ed25519&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;You can check your active address via sui client active-address and switch to a new address via sui client switch --address [ADDRESS]&lt;/p&gt;

&lt;p&gt;Obtain Sui Tokens from the Faucet&lt;br&gt;
sui client faucet --address &lt;br&gt;
You can check your balance via sui client gas which will output something like this:&lt;/p&gt;

&lt;p&gt;Note: You’ll need to replace recipient with the address you generated above.&lt;/p&gt;

&lt;p&gt;Verify Your Sui Address&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sui keytool list&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Create a New Move Package&lt;br&gt;
sui move new my_first_package&lt;br&gt;
Check Active Address&lt;br&gt;
Make sure that your newly created Sui address is set as the active address in your Sui CLI configuration.&lt;/p&gt;

&lt;p&gt;sui client active-address&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module your_namespace::YourToken {
    use std::option;
    use sui::coin;
    use sui::transfer;
    use sui::tx_context::{Self, TxContext};

   // Name matches the module name, but in UPPERCASE
   // Internal struct declarations are not yet supported annotations are required on struct declarations from the Move 2024 edition onwards.
    public struct YourToken has key, store {}

    public fun initialize(ctx: &amp;amp;mut TxContext) {
        let (treasury, _metadata) = coin::create_currency&amp;lt;YourToken&amp;gt;(1000000, 6, b"YT", b"YourToken", b"Your token description", option::some(ctx.sender));
        transfer::public_freeze_object(metadata);
        // deploy and mint_and_transfer token
        coin::mint_and_transfer(&amp;amp;mut treasury, 1000000000000000000, tx_context::sender(ctx), ctx);
        transfer::public_transfer(treasury, tx_context::sender(ctx));
    }

    public entry fun mint(treasury: &amp;amp;mut coin::TreasuryCap&amp;lt;YourToken&amp;gt;, amount: u64, recipient: address) {
        coin::mint(treasury, amount, recipient);
    }

    public entry fun burn(treasury: &amp;amp;mut coin::TreasuryCap&amp;lt;SUPRA&amp;gt;, coin: coin::Coin&amp;lt;SUPRA&amp;gt;) {
        coin::burn(treasury, coin);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;For your token LOGO 😎&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use sui::url
 const IconUrl: vector&amp;lt;u8&amp;gt; = b"your_ipfs_Url";
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;you can update the logo file &lt;br&gt;
here: &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;a href="https://nft.storage/" rel="noopener noreferrer"&gt;
      nft.storage
    &lt;/a&gt;
&lt;/div&gt;

&lt;p&gt;or &lt;/p&gt;
&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
&lt;br&gt;
    &lt;div class="c-embed__content"&gt;
&lt;br&gt;
        &lt;div class="c-embed__cover"&gt;
&lt;br&gt;
          &lt;a href="https://pinata.cloud/" class="c-link align-middle" rel="noopener noreferrer"&gt;&lt;br&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fframerusercontent.com%2Fassets%2FcTpX2tRRi82714xgNek1a8114Jk.png" height="419" class="m-0" width="800"&gt;&lt;br&gt;
          &lt;/a&gt;&lt;br&gt;
        &lt;/div&gt;
&lt;br&gt;
      &lt;div class="c-embed__body"&gt;
&lt;br&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
&lt;br&gt;
          &lt;a href="https://pinata.cloud/" rel="noopener noreferrer" class="c-link"&gt;&lt;br&gt;
            Pinata | Crypto's file storage&lt;br&gt;
          &lt;/a&gt;&lt;br&gt;
        &lt;/h2&gt;
&lt;br&gt;
          &lt;p class="truncate-at-3"&gt;&lt;br&gt;
            Add IPFS file uploads and retrieval in minutes so you can focus on your app — because you’ve got better things to code than infrastructure.&lt;br&gt;
          &lt;/p&gt;
&lt;br&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
&lt;br&gt;
            &lt;img&gt;
              alt="favicon"&lt;br&gt;
              class="c-embed__favicon m-0 mr-2 radius-0"&lt;br&gt;
              src="https://framerusercontent.com/images/xePsNxlJkbNDeEtG9QwvSr4Kcc.png"&lt;br&gt;
              loading="lazy" /&amp;gt;&lt;br&gt;
          pinata.cloud&lt;br&gt;
        &lt;/div&gt;
&lt;br&gt;
      &lt;/div&gt;
&lt;br&gt;
    &lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;Update init token&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    fun init(witness: YourToken, ctx: &amp;amp;mut TxContext) {
        let ascii_url = std::ascii::string(IconUrl);
        let icon_url = url::new_unsafe(ascii_url);
    // Declare 'treasury' as mutable
        let (mut treasury, metadata) = coin::create_currency(witness, 9, b"symbol_YourToken", b"YourToken", b"YourToken info", option::some(icon_url), ctx);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check your move version or migrate new version&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sui move migrate&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;UPDATING GIT DEPENDENCY &lt;br&gt;
&lt;a href="https://github.com/MystenLabs/sui.git" rel="noopener noreferrer"&gt;https://github.com/MystenLabs/sui.git&lt;/a&gt;&lt;br&gt;
Package toml does not specify an edition. As of 2024, Move requires all packages to define a language edition.&lt;/p&gt;

&lt;p&gt;Please select one of the following editions:&lt;/p&gt;

&lt;p&gt;1) 2024.beta&lt;br&gt;
2) legacy&lt;/p&gt;

&lt;p&gt;Selection (default=1): 1&lt;/p&gt;

&lt;p&gt;Would you like the Move compiler to migrate your code to Move 2024? (Y/n) y&lt;/p&gt;

&lt;p&gt;Generated changes . . .&lt;br&gt;
INCLUDING DEPENDENCY Sui&lt;br&gt;
INCLUDING DEPENDENCY MoveStdlib&lt;br&gt;
BUILDING firoll&lt;/p&gt;

&lt;p&gt;No migration is required. Enjoy!&lt;br&gt;
Recorded edition in 'Move.toml'&lt;br&gt;
Let’s Deploy and Test!&lt;br&gt;
sui client publish --gas-budget 10000000&lt;br&gt;
or&lt;/p&gt;

&lt;p&gt;sui client publish --gas-budget 100000000 --skip-dependency-verification&lt;/p&gt;

&lt;p&gt;Interaction&lt;br&gt;
Mint Token&lt;/p&gt;

&lt;p&gt;sui client call --package  --module firoll --function mint --args  1000000  --gas-budget 300000000&lt;br&gt;
Burn token&lt;/p&gt;

&lt;p&gt;sui client call --package  --module supra --function burn --args   --gas-budget 3000&lt;br&gt;
Handling Updates and Migrations&lt;br&gt;
To update your Move code or migrate to a newer version, use:&lt;/p&gt;

&lt;p&gt;sui move migrate&lt;br&gt;
more…..&lt;/p&gt;

&lt;p&gt;Error&lt;/p&gt;

&lt;p&gt;sui client ptb&lt;br&gt;
--gas-budget 100000000&lt;br&gt;
--assign sender @$MY_ADDRESS&lt;br&gt;
--move-call $PACKAGE_ID::todo_list::new&lt;br&gt;
--assign list&lt;br&gt;
--transfer-objects "[list]" sender&lt;/p&gt;

&lt;p&gt;[warn] Client/Server api version mismatch, client api version : 1.24.1, server api version : 1.25.0&lt;br&gt;
thread '2024-05-06T03:14:23.341406Z ERROR telemetry_subscribers: panicked at crates/sui-protocol-config/src/lib.rs:1252:9:&lt;br&gt;
Network protocol version is ProtocolVersion(44), but the maximum supported version by the binary is 43. Please upgrade the binary. panic.file="crates/sui-protocol-config/src/lib.rs" panic.line=1252 panic.column=9&lt;br&gt;
main' panicked at crates/sui-protocol-config/src/lib.rs:1252:9:&lt;br&gt;
Network protocol version is ProtocolVersion(44), but the maximum supported version by the binary is 43. Please upgrade the binary.&lt;br&gt;
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace&lt;br&gt;
Aborted&lt;br&gt;
run this&lt;/p&gt;

&lt;p&gt;cargo install --locked --force --git &lt;a href="https://github.com/MystenLabs/sui.git" rel="noopener noreferrer"&gt;https://github.com/MystenLabs/sui.git&lt;/a&gt; --branch devnet sui&lt;/p&gt;

&lt;p&gt;gas-budget error&lt;br&gt;
verify&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3kxey0aqsbx7plcc3xhf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3kxey0aqsbx7plcc3xhf.png" alt=" " width="800" height="730"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajlzc2taljo1e77rx3yj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fajlzc2taljo1e77rx3yj.png" alt=" " width="800" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjorukhhm4l9eq9bptpvk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjorukhhm4l9eq9bptpvk.png" alt=" " width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://blog.sui.io/explorer-verified-source-code/?utm_source=twitter&amp;amp;utm_medium=organic&amp;amp;utm_campaign=build_beyond" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;br&gt;
Tips and Trick&lt;br&gt;
Using JSON Output for Better Scripting and Debugging&lt;br&gt;
When deploying contracts or interacting with the Sui network, you can use the --json flag to format the output as JSON. This is particularly useful for developers who want to script interactions with the CLI and process the output programmatically.&lt;/p&gt;

&lt;p&gt;sui client publish --package ./path_to_your_package --gas-budget 100000000 --json&lt;br&gt;
Check Transaction Status&lt;br&gt;
After submitting transactions, you can check their status to ensure they have been processed successfully. This is critical for operations where the state must be verified before proceeding.&lt;/p&gt;

&lt;p&gt;sui client tx-status --digest &lt;br&gt;
Efficiently Manage Gas and Fees&lt;br&gt;
Understanding and managing gas is crucial. Use the --gas-budget parameter to specify the maximum amount of gas you're willing to spend on a transaction. This helps in avoiding unexpectedly high fees.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sui client call --package &amp;lt;PACKAGE_ID&amp;gt; --function &amp;lt;FUNCTION_NAME&amp;gt; --args &amp;lt;ARGS&amp;gt; --gas-budget 500000&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Save Deployment Artifacts&lt;br&gt;
When deploying contracts, the CLI tool can generate important artifacts such as logs or contract addresses, which are often useful for debugging or operational purposes. &lt;br&gt;
Use appropriate flags to save these outputs to a specific directory or file.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sui client call --package &amp;lt;PACKAGE_ID&amp;gt; --module &amp;lt;MODULE_NAME&amp;gt; --function &amp;lt;FUNCTION_NAME&amp;gt; --args &amp;lt;ARGS&amp;gt; --&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
`&lt;br&gt;
previewPlease Give Me a Star! ⭐ ⭐ ⭐&lt;br&gt;
If you find this repository useful, please consider giving it a star on GitHub. Your support is a big thank you to me and motivates me to continue developing and sharing more great content!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/DoctorNasa/sui_token" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Easy to install Python -&gt; Mac | Fix $PATH</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Sat, 04 May 2024 18:36:01 +0000</pubDate>
      <link>https://dev.to/roongroj/easy-to-install-python-mac-fix-path-3pgl</link>
      <guid>https://dev.to/roongroj/easy-to-install-python-mac-fix-path-3pgl</guid>
      <description>&lt;h1&gt;
  
  
  1. Install homebrew
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  2.Install Pyenv
&lt;/h1&gt;



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

&lt;/div&gt;



&lt;h1&gt;
  
  
  3.Test pyenv
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pyenv virtualenv 3.12.0 myproject

pyenv local myproject

pyenv virtualenv-delete my project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  4.Test python
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 --version
Python 3.9.6
$ which -a python3
/usr/bin/python3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;==================================================&lt;br&gt;
FIX Python not found in ZSH&lt;/p&gt;

&lt;p&gt;Rus this&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;brew info python&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Python has been installed as
  /opt/homebrew/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /opt/homebrew/opt/python@3.11/libexec/bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Open profile config
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nano ~/.bash_profile
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I use zsh and VS Code, so I ran this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following lines to the file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export PATH="/opt/homebrew/opt/python@3.11/libexec/bin:$PATH"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now reload the shell profile by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;source ~/.bash_profile&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;For zsh, you could use this:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;source ~/.zshrc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

</description>
    </item>
    <item>
      <title>useful ssh-keygen tips</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Sat, 20 Apr 2024 15:59:59 +0000</pubDate>
      <link>https://dev.to/roongroj/useful-ssh-keygen-tips-3bol</link>
      <guid>https://dev.to/roongroj/useful-ssh-keygen-tips-3bol</guid>
      <description>&lt;p&gt;useful ssh-keygen tips&lt;/p&gt;

&lt;p&gt;sshkeygen&lt;br&gt;
generates a public key from a secret key&lt;br&gt;
ssh-keygen -y -f ~/.ssh/id_rsa &amp;gt; ~/.ssh/id_rsa.pub&lt;br&gt;
generates fingerprints from a public key&lt;br&gt;
ssh-keygen -l -E md5 -f ~/.ssh/id_rsa.pub&lt;br&gt;
changing passphrase&lt;br&gt;
ssh-keygen -p -f ~/.ssh/ssh_key.pem&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Solana: Note</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Fri, 29 Mar 2024 16:06:22 +0000</pubDate>
      <link>https://dev.to/roongroj/solana-note-28la</link>
      <guid>https://dev.to/roongroj/solana-note-28la</guid>
      <description>&lt;p&gt;&lt;strong&gt;Accounts&lt;/strong&gt; =&amp;gt; Everything is an account!!!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Unique 256-bit address.&lt;/li&gt;
&lt;li&gt;Hold some balance of SOL.&lt;/li&gt;
&lt;li&gt;Can store arbitrary data.&lt;/li&gt;
&lt;li&gt;Data Storage is paid with Rent.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Anyone can credit SOL or read data.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Only the account's owner can debit SOL or modify data.
&lt;/h1&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   key: number,     // The address of the account
   lamports: number,      // Lamports currently held
   data: Uint8Array,     // Data stored in the account
   is_executale: boolean, // Is this data a program
   owner: PublicKe      // the program with write access
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;//Lamports: This is the unit of currency &lt;br&gt;
in Solana (similar to “wei” in Ethereum).&lt;br&gt;
Accounts hold lamports, which can be converted to SOL, Solana's native currency. 1 SOL is equal to 1,000,000,000 lamports it same as Satoshi on BTC. Data: This is a section where the account can store information.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Programs = Smart contracts&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Smart contracts on Solana are called "programs"&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Language written in Rust, C/C++, Python.&lt;/li&gt;
&lt;li&gt;Data is eBPF bytecode (ebpf bite code which is the Berkeley packet filter bite code&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Special kind of account&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programs are stateless: they read &amp;amp; write data to other accounts&lt;br&gt;
This allows programs to be &lt;strong&gt;executed in parallel&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Must be the owner of an account to modify&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programs process instructions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Programs can send instructions to other programs using called cross program invocation or CPI&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
     program_id: number, // program this instruction is for
     keys: Arry&amp;lt;{       // actions involved in the instraction
      key: PublicKey,
      is_mutable: boolean,
      is_signer: boolean,
     }&amp;gt;,
     data: Uint8Array, // action +args
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Transactions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Transaction =&amp;gt; RPC Client =&amp;gt; Network&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
 message: {
    instructions: Array&amp;lt;Instraction&amp;gt;, // list of instructions
    recent_blockhash: number,   // de-duplication
    fee_payer: PublicKey,      // pays "gas" fee
    ...
},
 signers: Array&amp;lt;Uint8Array&amp;gt;, // signed version of trasaction
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Transactions:&lt;br&gt;
Transactions are the vehicles through which instructions are executed on the Solana blockchain. A transaction consists of multiple components:&lt;/p&gt;

&lt;p&gt;Instructions: These are the individual actions that a transaction aims to perform. Each instruction specifies the program it's intended for, the accounts involved, and any additional data or arguments necessary for the program to execute the instruction.&lt;br&gt;
Recent Blockhash: This is a hash value derived from a recent block on the blockchain. It serves as a de-duplication mechanism, ensuring that transactions are not replayed or executed multiple times.&lt;br&gt;
Fee Payer: Every transaction requires a fee to be paid in SOL, which compensates the validators for processing the transaction. The fee payer is the account responsible for paying this fee.&lt;br&gt;
Signers: To authorize the execution of a transaction, it must be signed by one or more accounts. The signers array contains the cryptographic signatures of these accounts, proving their consent to the transaction.&lt;br&gt;
Transactions are submitted to the Solana network through an RPC (Remote Procedure Call) client, which broadcasts the transaction to the validators responsible for processing and adding it to the blockchain.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;+-------------+
|   Client    | 
|  (dApp UI)  |
+-------------+
     |
     | User Action
     | Triggers Transaction
     v
+-------------+
|  RPC Client |
+-------------+
     |
     | Routes Transaction
     v
+-------------+
|  Validator  |
+-------------+
     |
     | Executes Instruction
     v
+-------------+
|   Program   |
| (Smart      |
|  Contract)  |
+-------------+
     |
     | Modifies State
     v
+-------------+
|  Counter    |
|  Account    |
|  count = 1  |
+-------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Solana: From Zero to Noob - A Journey Through the Rust Wilderness 🤓</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Fri, 29 Mar 2024 11:33:00 +0000</pubDate>
      <link>https://dev.to/roongroj/solana-from-zero-to-noob-a-journey-through-the-rust-wilderness-2n94</link>
      <guid>https://dev.to/roongroj/solana-from-zero-to-noob-a-journey-through-the-rust-wilderness-2n94</guid>
      <description>&lt;p&gt;&lt;strong&gt;SAWADEE Rrap (Hello)&lt;/strong&gt;, fellow crypto enthusiasts! If you're reading this, chances are you've stumbled upon the exciting world of Solana, the high-performance blockchain that promises to revolutionize the way we think about decentralized applications. But before we dive into the nitty-gritty of this cutting-edge technology, let's address the elephant in the room – Rust.&lt;/p&gt;

&lt;p&gt;Ah, Rust – the programming language that strikes fear into the hearts of even the most seasoned developers. With its steep learning curve and unforgiving syntax, it can feel like you're scaling a treacherous mountain without a rope. But fear not, my friends! For those willing to embrace the challenge, the rewards are immense.&lt;/p&gt;

&lt;p&gt;Rust is the backbone of Solana's architecture, and mastering it is the key to unlocking the full potential of this blockchain behemoth. It's a language that demands precision, patience, and a willingness to embrace the mind-bending concepts of memory management and ownership rules. But once you've conquered these hurdles, you'll find yourself in possession of a powerful tool that can create lightning-fast, secure, and concurrent applications.&lt;/p&gt;

&lt;p&gt;Now, I know what you're thinking: "Lane, why can't we just stick to the tried-and-true languages we already know?" Well, my dear fellow, that's a valid question. But the truth is, Solana's ambitious goals – scalability, speed, and security – necessitate a language that can handle the demands of high-performance computing. And Rust, with its low-level control and zero-cost abstractions, is the perfect candidate for the job.&lt;/p&gt;

&lt;p&gt;But fear not, my friends! While the path to Rust mastery may seem daunting, there are countless resources available to guide you through the wilderness. From online courses and tutorials to vibrant community forums, you'll find a wealth of knowledge at your fingertips. And let's not forget the countless developers who have already braved the Rust journey and emerged victorious, ready to share their hard-earned wisdom with those willing to listen.&lt;/p&gt;

&lt;p&gt;So, my fellow noobs, embrace the challenge! Dive headfirst into the world of Rust and Solana, for the rewards are truly worth the effort. Remember, Rome wasn't built in a day, and neither will your Solana skills be mastered overnight. But with perseverance, dedication, and a healthy dose of humor, you'll soon find yourself wielding the power of Rust like a true blockchain warrior.&lt;/p&gt;

&lt;p&gt;And who knows? Perhaps one day, you'll be the one writing the "Solana: From Zero to Hero" guide, inspiring the next generation of developers to embark on this exciting journey. Until then, keep coding, keep learning, and never forget – the path to greatness is paved with countless compiler errors and head-scratching moments. Embrace them, my friends, for they are the badges of honor that mark your progress in the Rust wilderness.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Find memory address in Rust</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Wed, 27 Mar 2024 17:30:51 +0000</pubDate>
      <link>https://dev.to/roongroj/find-address-and-memory-5clm</link>
      <guid>https://dev.to/roongroj/find-address-and-memory-5clm</guid>
      <description>&lt;p&gt;This code demonstrates a few concepts: variable declaration, value printing, converting a numeric value to its byte representation, iteration with enumeration, and printing memory addresses.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdq2dwgd1rnga9bodsdq.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsdq2dwgd1rnga9bodsdq.gif" alt=" " width="450" height="253"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;fn main() {
    // convert and find address
    let x: u32 = 32;
    println!("The Value of x is:{}",x);

    // Convert x to bytes and print each byte
    let bytes = x.to_ne_bytes(); // Covert to native endian bytes order
    for (i, byte) in bytes.iter().enumerate(){
        println!("Byte {} of x: {:08b}", i , byte);

    }

    println!("The address of x is: {:p}" ,&amp;amp;x);
    println!("The address of x is: {:p}", &amp;amp;x as *const u32);
    println!("The address of x is: {:p}", &amp;amp;x as *const _);

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

&lt;/div&gt;



&lt;p&gt;Converting to Bytes and Iteration:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;let bytes = x.to_ne_bytes(); // Convert to native endian bytes order&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The to_ne_bytes method converts the integer &lt;code&gt;x&lt;/code&gt; into an array of bytes in the native endian order of the machine (either little or big endian, depending on the architecture).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;for (i, byte) in bytes.iter().enumerate(){
    println!("Byte {} of x: {:08b}", i , byte);
} 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This loop iterates over the byte array. The enumerate method adds a counter &lt;code&gt;(i),&lt;/code&gt; and for each byte in bytes, it prints the byte's index and its binary representation (:08b formats the byte as an 8-bit binary number).&lt;/p&gt;

&lt;p&gt;Printing Memory Addresses:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;println!("The address of x is: {:p}" ,&amp;amp;x);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This prints the memory address of &lt;code&gt;x.&lt;/code&gt; The &lt;code&gt;:p&lt;/code&gt; formatter is used for pointer types, and &amp;amp;x takes the address of &lt;code&gt;x.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;println!("The address of x is: {:p}", &amp;amp;x as *const u32);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is similar to the previous line but explicitly casts the reference &amp;amp;x to a constant pointer type *const u32.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;println!("The address of x is: {:p}", &amp;amp;x as *const _);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This line also prints the address of &lt;code&gt;x,&lt;/code&gt; but uses type inference (_) for the pointer type. It's essentially saying "treat &lt;code&gt;&amp;amp;x&lt;/code&gt; as a constant pointer to some type, but I don't care to specify what that type is."&lt;/p&gt;

&lt;p&gt;The result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The Value of x is:32
Byte 0 of x: 00100000
Byte 1 of x: 00000000
Byte 2 of x: 00000000
Byte 3 of x: 00000000
The address of x is: 0x16db4e474
The address of x is: 0x16db4e474
The address of x is: 0x16db4e474
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>rust</category>
      <category>learning</category>
    </item>
    <item>
      <title>Journey Beyond the Basics: A Year with Rust and the Quest to Code Confidently</title>
      <dc:creator>Roongroj Phetkheaw</dc:creator>
      <pubDate>Sun, 24 Mar 2024 19:59:57 +0000</pubDate>
      <link>https://dev.to/roongroj/journey-beyond-the-basics-a-year-with-rust-and-the-quest-to-code-confidently-50ko</link>
      <guid>https://dev.to/roongroj/journey-beyond-the-basics-a-year-with-rust-and-the-quest-to-code-confidently-50ko</guid>
      <description></description>
    </item>
  </channel>
</rss>
