March 13, 2026

Capitalizations Index – B ∞/21M

安全なスマートコントラクトを書くに最低限気をつける4つの点 – Kyuzan Engineering & Blockchain (JAPAN / 日本) – Medium

Crypto New Media
安全なスマートコントラクトを書くに最低限気をつける4つの点 – Kyuzan Engineering & Blockchain (JAPAN / 日本) – Medium

Crypto New Media Press

Go to the profile of tomohiro koana

Photo by mike dennler on Unsplash 暗号通貨に対するハッキングは近年増加しつつあることが知られています。 本記事では安全なスマートコントラクトを書くにあたり、4 つの主要な攻撃方法とその対策をコードサンプルとともに紹介します。 1. オーバーフロー オーバーフローとは与えられたビット数で表現できる数の範囲を超えてしまった場合に起こる現象のことを指します。たとえば、Solidity の符号なし整数 (uint) は 256 bit の非負整数であり、0 以上 2²⁵⁶ −1 以下の整数のみ表します。この場合、0 − 1 の結果は −1 ではなく 2²⁵⁶ −1 となってしまいます。 mapping (address => uint) balance // 残高 function withdraw(uint amount) {balance[msg.sender] -= amountmsg.sender.transfer(amount)} 上の例ではbalance[msg.sender]が 0 の状態で withdraw(1)を呼ぶと残高 balance[msg.sender]が 2²⁵⁶ − 1 なってしまいます。このような意図しない計算結果は、金銭的な取引を扱うことの多いスマートコントラクトでは致命的な損害につながる可能性があります。そのため、四則演算を扱う場合は OpenZepplin が公開している SafeMath を使用しましょう。a — b […]

The post 安全なスマートコントラクトを書くに最低限気をつける4つの点 – Kyuzan Engineering & Blockchain (JAPAN / 日本) – Medium appeared first on Crypto New Media.

安全なスマートコントラクトを書くに最低限気をつける4つの点 – kyuzan engineering & blockchain (japan / 日本) – medium

Previous Article

Ripple Price Analysis: XRP Resumes Uptrend, $0.4000 Next?

Next Article

Hong Kong Plans to Tighten Regulations on Crypto Industry

You might be interested in …

WandX ERC20 exchange finally launches protocol release 1.0

CryptoNinjas WandX ERC20 exchange finally launches protocol release 1.0 WandX this past week made significant news towards the full launch of its unique decentralized exchange. WandX was established as a platform that seeks to provide […]

A new platform introduces automated crypto trading

A New Platform Introduces Automated Crypto Trading

A New Platform Introduces Automated Crypto Trading Investing in cryptocurrency takes time, effort and one mistake can cost you a lot. Kryll.io, a new product, is aiming to become a game changer. The platform, starting […]