Creating Your First Simple Solidity Smart Contract with Remix IDE

Learn how to create your first simple Solidity smart contract using the popular Remix IDE. This tutorial covers the most basic contract that’s often introduced in Solidity learning resources. The contract functionality is straightforward: set a number and retrieve it. Even this simple operation consumes gas fees, which we’ll verify in a local EVM test environment. Creating Your First Smart Contract with Remix IDE 1. Access Remix IDE Visit https://remix.ethereum.org/ Ensure the Environment is set to [Remix VM (London)] for local testing. ...

September 19, 2022 · 1 min · 199 words · 0xuki

Solidity SafeMath Library: Secure Arithmetic Operations

Solidity SafeMath Library: Secure Arithmetic Operations 🔒 The SafeMath library provides secure arithmetic operations that prevent overflow and underflow vulnerabilities using assert statements. /** * @title SafeMath * @dev Math operations with safety checks that throw on error */ library SafeMath { /** * @dev Multiplies two numbers, throws on overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; assert(c / a == b); return c; } /** * @dev Integer division of two numbers, truncating the quotient. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Substracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend). */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { assert(b <= a); return a - b; } /** * @dev Adds two numbers, throws on overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; assert(c >= a); return c; } } /** * @title SafeMath32 * @dev SafeMath library implemented for uint32 */ library SafeMath32 { function mul(uint32 a, uint32 b) internal pure returns (uint32) { if (a == 0) { return 0; } uint32 c = a * b; assert(c / a == b); return c; } function div(uint32 a, uint32 b) internal pure returns (uint32) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint32 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint32 a, uint32 b) internal pure returns (uint32) { assert(b <= a); return a - b; } function add(uint32 a, uint32 b) internal pure returns (uint32) { uint32 c = a + b; assert(c >= a); return c; } } /** * @title SafeMath16 * @dev SafeMath library implemented for uint16 */ library SafeMath16 { function mul(uint16 a, uint16 b) internal pure returns (uint16) { if (a == 0) { return 0; } uint16 c = a * b; assert(c / a == b); return c; } function div(uint16 a, uint16 b) internal pure returns (uint16) { // assert(b > 0); // Solidity automatically throws when dividing by 0 uint16 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } function sub(uint16 a, uint16 b) internal pure returns (uint16) { assert(b <= a); return a - b; } function add(uint16 a, uint16 b) internal pure returns (uint16) { uint16 c = a + b; assert(c >= a); return c; } } Usage Best Practices When using this library, it’s recommended to replace increment operators like ++ with SafeMath’s .add(1) method. ...

September 11, 2022 · 3 min · 571 words · 0xuki

Understanding ERC20 Token Standard in Solidity

Understanding ERC20 Token Standard in Solidity The ERC20 standard is a specification for tokens that operate on the Ethereum blockchain. It defines a common set of rules that all Ethereum-based tokens must follow, ensuring compatibility across different platforms and applications. What is ERC20? 🤔 ERC20 is a technical standard used for smart contracts on the Ethereum blockchain that implements a common list of rules for Ethereum tokens. This standard allows developers to create tokens that are compatible with the broader Ethereum ecosystem. ...

September 11, 2022 · 1 min · 116 words · 0xuki

Solidity Data Types: Complete Guide for Smart Contract Development

Solidity Data Types: Complete Guide for Smart Contract Development Solidity is a statically-typed programming language designed for writing smart contracts on the Ethereum blockchain. This means you must specify the data type of every variable when declaring it, which helps the compiler catch errors and ensures your code is both safe and efficient. Understanding data types is fundamental to smart contract development. Let’s explore the most commonly used data types in Solidity: ...

September 3, 2022 · 2 min · 309 words · 0xuki

Computer Virus 101

Virus Types: Evolving Threats in the Digital Landscape Computer viruses have evolved significantly since their inception, becoming increasingly sophisticated in their methods of infection and evasion. Here’s a closer look at some prominent types: 1. Polymorphic Viruses: The Masters of Disguise Polymorphic viruses are designed to evade detection by constantly changing their code. Each time they infect a new system, they encrypt themselves with a different key, making it difficult for traditional antivirus software to recognize them using signature-based detection. This constant mutation makes them a challenging adversary in the cybersecurity realm. ...

August 11, 2022 · 4 min · 660 words · 0xuki

Kali Linux and CHNTPW

Kali Linux and CHNTPW: Resetting Lost Windows Passwords Losing your Windows administrator password can be a major headache, locking you out of your own system. But don’t panic! There’s a powerful solution using Kali Linux and a tool called CHNTPW. This method allows you to reset the password without needing to know the original one. Here’s a detailed breakdown of the process: What you’ll need: A USB drive with at least 1GB of storage A computer with internet access to download Kali Linux The target Windows computer with the lost password Step-by-step guide: ...

July 17, 2022 · 3 min · 507 words · 0xuki

Pharming and Phising

Pharming: A Silent Threat to Online Security While many are aware of phishing attacks, a lesser-known but equally dangerous threat lurks online: pharming. This insidious tactic manipulates internet infrastructure to redirect users to fraudulent websites, even when they type the correct URL. How Pharming Works Pharming exploits vulnerabilities in the Domain Name System (DNS), which acts as the internet’s address book, translating human-readable website names (like [無効な URL を削除しました]) into machine-readable IP addresses. By corrupting this system, attackers can misdirect users to fake websites designed to steal sensitive information. ...

May 26, 2022 · 3 min · 488 words · 0xuki

nmap basics

Nmap is like a superpower for exploring computer networks! It’s a tool that lets you see which “doors” (ports) are open on a computer, like checking if the front door, back door, or garage is open. This is called “port scanning,” and it’s super useful for security professionals to find weaknesses. Here’s a breakdown of some cool Nmap tricks: Speeding things up: -T5: Makes Nmap scan super fast, like a cheetah! But be careful, it can be noisy and get noticed. -T4: A bit slower, but still pretty quick. Like a racehorse! Stealth mode: ...

May 1, 2022 · 2 min · 306 words · 0xuki

pandas Dataredader

What is pandas Datareader It is a library to download data online. Official Documentation Here is a list of data sources. Some require an API key. fred and stooq can obtain data without an API key. Remote Data Access Fred Economic Data Data source provided by the St. Louis Fed. Federal Reserve Economic Data Time Series Graph of Fred NASDAQ Let’s create a time series graph of NASDAQ. Also, let’s display the 200-period moving average SMA200. This can be done in just about 10 lines. ...

September 19, 2021 · 1 min · 195 words · 0xuki

機械学習前処理

前処理 機械学習は前処理が8割と言われます。前処理の手法をまとめました。 欠損値の処理 データの一部数字がblankである場合、該当データを削除、または、代替値で補完します。 どのように欠損値を扱うかがポイントです。 処理としては、fillna,dropnaなどの関数で簡単に対処可能です。 欠損値の確認 df.isnull.sum() 欠損値の対応 平均値で補完 df = df.fillna(df.mean()) 中央値で補完 df = df.fillna(df.mean()) 最煩値で補完 df = df.fillna(df.mode()) 欠損データを削除 dropnaで削除する場合 df = df.dropna() 分類データの処理 アンダーサンプリング 分類を行う際、あるカテゴリのデータのみ件数が多い状況において、 そのカテゴリのデータを削除すること One-Hot-Encoding ダミー変数化 ダミー変数化とは、例えば、企業分類があった場合にそれをカテゴリ毎にゼロイチで表現することです。 分類データ 企業 Amazon Facebook Google One-Hot-Encoding Amazon Facebook Google 1 0 0 0 1 0 0 0 1 Target Encoding 各データをクラス分類してその出現頻度で置き換える方法です。 True/Falseの2値分類であれば、存在確率に置き換わります。 A Class False True False A Class 0.66 0.33 0.66 正規化・標準化 正規化 正規化は最小値を0最大値が1となるようにスケール変換すること。 ただし、外れ値を含む場合は、外れ値を最大値として、0側にデータが偏るため注意が必要。 $ X_{NORM} = \frac{X_i}{X_{max}-X_{min}} $ ...

July 22, 2021 · 1 min · 86 words · 0xuki