Skip to content

Tendermint-based blockchain that supports WebAssembly smart contract

License

Notifications You must be signed in to change notification settings

datachainlab/hypermint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hypermint

CircleCI

hypermint is a Tendermint-based blockchain that support WebAssembly smart contract.

Features

Build

$ make build

If you use Golang 1.12 or 1.11, export GO111MODULE=on for modules.

Getting started

Run a validator node

First, you need to initialize genesis state.

# these outputs will be different per execution
$ make init
{
  "chain_id": "test-chain-6AHEow",
  "node_id": "67b4f60a2b371a908848af2d35e7816b55610115",
  "app_message": "success"
}
export ADDR1=0x1221a0726d56aEdeA9dBe2522DdAE3Dd8ED0f36c
export ADDR2=0xD8eba1f372b9e0D378259F150d52C2e6C2e4109a

Next, run a blockchain node:

$ make start

If you want to deploy hypermint node on k8s, see here.

Smart contract

hypermint supports wasm based smart contract.

Contract example project is here.

If you don't have cargo and wasm-gc, you should install these.

To deploy simple token project, exec below commands:

# '0x1221a0726d56aEdeA9dBe2522DdAE3Dd8ED0f36c' should be replace with the value which was got by `make init`
$ export ADDR1=0x1221a0726d56aEdeA9dBe2522DdAE3Dd8ED0f36c

# To exec deploy cmd, cargo with wasm32 and wasm-gc
$ make -C ./example/token deploy
cargo build --target=wasm32-unknown-unknown
   Compiling hmc v0.1.0 (/Users/jun/go/src/github.com/bluele/hypermint/hmc)
   Compiling token v0.1.0 (/Users/jun/go/src/github.com/bluele/hypermint/example/token)
    Finished dev [unoptimized + debuginfo] target(s) in 2.08s
wasm-gc ./target/wasm32-unknown-unknown/debug/token.wasm -o ./token.min.wasm
contract address is 0xceD4629963CCc0549094e962a01f454EBFD80Cbd

Now you got the first contract address! Next, try to check your balance.

$ ./build/hmcli contract call --address=$ADDR1 --contract=0xceD4629963CCc0549094e962a01f454EBFD80Cbd --func="get_balance" --type=int --password=password --simulate --gas=1
10000

Contract development

We develop an emulation library to ease contract development and testing. https://github.com/bluele/hmemu

Please check this out.

Maintainers

About

Tendermint-based blockchain that supports WebAssembly smart contract

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •