Hello, World
Welcome to Flow blockchain, Let's call a contract on Testnet blockchain. Testnet is a public blockchain, you can call contracts without any cost. The Flow blockchain is decentralized data store that allows for custom executable code known as contracts to be deployed and called. Contracts are flexible and live on the Flow blockchain forever.
Calling a contract
On Testnet, HelloWorld
Contract has a public variable named greeting
, we'll use a Script to get it's value. For the purposes of this quick start, we are embedding Flow Runner website to run a script against Testnet. For reference Flow Runner website
_10import HelloWorld from 0x9dca641e9a4b691b_10_10pub fun main(): String {_10 return HelloWorld.greeting_10}
Copy
the script above into Flow Runner and click "Execute Script" Then scroll down to see the output.
Ignore the red underline
of HelloWorld. Fixing this will be in future learnings.
Contract on Testnet
Here is the HelloWorld
contract, Continue to other getting started examples to learn how to call changeGreeting
to change the greeting value.
_12pub contract HelloWorld {_12_12 pub var greeting: String_12_12 pub fun changeGreeting(newGreeting: String) {_12 self.greeting = newGreeting_12 }_12_12 init() {_12 self.greeting = "Hello, World!"_12 }_12}
There are no costs associated with calling contracts.
Continue to learn to create your own contracts and deploying with Flow CLI