loomnetwork / loomchain

Loom DAppChain Engine
Other
166 stars 32 forks source link

Loom Protocol

Loom Protocol powers Basechain, an interoperable DPoS blockchain that is live in production, EVM-compatible, audited, and battle-tested.

Prerequisites

Build the binary

  1. Set the value of the LOOM_SRC environment variable as follows:

    LOOM_SRC=$GOPATH/src/github.com/loomnetwork/loomchain
  2. Clone the repository into the $LOOM_SRC directory:

    git clone git@github.com:loomnetwork/loomchain.git $LOOM_SRC
  3. Install dependencies:

    cd $LOOM_SRC && make deps
  4. Build the binary:

    make
  5. Copy the ./loom binary to a directory of your choice.

Run

  1. Use the following command to initialize the blockchain with the built-in contracts:

    ./loom init
  2. Enter the following command to run the node:

    ./loom run

Generate keys

Use the loom genkey command. It will create two files with the given names.

./loom genkey -a publicKeyFilename -k privateKeyFilename

Ethereum smart contracts

  1. Deploy smart contract by entering the loom deploy command:

    ./loom deploy -a pubkeyFile -k prikeyFile -b contractBytecode.bin
    New contract deployed with address:  default:0xB448D7db27192d54FeBdA458B81e7383F8641c8A
    Runtime bytecode:  [96 96 96 64 82 96 .... ]
  2. Make a call to an already deployed contract with the loom cal call command:

    ./loom call  -a pubkeyFile -k prikeyFile -i inputDataFile -c 0xB448D7db27192d54FeBdA458B81e7383F8641c8A
    Call response:  [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 219]

Details of encoding contract input data can be found in the Solidity ABI documentation. You can use static-call similarly to run a read only method.

Update Protobuf Messages

Enter the following command to update protobuf messages:

# build the Go plugin for protoc
make proto

See the Go Generated Code page for more details about how you can use the generated protobuf messages.

Update vendored Go dependencies

Some of the Go dependencies are vendored using Dep. Most common operation when dealing with the vendored dependencies is to update the Tendermint or IAVL branch/revision. This can be done by updating the branch/revision in Gopkg.toml and then running dep ensure -update.

For example:

dep ensure -v -update github.com/tendermint/iavl

Useful Links