Ethereum: Getting different binary for the same Solidity source code compiling with solc and Remix – The Kidney Care Society COVID-19 Checklist

Know your kidney function

Check eGFR

Check Your EGFR ×

All fields are mandatory.

Ethereum: Getting different binary for the same Solidity source code compiling with solc and Remix

Ethereum: Debugging Binary Differences Between Local and Remix

As a solidity development, In this article,

The Issue: Different Binary Formats

(Solidity Compiler) Locally, it produces a binary file with a specific format that’s compatible only with the local machine’s architecture. However

The Problem: Solc Compiler Version

A potential cause of these binary differentences is a mismatch between the version of the solc compiler being used locally versus what remix is ​​used. The SOLC Compiler version might not be compatible with your local setup, leading to different binary outputs when compiling and deploying on both platforms.

Testing with remix

. We’ll create a new contract and deploy it using remix,

Here’s an updated version of your code:

`Solidity

Pragma Solidity 0.8.20;

Helloworld contract {

Function Test () Public Pure Returns (Bool) {}

}

// Deployment with remix

Main Function () Public Payable {

Helloworld Memory Hello = Hello ();

Require (hello.test () == true, "hello");

}

Deployment to Remix

We Solana compiler used.

Testing with Solc Compiler Version

Now, let’s test this scenario by comparing the binary output produced locally versus when we use remix.

Local Compilation

`Bash

cd ~/truffle

-V SOLIDITY -0.8.20.JS -BIN HELLOWORLED.JS

`

Remix Deployment (with Solana)

Ethereum: Getting different binary for the same Solidity source code compiling with solc and Remix

Solana blockchain and interact with it to test our deployment.

`JavaScript

Const {Web3} = Require ('Web3');

Const Web3 = New Web3 ();

Async Function Main () {

Const Networkname = 'Mainnet';

Const accountdress = '0x ...'; // replace with your own solana address

try {

Const transactioncount = Await web3.eth.gettransactioncount (accountdress);

Const tx = Await Web3.eth.sendtransaction ({

From: Accountdrys,

to: '0x ...', // replace with the Recipient's Address

Value: web3.utils.towei ('1', 'ether'),

Gas: 200000,

Gassrice: 20,

});

console.log (tx);

} Catch (Error) {

Console.Error (Error);

}

}

Slender ();

Compare Binary Outputs

We can compare the binary output produced locally and when

Comparison Output

When we run the code in local Let’s take a look at the potential differences:

`Bash

$ Objdump -h Helloworld_0x12345678.bin

File Format bin

`

We’ll compare the output of objdump for both scenarios.

In this example, the `helloworld_0x12345678. Binary produced locally has a different structure and layout compared to what’s deployed with remix. This difference might be caused by the solana compiler used in remix versus the solc compiler being used locally.

Ethereum Bitcoind Incorrect Authorization Failed

Leave a comment

Your email address will not be published. Required fields are marked *