|
Siddharth  Khurana Oodles

Siddharth Khurana (Backend-Sr. Lead Development)

Experience:4+ yrs

Siddharth is a highly skilled Software Developer who excels in Solidity, Rust, and Node.js. His expertise in these technologies is primarily focused on building decentralized applications, smart contracts, and server-side solutions. Siddharth has made significant contributions to various projects, including Huma, Smokin Token, HODLToken, Wethio Exchange, and many others. Whether it involves creating secure and reliable smart contracts using Solidity, developing efficient software solutions by leveraging Rust's safety and performance features, or building scalable server applications using Node.js, Siddharth consistently showcases his strong technical acumen and a deep passion for crafting high-quality code. His commitment to delivering robust solutions and his meticulous approach to software development make him an invaluable asset to any project he undertakes.

Siddharth  Khurana Oodles
Siddharth Khurana
(Sr. Lead Development)

Siddharth is a highly skilled Software Developer who excels in Solidity, Rust, and Node.js. His expertise in these technologies is primarily focused on building decentralized applications, smart contracts, and server-side solutions. Siddharth has made significant contributions to various projects, including Huma, Smokin Token, HODLToken, Wethio Exchange, and many others. Whether it involves creating secure and reliable smart contracts using Solidity, developing efficient software solutions by leveraging Rust's safety and performance features, or building scalable server applications using Node.js, Siddharth consistently showcases his strong technical acumen and a deep passion for crafting high-quality code. His commitment to delivering robust solutions and his meticulous approach to software development make him an invaluable asset to any project he undertakes.

LanguageLanguages

DotEnglish

Fluent

DotHindi

Fluent

Skills
Skills

DotEtherscan

80%

DotJavascript

80%

DotAnchor

80%

DotIPFS

80%

DotEthers.js

100%

DotOpenZeppelin

80%

DotTruffle

80%

DotHardhat

80%

DotRust

80%

DotMetaMask

80%

DotWeb3.js

100%

DotNode Js

100%

DotpNFTs

80%

DotBlockchain

100%

DotSolidity

80%

DotGnosis Safe

80%

DotUniswap

80%

DotSolana Web3.js

80%

DotERC-721

60%

DotSmart Contract

100%

DotEthereum

80%

DotChainlink

80%

DotCoinbase API

80%

DotERC-1155

80%

DotSolana

100%

DotPolkadot

80%
ExpWork Experience / Trainings / Internship

Nov 2020-Present

Lead Development

Unit No. 117- 120, Welldone Tech Park, Sector 48, Sohna Road, Gurgaon, India, 122018.


Oodles Technologies

Unit No. 117- 120, Welldone Tech Park, Sector 48, Sohna Road, Gurgaon, India, 122018.

Nov 2020-Present

EducationEducation

2017-2021

Dot

Dronacharya College of Engineering, Gurugram

B.Tech-Computer Science and Engineering

Top Blog Posts
Taxable Token Development on Polygon

In this blog, we will explore the inner workings of a custom ERC-20 token named MyToken. This token not only adheres to the ERC-20 standard but also incorporates a fee mechanism on each transfer. Let's delve into the code and understand how this innovative token is implemented. Also, visit smart contract development services on various blockchains like Ethereum, Solana, and Polygon. 


Smart Contract Essentials


The Solidity smart contract language is at the core of decentralized applications (DApps) on the Ethereum blockchain. In this project, the contract is written in Solidity version ^0.8.20, emphasizing the use of a specific compiler version.


Token Features

 

Fee Mechanism:

 

One of the standout features of MyToken is the incorporation of a fee mechanism on each transfer. This is achieved through the following steps:

 

Fee Variable:

 

The uint16 fee; variable is introduced to store the fee percentage. This can be adjusted by the owner of the contract.

 

Code - uint16 fee;

 

Transfer Function

 

The standard transfer function from ERC-20 is overridden to include the fee calculation. The fee is deducted from the transferred amount, and the remainder is sent to the intended recipient.

 

Code - function transfer(address to, uint256 amount) public virtual override returns (bool) {
    uint256 feeAmount = amount * fee / 100;
    uint256 transferAmount = amount - feeAmount;
    super.transfer(owner(), feeAmount);
    return super.transfer(to, transferAmount);
}

 

Owner Receives Fee 

 

The deducted fee is transferred to the contract owner. This ensures a seamless revenue stream for the owner proportional to the token transfers.

 

Code - super.transfer(owner(), feeAmount);

 

Constructor Initialization:

 

The contract's constructor initializes crucial parameters during deployment:

 

Code - constructor(string memory _name, string memory _symbol, uint16 _fee) 
    ERC20(_name, _symbol) 
    Ownable(msg.sender) {
    fee = _fee;
    _mint(msg.sender, 1000000000 * 10 ** decimals());
}

 

Token Name and Symbol

 

The name and symbol of the token are set, providing a unique identity on the Ethereum blockchain.

 

Code - ERC20(_name, _symbol)

 

Initial Fee and Total Supply

 

The initial fee percentage is set, and an initial supply of 1,000,000,000 tokens is minted and assigned to the contract deployer.

 

Code - fee = _fee;
_mint(msg.sender, 1000000000 * 10 ** decimals());

 

Updating the Fee

 

To maintain flexibility, the contract includes a function to update the fee. The updateFee function can only be called by the owner of the contract and ensures that the fee remains within a reasonable range (less than or equal to 100%).

 

Code - require(_fee <= 100, "Fee should be less than 100");
fee = _fee;


Conclusion


The MyToken smart contract showcases the power and flexibility of Ethereum smart contracts. By adhering to the ERC-20 standard and incorporating a fee mechanism, this token opens up possibilities for various use cases, from incentivizing token holders to supporting sustainable blockchain projects. As you continue your journey into the world of decentralized finance (DeFi), remember that innovation knows no bounds in the realm of smart contracts and blockchain technology.

 

If you're interested in developing ERC-20 token on Ethereum or Polygon, connect with our blockchain developers to get started. 


Complete Code -

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract MyToken is ERC20, Ownable {
   uint16 fee;
   constructor(string memory _name, string memory _symbol, uint16 _fee) 
       ERC20(_name, _symbol) 
       Ownable(msg.sender) {
       fee = _fee;
       _mint(msg.sender, 1000000000 * 10 ** decimals());
   }
   function transfer(address to, uint256 amount) public virtual override returns (bool) {
       uint256 feeAmount = amount * fee / 100;
       uint256 transferAmount = amount - feeAmount;
       super.transfer(owner(), feeAmount);
       return super.transfer(to, transferAmount);
   }
   function updateFee(uint16 _fee) public onlyOwner {
       require(_fee <= 100, "Fee should be less than 100");
       fee = _fee;
   }
}
A Guide to Counter DApp Development on Solana Blockchain

This blog gives a comprehensive guide to smart contract development using Anchor for counter dApp development on the Solana blockchain.

 

About Solana 

 

Solana is a high-performance blockchain known for its remarkable speed and scalability. It uses proof-of-history (PoH) and proof-of-stake (PoS) to process thousands of transactions per second, offering low fees. Solana's native cryptocurrency is SOL. 

 

It has a growing ecosystem that enables dApps (decentralized applications) to thrive. The network focuses on decentralization and interoperability. While it has faced some challenges, Solana remains a promising platform for blockchain innovation.

 

Check It Out: What Makes Solana Blockchain Development Stand Out

 

Writing Smart Contracts on Solana using Anchor 

 

Set Up Environment 

 

Install Rust, Solana CLI, and Anchor CLI for development, for more details refer to https://www.anchor-lang.com/docs/installation.

 

Initialize Project 

 

Use Anchor CLI to create a project with smart contract templates.

 

Define Contract 

 

Write your smart contract logic in Rust within the lib.rs file, specifying state structures and initializing accounts.

 

Compile and Deploy 

 

Use Anchor CLI to compile your code into a Solana program and deploy it to the network.

 

Interact 

 

Users can interact with your contract by sending transactions to its entry points.

 

Testing 

 

Test your contract and use Anchor for upgrades.

 

Suggested Read: Exploring the Potential of Solana Smart Contract Development

 

Creating an Update Counter Smart Contract 

 

About Smart Contract 

 

This is a simple smart contract built using Anchor. This smart contract allows you to initialize a counter account and then increment and decrement it. Only the creator can increment and decrement on the counter account they created and then choose to remove it.

 

Concepts Covered:

  1. PDA - Program Derived Address
  2. Structs
  3. Modify the state of the smart contract
  4. Add Signers for signing the transaction
  5. Error Code
  6. InitSpace for default spacing of account struct
  7. Closing a created PDA and getting the Rent SOL back

 

Dependencies Version 

 

Anchor 0.28.0

 

Solana CLI 1.16.9

 

Project Creation Command

 

anchor init solana-counter

Functions and Functionality

 

First of all, we’ll create an account struct that will store data.

 

#[account]
#[derive(Default, InitSpace)]
pub struct Counter {
    pub owner: Pubkey,
    pub counter: u64,
    pub bump: u8,
}

 

Explanation

 

  1. Owner: To store the owner who created the counter account
  2. Counter: To store the count of a particular counter account
  3. Bump: To store the canonical bump of the account

 

Then we’ll manage this created account as follows:

 

1. Initialize: To initialize the counter account which can store the above details, below is the code to initialize a counter account. 

 

Account 

 

#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(
        init,
        payer = initializer,
        seeds = [
            COUNTER_SEED.as_bytes(),
            initializer.key.as_ref()
        ],
        bump,
        space = 8 + Counter::INIT_SPACE
      )]
    pub counter_account: Account<'info, Counter>,

    #[account(mut)]
    pub initializer: Signer<'info>,

    pub system_program: Program<'info, System>,
}

 

Function 

 

pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        let counter_account = &mut ctx.accounts.counter_account;

        counter_account.owner = ctx.accounts.initializer.key();
        counter_account.counter = 0;
        counter_account.bump = *ctx.bumps.get("counter_account").unwrap();

        Ok(())
}

 

Explanation 

 

  • Counter account: a PDA type account that will be initialized first with the seeds (COUNTER_SEED and initializer account) so that for every initializer there can be a different counter account, we’ll store the owner, set the counter to 0 and the canonical bump.
  • Initializer: a Signer-type account that will pay for the account creation.
  • System Program: a System Program account that will be used to create an account with the System Program.

 

2. Increment Counter: To increment the counter account, below is the code to increment a counter account. 

 

Account

 

#[derive(Accounts)]
pub struct Update<'info> {
    #[account(
        mut,
        seeds = [
            COUNTER_SEED.as_bytes(),
            updater.key.as_ref()
        ],
        bump = counter_account.bump,
      )]
    pub counter_account: Account<'info, Counter>,

    #[account(
        mut,
        constraint = updater.key() == counter_account.owner @ ErrorCode::AccessDenied
    )]
    pub updater: Signer<'info>,
}

 

Function

 

pub fn increment_counter(ctx: Context<Update>) -> Result<()> {
        let counter_account = &mut ctx.accounts.counter_account;

        counter_account.counter += 1;

        Ok(())
}

 

Explanation 

 

  • Counter account: the same PDA account that we created before will be passed so that we can access the data from that account.
  • Updater: a Signer-type account that will pay for the account updation.

 

3. Decrement Counter: To decrement the counter account, below is the code to decrement a counter account.

 

Function 

 

pub fn decrement_counter(ctx: Context<Update>) -> Result<()> {
        let counter_account = &mut ctx.accounts.counter_account;

        require!(counter_account.counter > 0, ErrorCode::InvalidCount);

        counter_account.counter -= 1;

        Ok(())
}

 

Explanation 

 

  • Counter account: the same PDA account that we created before will be passed so that we can access the data from that account.
  • Updater: a Signer-type account that will pay for the account updation.

 

Note: We can use the same Update Account in Increment for decrement as well.

 

4. Remove Counter: To remove the counter account, below is the code to remove a counter account.

 

Account 

 

#[derive(Accounts)]
pub struct Remove<'info> {
    #[account(
        mut,
        seeds = [
            COUNTER_SEED.as_bytes(),
            remover.key.as_ref()
        ],
        bump = counter_account.bump,
        close = remover
      )]
    pub counter_account: Account<'info, Counter>,

    #[account(
        mut,
        constraint = remover.key() == counter_account.owner @ ErrorCode::AccessDenied
    )]
    pub remover: Signer<'info>,
}

 

Function 

 

pub fn remove_counter(_ctx: Context<Remove>) -> Result<()> {
        Ok(())
}

 

Explanation 

  • Counter account: the same PDA account that we created before will be passed so that we can access the data from that account.
  • Remover: a Signer type account, who will get the SOL for the account removal.

 

Steps to Deploy on Localhost

 

“solana config get” - Make sure it shows localhost configuration, if not run the command below.

 

“solana config set –url localhost”

 

After the instance is set to localhost, run the command below.

 

“anchor localnet” - This will start a local validator so that you can deploy and run the smart contract.

 

“anchor build” - This will build the smart contract.

 

“anchor keys list” - Copy the program ID that is returned and paste it in lib.rs and Anchor.toml also check if the cluster is set to “localnet”.

 

“anchor build” - This will build the smart contract again with the updated program ID.

 

“anchor deploy” - This will deploy the smart contract on the localhost.

 

“anchor run test” - This will run the smart contract test cases.

 

Complete codehttps://github.com/siddharth-oodles/solana-counter

 

Explore More: Why Develop DApps on Solana

 

Solana DApp Development with Oodles 

 

Oodles Blockchain offers a wide range of dApp development services for the Solana blockchain. We enable you to develop robust Solana dApps for fintech, non-fungible token marketplaces, gaming, and beyond. Connect with our Solana developers to discuss your project needs.

POAP: Revolutionizing Event Attendance with Blockchain Verification

A blockchain development company can implement a Proof of Attendance Protocol (POAP) to enhance trust and accountability by providing verifiable proof of participation in events or activities on the blockchain. This blog gives a brief on POAP and how it is revolutionizing event attendance tracking through the power of blockchain technology. 

 

Understanding Proof of Attendance Protocol (POAP)

 

POAP, an acronym for Proof of Attendance Protocol, is an innovative blockchain-based system that enables event organizers to issue unique and verifiable digital tokens to attendees. These tokens serve as cryptographic proof of an individual's participation in an event, offering a novel way to acknowledge and reward attendance.

 

Explore More | The Boons of Building on Cardano Blockchain

 

How Does POAP Work

 

POAP leverages the decentralized and immutable nature of blockchain technology to ensure the authenticity and integrity of event attendance records. Here's a simplified breakdown of how the protocol operates:

 

  • Event Creation: The event organizer creates a unique POAP token associated with a specific event. This token will be later distributed to attendees.

 

  • Attendance Verification: At the event, attendees receive a unique code or QR code that they can scan using a dedicated POAP app or website. This process verifies their presence and generates a digital record of their attendance.

 

  • Token Distribution: Once attendance is confirmed, the POAP token is minted and assigned to the participant's digital wallet address. This token represents their attendance at the event and is owned solely by the attendee.

 

  • Ownership and Benefits: Attendees can display their POAP tokens in their digital wallets, proving their participation in the event. Depending on the organizer's preferences, these tokens can unlock various benefits, such as access to exclusive content, discounts, or future event perks.

 

Suggested Read | AI and Blockchain for Technological Advancements in Healthcare

 

Benefits of POAP

 

  • Authenticity and Trust: POAP tokens provide verifiable proof of attendance, eliminating the possibility of false claims or counterfeit tickets. As the data is stored on the blockchain, it cannot be altered or tampered with, ensuring the integrity of attendance records.

 

  • Engaging Attendees: By offering digital tokens as a reward, POAP incentivizes event attendance and fosters a sense of community among participants. Attendees can showcase their tokens, creating a collectible aspect that adds an extra layer of engagement and excitement.

 

  • Seamless Integration: POAP can seamlessly integrate with existing event management systems, making it an accessible solution for event organizers. By leveraging web-based or mobile applications, attendees can easily interact with the protocol, simplifying the attendance verification process.

 

  • Versatility and Customization: The flexibility of POAP allows organizers to customize the tokens and associated benefits according to their event's requirements. This adaptability enables organizers to enhance the attendee experience and tailor rewards to specific demographics or interests.

 

  • Data Privacy: POAP respects the privacy of attendees by not storing personally identifiable information on the blockchain. The protocol only records the fact of attendance, maintaining a balance between transparency and individual privacy.

 

Check It Out | Why Hard Fork a Blockchain

 

Future Implications

 

The potential applications of POAP extend beyond event management. The protocol's underlying technology can be leveraged in various industries to track and verify participation, such as educational certifications, professional development programs, and even voting systems. The transparent and immutable nature of blockchain ensures the credibility and trustworthiness of these records.

 

Have a blockchain-based project in mind? Connect with our blockchain developers

Creating a Staking Smart Contract on Solana using Anchor

This article explores a concise yet comprehensive guide on creating a staking smart contract on Solana utilizing Anchor. Explore the vast potential of Solana blockchain development services by leveraging Anchor's capabilities to build robust staking mechanisms. 

 

What is Solana Blockchain

 

Solana is a high-performance blockchain platform that provides fast, secure, and scalable transactions for decentralized applications (dApps) and marketplaces. Solana uses a unique consensus algorithm called Proof of History (PoH), which allows the network to verify transactions and reach consensus quickly and efficiently.

 

Solana also provides a suite of developer tools, including a web-based wallet, smart contract language, and decentralized exchange (DEX) for developers to build on its platform. Its native cryptocurrency, SOL, is used for transaction fees, staking, and exchange within the Solana ecosystem.

 

Suggested Read | What Makes Solana Blockchain Development Stand Out

 

What is a Smart Contract

 

A smart contract is a self-executing program that automatically enforces the rules and regulations of a contract when certain pre-defined conditions are met. Smart contracts are usually written in programming languages such as Solidity for Ethereum or Rust for Solana and are stored on a blockchain, making them immutable and tamper-proof.

 

Smart contracts are an integral part of decentralized applications (dApps) that operate on blockchain networks. Smart contracts are transparent and secure, and provide a trustless environment for parties to interact with each other.

 

Also, Explore | Top 5 Smart Contract Development Companies

 

What is a Staking Contract

 

A staking contract is a type of smart contract that allows users to earn rewards by staking their tokens or cryptocurrencies in a particular blockchain network. By staking their tokens, users can participate in the consensus process and earn rewards in return.

 

Staking contracts can also include various features such as slashing mechanisms, where a portion of a staker's tokens is taken away as a penalty for malicious behavior or failure to perform network duties. Staking contracts can also implement additional features, such as delegation, slashing, and governance, to improve the staking experience and incentivize participation.

 

Check It Out | An Explainer to Liquidity Staking Solution

 

Installation and Versions Used in Code

 

  1. Rust - 1.69.0
  2. Solana - 1.15.2
  3. Anchor - 0.27.0

 

You can follow the link to install all the dependencies.

 

Also, Discover | Exploring the Potential of Liquid Staking Derivatives (LSD)

 

Code

 

use anchor_lang::prelude::*;
use anchor_spl::token::{self, MintTo, Transfer};
use anchor_spl::token_interface::{Mint, TokenAccount, TokenInterface};
declare_id!("7MHr6ZPGTWZkRk6m52GfEWoMxSV7EoDjYyoXAYf3MBwS");
#[program]
pub mod solana_staking_blog {
    use super::*;
    pub fn initialize(ctx: Context<Initialize>, start_slot: u64, end_slot: u64) -> Result<()> {
        msg!("Instruction: Initialize");
        let pool_info = &mut ctx.accounts.pool_info;
        pool_info.admin = ctx.accounts.admin.key();
        pool_info.start_slot = start_slot;
        pool_info.end_slot = end_slot;
        pool_info.token = ctx.accounts.staking_token.key();
        Ok(())
    }
    pub fn stake(ctx: Context<Stake>, amount: u64) -> Result<()> {
        msg!("Instruction: Stake");
        let user_info = &mut ctx.accounts.user_info;
        let clock = Clock::get()?;
        if user_info.amount > 0 {
            let reward = (clock.slot - user_info.deposit_slot) - user_info.reward_debt;
            let cpi_accounts = MintTo {
                mint: ctx.accounts.staking_token.to_account_info(),
                to: ctx.accounts.user_staking_wallet.to_account_info(),
                authority: ctx.accounts.admin.to_account_info(),
            };
            let cpi_program = ctx.accounts.token_program.to_account_info();
            let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
            token::mint_to(cpi_ctx, reward)?;
        }
        let cpi_accounts = Transfer {
            from: ctx.accounts.user_staking_wallet.to_account_info(),
            to: ctx.accounts.admin_staking_wallet.to_account_info(),
            authority: ctx.accounts.user.to_account_info(),
        };
        let cpi_program = ctx.accounts.token_program.to_account_info();
        let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
        token::transfer(cpi_ctx, amount)?;
        user_info.amount += amount;
        user_info.deposit_slot = clock.slot;
        user_info.reward_debt = 0;
        Ok(())
    }
    pub fn unstake(ctx: Context<Unstake>) -> Result<()> {
        msg!("Instruction: Unstake");
        let user_info = &mut ctx.accounts.user_info;
        let clock = Clock::get()?;
        let reward = (clock.slot - user_info.deposit_slot) - user_info.reward_debt;
        let cpi_accounts = MintTo {
            mint: ctx.accounts.staking_token.to_account_info(),
            to: ctx.accounts.user_staking_wallet.to_account_info(),
            authority: ctx.accounts.admin.to_account_info(),
        };
        let cpi_program = ctx.accounts.token_program.to_account_info();
        let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
        token::mint_to(cpi_ctx, reward)?;
        let cpi_accounts = Transfer {
            from: ctx.accounts.admin_staking_wallet.to_account_info(),
            to: ctx.accounts.user_staking_wallet.to_account_info(),
            authority: ctx.accounts.admin.to_account_info(),
        };
        let cpi_program = ctx.accounts.token_program.to_account_info();
        let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
        token::transfer(cpi_ctx, user_info.amount)?;
        user_info.amount = 0;
        user_info.deposit_slot = 0;
        user_info.reward_debt = 0;
        Ok(())
    }
    pub fn claim_reward(ctx: Context<ClaimReward>) -> Result<()> {
        msg!("Instruction: Claim Reward");
        let user_info = &mut ctx.accounts.user_info;
        let clock = Clock::get()?;
        let reward = (clock.slot - user_info.deposit_slot) - user_info.reward_debt;
        let cpi_accounts = MintTo {
            mint: ctx.accounts.staking_token.to_account_info(),
            to: ctx.accounts.user_staking_wallet.to_account_info(),
            authority: ctx.accounts.admin.to_account_info(),
        };
        let cpi_program = ctx.accounts.token_program.to_account_info();
        let cpi_ctx = CpiContext::new(cpi_program, cpi_accounts);
        token::mint_to(cpi_ctx, reward)?;
        user_info.reward_debt += reward;
        Ok(())
    }
}
#[derive(Accounts)]
pub struct Initialize<'info> {
    #[account(mut)]
    pub admin: Signer<'info>,
    #[account(init, payer = admin, space = 8 + PoolInfo::LEN)]
    pub pool_info: Account<'info, PoolInfo>,
    #[account(mut)]
    pub staking_token: InterfaceAccount<'info, Mint>,
    #[account(mut)]
    pub admin_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
pub struct Stake<'info> {
    #[account(mut)]
    pub user: Signer<'info>,
    /// CHECK:
    #[account(mut)]
    pub admin: AccountInfo<'info>,
    #[account(init, payer = user, space = 8 + UserInfo::LEN)]
    pub user_info: Account<'info, UserInfo>,
    #[account(mut)]
    pub user_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    #[account(mut)]
    pub admin_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    #[account(mut)]
    pub staking_token: InterfaceAccount<'info, Mint>,
    pub token_program: Interface<'info, TokenInterface>,
    pub system_program: Program<'info, System>,
}
#[derive(Accounts)]
pub struct Unstake<'info> {
    /// CHECK:
    #[account(mut)]
    pub user: AccountInfo<'info>,
    /// CHECK:
    #[account(mut)]
    pub admin: AccountInfo<'info>,
    #[account(mut)]
    pub user_info: Account<'info, UserInfo>,
    #[account(mut)]
    pub user_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    #[account(mut)]
    pub admin_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    #[account(mut)]
    pub staking_token: InterfaceAccount<'info, Mint>,
    pub token_program: Interface<'info, TokenInterface>,
}
#[derive(Accounts)]
pub struct ClaimReward<'info> {
    /// CHECK:
    #[account(mut)]
    pub user: AccountInfo<'info>,
    /// CHECK:
    #[account(mut)]
    pub admin: AccountInfo<'info>,
    #[account(mut)]
    pub user_info: Account<'info, UserInfo>,
    #[account(mut)]
    pub user_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    #[account(mut)]
    pub admin_staking_wallet: InterfaceAccount<'info, TokenAccount>,
    #[account(mut)]
    pub staking_token: InterfaceAccount<'info, Mint>,
    pub token_program: Interface<'info, TokenInterface>,
}
#[account]
pub struct PoolInfo {
    pub admin: Pubkey,
    pub start_slot: u64,
    pub end_slot: u64,
    pub token: Pubkey,
}
#[account]
pub struct UserInfo {
    pub amount: u64,
    pub reward_debt: u64,
    pub deposit_slot: u64,
}
impl UserInfo {
    pub const LEN: usize = 8 + 8 + 8;
}
impl PoolInfo {
    pub const LEN: usize = 32 + 8 + 8 + 32;
}

 

You May Also Like | NFT Staking Platform Development Explained

 

Steps to Run the Test Case

 

  1. NPM/Yarn install dependencies ("npm i" or "yarn")
  2. Run "solana-test-validator" in the new terminal
  3. Run "anchor test --skip-local-validator"

 

Output

 

solana-staking-blog

 

   ✔ Initialize

   ✔ Stake

   ✔ Claim Reward

   ✔ Unstake

 

The complete code can be found here.

 

If you want more information about Solana blockchain development or want to get started with a project, connect with our skilled blockchain developers.

Category: Blockchain
Why Build Apps on Cardano Blockchain

Cardano

 

Cardano is a global blockchain initiative as it is the first blockchain to be peer-reviewed and academically developed by a panel of experts in the field.

 

Composed of engineers, academics, and one of the founders of Ethereum, the Cardano team chose to do something different and created an original blockchain from scratch, and together they focused on making sure that Cardano would fulfill its purpose to run a digital platform free of intermediaries. This system is more comprehensive and sustainable than other blockchain platforms.

 

The Cardano blockchain is based on the Shelley consensus algorithm, which is a new consensus algorithm. The platform was designed to be secure, scalable, and easy to use for building and running decentralized applications.

 

What is the Native Crypto used in Cardano Blockchain?

 

Cardano's native cryptocurrency, ADA, is a valuable asset on the Cardano blockchain. You can use ADA on the Cardano blockchain just as you would ETH on the Ethereum blockchain. ADA can be used as both a digital currency and a token. As a token, ADA is the only currency that rewards holders

 

What is the Programming Language used in Cardano Blockchain?

 

Plutus

 

It is a smart contract platform for the Cardano blockchain. The SDK enables developers to build apps that communicate with the Cardano blockchain. Plutus makes it possible for all programming to be done in Haskell using a single library. The Cardano platform makes it easy to create safe apps, acquire new assets, and create smart contracts. Additionally, developers do not have to test their work on a complete Cardano node to make sure it is correct. You can create new Plutus tokens in a minimal environment, create smart contracts, and create scripts.

 

Haskell

 

Haskell is the language of choice for developing applications on Plutus. Cardano uses a programming language to create smart contracts. Haskell is Cardano's first choice when it comes to implementing programming languages.

 

Sample program

 

import Data.Text qualified as T

import Playground.Contract

import Plutus.Contract

import PlutusTx.Prelude

import Prelude qualified as Haskell

 

hello :: Contract () EmptySchema T.Text ()

hello = logInfo @Haskell.String "Hello, oodles"

 

endpoints :: Contract () EmptySchema T.Text ()

endpoints = hello

 

type DemoSchema = Endpoint "demo" ()

mkSchemaDefinitions ''DemoSchema

$(mkKnownCurrencies [])

 

Workings of the Above Program

 

1. Libraries 

 

  • Plutus.Contract for using Plutus core library

  • Data.Text for converting strings to text

  • PlutusTx.Prelude for replacing the Haskell library

  • Playground.Contract for importing the interface to the playground

 

2. Code 

 

  • Function name – hello

  • Contract () EmptySchema T.Text () will tell that nothing is returned

  • logInfo is used to print out data to the console

  • endpoints will create a “hello” function to run the code

 

3. Output 

 

  • Hello, oodles

 

Exploring Solana Blockchain for Smart Contract Development

In this blog, we explore the disruptive potential of Solana, a cutting-edge blockchain network driving the future of decentralized applications (dApps). We explain unique features that set Solana blockchain development apart, highlighting its ongoing evolution and continual enhancement of capabilities.

 

What is Solana

 

Solana is a cutting-edge blockchain project that is using several groundbreaking technologies to power the next generation of decentralized applications. The project aims to provide a platform that is scalable, secure, and decentralized, which can support a large number of nodes without sacrificing throughput. It was founded in 2017 during the ICO boom and has raised over $25 million in various private and public sale rounds. The platform went live on mainnet in March 2020, but it is still in beta mode.

 

Suggested Read | Why Develop DApps on Solana

 

What Makes Solana Stand Out 

 

When it comes to decentralized applications, speed is key. The Ethereum network is experiencing some congestion issues. Solana's high throughput architecture avoids some of the problems that other blockchain platforms face. Solana claims that its blockchain can handle more than 50,000 transactions per second at peak load, which would make it arguably the fastest blockchain currently in operation. To put this in perspective, this is almost 1,000x faster than Bitcoin (max throughput ~5-7 TPS) and more than 3,000x faster than Ethereum (max throughput ~15 TPS).

 

Check It Out | Exploring the Potential of Solana Smart Contract Development

 

What Consensus Algorithm is used by Solana

 

Solana uses a Proof-of-History (PoH) algorithm instead of the more commonly used Proof-of-Work (PoW) algorithm. This method is used to ensure that the system is running smoothly and that transactions are being recorded correctly. With PoH, you can create historical records that prove that an event occurred at a specific moment in time. The algorithm is a high-frequency verification delay function. This function requires a specific number of steps to be executed for it to be fully evaluated. Events or transactions that will be evaluated will have a unique hash and a count that can be publicly verified. The count allows us to track the chronological order of each transaction or event, providing a timestamp for each. Within every node on the network, there is a clock that keeps track of the network's time.

 

Also, Discover | Top 5 Compelling Solana Blockchain Use Cases

 

Ethereum Vs Solana

 

Ethereum uses the same technology as Bitcoin. PoW is a security measure that is secured by hundreds of miners. PoH relies on a certain number of sequential computational steps that determine the time gap between two events and give the transactions a time stamp. How do you think people can best live together in a society? Crypto investors are very impressed with Solana's quick transaction times. Ethereum can process 30 transactions per second, while Solana can process 65,000 transactions per second. The block time of Ethereum is 15 seconds, while that of Solana is just one second. I'm not sure what you're asking. 

 

Operating costs

 

Since many of us hate paying transaction costs, this is important. Solana is known for its low transaction costs. Ethereum calculates significantly more transaction costs compared to Solana. I love it! It looks great on you. What do you think of my new hairstyle? Ethereum has a large community of developers, but Solana does not always track who its developers are. This sentence is not a sentence.

Both Ethereum and Solana are good recommendations from everyone. If you are planning to include cryptocurrencies in your portfolio, evaluate the above points.

Also, if you are interested in blockchain or cryptocurrency-related project development, connect with Solana blockchain developers

Understanding Governance and DAO

Understanding Governance and DAO

 

DAO is short for a decentralized autonomous organization which is an organization that runs on a blockchain, has a set of rules like working in smart contracts.

 

An important point to note here is that DAO’s are trustless, which means that there is no one controlling which eliminates the need for supervision, it has governance to which everyone has access, instead of some special users.

 

The difference between a trustful and trustless organization is that you trust the systems and they are sole decision-makers, but the opposite is the case in a trustless organization, where you can be a decision-maker if you have the required criteria to be one.

 

To be a member of DAO you need to first join them by purchasing the required cryptocurrency required by the platform, COMP for Compound and UNI for Uniswap.

 

By being a member of DAO you can contribute to the well-being of the platform by creating proposals, voting for decisions to impose, something that needs to be changed, or needs updations for some ongoing things, etc.

 

The vote weightage is dependent on the number of tokens you are holding, you cannot just buy tokens and vote on an ongoing proposal, you must be a prior holder of the token.

 

Now let's discuss the contract part for the Governance

 

Required contracts are -
1. GovernanceToken – a token that is required by the user to be a member of DAO
2. A contract that needs to be governed
3. GovernorContract – having functions like createProposal, execute, etc.
4. TimelockContract – having functions to keep track of the time required for the proposals

 

To understand the process we can take the help of Compound Governance

 

Following are the steps for Successful Proposal -

 

Proposal Created (Reviewing) -> Voting Active (Active) -> Voting Ends (Succeeded) -> Timelock (Queued) -> Executed 

 

Following are the steps for Failed Proposal -

 

Proposal Created (Reviewing) -> Voting Active (Active) -> Voting Ends (Defeated) -> Canceled

 

To write these contracts from scratch is a very difficult task, Openzeppelin has support for the Governance and has really good support.

 

Link for the contracts by Openzeppelin - https://docs.openzeppelin.com/contracts/4.x/governance

 

Understanding NFT_NonFungible Token_ and their Technical Aspects

Non Fungible Token (NFT) Non-fungible tokens are unique in nature, they own their specific value, and the thing that makes them unique is the property of being non-exchangeable with other assets of the same value.

 

A nonfungible token, or NFT, is a data unit recorded on a digital ledger known as a blockchain that verifies that a digital asset is unique and therefore not interchangeable. Photos, movies, audio, and other forms of digital information may all be represented using NFTs. The buyer of the NFT, on the other hand, has access to any duplicate of the original file. While anybody may get copies of these digital things, NFTs are recorded on blockchains to give the owner proof of ownership that is distinct from copyright.

 

Single owner owns NFTs, so they can neither be shared in-fractions nor be transferred in parts. NFTs were developed to allow genuine owners of digital artwork or codes to transfer ownership benefits to them as long as they remain in use after being purchased from the NFT shop.

 

Oodles Technologies is a perfect place that can help you simplify the challenges that you may face while integrating the non-fungible tokens, business solutions, and applications into your IT infrastructure.

 

How Does an NFT Work?

 

NFTs exist on a blockchain, which is a distributed public ledger that records transactions. You’re probably most familiar with blockchain as the underlying process that makes cryptocurrencies possible.

 

NFTs are most often kept on the Ethereum blockchain, although they can also be stored on other blockchains.

 

An NFT is created, or “minted” from digital objects that represent both tangible and intangible items, including:

  • Art

  • GIFs

  • Videos

  • Collectibles

  • Video game avatars

  • Music and artists

 

What Are NFTs Used For?

 

NFTs are definitely having a moment, with creators of NFT art including artists, gamers, and brands across the world of innovative creators. In fact, it appears like a new participant enters the NFT market every day.

 

The blockchain ledger can verify an NFT's unique identification and ownership. Ownership of the NFT is often associated with a license to use the underlying digital asset, but generally does not confer the copyright to the buyer: some agreements only grant a license for personal, non-commercial use, while other licenses also allow commercial use of the underlying digital asset.

 

How to Buy NFTs?

 

First, you’ll need to create a digital wallet that allows you to save your bought NFTs and cryptocurrencies like MetaMask or any other wallets. You’ll likely need to purchase some cryptocurrency, like ETH, depending on what currencies your NFT provider accepts, mostly ETH works. You can buy crypto using a credit card on platforms like WazirX, Coinbase, Kraken, eToro. You’ll then be able to move it from exchange to your wallet of choice.

 

You’ll want to keep fees in mind. When you acquire bitcoin, most exchanges charge at least a portion of your transaction.

 

Popular NFT Marketplaces

 

Once you’ve got your wallet set up and funded with balance, there’s no shortage of NFT sites to shop. Currently, the largest NFT marketplaces are:

 

  • OpenSea.io: OpenSea.io is the first and largest digital marketplace for crypto collectibles and nonfungible tokens (NFTs) in the world.

  • Foundation: Artists must earn "upvotes" or an invitation from fellow creators to put their work on the foundation. Because of the community's exclusivity and the high cost of entry (artists must additionally buy "gas" to mint NFTs), it may have higher-quality artwork. It may also mean higher prices not necessarily a bad thing for artists and collectors seeking to capitalize, assuming the demand for NFTs remains at the same as of now, or even increases over time.

Banner

Don't just hire talent,
But build your dream team

Our experience in providing the best talents in accordance with diverse industry demands sets us apart from the rest. Hire a dedicated team of experts to build & scale your project, achieve delivery excellence, and maximize your returns. Rest assured, we will help you start and launch your project, your way – with full trust and transparency!