- The contract can be funded in any amount of tez by anyone on the network.
- 1 tez at a time can be withdrawn from the funded contract by anyone on the network.
Prerequisites
- Get a Tezos node endpoint.
- LIGO to create and test the contract.
- Tezos client to originate the contract and to interact with the contract through the CLI.
- Temple wallet to interact with the contract through a web app.
Overview
To get from zero to a deployed contract on Ghostnet, do the following:Fund your developer Tezos account through a faucet.
Install LIGO
See LIGO: Installation.Install and configure the Tezos client
To install the client, see Installing binaries. Once installed, configure the client to the the node:Generate an account
Run:Fund your account with testnet tez
Create the contract
Create a simple fund contract in the PascaLIGO syntax with two entrypoints:Deposit— any account on the network can deposit any amount of tez in the contract.Withdraw— any account on the network can withdraw 1 tez at a time from the contract.
simplefund.ligo:
Test the contract
Before compiling the contract, you can test it using the LIGO CLI. Deposit 10 tez:Compile the contract
Compile the contract and save the compiled code in a.tz file:
Originate the contract
Originate the contract using your account, initiate the contract with 0 tez, and provide the origination fee with--burn-cap:
Originated contracts.
Example:
Interact with the contract using the Tezos client
You can now fund the contract using the Tezos client. Get the contract parameter for the deposit function to pass to the Tezos client. Get the parameter forDeposit:
Get a Temple wallet account with test tez
You need an account in the Temple wallet with some test tez to execute operations on Ghostnet.Install the Temple wallet.
Go to the faucet.
Interact with the contract using the Temple wallet
Navigate to the BCD explorer.
