Skip to content

Instantly share code, notes, and snippets.

View lucas-maicoin's full-sized avatar

Lucas Zhang lucas-maicoin

  • MaiCoin
  • Wuhan, China
View GitHub Profile
## clean source
sudo rm /etc/apt/sources.list.d/mongodb*.list
## Import the public key used by the package management system.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
## Create a list file for MongoDB
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.0.list
## Reload local package database
@lucas-maicoin
lucas-maicoin / eos-permission.md
Last active June 28, 2018 04:53
EOS Permissions

Update key in a permission

$ cleos set account permission lucaszhang11 active '{"threshold": 1, "keys": [{"key": "EOS64fsvNKzjEoKCDH7u2zhKAouNWt2xAqWN5dxpLfMnVd17uGNYp", "weight": 1}], "accounts": []}' owner
executed transaction: 34063ebd1312c6704aa3978e0327ea996df43148cc44da49c223b48d7f587e70  160 bytes  649 us
#         eosio <= eosio::updateauth            {"account":"lucaszhang11","permission":"active","parent":"owner","auth":{"threshold":1,"keys":[{"key...
warning: transaction executed locally, but may not be confirmed by the network yet

$ cleos get account lucaszhang11
permissions:
 owner 1: 1 EOS5ZxpFzmqybRZjoBt9Xavb3PrYBG8LNf91aag2KaCdE1nEb2G8Y
@lucas-maicoin
lucas-maicoin / eos-account.md
Last active June 28, 2018 04:01
EOS Account

create an account

# buy RAM 
$ cleos system buyram lucaszhang15 lucaszhang15 "0.10000 EOS"

# delegate bandwidth for CPU and network
$ cleos system delegatebw lucaszhang15 lucaszhang15 "0.50000 EOS" "0.50000 EOS"

# create EOS account
@lucas-maicoin
lucas-maicoin / eos-build.md
Last active October 26, 2018 11:56
EOS build process

1. build

$ git clone https://github.com/EOS-Mainnet/eos -b mainnet-1.4.1
$ cd eos && git submodule update --init --recursive
$ ./eosio_build.sh -s EOS
$ cd build && make install

2. generate config.ini and download genesis.json

@lucas-maicoin
lucas-maicoin / eos-keys.md
Created June 28, 2018 01:50
EOS public/private keys

create public/private key

$ cleos create key
Private key: 5Jxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Public key: EOS5ZxpFzmqybRZjoBt9Xavb3PrYBG8LNf91aag2KaCdE1nEb2G8Y

import public/private key into a wallet

@lucas-maicoin
lucas-maicoin / eos-wallet.md
Last active June 28, 2018 01:40
EOS wallet

create a default wallet

$ cleos --wallet-url http://localhost:8900/ wallet create
Creating wallet: default
Save password to use in the future to unlock this wallet.
Without password imported keys will not be retrievable.
"PW5Jxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

create a wallet with name

@lucas-maicoin
lucas-maicoin / gist:bf29af19f6a488f2509d74b406e1f127
Created June 26, 2018 14:39
cleos --print-request --print-response transfer lucaszhang15 lucaszhang11 "0.1 EOS" "test"
$ cleos --print-request --print-response transfer lucaszhang15 lucaszhang11 "0.1 EOS" "test"
REQUEST:
---------------------
POST /v1/chain/get_currency_stats HTTP/1.0
Host: localhost
content-length: 63
Accept: */*
Connection: close
{
var filter = web3.eth.filter({fromBlock: 4847473, toBlock: 4847473});
filter.watch(function(error, result) {
if (error) {
logger.error('Block error', error);
return;
};
logger.info(JSON.stringify(result));
}