Loom Protocol powers Basechain, an interoperable DPoS blockchain that is live in production, EVM-compatible, audited, and battle-tested.
-
A running Linux or macOS system.
-
Go 1.9+.
-
Dep. For details about installing Dep, see the Dep page.
-
(OPTIONAL) LevelDB.
If you're running macOS, you can enter the following command to install LevelDB:
brew install leveldb
If you're running Linux, you can enter the following command to install LevelDB:
apt-get install libleveldb-dev libleveldb1v5
-
The
GOPATH
environment variable is defined.
- Set the value of the
LOOM_SRC
environment variable as follows:
LOOM_SRC=$GOPATH/src/github.com/loomnetwork/loomchain
- Clone the repository into the
$LOOM_SRC
directory:
git clone [email protected]:loomnetwork/loomchain.git $LOOM_SRC
- Install dependencies:
cd $LOOM_SRC && make deps
- Build the binary:
make
- Copy the
./loom
binary to a directory of your choice.
- Use the following command to initialize the blockchain with the built-in contracts:
./loom init
- Enter the following command to run the node:
./loom run
Use the loom genkey
command. It will create two files with the given names.
./loom genkey -a publicKeyFilename -k privateKeyFilename
- 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 .... ]
- 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.
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.
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