Skip to content

Instantly share code, notes, and snippets.

@stephen-tse
Created December 6, 2019 04:46
Show Gist options
  • Select an option

  • Save stephen-tse/df157b34402ca3a1b0c9ec055db812ef to your computer and use it in GitHub Desktop.

Select an option

Save stephen-tse/df157b34402ca3a1b0c9ec055db812ef to your computer and use it in GitHub Desktop.
shard=s0.pga.hmny.io
chain=pangaea
./wallet.sh new # validator
account: one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt
URL: keystore:///home/ec2-user/.hmy/keystore/UTC--2019-12-06T03-57-47.639169586Z--229a7d93484ecc7e646b5fe7e666b5b3cd90f36d
./wallet.sh new # delegator
account: one1lzprzwqsnlp2wajf6smw0mrdjn9qpk8lttjkzx
URL: keystore:///home/ec2-user/.hmy/keystore/UTC--2019-12-06T04-16-35.771556754Z--f8823138109fc2a77649d436e7ec6d94ca00d8ff
./wallet.sh blsgen
Bls private key: f5bfbf6f0216855143f4ef26710c725eafec4948d6797f33e3d57e48b7e00573
Bls public key: d7f012b4b7dfdf8bdbd478d5ebff3fac1f7fb39885254197a8a3e7ff955eed4ac6a0b04d03fe5b8e080c9bd7ce021018
File storing the ENCRYPTED private key with your passphrase: d7f012b4b7dfdf8bdbd478d5ebff3fac1f7fb39885254197a8a3e7ff955eed4ac6a0b04d03fe5b8e080c9bd7ce021018.key
./hmy keys import-ks ///home/ec2-user/.hmy/keystore/UTC--2019-12-06T03-57-47.639169586Z--229a7d93484ecc7e646b5fe7e666b5b3cd90f36d --passphrase foo
Imported keystore given account alias of `excess-imported`
./hmy keys import-ks ///home/ec2-user/.hmy/keystore/UTC--2019-12-06T04-16-35.771556754Z--f8823138109fc2a77649d436e7ec6d94ca00d8ff --passphrase foo2
Imported keystore given account alias of `excess-imported`
./hmy balances $account --node=https://api.$shard
[
{
"shard": 0,
"amount": 2000.0000
},
{
"shard": 1,
"amount": 0.0000
}
]
./hmy balances $account2 --node=https://api.$shard
[
{
"shard": 0,
"amount": 1000.0000
},
{
"shard": 1,
"amount": 0.0000
}
]
account=one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt
account2=one1lzprzwqsnlp2wajf6smw0mrdjn9qpk8lttjkzx
bls=d7f012b4b7dfdf8bdbd478d5ebff3fac1f7fb39885254197a8a3e7ff955eed4ac6a0b04d03fe5b8e080c9bd7ce021018
self=`hostname`
./hmy --node=https://api.$shard staking create-validator --validator-addr $account --name $self-name --identity $self --website $self-site --security-contact $self-contact --details $self-details --rate 0.1 --max-rate 0.9 --max-change-rate 0.05 --min-self-delegation 2 --max-total-delegation 3000 --amount 10 --bls-pubkeys $bls --chain-id $chain --passphrase ''
{"transaction-receipt":"0x0f0aa93b63fd64a23149e3616042ae880fb3843bc62904005431409133d3726f"}
name=`hostname`
./hmy --node=https://api.$shard/ blockchain validator all # takes 8 seconds
{
"id": "0",
"jsonrpc": "2.0",
"result": [
"one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt"
]
}
./hmy --node=https://api.$shard/ blockchain validator information $account
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"active": true,
"address": "one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt",
"avg_voting_power": "",
"commission": {
"commission_rates": {
"max_change_rate": "0.050000000000000000",
"max_rate": "0.900000000000000000",
"rate": "0.100000000000000000"
},
"update_height": 661
},
"creation_height": 661,
"description": {
"details": "ip-172-31-5-34.us-west-1.compute.internal-details",
"identity": "ip-172-31-5-34.us-west-1.compute.internal",
"name": "ip-172-31-5-34.us-west-1.compute.internal-name",
"security_contact": "ip-172-31-5-34.us-west-1.compute.internal-contact",
"website": "ip-172-31-5-34.us-west-1.compute.internal-site"
},
"max_total_delegation": 3e+21,
"min_self_delegation": 2000000000000000000,
"slot_pub_keys": [
"d7f012b4b7dfdf8bdbd478d5ebff3fac1f7fb39885254197a8a3e7ff955eed4ac6a0b04d03fe5b8e080c9bd7ce021018"
],
"slot_shard_ids": [
0
],
"total_effective_stake": "",
"unbonding_height": 0,
"uptime": ""
}
}
./hmy --node=https://api.$shard staking delegate --delegator-addr $account2 --validator-addr $account --amount 201.00000015 --chain-id $chain --passphrase ''
{"transaction-receipt":"0x438b633ec2773ffe6e777daf72c536862b9f3bd53d0052af9f3cae5edc726dd9"}
./hmy --node=https://api.$shard/ blockchain delegation by-validator $account
{
"id": "0",
"jsonrpc": "2.0",
"result": [
{
"Undelegations": [],
"amount": 10000000000000000000,
"delegator_address": "one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt",
"reward": 0,
"validator_address": "one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt"
},
{
"Undelegations": [],
"amount": 201000000150000000000,
"delegator_address": "one1lzprzwqsnlp2wajf6smw0mrdjn9qpk8lttjkzx",
"reward": 0,
"validator_address": "one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt"
}
]
}
./hmy --node=https://api.$shard/ blockchain delegation by-delegator $account2
{
"id": "0",
"jsonrpc": "2.0",
"result": [
{
"Undelegations": [],
"amount": 201000000150000000000,
"delegator_address": "one1lzprzwqsnlp2wajf6smw0mrdjn9qpk8lttjkzx",
"reward": 0,
"validator_address": "one1y2d8my6gfmx8uerttln7ve44k0xepumd4h2ewt"
}
]
}
./hmy --node=https://api.$shard/ staking collect-rewards --delegator-addr $account --chain-id $chain
{"transaction-receipt":"0xa79d024967dddf46b43e9b5a4a8af0433d0f478fd16edc03d46e2430b4f704fc"}
./hmy --node=https://api.$shard/ blockchain delegation by-delegator $account2 | python -c 'import json, sys; assert json.load(sys.stdin)["result"][0]["delegator_address"] == sys.argv[1]' $account
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment