Hh Smart Contract Hero
Hh Smart Contract Hero

Hedera Smart Contract Service

NOW ON MAINNET

Build decentralized applications and protocols that scale with Solidity smart contracts on Hedera.

Join the testnet View docs
Run Solidity
Start from the ground-up — or port over existing Solidity code in minutes. The Hedera Smart Contract service is EVM compatible to run Solidity, unchanged, on the Hedera network.
Efficient consensus
Smart contracts on Hedera are optimized for hashgraph. With hashgraph efficiency, your contracts run fast with finality in seconds, carbon-negative energy use, and always predictable gas fees.
Hedera ready
Use Hedera Token Service or hbars in your contract to power logic such as exchanging assets or recording governance votes without an intermediary.

What can you build with smart contracts?

Smart contracts offer autonomous, self-executing logic to create an entirely new class of applications. By trusting code, instead of centralized entities, we can increase transparency and efficiency across industries.

Real time settelment
AUCTIONS

Manage a bidding process and exchange assets transparently without a centralized authority.

Vision gradient 1
Bridges

Smart contracts are a key building block to enable trustless transactions across multiple blockchain and public ledger networks.

Payments gradient 1
DEFI

Decentralized Finance is a collective effort to recreate traditional financial systems in a decentralized manner; earn interest, borrow loans, manage derivatives, and more.

Cloud computing gradient
Oracles

Supply smart contracts with off-ledger, real world data for use in applications across gaming, retail, and manufacturing.

Code Snippet Background

Ready for every developer

Hedera SDKs, open-source examples, and tutorials make decentralized apps ready for your stack.

Function

Create contract
  • Create contract
  • Call contract
  • Query contract

//Create the transaction

const transaction = new ContractCreateTransaction()

.setGas(100_000_000)

.setBytecodeFileId(bytecodeFileId)

.setAdminKey(adminKey);

//Modify the default max transaction fee (default: 1 hbar)

const modifyTransactionFee = transaction.setMaxTransactionFee(new Hbar(16));

//Sign the transaction with the client operator key and submit to a Hedera network

const txResponse = await modifyTransactionFee.execute(client);

//Get the receipt of the transaction

const receipt = await txResponse.getReceipt(client);

//Get the new contract ID

const newContractId = receipt.contractId;

console.log("The new contract ID is " +newContractId);

//Create the transaction

const transaction = new ContractExecuteTransaction()

.setContractId(newContractId)

.setGas(100_000_000)

.setFunction("set_message", new ContractFunctionParameters()

.addString("hello from hedera again!"))

//Sign with the client operator private key to pay for the transaction and submit the query to a Hedera network

const txResponse = await transaction.execute(client);

//Request the receipt of the transaction

const receipt = await txResponse.getReceipt(client);

//Get the transaction consensus status

const transactionStatus = receipt.status;

console.log("The transaction consensus status is " +transactionStatus);

//v2.0.0

//Contract call query

const query = new ContractCallQuery()

.setContractId(contractId)

.setGas(600)

.setFunction("greet");

//Sign with the client operator private key to pay for the query and submit the query to a Hedera network

const contractCallResult = await query.execute(client);

// Get the function value

const message = contractCallResult.getString(0);

console.log("contract message: " + message);

Why smart contracts on Hedera?

Solidity community

Use the world’s most popular smart contract language to take advantage of community-driven standards, development tools, frameworks, and support.

Low fees

The efficiency of hashgraph means your users aren't paying outrageous gas fees. Smart contracts on Hedera run at a lower cost with less volatility than blockchain alternatives.

Fast transactions

Deliver a modern user experience with transactions settling in seconds with finality instead of waiting for slow block confirmations.

Carbon negative

All contracts deployed on Hedera are environmentally sustainable and offset by Hedera’s carbon negative initiative.

Fair ordering

Smart contracts are always processed in the order they are received, not based on how much gas you’re willing to pay or at the choice of a miner.

Optionally upgradeable

Deploy an immutable contract or, transparently and optionally, include admin keys to modify bug fixes, resolve disputes, or support upgrades.

Red Swan BG Desktop

Dive deep into the new Hedera Smart Contract Service 2.0 in the virtual meetup that covers EVM upgrades, database architecture modifications, and support for Hedera Token Service.

Richard Bair, VP of Software Engineering
Danno Ferrin, Principal Software Engineer

A network for decentralized applications

Explore other Hedera network services to enable fast payments, tokenization, and immutable data records.

Token Service

Create your own token or NFT

Mint and manage fungible and non-fungible tokens on Hedera for application payments, governance, or digital collectibles.

Consensus Service

Build directly on hashgraph

Record immutable, verifiable, and fairly ordered event data for any application or permissioned blockchain framework.

HBAR

Hedera's cryptocurrency

Use hbars, the Hedera network's native cryptocurrency, in smart contracts for collateral, staking, and other use cases.

Ready to start building?

Join a testnet or view the docs