Skip to content

invalid chain id for signer for  #112

@yurenji

Description

@yurenji

I tried to create a transaction following the sdk example:

  const hmy = new Harmony(
    'https://api.fuzz.fi/',
    {
        chainType: ChainType.Harmony,
        chainId: ChainID.Harmony,
    },
  );
  hmy.wallet.addByPrivateKey('');
  const txn = hmy.transactions.newTx({
    to: receiver_address,
    value: new Unit(1).asOne().toWei(),
    gasLimit: '21000',
    shardID: 0,
    toShardID: 0,
    gasPrice: new hmy.utils.Unit('31').asGwei().toWei(),
  });
  const signedTxn = await hmy.wallet.signTransaction(txn);
  const txnHash = await hmy.blockchain.sendTransaction(signedTxn);

but got the following error msg:

{
  jsonrpc: '2.0',
  id: 3,
  error: {
    code: -32000,
    message: 'blockchain chain id:1, given 2: invalid chain id for signer'
  },
  req: {
    payload: {
      jsonrpc: '2.0',
      id: 3,
      method: 'hmy_sendRawTransaction',
      params: [Array]
    },
    url: 'https://api.fuzz.fi/',
    options: {
      method: 'POST',
      timeout: 120000,
      headers: [Object],
      user: null,
      password: null
    }
  },
  responseType: 'raw'
}

Not sure why since only one chainId is provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions