Ways to speed up the TPS for multichain when used as a shared-immutable key–value database

+2 votes
We all know that the tps for bitcoin is only 6~7/s due to POW which is too low .

For multichain we can use it as a shared database , let's assume in a developing env in which the tps might be up to 10000/s  ,how to config multichain to support this as we know all transactions should be packaged into a block and mined by a miner ,like the maximum-block-size? mining-diversity ? consensus algorithm ?

what other paras should be considered ?

Any suggestion would be very greatful
asked Sep 7, 2017 by Leo-LL

1 Answer

+2 votes
First just FYI the bitcoin tps limit is not really related to PoW, since the difficulty of the PoW challenge is unconnected to the number of transactions in the block. The limit is set by various network parameters, which are designed to ensure that it is easy for nodes (and especially miners) on slow connections to keep up, and to prevent the blockchain growing too large on disk. And beyond that, the Bitcoin Core software itself has a limit in how many transactions it can handle per second, based on the complexity of validating blocks and transactions.

In MultiChain we've (a) allow the blockchain parameters to be changed to greatly increased transaction capacity, and (b) rebuilt several parts of the software to support a much higher transaction rate. We still have plenty more to do, but for you can expect to reach about 1000 tps with nodes running on mid-range servers.

In terms of configuration, you should look at the 'Production recommendations' section of this page for detailed suggestions: https://www.multichain.com/developers/blockchain-parameters/
answered Sep 7, 2017 by MultiChain
Hi,

Is it possible if I want to run the test tps on my machine? I did try to test using multichain-cli, but it seem it is impossible to reach 1000 tps.

If it is possible to run the test in my machine, how? Thank you.
You can't use multichain-cli to get to that tps, because each instance of multichain-cli is a separate process on the operating system level, and this takes quite a bit of time to start up.

Instead you need to access the API in a way which does not start a new process each time. One good way is using ab (Apache benchmark). Here are some element of the bash script we use for benchmarking:

echo '{"method":"sendtoaddress","params":["<chain-burn-address>",0],"id":1}' > ./send-request.json

ab -n 100000 -c 2 -A multichainrpc:<rpcpassword> -p ./send-request.json 'http://127.0.0.1:<rpcport>/'

You should replace the items in <brackets> as appropriate.
Hi, I got this result

Concurrency Level:      2
Time taken for tests:   18.019 seconds
Complete requests:      100000
Failed requests:        0
Non-2xx responses:      100000
Total transferred:      29800000 bytes
Total body sent:        32500000
HTML transferred:       10900000 bytes
Requests per second:    5549.84 [#/sec] (mean)

I have only single node running on my VM.
100000tx/18,019s is the throughput transaction right ?

If so how can I get the benchmark for all tx completed write into the blockchain ?

What I need is Benchmark for :
1. Throughput
2. Validate
3. Commit/append to the blockchain

Any recommendation ? Thank you.
First, that transaction throughput is much higher than we'd expect, so you should check that the transactions are actually taking place on the blockchain. It looks more likely that some error is being generated instead. You should test posting this request with curl as well, to see what is in the response:

curl --user multichainrpc:<rpcpassword> --data-binary @send-request.json -H 'content-type: text/plain;' http://127.0.0.1:<rpcport>

Given that, you can test the full life cucle blockchain performance by running API requests for long enough for the transactions to be confirmed in blocks. You can confirm this by running getmempoolinfo/getinfo API commands to see the number of unconfirmed transactions, and the number of blocks on the chain.
Oh the previous result contain some error: the burning address do not have receive permission as I using curl as u instruct.

the result after I add receive permission is :

Concurrency Level:      2
Time taken for tests:   112.508 seconds
Complete requests:      100000
Failed requests:        0
Total transferred:      26700000 bytes
Total body sent:        32500000
HTML transferred:       9800000 bytes
Requests per second:    888.82 [#/sec] (mean)

BTW: why the burning address is not by default have receive permission ?

For transaction confirmed in block measure, we need to set clock by ourself ? or just check the time stamp ?
The burn address does not have receive permissions by default because burning assets is a potentially dangerous action, and therefore it should be explicitly enabled.

Can you please explain what you mean by "transaction confirmed in block measure"?
transaction confirmed in block measure: duration for transaction/transactions takes to confirm in the blockchain or
the duration take to appended new confirm tx to the blockchain.

Using ab command can get only thought put tps not the duration for blocks are being added to the blockchain.

so I am wonder how to get to measure the tps when is the transaction confirm.
e.g, if I request 10000 tx, how long it will take for Confirm that tx and append into Blockchain ?
I understand. So you just need to keep your test running long enough, and you'll start to see the transactions generated by the test being confirmed. You can verify this by running the getmempoolinfo and getinfo API commands to see the number of unconfirmed transactions, and the number of blocks on the chain. For example if your target block time is 10 seconds, run your test for say 2 minutes, and you'll get an accurate speed measure that includes the full life cycle of a transaction, up to the point where it's confirmed.
Hi, can you provide json of method "sendassetfrom" , I did try :

{
    "method": "sendassetfrom",
    "param": [{
        "from-address": "19vpjciJ4NQc8MNeV6uKRqe2p7zaWCHDz4zJJv",
        "to-address": "1FQQHT8b9zxUCxdRtJEWmuumUunmEda2VtFPem",
        "USD": 0.01
    }],
    "id": 1
}

but no luck, anywhere that I can look up for the parameter to call multichain API, I never been experience with calling BTC API before. Thank you .
The APIs are all documented on this page:

https://www.multichain.com/developers/json-rpc-api/

And parameters are passed as an array without labels. In this case you would need this inside the JSON-RPC request:

"params" : ["19vpjciJ4NQc8MNeV6uKRqe2p7zaWCHDz4zJJv", "1FQQHT8b9zxUCxdRtJEWmuumUunmEda2VtFPem", "USD", 0.01]

Also if you use multichain-cli it outputs the full JSON-RPC request for every command to the terminal.
...