Skip to content

Latest commit

 

History

History
102 lines (77 loc) · 3.22 KB

File metadata and controls

102 lines (77 loc) · 3.22 KB

Hedera Developer Foundation

Code examples used in the Hedera Developer Foundation course. Covers core Hedera services including accounts, tokens, consensus, file storage, and smart contracts.

Prerequisites

Setup

git clone https://github.com/pathornteng/hedera-developer-foundation.git
cd hedera-developer-foundation
npm install

Copy .env_sample to .env and fill in your credentials:

cp .env_sample .env
MY_ACCOUNT_ID=0.0.xxxxx
MY_PRIVATE_KEY=your-private-key
SECOND_ACCOUNT_ID=0.0.xxxxx
SECOND_PRIVATE_KEY=your-second-private-key

Examples

Account

Script Description
account/create-account.js Create a new Hedera account
account/create-account-mnemonic.js Create an account from a mnemonic
account/get-account.js Fetch account info
account/get-account-balance.js Check HBAR balance
account/transfer-hbar.js Transfer HBAR between accounts
account/allowance.js Set and use HBAR allowances
account/update-account.js Update account properties
account/evm-account.js Create an EVM-compatible account
account/account-address-conversion.js Convert between Hedera and EVM addresses

Basic Transactions

Script Description
basic/transaction.js Submit a basic transaction
basic/manual-sign.js Manually sign a transaction
basic/multisig-transaction.js Multi-signature transaction
basic/scheduled-transaction.js Schedule a future transaction
basic/key.js Key generation and management
basic/client.js Configure the Hedera client

Token Service (HTS)

Script Description
token-service/fungible-token.js Create a fungible token
token-service/fungible-token-fixed-fee.js Fungible token with custom fixed fee
token-service/nft.js Create and mint an NFT
token-service/nft-custom-fee.js NFT with custom royalty fee
token-service/associate-token.js Associate a token to an account
token-service/transact-fungible-token.js Transfer fungible tokens
token-service/transact-nft.js Transfer an NFT
token-service/update-token.js Update token properties

Consensus Service (HCS)

Script Description
consensus-service/submit-message.js Submit a message to a topic
consensus-service/query-messages.js Query messages from a topic

File Service

Script Description
file-service/file-service.js Create, read, and update files on Hedera

Smart Contract Service

Script Description
smart-contract-service/smart-contract.js Deploy and call a smart contract
smart-contract-service/simple-storage.js Simple storage contract example
smart-contract-service/create-nft-solidity/nft.js Deploy an NFT contract via Solidity
smart-contract-service/truffle-example/ Truffle-based contract examples

Run any script directly with Node:

node account/create-account.js
node token-service/fungible-token.js

License

MIT