Meterify Code Examples

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

Last updated