Remix IDE
This page compiles a contract in Remix and deploys it to SupraEVM on Devnet through StarKey. Before starting:
- add Devnet to StarKey, as described in Adding Devnet;
- fund the account’s EVM address, as described in Funding an account.
Create a contract
In Remix, open the File Explorer, create a file named SimpleStorage.sol, and paste:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract SimpleStorage {
uint256 public storedData;
function set(uint256 x) public {
storedData = x;
}
function get() public view returns (uint256) {
return storedData;
}
}storedData holds one number, set replaces it, and get returns it.
Compile for Osaka
Open the Solidity Compiler tab and choose a compiler version that offers osaka as
its EVM version, such as 0.8.34. Under Advanced Configurations, set EVM Version to
osaka, then click Compile SimpleStorage.sol.
Remix’s default EVM version follows the compiler version. Bytecode compiled for a later version than Osaka can contain an opcode the chain does not define; see EVM version.
Connect StarKey
In StarKey, switch the network to Supra Devnet (EVM), the name you gave Devnet when you added it.
Open the Deploy & Run Transactions tab. Under Environment, choose Injected Provider – StarKey. If StarKey is not listed, click Customize this list and enable it. Approve the connection in StarKey.
Remix shows the connected account and the chain ID 535600. Another chain ID means StarKey is on a
different network.
Deploy
With SimpleStorage selected under Contract, click Deploy, and confirm the transaction in
StarKey.
StarKey sets the fee. A fee below the gas price floor is refused at submission, after the transaction has been confirmed in the wallet.
Call the contract
The deployed contract appears under Deployed Contracts. Enter a number next to set and click
it to send a transaction; click get to read the value, which sends no transaction.
Find the transactions on the explorer
Paste the transaction hash or the contract’s address into the
Devnet explorer to see the deployment and each set transaction,
with the gas each used.