Build decentralized applications using Solidity and the most ubiquitous EVM tooling, libraries, and environments.
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.
Manage a bidding process and exchange assets transparently without a centralized authority.
Smart contracts are a key building block to enable trustless transactions across multiple blockchain and public ledger networks.
Decentralized Finance is a collective effort to recreate traditional financial systems in a decentralized manner; earn interest, borrow loans, manage derivatives, and more.
Supply smart contracts with off-ledger, real world data for use in applications across gaming, retail, and manufacturing.
Hedera SDKs, open-source examples, and tutorials make decentralized apps ready for your stack.
Function
//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 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
const transaction = new ContractExecuteTransaction()
.setContractId(newContractId)
.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
//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);
//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);
Use the world’s most popular smart contract language to take advantage of community-driven standards, development tools, frameworks, and support.
The efficiency of hashgraph means your users aren't paying outrageous gas fees. Smart contracts on Hedera run at a lower cost relative to blockchain alternatives, with fixed fees.
Deliver a modern user experience with transactions settling in seconds with finality instead of waiting for slow block confirmations.
All contracts deployed on Hedera are environmentally sustainable and offset by Hedera’s carbon negative initiative.
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.
Here is natively resistant to MEV behavior in decentralized finance applications due to its unique consensus mechanism and fixed-fee economics.
Richard Bair, VP of Software Engineering Danno Ferrin, Principal Software Engineer
Explore other Hedera network services to enable fast payments, tokenization, and immutable data records.
Create your own token or NFT
Mint and manage fungible and non-fungible tokens on Hedera for application payments, governance, or digital collectibles.
Build directly on hashgraph
Record immutable, verifiable, and fairly ordered event data for any application or permissioned blockchain framework.
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?