Meter Docs
Learn
  • Welcome to Meter!
  • 中文版文档
  • Overview of Meter
    • Introduction to Meter
    • Hybrid PoV Consensus Mechanism
    • MTR - The Metastable Coin
    • MTRG - Meter Governance Coin
    • On-Chain Auctions
    • The Meter Reserve
    • Meter's Ethereum Emulation Mode
  • Wallet Setup
    • Interacting with Meter Mainnet Using MetaMask
    • Interacting with Meter Mainnet Using Ledger
    • Adding Custom Tokens to MetaMask
    • Getting MTR for Gas
    • Revoking Contract Spend Limits
    • Specifying gas (GWEI) for transactions
    • Speeding Up/ Canceling Transactions
  • Meter Passport V2.0
    • Meter Passport Architecture
    • Salient Features
    • Bridge Fee
    • Programming Meter Passport
    • Tutorials for Using Meter Passport
    • MTRG Crosschain Info
    • Onboarding Passport for Your Project
    • Technical Guideline for Meter Passport
    • Security Audit for Meter Passport V2.0
  • Staking and Validation
    • Staking MTRG
      • How to Stake MTRG
        • Choosing Candidates
        • Factors affecting Staking Rewards
      • How to Stake Incremental MTRG
      • How to Undelegate MTRG
      • How to Unbound MTRG
      • Frequently Asked Questions
    • Running a Full Node on Meter Mainnet
    • Configure the Full Node to Validator Node
    • Meter Incentive Programs to promote decentralization
  • Mining
    • Meter Mining Guide
  • NFT Collections
    • Meter Community NFTs
  • Developer Documentation
    • Meter Developer Incentives
      • Meter Developer Grant Program
      • Meter TVL Incentive Program
      • Meter Gas Monetization Program
      • Meter Co-marketing Program
      • Meter DAPP Referral Program
    • Introduction to Developer Documentation
    • Developing with Remix, Ethers.js and Web3.js
    • Index Data with SubQuery
    • Meter Native TX RESTful APIs
    • Meterify API Documentation
      • meterify.eth
      • meterify.eth.Contract
      • meterify.eth.accounts
      • meterify.utils
      • meterify.module.options
      • Callbacks Promises Events
      • json interface
    • Meterify DApp Tutorials
    • Meterify Code Examples
    • Contributing to Meter and Our Documentation
      • Documentation Guidelines
        • API Documentation Guidelines
        • Tutorial Creation Guidelines
        • Code Example Guidelines
        • Article Writing Guidelines
Powered by GitBook
On this page
  • Setup Test Environment
  • Create Account Example
  • Send Transaction CLI Example
  • Deploy a Contract Example
  • Call a Contract CLI Example
  • Meterify + Simple React Wallet

Was this helpful?

  1. Developer Documentation

Meterify Code Examples

PreviousMeterify DApp TutorialsNextContributing to Meter and Our Documentation

Last updated 2 years ago

Was this helpful?

Setup Test Environment

We already have the example code in Github, which require node.js as the runtime environment. The following commands setup node.js, install meterify package and check out the example code in Github.

Please change the end point in meterifiedWeb3.js to your own node or the official mainnet/testnet end points, which are:

mainnet: https://mainnet.meter.io

Warringstakes tesnet: http://testnet.meter.io

$ sudo apt install npm
$ npm install meterify
$ git clone https://github.com/meterio/hackathon-demo

Create Account Example

$ node createAccount.js

Please be aware the above script creates the private/public key pair on the RPC end point. You should always run your own local node and connect to the local RPC end point for creating account due to security reasons.

Source Files

Send Transaction CLI Example

Run


$ node createAccount.js

$ node sendTransaction.js

Source Files

Deploy a Contract Example

Run


$ node createAccount.js

$ node sendTransaction.js

$ node deployContract.js

Source Files

Call a Contract CLI Example

Run

$ node createAccount.js

$ node sendTransaction.js

$ node deployContract.js

$ node callContract.js

Source Files

Meterify + Simple React Wallet

Install

$ git clone https://github.com/meterio/hackathon-demo-react.git

$ cd hackathon-demo-react.git

$ npm install

Run

$ npm start

createAccount.js
meterifiedWeb3.js
utils.js
package.json
createAccount.js
sendTransaction.js
meterifiedWeb3.js
utils.js
package.json
createAccount.js
sendTransaction.js
deployContract.js
sample_token.sol
meterifiedWeb3.js
utils.js
package.json
createAccount.js
sendTransaction.js
deployContract.js
callContract.js
sample_token.sol
meterifiedWeb3.js
utils.js
package.json