Skip to main content
Version: Next

Hello, World

Welcome to Flow blockchain, Let's call a contract on Testnet.

Calling a contract

There exists a HelloWorld Contract on Testnet. Scripts are used to call contracts. For the purposes of this quick start, we are embedding Flow Runner website to run a script against Testnet. For reference Flow Runner website


_10
import HelloWorld from 0x9dca641e9a4b691b
_10
_10
pub 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.

Contract on Testnet

Here is the contract, see the simple Cadence syntax to create a contract.


_12
pub 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
}

You can see how simple it is to call a method on a contract. There are no costs associated with calling contracts. Continue to learn how to create your own custom contracts and deploying with Flow CLI

Check out the Flow CLI