LoginSignup
4
2

More than 3 years have passed since last update.

Remixでbyte32型の引数に値を設定する

Posted at

記事の内容

Remixでbyte32型の引数に値を設定する方法です。
考えてみれば当たり前の内容ですが、地味に解決に時間を要してしまったのでメモ

失敗例

実装はこんな感じのコントラクトを呼び出そうとしています。

function reveal(bytes32 _seed) public payable returns(uint){

uintだと普通に「100」とか設定して通りますが、byte32で「"0x64"」だと以下のエラーが出力されます。

transact to Randomness.reveal errored: Error encoding arguments: Error: invalid bytes32 value (arg="", coderType="bytes32", value="0x64", version=4.0.44) 

解決策

考えてみれば当たり前な内容ですが、以下の設定方法で解決

"0x0000000000000000000000000000000000000000000000000000000000000064"
4
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2