GithubHelp home page GithubHelp logo

harmony-one / go-sdk Goto Github PK

View Code? Open in Web Editor NEW
43.0 22.0 45.0 1.06 MB

Go-SDK & CLI tool to interact with the Harmony Blockchain

Home Page: https://docs.harmony.one/

Makefile 0.21% Go 54.02% Shell 0.18% Python 1.17% JavaScript 44.43%
golang sdk

go-sdk's Introduction

Harmony's go-sdk

This is a go layer on top of the Harmony RPC, included is a CLI tool that you can build with a simple invocation of make

See https://docs.harmony.one/home/network/wallets/harmony-cli/download-setup for detailed documentation on how to use the hmy CLI tools

Build

Working directly on this repo can be challenging because of the upstream dependencies. Follow the README in the main repo for an already ready development environment: https://github.com/harmony-one/harmony/blob/master/README.md.

...for the impatient:

$ docker run -it  harmonyone/main:stable /bin/bash
$ cd ../go-sdk
$ git pull -r origin master
$ make

Usage & Examples

hmy implements a fluent API, that is, there is a hierarchy of commands.

bash completions

once built, add hmy to your path and add to your .bashrc

. <(hmy completion)

invoke the following command to see the most command usages of hmy

$ hmy cookbook

Cookbook of Usage

Note:

1) Every subcommand recognizes a '--help' flag
2) If a passphrase is used by a subcommand, one can enter their own passphrase interactively
   with the --passphrase option. Alternatively, one can pass their own passphrase via a file
   using the --passphrase-file option. If no passphrase option is selected, the default
   passphrase of '' is used.
3) These examples use Shard 0 of Mainnet as argument for --node

Examples:

1.  Check account balance on given chain
./hmy --node=https://api.s0.t.hmny.io balances <SOME_ONE_ADDRESS>

2.  Check sent transaction
./hmy --node=https://api.s0.t.hmny.io blockchain transaction-by-hash <SOME_TX_HASH>

3.  List local account keys
./hmy keys list

4.  Sending a transaction (waits 40 seconds for transaction confirmation)
./hmy --node=https://api.s0.t.hmny.io transfer \
    --from <SOME_ONE_ADDRESS> --to <SOME_ONE_ADDRESS> \
    --from-shard 0 --to-shard 1 --amount 200 --passphrase

5.  Sending a batch of transactions as dictated from a file (the `--dry-run` options still apply)
./hmy --node=https://api.s0.t.hmny.io transfer --file <PATH_TO_JSON_FILE>
Check README for details on json file format.

6.  Check a completed transaction receipt
./hmy --node=https://api.s0.t.hmny.io blockchain transaction-receipt <SOME_TX_HASH>

7.  Import an account using the mnemonic. Prompts the user to give the mnemonic.
./hmy keys recover-from-mnemonic <ACCOUNT_NAME>

8.  Import an existing keystore file
./hmy keys import-ks <PATH_TO_KEYSTORE_JSON>

9.  Import a keystore file using a secp256k1 private key
./hmy keys import-private-key <secp256k1_PRIVATE_KEY>

10. Export a keystore file's secp256k1 private key
./hmy keys export-private-key <ACCOUNT_ADDRESS> --passphrase

11. Generate a BLS key then encrypt and save the private key to the specified location.
./hmy keys generate-bls-key --bls-file-path <PATH_FOR_BLS_KEY_FILE>

12. Create a new validator with a list of BLS keys
./hmy --node=https://api.s0.t.hmny.io staking create-validator --amount 10 --validator-addr <SOME_ONE_ADDRESS> \
    --bls-pubkeys <BLS_KEY_1>,<BLS_KEY_2>,<BLS_KEY_3> \
    --identity foo --details bar --name baz --max-change-rate 0.1 --max-rate 0.1 --max-total-delegation 10 \
    --min-self-delegation 10 --rate 0.1 --security-contact Leo  --website harmony.one --passphrase

13. Edit an existing validator
./hmy --node=https://api.s0.t.hmny.io staking edit-validator \
    --validator-addr <SOME_ONE_ADDRESS> --identity foo --details bar \
    --name baz --security-contact EK --website harmony.one \
    --min-self-delegation 0 --max-total-delegation 10 --rate 0.1\
    --add-bls-key <SOME_BLS_KEY> --remove-bls-key <OTHER_BLS_KEY> --passphrase

14. Delegate an amount to a validator
./hmy --node=https://api.s0.t.hmny.io staking delegate \
    --delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
    --amount 10 --passphrase

15. Undelegate to a validator
./hmy --node=https://api.s0.t.hmny.io staking undelegate \
    --delegator-addr <SOME_ONE_ADDRESS> --validator-addr <VALIDATOR_ONE_ADDRESS> \
    --amount 10 --passphrase

16. Collect block rewards as a delegator
./hmy --node=https://api.s0.t.hmny.io staking collect-rewards \
    --delegator-addr <SOME_ONE_ADDRESS> --passphrase

17. Check elected validators
./hmy --node=https://api.s0.t.hmny.io blockchain validator elected

18. Get current staking utility metrics
./hmy --node=https://api.s0.t.hmny.io blockchain utility-metrics

19. Check in-memory record of failed staking transactions
./hmy --node=https://api.s0.t.hmny.io failures staking

20. Check which shard your BLS public key would be assigned to as a validator
./hmy --node=https://api.s0.t.hmny.io utility shard-for-bls <BLS_PUBLIC_KEY>

21. Vote on a governance proposal on https://snapshot.org
./hmy governance vote-proposal --space=[harmony-mainnet.eth] \
	--proposal=<PROPOSAL_IPFS_HASH> --proposal-type=[single-choice] \
	--choice=<VOTING_CHOICE(S)> --app=[APP] --key=<ACCOUNT_ADDRESS_OR_NAME>
PS: key must first use (hmy keys import-private-key) to import

22. Enter Console
./hmy command --net=testnet

Sending batched transactions

One may find it useful to send a batch of transaction with 1 instance of the binary. To do this, one can specify a JSON file with the transaction subcommand to dictate a batch of transaction to send off in sequential order.

Example:

hmy --node="https://api.s1.t.hmny.io/" transfer --file ./batchTransactions.json

Note that the --wait-for-confirm and --dry-run options still apply when sending batched transactions

Transfer JSON file format

The JSON file will be a JSON array where each element has the following attributes:

Key Value-type Value-description
from string [Required] Sender's one address, must have key in keystore.
to string [Required] The receivers one address.
amount string [Required] The amount to send in $ONE.
from-shard string [Required] The source shard.
to-shard string [Required] The destination shard.
passphrase-file string [Optional] The file path to file containing the passphrase in plain text. If none is provided, check for passphrase string.
passphrase-string string [Optional] The passphrase as a string in plain text. If none is provided, passphrase is ''.
nonce string [Optional] The nonce of a specific transaction, default uses nonce from blockchain.
gas-price string [Optional] The gas price to pay in NANO (1e-9 of $ONE), default is 1.
gas-limit string [Optional] The gas limit, default is 21000.
stop-on-error boolean [Optional] If true, stop sending transactions if an error occurred, default is false.
true-nonce boolean [Optional] If true, send transaction using true on-chain nonce. Cannot be used with nonce. If none is provided, use tx pool nonce.

Example of JSON file:

[
  {
    "from": "one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7",
    "to": "one1zksj3evekayy90xt4psrz8h6j2v3hla4qwz4ur",
    "from-shard" : "0",
    "to-shard": "0",
    "amount": "1",
    "passphrase-string": "",
    "nonce": "35",
    "stop-on-error": true
  },
  {
    "from": "one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7",
    "to": "one1zksj3evekayy90xt4psrz8h6j2v3hla4qwz4ur",
    "from-shard" : "0",
    "to-shard": "0",
    "amount": "1",
    "passphrase-file": "./pw.txt",
    "gas-price": "1",
    "gas-limit": "21000",
    "true-nonce": true
  }
]

Batched transaction response format

The return will be a JSON array where each element is a transaction log. The transaction log has the following attributes:

Key Value-type Value-description
transaction-receipt string The transaction hash/receipt if the CLI signed and sent a transaction, otherwise this key will not exist
transaction JSON Object The transaction parameters if --dry-run is toggled, otherwise this key will not exist.
blockchain-receipt JSON Object The transaction receipt from the blockchain if wait-for-confirm is > 0, otherwise this key will not exist.
raw-transaction string The raw bytes in hex of a sighed transaction if --dry-run is toggled, otherwise this key will not exist
errors JSON Array A JSON array of strings describing any error that occurred during the execution of a transaction. If no errors, this key will not exist.
time-signed-utc string The time in UTC as a string of roughly when the transaction was signed. If no signed transaction, this key will not exist.

Example of returned JSON Array:

[
  {
    "errors": [
      "[2020-01-22 22:01:10.819406] strconv.ParseUint: parsing \"-1\": invalid syntax"
    ]
  },
  {
    "transaction-receipt": "0xf1706080ea9ac210ee2c12c69fb310be5a5da99582b7c783e2f741a3536abbfd",
    "blockchain-receipt": {
      "blockHash": "0xe6de09f4e0ca351257d301a50b4e2ca82646473dc1c4302b570bfab17d421850",
      "blockNumber": "0xb71",
      "contractAddress": null,
      "cumulativeGasUsed": "0x5208",
      "from": "one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7",
      "gasUsed": "0x5208",
      "logs": [],
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "shardID": 0,
      "status": "0x1",
      "to": "one1zksj3evekayy90xt4psrz8h6j2v3hla4qwz4ur",
      "transactionHash": "0xf1706080ea9ac210ee2c12c69fb310be5a5da99582b7c783e2f741a3536abbfd",
      "transactionIndex": "0x0"
    },
    "time-signed-utc": "2020-01-22 22:01:11.468407"
  }
]

Offline sign transfer

  1. Get Nonce From a Account. (Need to be online, but no passphrase required)
./hmy get-nonce --node=https://api.s0.t.hmny.io --from=[ONE address]
  1. Sign transfer and write to file. (Passphrase required, But no need to be online)
./hmy transfer --offline-sign --nonce=[nonce value from previous] --from=[ONE address] --to=[ONE address] --amount=1000 --from-shard=0 --to-shard=0 > signed.json
  1. send signed.json to Harmony blockchain! (Need to be online, but no passphrase required)
./hmy offline-sign-transfer --node=https://api.s0.b.hmny.io --file ./signed.json

Debugging

The go-sdk code respects HMY_RPC_DEBUG HMY_TX_DEBUG as debugging based environment variables.

HMY_RPC_DEBUG=true HMY_TX_DEBUG=true ./hmy blockchain protocol-version

Contract Deploy

You can deploy the contract use the command;

./hmy command --node="https://api.s0.b.hmny.io" --net=testnet

Then you can test this code to deploy a smart contract

var abi = [{"constant":false,"inputs":[],"name":"changeIt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"number","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]
var code = '0x60806040526212345660005534801561001757600080fd5b5060c8806100266000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806327b5c17514604e5780638381f58a146062575b600080fd5b348015605957600080fd5b506060608a565b005b348015606d57600080fd5b5060746096565b6040518082815260200191505060405180910390f35b62654321600081905550565b600054815600a165627a7a72305820294db9eed647c48762212fd43bf9ed7733c9d9f43b1ce5583bb4c2bae97fae770029'
var account = 'one1xjanr7lgulc0fqyc8dmfp6jfwuje2d94xfnzyd' // change this to your account address, support eth or one address
var myContract=eth.contract(abi)
contract = myContract.new({from:account,data:code})

Wait for a few seconds and it's ready to use

go-sdk's People

Contributors

cem-harmony avatar charleszqwang avatar coolcottontail avatar daniel-vdm avatar flicker-harmony avatar fxfactorial avatar gupadhyaya avatar harmony-devops avatar hsiungpins avatar jhd2best avatar luttyyang avatar manish0338 avatar maxmustermann2 avatar michaelotis avatar mirrormirage0 avatar polymorpher avatar rhazberries avatar rlan35 avatar samhsiung avatar sophoah avatar sunwavesun avatar valyd8chain avatar zenhack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-sdk's Issues

Need to validate input of staking transaction before sending off

Given a staking transaction (create-validator)

of this:

        staking_command = f"hmy staking create-validator --amount 1 " \
                          f"--validator-addr {address} " \
                          f"--bls-pubkeys {key} --identity foo --details bar --name baz " \
                          f"--max-change-rate 10 --max-rate 10 --max-total-delegation 10 " \
                          f"--min-self-delegation 1 --rate 10 --security-contact Leo  " \
                          f"--website harmony.one --passphrase={args.passphrase}"

It fails once on blockchain side because of sanity checks here:

https://github.com/harmony-one/harmony/blob/master/staking/types/validator.go#L111

for example, we'd get:

in sanity-check, rate, maxrate, maxchangerate 10.000000000000000000 10.000000000000000000 10.000000000000000000

which fails as each is larger than 1.

aka, please send over as decimal % in SDK before kicking it over the wire to the blockchain

Trading Platform Requirements

Key Deliverables

  • Account Management
  • Transfer Management
  • Support via CLI for http requests
    • getTxByHash - Implemented in RPC "hmy_getTransactionByHash"
    • getbalance(for any address) - Implemented in RPC "hmy_getBalance"
    • build and broadcast transaction.
  • Block related commands
    • getLatestBlockNum - Implemented in RPC "hmy_blockNumber"
    • getBlockByHeight - Implemented in RPC "hmy_getBlockByNumber"
    • getBlockByHash - Implemented in RPC "hmy_getBlockByHash"
    • getTxsByBlockHeight, Not yet implemented - Subset of "hmy_getBlockByNumber"
    • getTxsByBlockHash, Not yet implemented - Subset of "hmy_getBlockByHash"
  • Additional reporting queries
    • getTxsByAddress(paging)

Gas fee calculation for staking transaction is wrong

Currently staking transactions are getting rejected when created by the cli because the gas limit is too low:

https://github.com/harmony-one/go-sdk/blob/master/cmd/subcommands/staking.go#L69

note that the first param is nil and calling core.IntrinsicGas(nil, false, true) gives back 21000.

For reference, the staking transaction made in test.py of harmony-ops repo has:

        staking_command = f"hmy staking create-validator --amount 1 " \
                          f"--validator-addr {address} " \
                          f"--bls-pubkeys {key} --identity foo --details bar --name baz " \
                          f"--max-change-rate 10 --max-rate 10 --max-total-delegation 10 " \
                          f"--min-self-delegation 1 --rate 10 --security-contact Leo  " \
                          f"--website harmony.one --passphrase={args.passphrase}"

and when this hits the blockchain, it actually uses up 31048 gas.

(Can get the 31048 number from adding a print on the gas value here: https://github.com/harmony-one/harmony/blob/master/core/state_transition.go#L287)

edit validator should take in multiple bls keys

edit-validator takes in list of bls pubkeys for remove-bls-key & add-bls-key, cli should send N edit validator transactions to run all the changes to be consistent with the way the cli takes in params for create-validator --bls-pubkeys k1,k2,k3

provide flags to filter

one can get the in memory failures of staking transactions like so:

./hmy failures staking --node="https://api.s0.pga.hmny.io"
{
  "id": "0",
  "jsonrpc": "2.0",
  "result": [
    {
      "directive-kind": "CreateValidator",
      "error-message": "insufficient balance to pay for gas",
      "time-at-rejection": 1576049281,
      "tx-hash-id": "0xe02045667c208f860a62008dce2266e3a314b90b1c58db54245d2e1e1a274e67"
    },
    {
      "directive-kind": "Delegate",
      "error-message": "insufficient balance to stake",
      "time-at-rejection": 1576052305,
      "tx-hash-id": "0x32ece961a3ee9fb9842bb3d56d9e1b6d9f01ff5d2254b547d2b6373199f22b55"
    },
    {
      "directive-kind": "CreateValidator",
      "error-message": "insufficient balance to pay for gas",
      "time-at-rejection": 1576062960,
      "tx-hash-id": "0xc881bb739d8041066569c585bb10bd200ed673aa437c3524fae2a88ac1b754af"
    },
    {
      "directive-kind": "CreateValidator",
      "error-message": "insufficient balance to pay for gas",
      "time-at-rejection": 1576063726,
      "tx-hash-id": "0xc881bb739d8041066569c585bb10bd200ed673aa437c3524fae2a88ac1b754af"
    },
    {
      "directive-kind": "Delegate",
      "error-message": "total delegation can not be bigger than max_total_delegation",
      "time-at-rejection": 1576065393,
      "tx-hash-id": "0x4bf8c7ac8a9e332cd888e98b6d18408ef7fe076091ba38e8510735c6ea38fcba"
    },
    {
      "directive-kind": "Delegate",
      "error-message": "total delegation can not be bigger than max_total_delegation",
      "time-at-rejection": 1576065704,
      "tx-hash-id": "0x5b68d98279a52d67caa933f40e2fcb4540e787c71e73a52ea03288f31aa4ee43"
    },
    {
      "directive-kind": "CreateValidator",
      "error-message": "staking validator already exists",
      "time-at-rejection": 1576072069,
      "tx-hash-id": "0x14f9312d46449a8960368c4522d798783929169fa3a4162f64ec4f48d381739d"
    },
    {
      "directive-kind": "Delegate",
      "error-message": "insufficient balance to stake",
      "time-at-rejection": 1576080035,
      "tx-hash-id": "0x448ea36e78d65392bd5c1cd7a9f5b66416112382d09d9756863914fc0f3b1f46"
    },
    {
      "directive-kind": "CreateValidator",
      "error-message": "insufficient balance to pay for gas",
      "time-at-rejection": 1576086292,
      "tx-hash-id": "0x94237f1cf73ab6874ea5ba257cf9fdee0513b1f568f385638e2c0087826497d0"
    },
    {
      "directive-kind": "CreateValidator",
      "error-message": "staking validator already exists",
      "time-at-rejection": 1576091697,
      "tx-hash-id": "0xeba9dc3244061fff6a2a1db35c6409b6683c7944ce81b1fb476a413e169ec63d"
    }
  ]
}

Without going into too much feature-creep, provide a six flags that allow filtering on directive-kind (that's five there) and on the tx-hash-id

Special behavior of *Big.Int once it is stored in variable/map

I lost some time over some behavior of *Bit.Int once it stored in a variable, reader can verify by looking at tx-controller.go:183 and notice how referencing the transfer-amount via a map is commented out in favor of recomputing the amt. Hence amount is needlessly passed to several methods, redundantly.

Find out the root explanation of *Big.Int in the case of it being stored in a variable and losing ~8 decimal points, take that into account and fix the various spots in tx-controller.go that take amount, basically only C.setAmount should be taking amount

./hmy.sh does not show valid help

Steps to reproduce

  1. Running ./hmy.sh --help gives the following
Johns-MacBook-Pro:cli johnwhitton$ ./hmy.sh --help
./hmy.sh: illegal option -- -
Usage: ./hmy.sh [option] command

Options:
   -d          download all the binaries
   -h          print this help
Note: Arguments must be passed at the end for ./hmy to work correctly.
For instance: ./hmy.sh balances <one-address> --node=https://api.s0.p.hmny.io/

Johns-MacBook-Pro:cli johnwhitton$
  1. It should produce similar help to ./hmy.sh
Johns-MacBook-Pro:cli johnwhitton$ ./hmy.sh

CLI interface to the Harmony blockchain

Invoke 'hmy cookbook' for examples of the most common, important usages

Usage:
  hmy [flags]
  hmy [command]

Available Commands:
  balances    Check account balance on all shards
  blockchain  Interact with the Harmony.one Blockchain
  completion  Generates bash completion scripts
  cookbook    Example usages of the most important, frequently used commands
  docs        Generate docs to a local hmy-docs directory
  failures    Check in-memory record of failed transactions
  help        Help about any command
  keys        Add or view local private keys
  staking     newvalidator, editvalidator, delegate, undelegate or redelegate
  transfer    Create and send a transaction
  utility     Check in-memory record of failed transactions
  version     Show version

Flags:
  -h, --help          help for hmy
  -e, --ledger        Use ledger hardware wallet
      --no-latest     Do not add 'latest' to RPC params
      --no-pretty     Disable pretty print JSON outputs
  -n, --node string   <host> (default "http://localhost:9500")
  -v, --verbose       dump out debug information, same as env var HMY_ALL_DEBUG=true

Use "hmy [command] --help" for more information about a command.

Note
./hmy gives the correct help

ohns-MacBook-Pro:go-sdk johnwhitton$ ./hmy

CLI interface to the Harmony blockchain

Invoke 'hmy cookbook' for examples of the most common, important usages

Usage:
  hmy [flags]
  hmy [command]

Available Commands:
  balances    Check account balance on all shards
  blockchain  Interact with the Harmony.one Blockchain
  completion  Generates bash completion scripts
  cookbook    Example usages of the most important, frequently used commands
  docs        Generate docs to a local hmy-docs directory
  failures    Check in-memory record of failed transactions
  help        Help about any command
  keys        Add or view local private keys
  staking     newvalidator, editvalidator, delegate, undelegate or redelegate
  transfer    Create and send a transaction
  utility     common harmony blockchain utilities
  version     Show version

Flags:
  -h, --help          help for hmy
  -e, --ledger        Use ledger hardware wallet
      --no-latest     Do not add 'latest' to RPC params
      --no-pretty     Disable pretty print JSON outputs
  -n, --node string   <host> (default "http://localhost:9500")
  -v, --verbose       dump out debug information, same as env var HMY_ALL_DEBUG=true

Use "hmy [command] --help" for more information about a command.
Johns-MacBook-Pro:go-sdk johnwhitton$

Fractional amount for transfer without leading zero leads to an error

With the following command:

hmy transfer --from one17ys3gsd5gpuhx3juqe73sgtpzpvdusktuq7kfc --to one17ys3gsd5gpuhx3juqe73sgtpzpvdusktuq7kfc --amount .1 --from-shard 0 --to-shard 0

It returns: commit: v2208c51002, error: bad decimal length

Where as

hmy transfer --from one17ys3gsd5gpuhx3juqe73sgtpzpvdusktuq7kfc --to one17ys3gsd5gpuhx3juqe73sgtpzpvdusktuq7kfc --amount 0.1 --from-shard 0 --to-shard 0

works.

setup travis build

Please setup an automated travis build for go-sdk module and add unit test.

remove code duplication in staking.go

Too much code duplication, remove functionality by defining preRun (@janet-harmony you know about this CLI based example in the watchdog, same technique)

Create validator amount error

./hmy staking create-validator --validator-addr one15hahd95t5nsxmehrn7qznxh8m6c2a22rcn3qrh --name Mindstyle --identity Mindstyle --website [email protected] --security-contact Mindstyle --details "Pink Pony validators inc" --rate 0.1 --max-rate 0.4 --max-change-rate 0.01 --min-self-delegation 10 --max-total-delegation 0 --bls-pubkeys 75b92d038fd0e96df21ee45c88bc27baa60e113e55b2a81b16f7b34289fc8083b6812d08f36b92b372545fb522aeff11 --amount 121478 --chain-id pangaea
Enter the bls passphrase:
Repeat the bls passphrase:
Error: amount value should be between min_self_delegation and max_total_delegation

Account Management Requirements

Account Management Requirements

  • CLI Account Management Feature
  • Create Account
    • Password Protect account
  • Import Private Key
  • Import Mnemonic
    • Generate next account from mnemonic
  • Export Private Key
  • Export Mnemonic
  • Account Balance

Remove default passphrase for accounts

Overview
When adding an account you must use the passphrase for the account.
Currently we have a default value of harmony-one

Issue
The user may not realize that this default value is set and may assume that the account was created with an empty passphrase. The passphrase is needed when performing transfers and if the wrong passphrase is entered the transfer fails.

Recommendation

  1. Recommend that the passphrase is made mandatory and the default is removed.
  2. If the user wants to use an empty passphrase when adding the key they must enter --passphrase=''
  3. For transfer the passphrase can be made optional if the user does not enter a passphrase it is the same as having entered --passphrase=''

Sample help for adding keys

Johns-MacBook-Pro:api-tests johnwhitton$ ./hmy keys add -h
Create a new keystore key

Usage:
  hmy keys add <ACCOUNT_NAME> [flags]

Flags:
  -h, --help                     help for add
      --passphrase harmony-one   provide own keystore encryption phrase, default: harmony-one
      --recover                  create keys from a mnemonic

Global Flags:
  -e, --ledger        Use ledger hardware wallet
      --no-latest     Do not add 'latest' to RPC params
      --no-pretty     Disable pretty print JSON outputs
  -n, --node string   <host> (default "http://localhost:9500")
  -v, --verbose       dump out debug information, same as env var HMY_ALL_DEBUG=true
Johns-MacBook-Pro:api-tests johnwhitton$

Encoding error when creating a validator

Command:

./hmy staking create-validator --amount 1 --bls-pubkeys 0x678ec9670899bf6af85b877058bea4fc1301a5a3a376987e826e3ca150b80e3eaadffedad0fedfa111576fa76ded980c 0xe111e3e705067203d3416c102ed54f6ed33c2a0aec24562dba3b13d209cf3a18 --identity foo --details bar --max-change-rate 10 --max-rate 10 --max-total-delegation 10 --min-self-delegation 10 --name baz --rate 10 --security-contact jim --validator-addr one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7 --website lol.com --passphrase=''

Error:

Error: encoding/hex: invalid byte: U+0078 'x'

Provide abstraction layer for messenger

Right now supporting only HTTP based RPC but might be nice to abstract over the messenger so that we can use websockets (atm the subscribe RPC requires WS, http can't do it)

HMY edit-validator ask for Absolute Path

Trying to edit my validator on devnet by running the command bellow:

./hmy staking edit-validator --validator-addr one1echapu535qgtc5ktkgjj3raec4x4gp0a2mh9ec --name Yelllowsin --identity Yelllowsin --website [email protected] --security-contact Yellowsin --details "Maha Lakshmi" --rate 0.3 --min-self-delegation 2 --max-total-delegation 11000 --remove-bls-key 0xa8a0637c7e11e2ea82c23ec1c0dcae3963a34bbabd92b03f9d895d04377ac72ae770da75c4c5868490378501cbd3888e --add-bls-key 0xa8a0637c7e11e2ea82c23ec1c0dcae3963a34bbabd92b03f9d895d04377ac72ae770da75c4c5868490378501cbd3888e --chain-id devnet

HMY returns with this error:

For bls public key: 0xa8a0637c7e11e2ea82c23ec1c0dcae3963a34bbabd92b03f9d895d04377ac72ae770da75c4c5868490378501cbd3888e
Enter the absolute path to the encrypted bls private key file:

Error: keypath is not absolute path
v179f4cf946: keypath is not absolute path

I am sure i am passing the correct BLS KEY parameter as this same parameter works for "create-validator" as shown bellow:

./hmy staking create-validator --validator-addr one1echapu535qgtc5ktkgjj3raec4x4gp0a2mh9ec --name Yelllowsin --identity yelllowsin --website [email protected] --security-contact Yelllowsin --details "Maha Lakshmi" --rate 0.3 --max-rate 0.9 --max-change-rate 0.05 --min-self-delegation 2 --max-total-delegation 11000 --amount 1000 --bls-pubkeys 0xa8a0637c7e11e2ea82c23ec1c0dcae3963a34bbabd92b03f9d895d04377ac72ae770da75c4c5868490378501cbd3888e --chain-id devnet

make all the commands use RunE

I want when cli errors, that whatever error presented, it is wrapped by version, commit. (skips the need to have to ask for version)

see at bottom of root.go that has:

		fmt.Println(errors.Wrapf(err, VersionWrapDump).Error())

but this is doing some kind of redunancy.

Refactor all the Run callbacks to cmds to be RunE instead, so everything returns error at just eventually one place

build failure on Amazon Linux platform

$ make
mkdir -p dist
rsync -a /home/ec2-user/go/src/github.com/harmony-one/bls/lib/* ./dist/lib/
rsync -a /home/ec2-user/go/src/github.com/harmony-one/mcl/lib/* ./dist/lib/
rsync -a /usr/local/opt/openssl/lib/* ./dist/lib/
rsync: change_dir "/usr/local/opt/openssl/lib" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1039) [sender=3.0.6]
make: *** [prepare-dirs] Error 23

Importing key issues.

  • We can import a keystore .key file multiple times (under different names).
  • We can import multiple keys under the same name.

Individual fields of edit-validator command should be allowed to change

Currently, staking edit-validator command requires that user provide values for all the fields, however edit-validator should allow changing one or more fields and validator-addr is always provided.

./hmy staking edit-validator --validator-addr one1pdv9lrdwl0rg5vglh4xtyrv3wjk3wsqket7zxy --name John
Error: required flag(s) "add-bls-key", "details", "identity", "max-total-delegation", "min-self-delegation", "rate", "remove-bls-key", "security-contact", "website" not set

Fix usage of --passphrase for keys import-private-key

Passphrase not needed when using private key

$ ./hmy keys import-private-key --help
Import an existing keystore key (only accept secp256k1 private keys)

Usage:
  hmy keys import-private-key <secp256k1_PRIVATE_KEY> [ACCOUNT_NAME] [flags]

Flags:
  -h, --help                     help for import-private-key
      --passphrase harmony-one   provide own phrase over default: harmony-one

One1 address is not propery checked

One can check the balance of an invalid one1... address and it will return something. We should verify that the length of the account address is correct.

Ex:

./hmy.sh balances onedeadbeef --node=https://api.s1.t.hmny.io/

[
  {
    "shard": 0,
    "amount": 0.0000003
  },
  {
    "shard": 1,
    "amount": 2.0000
  },
  {
    "shard": 2,
    "amount": 903.566074606
  },
  {
    "shard": 3,
    "amount": 151.363590425
  }
]

When exporting a private key - I am unable to import it into math wallet

Steps to reproduce

  1. import the key file for account 13 in this folder
    /hmy.sh keys import-ks /Users/johnwhitton/go/src/github.com/harmony-one/cli/UTC--2020-01-15T01-02-06.606670000Z--9689a0711642bf08ea92ed98d552f0c1b8c8cefb --passphrase ""
  2. Export the private key
    /hmy.sh keys export-private-key one1j6y6qugkg2ls365jakvd25hscxuv3nhmhj0auh
  3. Go to math wallet and try and import the private key (see attached screenshots)

Screen Shot 2020-01-15 at 3 12 18 PM

Screen Shot 2020-01-15 at 3 12 26 PM

Notes
a) Other keys can be exported via the CLI and imported by mathwallet - but none of the keys in the folder work
b) The folder is private at this point for Harmony folks only

hmy cli validator information should work even when shard 0 is stuck

Describe the bug
Shard 0 is currently block and the hmy cli command to show the validator information shows empy result

./hmy blockchain validator all-active
{
"id": "0",
"jsonrpc": "2.0",
"result": [
"one1nw7u4slurmzsptwfgy52r6t2qyvdhwt0tlmc6n",
"one1aeh9m0r3wkdjad99lwnta3hddk52cn5mjhrnf2",
"one1a73ags7j5wzerfekq82lk896klqj9p7xyph4f7",
"one189h70u44aajkgjt9atswrvgy0uv5fhrd0w8umt",
"one1dth3yqnayxz383v2rzwg4twxd6lrzdjdu8etst",
"one103q7qe5t2505lypvltkqtddaef5tzfxwsse4z7",
...

./hmy blockchain validator information one1aeh9m0r3wkdjad99lwnta3hddk52cn5mjhrnf2
{}

To Reproduce
Steps to reproduce the behavior:

Shard 0 is stuck
execute the command to check validator information
Expected behavior
validator information added to shard 0 before it go stuck should return result.

the staking explorer doesn't have that issue and display the information (maybe it has his own saved local database ?)

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

OS: tested on a ubuntu 18
Additional context
NA

edit validator nil pointer

./hmy --node=https://api.s0.pga.hmny.io/ staking edit-validator --validator-addr one1hs80ss7xzxt6rl6kkvecc4yrenttx8dw308vyj --name Mirror --identity Mirror --website [email protected] --security-contact Mirror --details "One Too Many"  --rate 0.01 --min-self-delegation 2 --max-total-delegation 30 --remove-bls-key 4cc25d3c530d8ce6d0ec3c1e8f14454739fbf69b607cd80e2567252ac7d426f85f2cffebf47b2f6b28031d5bfd70b815 --add-bls-key 4cc25d3c530d8ce6d0ec3c1e8f14454739fbf69b607cd80e2567252ac7d426f85f2cffebf47b2f6b28031d5bfd70b815 --chain-id pangaea
Enter the bls passphrase:
Repeat the bls passphrase:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa0e903]

goroutine 1 [running]:
github.com/harmony-one/go-sdk/cmd/subcommands.delegationAmountSanityCheck(0xc0002cc120, 0xc0002cc140, 0x0, 0x0, 0x0)
    /home/edgar/go/src/github.com/harmony-one/go-sdk/cmd/subcommands/staking.go:167 +0x143
github.com/harmony-one/go-sdk/cmd/subcommands.stakingSubCommands.func2(0xc0002f9400, 0xc0000afa00, 0x0, 0x19, 0x0, 0x0)
    /home/edgar/go/src/github.com/harmony-one/go-sdk/cmd/subcommands/staking.go:412 +0x3a3
github.com/spf13/cobra.(*Command).execute(0xc0002f9400, 0xc0000af860, 0x19, 0x1a, 0xc0002f9400, 0xc0000af860)
    /home/edgar/go/pkg/mod/github.com/spf13/[email protected]/command.go:826 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0x15a3d80, 0x10, 0x0, 0xc000306280)
    /home/edgar/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fc
github.com/spf13/cobra.(*Command).Execute(...)
    /home/edgar/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/harmony-one/go-sdk/cmd/subcommands.Execute()
    /home/edgar/go/src/github.com/harmony-one/go-sdk/cmd/subcommands/root.go:87 +0x2e
main.main()
    /home/edgar/go/src/github.com/harmony-one/go-sdk/cmd/main.go:37 +0xec

fatal error: unexpected signal during runtime execution

Describe the issue :
Segfault error

How to replicate:
On a ubuntu aws free tier machine,
curl -LO https://harmony.one/hmycli && chmod +x hmycli && mv hmycli hmy
./hmy --node="https://api.s1.b.hmny.io/" balances one1yc06ghr2p8xnl2380kpfayweguuhxdtupkhqzw

Full error message below:

[signal SIGSEGV: segmentation violation code=0x1 addr=0x63 pc=0x7fac45b12448]

runtime stack:
runtime.throw(0xd71ab8, 0x2a)
/usr/local/go/src/runtime/panic.go:617 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:374 +0x4a9

goroutine 22 [syscall]:
runtime.cgocall(0xa16a15, 0xc000218de0, 0xc000010240)
/usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000218db0 sp=0xc000218d78 pc=0x40777b
net._C2func_getaddrinfo(0xc0003f8a00, 0x0, 0xc000354bd0, 0xc000010240, 0x0, 0x0, 0x0)
_cgo_gotypes.go:91 +0x55 fp=0xc000218de0 sp=0xc000218db0 pc=0x5866e5
net.cgoLookupIPCNAME.func1(0xc0003f8a00, 0x11, 0x11, 0xc000354bd0, 0xc000010240, 0x10, 0x4305af, 0x8)
/usr/local/go/src/net/cgo_unix.go:154 +0x13e fp=0xc000218e28 sp=0xc000218de0 pc=0x58bf1e
net.cgoLookupIPCNAME(0xd3837b, 0x2, 0xc0003f8980, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/usr/local/go/src/net/cgo_unix.go:154 +0x176 fp=0xc000218f18 sp=0xc000218e28 pc=0x587bb6
net.cgoIPLookup(0xc000755560, 0xd3837b, 0x2, 0xc0003f8980, 0x10)
/usr/local/go/src/net/cgo_unix.go:206 +0x67 fp=0xc000218fb8 sp=0xc000218f18 pc=0x5882a7
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1337 +0x1 fp=0xc000218fc0 sp=0xc000218fb8 pc=0x45e681
created by net.cgoLookupIP
/usr/local/go/src/net/cgo_unix.go:216 +0xc7

goroutine 1 [select]:
net.(*Resolver).lookupIPAddr(0x15b8760, 0x1011260, 0xc00002a0a0, 0xd3837b, 0x2, 0xc0003f8980, 0x10, 0x7fac4a89f008, 0x0, 0x0, ...)
/usr/local/go/src/net/lookup.go:275 +0x663
net.(*Resolver).LookupIPAddr(...)
/usr/local/go/src/net/lookup.go:205
net.LookupIP(0xc0003f8980, 0x10, 0x1bb, 0x0, 0x0, 0x3, 0x0)
/usr/local/go/src/net/lookup.go:191 +0x88
github.com/valyala/fasthttp.resolveTCPAddrs(0xc0003f8980, 0x14, 0xc0003f8900, 0x14, 0x15f6bc0, 0x8, 0x203000, 0xc000354b40)
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:425 +0xc7
github.com/valyala/fasthttp.(*TCPDialer).getTCPAddrs(0x15201c0, 0xc0003f8980, 0x14, 0xc000731500, 0xc0007315a0, 0x40ff29, 0xc00034be10, 0x4e8559, 0xc0003f8980, 0x14)
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:390 +0x14c
github.com/valyala/fasthttp.(*TCPDialer).dial(0x15201c0, 0xc0003f8980, 0x14, 0xe30000000070f000, 0xb2d05e00, 0xe3043d6c2a5a5d6f, 0xc0003f8980, 0x10, 0xc000354b70)
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:255 +0xac
github.com/valyala/fasthttp.(*TCPDialer).Dial(...)
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:164
github.com/valyala/fasthttp.Dial(0xc0003f8980, 0x14, 0xc000354b01, 0xc0003f8980, 0x14, 0xc00034be98)
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:36 +0x51
github.com/valyala/fasthttp.dialAddr(0xc0003f8980, 0x14, 0x0, 0xc000160100, 0xc00016c300, 0xcd4cec95, 0x15b8f80, 0xc0003f8920, 0xc0004915f0)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1566 +0x4a
github.com/valyala/fasthttp.(*HostClient).dialHostHard(0xc0000c4f00, 0xf15118, 0xc0000c4f00, 0x73454f, 0xc00008fb00)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1526 +0x199
github.com/valyala/fasthttp.(*HostClient).acquireConn(0xc0000c4f00, 0x1a7c7ca7, 0x15b8f80, 0x20)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1292 +0xee
github.com/valyala/fasthttp.(*HostClient).doNonNilReqResp(0xc0000c4f00, 0xc0000c6dc0, 0xc00008fb00, 0x0, 0x10, 0xc000491600)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1143 +0xcb
github.com/valyala/fasthttp.(*HostClient).do(0xc0000c4f00, 0xc0000c6dc0, 0xc00008fb00, 0x780000c0003f8980, 0xc0007318a0, 0x78017356b33546da)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1110 +0x57
github.com/valyala/fasthttp.(*HostClient).Do(0xc0000c4f00, 0xc0000c6dc0, 0xc00008fb00, 0x10, 0xc000235d00)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1060 +0x76
github.com/valyala/fasthttp.(*Client).Do(0x15b9460, 0xc0000c6dc0, 0xc00008fb00, 0xc000731a20, 0x18)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:437 +0x1f2
github.com/valyala/fasthttp.Do(...)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:37
github.com/harmony-one/go-sdk/pkg/rpc.baseRequest(0xd3e14c, 0xe, 0xc0003f8800, 0x18, 0xc44a20, 0xc0004ce020, 0x13c, 0x13c, 0xc000731b80, 0x40ddcd, ...)
/go/src/github.com/harmony-one/go-sdk/pkg/rpc/query.go:32 +0x48a
github.com/harmony-one/go-sdk/pkg/rpc.Request(0xd3e14c, 0xe, 0xc0003f8800, 0x18, 0xc44a20, 0xc0004ce020, 0x0, 0x93530b, 0xc7aea0)
/go/src/github.com/harmony-one/go-sdk/pkg/rpc/query.go:59 +0xab
github.com/harmony-one/go-sdk/pkg/sharding.CheckAllShards(0x7ffd8325e777, 0x19, 0x7ffd8325e79a, 0x2a, 0xd39300, 0x4, 0x981df0, 0xc0002a3d48, 0xc0002a3d18)
/go/src/github.com/harmony-one/go-sdk/pkg/sharding/structure.go:43 +0x224
github.com/harmony-one/go-sdk/cmd/subcommands.init.0.func1(0xc000266280, 0xc000278940, 0x1, 0x2, 0x0, 0x0)
/go/src/github.com/harmony-one/go-sdk/cmd/subcommands/balance.go:17 +0x6c
github.com/spf13/cobra.(*Command).execute(0xc000266280, 0xc0002788e0, 0x2, 0x2, 0xc000266280, 0xc0002788e0)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:826 +0x465
github.com/spf13/cobra.(*Command).ExecuteC(0x1527780, 0xd36180, 0x0, 0xc0002ae500)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fc
github.com/spf13/cobra.(*Command).Execute(...)
/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/harmony-one/go-sdk/cmd/subcommands.Execute()
/go/src/github.com/harmony-one/go-sdk/cmd/subcommands/root.go:87 +0x2e
main.main()
/go/src/github.com/harmony-one/go-sdk/cmd/main.go:32 +0xbe

goroutine 5 [sleep]:
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:307
time.Sleep(0x3b9aca00)
/usr/local/go/src/runtime/time.go:105 +0x159
github.com/valyala/fasthttp.init.0.func1()
/go/pkg/mod/github.com/valyala/[email protected]/header.go:1443 +0x2a
created by github.com/valyala/fasthttp.init.0
/go/pkg/mod/github.com/valyala/[email protected]/header.go:1441 +0x3a

goroutine 7 [syscall]:
os/signal.signal_recv(0x0)
/usr/local/go/src/runtime/sigqueue.go:139 +0x9c
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:23 +0x22
created by os/signal.init.0
/usr/local/go/src/os/signal/signal_unix.go:29 +0x41

goroutine 8 [chan receive]:
github.com/rjeczalik/notify.(*nonrecursiveTree).dispatch(0xc000064780, 0xc0000646c0)
/go/pkg/mod/github.com/rjeczalik/[email protected]/tree_nonrecursive.go:36 +0xb6
created by github.com/rjeczalik/notify.newNonrecursiveTree
/go/pkg/mod/github.com/rjeczalik/[email protected]/tree_nonrecursive.go:29 +0xdd

goroutine 9 [chan receive]:
github.com/rjeczalik/notify.(*nonrecursiveTree).internal(0xc000064780, 0xc000064720)
/go/pkg/mod/github.com/rjeczalik/[email protected]/tree_nonrecursive.go:81 +0x58
created by github.com/rjeczalik/notify.newNonrecursiveTree
/go/pkg/mod/github.com/rjeczalik/[email protected]/tree_nonrecursive.go:30 +0x109

goroutine 10 [chan receive]:
github.com/ethereum/go-ethereum/core.(*txSenderCacher).cache(0xc000252450)
/go/pkg/mod/github.com/ethereum/[email protected]/core/tx_cacher.go:63 +0x97
created by github.com/ethereum/go-ethereum/core.newTxSenderCacher
/go/pkg/mod/github.com/ethereum/[email protected]/core/tx_cacher.go:55 +0x9f

goroutine 11 [chan receive]:
github.com/harmony-one/harmony/core.(*txSenderCacher).cache(0xc000252710)
/go/pkg/mod/github.com/harmony-one/[email protected]/core/tx_cacher.go:63 +0x97
created by github.com/harmony-one/harmony/core.newTxSenderCacher
/go/pkg/mod/github.com/harmony-one/[email protected]/core/tx_cacher.go:55 +0x9f

goroutine 12 [sleep]:
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:307
time.Sleep(0x2540be400)
/usr/local/go/src/runtime/time.go:105 +0x159
github.com/valyala/fasthttp.(*Client).mCleaner(0x15b9460, 0xc000263b00)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:462 +0x143
created by github.com/valyala/fasthttp.(*Client).Do
/go/pkg/mod/github.com/valyala/[email protected]/client.go:434 +0x24b

goroutine 13 [sleep]:
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:307
time.Sleep(0x2540be400)
/usr/local/go/src/runtime/time.go:105 +0x159
github.com/valyala/fasthttp.(*HostClient).connsCleaner(0xc0000c5540)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1354 +0x332
created by github.com/valyala/fasthttp.(*HostClient).acquireConn
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1289 +0x192

goroutine 14 [sleep]:
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:307
time.Sleep(0x3b9aca00)
/usr/local/go/src/runtime/time.go:105 +0x159
github.com/valyala/fasthttp.(*TCPDialer).tcpAddrsClean(0x15201c0)
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:367 +0x110
created by github.com/valyala/fasthttp.(*TCPDialer).dial.func1
/go/pkg/mod/github.com/valyala/[email protected]/tcpdialer.go:252 +0x6a

goroutine 20 [runnable]:
github.com/valyala/fasthttp.(*HostClient).connsCleaner(0xc0000c4f00)
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1302
created by github.com/valyala/fasthttp.(*HostClient).acquireConn
/go/pkg/mod/github.com/valyala/[email protected]/client.go:1289 +0x192

goroutine 21 [select]:
net.cgoLookupIP(0x1011220, 0xc00057b140, 0xd3837b, 0x2, 0xc0003f8980, 0x10, 0x200, 0x202, 0x5, 0x1, ...)
/usr/local/go/src/net/cgo_unix.go:217 +0x195
net.(*Resolver).lookupIP(0x15b8760, 0x1011220, 0xc00057b140, 0xd3837b, 0x2, 0xc0003f8980, 0x10, 0x0, 0x0, 0xc00016c480, ...)
/usr/local/go/src/net/lookup_unix.go:96 +0x1a4
net.glob..func1(0x1011220, 0xc00057b140, 0xc0003af2f0, 0xd3837b, 0x2, 0xc0003f8980, 0x10, 0x0, 0xefd1e705c, 0x0, ...)
/usr/local/go/src/net/hook.go:23 +0x72
net.(*Resolver).lookupIPAddr.func1(0x0, 0x0, 0x0, 0x0)
/usr/local/go/src/net/lookup.go:269 +0x116
internal/singleflight.(*Group).doCall(0x15b8770, 0xc00034d400, 0xc0003f89c0, 0x13, 0xc00057b180)
/usr/local/go/src/internal/singleflight/singleflight.go:95 +0x2e
created by internal/singleflight.(*Group).DoChan
/usr/local/go/src/internal/singleflight/singleflight.go:88 +0x29d

Update for CrossShard transaction, test & verify all working

This repo's master assume single shard transaction, that is, hard coded to shard 0 and hence the harmony node repo it was tested against is b4c9a3264a3639367c9baab168aa8e5c7ab2715f This is behind, hence need to update NewTransaction to be instead NewCrossShardTransaction (See the commented out code on tx-controller.go:187

Follow the general outline of the flow, that is, put the toshardID as well in txparams map.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.