Anatomy of a Smart Contract | IOTA Wiki (2024)

Smart contracts are programs that are immutably stored in the chain.

Through VM abstraction, the ISC virtual machine is agnostic about the interpreter used to execute each smart contract.It can support different VM types (i.e., interpreters) simultaneously on the same chain.For example, it is possible to have Wasm and EVM/Solidity smartcontracts coexisting on the same chain.

Anatomy of a Smart Contract | IOTA Wiki (1)

The ISC core contracts and WASM contracts on the chain are identified by a hname (pronounced"aitch-name"), which is a uint32 value calculated as a hash of the smart contract's instance name (a string).For example, the hname of the root core contractis 0xcebf5908. This value uniquely identifies this contract in every chain. This does not apply to EVM contracts.

State

The smart contract state is the data owned by the smart contract and stored on the chain.The state is a collection of key/value pairs.Each key and value are byte arrays of arbitrary size (there are practical limits set by the underlying database, ofcourse).You can think of the smart contract state as a partition of the chain's data state, which can only be written by thesmart contract program itself.

The smart contract also owns an account on the chain, stored as part of the chain state.The smart contract account represents the balances of base tokens, native tokens, and NFTs controlled by the smartcontract.

The smart contract program can access its state and account through an interface layer called the SandboxA controlled environment where programs can be tested safely..Only the smart contract program can change its data state and spend from itsaccount. Tokens can be sent to the smart contract account by any other agent onthe ledger, be it a wallet with an address or another smart contract.

See Accounts for more information on sending and receivingtokens.

Entry Points

Each smart contract has a program with a collection of entry points.An entry point is a function through which you can invoke the program.

There are two types of entry points:

  • Full entry points (or simply entry points): These functions can modify(mutate) the smart contract's state.
  • View entry points (or views): These are read-only functions. They are only usedto retrieve the information from the smart contract state. They cannotmodify the state, i.e., they are read-only calls.

After a request to a Smart Contract is executed (a call to a full entry point), a receipt will be added tothe blocklog core contract. The receipt details theexecution resultsof said request: whether it was successful, the block it was included in, and other information.Any events dispatched by the smart contract in context of this execution will also be added to the receipt.

Error Handling

Smart contract calls can fail: for example, if they are interrupted for any reason (e.g., an exception) or if itproduces an error (missing parameter or other inconsistency).Any gas spent will be charged to the sender, and the error message or value is stored in the receipt.

Anatomy of a Smart Contract | IOTA Wiki (2024)
Top Articles
7 Fastest Ways to Gain Karma on Reddit
If I lie to my insurance, have I committed insurance fraud?
Automated refuse, recycling for most residences; schedule announced | Lehigh Valley Press
Lengua With A Tilde Crossword
Places 5 Hours Away From Me
Craigslist Benton Harbor Michigan
What's New on Hulu in October 2023
State Of Illinois Comptroller Salary Database
Red Heeler Dog Breed Info, Pictures, Facts, Puppy Price & FAQs
Taylor Swift Seating Chart Nashville
Huge Boobs Images
iOS 18 Hadir, Tapi Mana Fitur AI Apple?
boohoo group plc Stock (BOO) - Quote London S.E.- MarketScreener
Mals Crazy Crab
Yakimacraigslist
The best TV and film to watch this week - A Very Royal Scandal to Tulsa King
Carson Municipal Code
No Hard Feelings - Stream: Jetzt Film online anschauen
Strange World Showtimes Near Roxy Stadium 14
Craigslist Southern Oregon Coast
Costco Great Oaks Gas Price
Gayla Glenn Harris County Texas Update
Project, Time & Expense Tracking Software for Business
Gina Wilson All Things Algebra Unit 2 Homework 8
U Of Arizona Phonebook
Shreveport City Warrants Lookup
Cookie Clicker Advanced Method Unblocked
When Does Subway Open And Close
Obituaries Milwaukee Journal Sentinel
Kirsten Hatfield Crime Junkie
Dmv In Anoka
Watson 853 White Oval
Wolfwalkers 123Movies
Uncovering the Enigmatic Trish Stratus: From Net Worth to Personal Life
Japanese Emoticons Stars
Emuaid Max First Aid Ointment 2 Ounce Fake Review Analysis
Courtney Roberson Rob Dyrdek
Chadrad Swap Shop
2487872771
Back to the Future Part III | Rotten Tomatoes
Arcadia Lesson Plan | Day 4: Crossword Puzzle | GradeSaver
Section 212 at MetLife Stadium
Callie Gullickson Eye Patches
Sdn Fertitta 2024
3 Zodiac Signs Whose Wishes Come True After The Pisces Moon On September 16
bot .com Project by super soph
Bellelement.com Review: Real Store or A Scam? Read This
The Quiet Girl Showtimes Near Landmark Plaza Frontenac
Call2Recycle Sites At The Home Depot
Game Akin To Bingo Nyt
Craigslist Cars And Trucks For Sale By Owner Indianapolis
Latest Posts
Article information

Author: Nicola Considine CPA

Last Updated:

Views: 5792

Rating: 4.9 / 5 (49 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Nicola Considine CPA

Birthday: 1993-02-26

Address: 3809 Clinton Inlet, East Aleisha, UT 46318-2392

Phone: +2681424145499

Job: Government Technician

Hobby: Calligraphy, Lego building, Worldbuilding, Shooting, Bird watching, Shopping, Cooking

Introduction: My name is Nicola Considine CPA, I am a determined, witty, powerful, brainy, open, smiling, proud person who loves writing and wants to share my knowledge and understanding with you.