Issue with settxfee command of multichain-api

+1 vote

Each time I execute the settxfee command, it will return the Invalid Amount exception.
Below is the sample I am running:

multichain-cli Chain1 settxfee 0.0001
{"method":"settxfee","params":[0.0001],"id":"69308755-1582260946","chain_name":"Chain1"}

error code: -8
error message:
Invalid amount

I have tried different amounts, such as 0.0001, 0.001, 0.01, 0.1, 1, etc.
But each time getting the same error.
Could anyone please provide the solution.

asked Feb 21 by Nikunj Dhameliya
Can you please post the output of getblockchainparams so we can see how the native currency is set up on your chain?
{
  "chain-protocol": "multichain",
  "chain-description": "MultiChain techforce",
  "root-stream-name": "root",
  "root-stream-open": true,
  "chain-is-testnet": false,
  "target-block-time": 15,
  "maximum-block-size": 8388608,
  "maximum-chunk-size": 1048576,
  "maximum-chunk-count": 1024,
  "default-network-port": 6453,
  "default-rpc-port": 6452,
  "anyone-can-connect": false,
  "anyone-can-send": false,
  "anyone-can-receive": false,
  "anyone-can-receive-empty": true,
  "anyone-can-create": false,
  "anyone-can-issue": false,
  "anyone-can-mine": false,
  "anyone-can-activate": false,
  "anyone-can-admin": false,
  "support-miner-precheck": true,
  "allow-arbitrary-outputs": false,
  "allow-p2sh-outputs": true,
  "allow-multisig-outputs": true,
  "setup-first-blocks": 60,
  "mining-diversity": 0.3,
  "admin-consensus-upgrade": 0.5,
  "admin-consensus-txfilter": 0.5,
  "admin-consensus-admin": 0.5,
  "admin-consensus-activate": 0.5,
  "admin-consensus-mine": 0.5,
  "admin-consensus-create": 0,
  "admin-consensus-issue": 0,
  "lock-admin-mine-rounds": 10,
  "mining-requires-peers": true,
  "mine-empty-rounds": 10,
  "mining-turnover": 0.5,
  "first-block-reward": -1,
  "initial-block-reward": 0,
  "reward-halving-interval": 52560000,
  "reward-spendable-delay": 1,
  "minimum-per-output": 0,
  "maximum-per-output": 100000000000000,
  "minimum-offchain-fee": 0,
  "minimum-relay-fee": 0,
  "native-currency-multiple": 100000000,
  "skip-pow-check": false,
  "pow-minimum-bits": 8,
  "target-adjust-freq": -1,
  "allow-min-difficulty-blocks": false,
  "only-accept-std-txs": true,
  "max-std-tx-size": 4194304,
  "max-std-op-returns-count": 32,
  "max-std-op-return-size": 2097152,
  "max-std-op-drops-count": 5,
  "max-std-element-size": 40000,
  "chain-name": "techforce",
  "protocol-version": 20011,
  "network-message-start": "f6e3dee1",
  "address-pubkeyhash-version": "00d30a07",
  "address-scripthash-version": "058edcb9",
  "private-key-version": "80ff8c62",
  "address-checksum-value": "1e8bd090",
  "genesis-pubkey": "02748f6a219a02138ba8a2e5dbc6c651cf4f5c767c2e858fec4583b214d171b610",
  "genesis-version": 1,
  "genesis-timestamp": 1580798038,
  "genesis-nbits": 536936447,
  "genesis-nonce": 165,
  "genesis-pubkey-hash": "dfbc0daec60602be631a4bbfd75137f07e451fc1",
  "genesis-hash": "001d24c20cf20caeb441cd622411c8a7a0333e706f899d10f81fc8c1739828b9",
  "chain-params-hash": "3f30fe811f21c2fffb4bddddc8ce74c6725e11df235dc66d29d948ff350b6442"
}

1 Answer

0 votes
 
Best answer
Looking at your blockchain parameters, the issue is that you have no native currency set up on your blockchain, so it not possible to charge transaction fees. Please look at the 'Native blockchain currency' section on this page:

https://www.multichain.com/developers/blockchain-parameters/
answered Mar 11 by MultiChain
selected Mar 12 by Nikunj Dhameliya
Thanks for the solution.

When I check param.dat I have found the following settings for the native blockchain currency:

initial-block-reward = 0                # Initial block mining reward in raw native currency units. (0 - -1486618624)
first-block-reward = -1                 # Different mining reward for first block only, ignored if negative. (-1 - -1486618624)
reward-halving-interval = 52560000      # Interval for halving of mining rewards, in blocks. (60 - 1000000000)
reward-spendable-delay = 1              # Delay before mining reward can be spent, in blocks. (1 - 100000)
minimum-per-output = 0                  # Minimum native currency per output (anti-dust), in raw units.
                                        # If set to -1, this is calculated from minimum-relay-fee. (-1 - 1000000000)
maximum-per-output = 100000000000000    # Maximum native currency per output, in raw units. (0 - -1486618624)
minimum-offchain-fee = 0                # Minimum fee for publishing off-chain data items, per 1000 bytes, in raw units of native currency. (0 - 1000000000)
minimum-relay-fee = 0                   # Minimum transaction fee, per 1000 bytes, in raw units of native currency. (0 - 1000000000)
native-currency-multiple = 100000000    # Number of raw units of native currency per display unit. (0 - 1000000000)

Here I have a couple of questions:
1) why the initial block reward parameter range in negative value (0 to -1486618624).
2) How can I calculate the transaction fee if I wanted to apply it as a percentage like 0.45% per transaction.
3) Is it necessary to create a new blank chain to apply transaction fees or is it okay to continue with the old one?
...