RPC API

net_version

Returns the ID of the current connected network.

Parameter

None

Return Value
  • String – ID of the current connected network.
    • “1”: MAN Mainnet
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'

Response:

1
2
3
4
5
{
"id":67,
"jsonrpc": "2.0",
"result": "1"
}

net_listening

If the client is in a listening state, the call returns true.

Parameter

None

Return Value
  • Boolean – When the client is in a listening state, it returns true. Otherwise, it returns false.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'

Response:

1
2
3
4
5
{
"id":67,
"jsonrpc":"2.0",
"result":true
}

net_peerCount

Returns the number of peers connected to the current client.

Parameter

None

Return Value
  • QUANTITY – Integer, the number of connected peers.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":67}'

Response:

1
2
3
4
5
{
"id":67,
"jsonrpc": "2.0",
"result": "0x2" // 2
}

man_protocolVersion

Returns the current protocol version.

Parameter

None

Return Value
  • String – Current version of MAN protocol.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_protocolVersion","params":[],"id":67}'

Response:

1
2
3
4
5
{
"id":67,
"jsonrpc": "2.0",
"result": "54"
}

man_mining

If the client is actively mining, the call returns true.

Parameter

None

Return Value
  • Boolean – When the client is mining, it returns true, otherwise it returns false.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_mining","params":[],"id":71}'

Response:

1
2
3
4
5
{
"id":71,
"jsonrpc": "2.0",
"result": true
}

man_hashrate

Returns the number of hashes that can be calculated per second when mining.

Parameter

None

Return Value
  • QUANTITY – The number of hashes calculated per second.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_hashrate","params":[],"id":71}'

Response:

1
2
3
4
5
{
"id":71,
"jsonrpc": "2.0",
"result": "0x38a"
}

man_getDepositByAddr

Returns the stake information of the specified account.

Parameter
  • String – String, MAN address.
  • QUANTITY|TAG – Integer block number, or the “latest” string .
Return Value
  • OBJECT – The information of stake account is structured as follows:
    • AddressA0: STRING – The address of stake.
    • SignAddressA1: STRING – The address of signature.
    • OnlineTime: QUANTITY – Integer, online time, counted by block height.
    • Role: QUANTITY – Election identity, 128: Verifiers; 16: Miners.
    • PositionNonce: QUANTITY-Integer, position nonce value.
    • Dpstmsg:OBJECT- stake position information list, stake warehouse information structure is as follows:
      • DepositType:QUANTITY-Integer,//0-flexible,1-fixed1month,3-fixed3months,6-fixed6months.
      • DepositAmount:QUANTITY-Integer, stake amount in zhu.
      • Interest:QUANTITY-Integer,interest value in zhu.
      • Slash:QUANTITY-Integer, punish value in zhu.
      • BeginTime: QUANTITY-Integer, UTC time, the start time of stake; The start time of flexible stake is 0 .
      • EndTime: QUANTITY-Integer, UTC time, represents the unstake time for fixed stakes, or the earliest withdrawal time for flexible stakes.
      • Position: QUANTITY-Integer, the number of warehouse.
    • WithDrawInfo:OBJECT-Refund object array, the information structure of refund object is as follows:
      • WithDrawAmount:QUANTITY-Integer, refund amount in zhu
      • WithDrawTime:QUANTITY-Integer, UTC time, refund time
Example

Request:

1
curl -X POST --data {"jsonrpc":"2.0","method":"man_getDepositByAddr","params":["MAN.4Pn182LSJ3JNr9by4T5kDKsf127Jb", "latest"],"id":67}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"jsonrpc": "2.0",
"id": 67,
"result": {
"AddressA0": "MAN.4Pn182LSJ3JNr9by4T5kDKsf127Jb",
"AddressA1": "MAN.Tfr4DZYNeWqqTth87phrg2KZcqya",
"OnlineTime": "0x81923",
"Role": "0x80",
"PositionNonce": 0,
"Dpstmsg": [
{
"DepositType": 0,
"DepositAmount": "0x8631d81fc94c92f9b336d",
"Interest": "0x2bf9f54df6717b96ef",
"Slash": "0x0",
"BeginTime": 0,
"EndTime": 0,
"Position": 0,
"WithDrawInfolist": []
}
]
}
}

man_getDeposit

Returns the stake information of the specified block. The block is specified by height.

Parameter
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string .
1
2
3
params: [
' 0xac477 '// 705655
]
Return Value
  • OBJECT – The information of stake account is structured as follows:
    • Address: STRING – The address of stake.
    • SignAddress: STRING – The address of signature.
    • Deposit: QUANTITY – Stake amount.
    • Withdraw: QUANTITY – Election state, 0, in the election; non-0, withdrawal height.
    • OnlineTime: QUANTITY – Integer, online time, counted by block height.
    • Role: QUANTITY – Election identity, 128: Verifiers; 16: Miners.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getDeposit","params":["0x01"],"id":67}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"jsonrpc": "2.0",
"id": 67,
"result": [
{
"Address": "MAN.4M29vNSn7jG1dwLs7bxG2RHYLikWG",
"SignAddress": "MAN.3EX7HepVHi85wAh6duzGotYGbpBQR",
"Deposit": 1e+25,
"WithdrawH": 0,
"OnlineTime": 0,
"Role": 128
},
{
"Address": "MAN.439xNJTQrmmYEkm2wm5ThU79UsMiu",
"SignAddress": "MAN.4URp9YU7ufxNf1i1EbUs1PGhYwFzJ",
"Deposit": 1e+25,
"WithdrawH": 0,
"OnlineTime": 0,
"Role": 128
},
{
"Address": "MAN.2LrYy4EbhAi7Az4HdzKHbbyraMPBj",
"SignAddress": "MAN.4PMxVeKv9JZpBxK8oWcMDmcTUZtn9",
"Deposit": 1e+22,
"WithdrawH": 0,
"OnlineTime": 0,
"Role": 16
}
]
}

man_getMatrixCoin

Returns the multi-currency information.

Parameter
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
1
2
3
params:  [
"latest"
]
Return Value
  • OBJECT – STRING array, the names of multi-currency.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getMatrixCoin","params":[ "latest"],"id":67}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
"jsonrpc": "2.0",
"id": 67,
"result": [
"MBN",
"MCN",
"MDN",
"MEN",
"MIN",
"MSN",
"MUSD"
]
}

man_getMatrixCoinConfig

Returns the configuration information for multi-currency.

Parameter
  • STRING – The name of currency.
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
1
2
3
4
params: [
'MEN',
'latest'
]
Return Value
  • OBJECT – Currency configuration information. The structure is as follows:
    • CoinRange: STRING. The range of the coin.
    • CoinType: STRING. The name of the coin.
    • PackNum: QUANTITY. Integer, the maximum number of transactions per block.
    • CoinUnit: QUANTITY. Integer, coin unit.
    • CoinTotal: QUANTITY. Integer, coin total circulation.
    • CoinAddress: DATA, 20 bytes. Coin transaction fee account address.
Example

Request:

1
curl -X POST --data '  {"jsonrpc":"2.0","method":"man_getMatrixCoinConfig","params":["MEN", "latest"],"id":67}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"jsonrpc": "2.0",
"id": 67,
"result": [
{
"CoinRange": "MEN",
"CoinType": "MEN",
"PackNum": 9999,
"CoinUnit": "0xde0b6b3a7640000",
"CoinTotal": "0x33b2e3c9fd0803ce8000000",
"CoinAddress": "0x8000000000000000000000000000000000000001"
}
]
}

man_getDestroyBalance

Returns the number of MANs consumed to create multiple currencies.

Parameter

None

Return Value

QUANTITY – Integer, the number of MANs consumed to create multiple currencies in zhu.

Example

Request:

1
{"jsonrpc":"2.0","method":"man_getDestroyBalance","params":[ "latest"],"id":67}

Response:

1
2
3
4
5
{
"jsonrpc": "2.0",
"id": 67,
"result": "0x152d02c7e14af6800000" // 100000000000000000000000
}

man_getSignAccountsByHash

Returns a list of block signatures for the specified block. The block is specified by hash.

Parameter
  • DATA - 32 bytes,block hash
1
2
params: [       '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
]
Return Value
  • Object Array – The array of signature object. The signature structure is as follows:
    • Sign: DATA, 65 bytes – signature
    • Account:STRING, – signature account
    • Validate:BOOL, – signature state。TRUE:signed;FALSE:unsigned
    • Stock: QUANTITY, stock right. Invalid for now.
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getSignAccountsByHash","params":["0x43cfffb8029e9ac1f380f0b970b0be0bdfdf96bc42599cc110ca31f00aa14d12"],"id":67}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
"jsonrpc": "2.0",
"id": 67,
"result": [
{
"sign": "0xf3fd53b57786bee28aa27e8439251e8c1c5233db964b8b69528ebc46861e79090f4ae49e617707c11e121e24ef099160262bcdf2347033d399d003ef7f6d69e100",
"account": "MAN.3pTAH8pGwmJ94Zm1B1sNMcm4q1kVr",
"validate": true,
"stock": 0
},
{
"sign": "0xcd577141ac1a9173316f20df9a39318a107169c5d93659a04b749cddb606e9f16e70b37cad5230c4e4a0e2c071f5d6b701dadf005211539b92309a9fc75e6c4501",
"account": "MAN.4Pn182LSJ3JNr9by4T5kDKsf127Jb",
"validate": true,
"stock": 0
},
{
"sign": "0xdc61de03cae70a4e010c695c123142e51aa9beff7b29be25c09cf784130558c634044c5d86f9c19898255d95494283a19ac77bb7ab59c96159537b6fa94a858f01",
"account": "MAN.23983gYFh8YH1ovpzKa3wpcNaRVn7",
"validate": true,
"stock": 0
}
]
}

man_getSignAccountsByNumber

Returns a list of block signatures for the specified block. Block is specified by height.

Parameter
  • QUANTITY|TAG - Integer block number, or the “latest”, “earliest” string
1
2
3
params: [
'0x1b4', // 436
]
Return Value

Refer to man_getSignAccountsByHash Return Value.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getSignAccountsByNumber","params":["0x1b4"],"id":67}'

Response:

Refer to man_getSignAccountsByHash Response.

man_call

Immediately executes a new message call, without the need to create a transaction on the blockchain.

Parameter
  • Object – Transaction call object
    • from: STRING – The original address of the sending transaction, optional.
    • to: STRING – Transaction target address
    • gas: QUANTITY – The amount of gas available for trading, optional. man_call does not consume gas, but some implementations require this parameter
    • gasPrice: QUANTITY – gas price, optional
    • value: QUANTITY – The number of MAN coins sent by the transaction, optional
    • data: DATA – Method signature and hash of the encoding Parameter, optional
    • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
Return Value

DATA – Return Value of the executed contract.

Example

Request:

1
curl -X POST --data '{"jsonrpc": "2.0","method": "man_call","params": [{"to": "MAN.468kLTuAEjm53ro2pPErnAAHqbccK","data": "0x58975919","currency": "MAN"},"latest"],"id": 67}'

Response:

1
2
3
4
5
{
"jsonrpc": "2.0",
"id": 67,
"result": "0x0000000000000000000000000000000000000000000000000000000000000006"
}

man_getValidatorGroupInfo

Returns the joint mining information of the specified block. Block is specified by block height.

Parameter
  • QUANTITY|TAG - Integer block number, or the “latest”, “earliest” string .
1
2
3
params: [
'latest'
]
Return Value

OBJECT – Joint Mining Information MAP. MAP: subcontract address as key value; STRING; slice with contract storage information as value, OBJECT.

The contract storage information structure is as follows:

  • OwnerInfo.OBJECT, contract creation information is structured as follows:

    • Owner: String – Owner account address
    • SignAddress: String – Signature account address
    • WithdrawAllTime: QUANTITY – All revocation time
  • Reward.OBJECT, return allocation information is structured as follows:

    • LevelRate: OBJECT – Participant Threshold and Returns Ratio Information, structured as follows:

      • Rate: OBJECT – Distribution proportional coefficient { Decimal : denominator; Rate: numerator };

      • Threshold: QUANTITY – Integer, minimum threshold for participation. Unit zhu.

    • NodeRate: OBJECT – Management fee information is structured as follows:

      • Decimal: QUANTITY – Integer, denominator of management fee ratio.

      • Rate: QUANTITY – Integer, numerator of management fee ratio.

    • OwnerRate: OBJECT – owner return ratio information, structured as follows:

      • Decimal: QUANTITY – Integer, denominator of owner’s return ratio.

      • Rate: QUANTITY – Integer, numerator of owner’s return ratio.

    • ValidatorMap: OBJECT, an array of participant information, including Owner; participant information structure is as follows:

      • Address: STRING – Participant account address;
      • Reward: QUANTITY – Integer, Incentive distribution accumulated value.When the user extracts the reward, the value is subtracted from the user extracts value.
      • AllAmount: QUANTITY – Integer, Total stake amount.
      • Current: OBJECT – flexible stake information, structured as follows:
        • Amount: QUANTITY – Integer, the amount of flexible stake.
        • PreAmount: QUANTITY – Integer, the amount of flexible stake in the previous round.
        • Interest: QUANTITY – Integer, flexible interest.
        • WithdrawList: Withdraw stake information list a) WithDrawAmount Withdraw Amount;b) .
      • WithDrawTime :Withdraw time
      • Positions: OBJECT – fixed stake warehouse information list; fixed stake information is structured as follows:
        • DType: QUANTITY – Integer, fixed stake type
        • Position: QUANTITY – Integer, fixed stake warehouse
        • Amount: QUANTITY – Integer, fixed stake amount
        • EndTime: QUANTITY – Integer, fixed stake end time
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getValidatorGroupInfo","params":["0x910f0"],"id":1}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"MAN.w8Nvei3g98GAtbuCzPWHb9UiDRZj": {
"OwnerInfo": {
"Owner": "MAN.s7jf4pkbZdfnUaZyDL4EGZprWrHm",
"SignAddress": "MAN.4SYA8BxUZaevRXczJvdoSMT2p89Np",
"WithdrawAllTime": 0
},
"Reward": {
"LevelRate": [
{
"Rate": {
"Decimal": "1000000000",
"Rate": "1"
},
"Threshold": "0"
},
{
"Rate": {
"Decimal": "1000000000",
"Rate": "1"
},
"Threshold": "10000000000000000000000"
},
{
"Rate": {
"Decimal": "1000000000",
"Rate": "1"
},
"Threshold": "100000000000000000000000"
}
],
"NodeRate": {
"Decimal": "1000000000",
"Rate": "0"
},
"OwnerRate": {
"Decimal": "1000000000",
"Rate": "1"
}
},
"ValidatorMap": [
{
"Address": "MAN.B1dmKTmWqNfHpv6mKytRrCy2NkWi",
"AllAmount": "100000000000000000000",
"Current": {
"Amount": "100000000000000000000",
"Interest": "5891875148930089",
"PreAmount": "0",
"WithdrawList": []
},
"Positions": [],
"Reward": "57970186835851759"
},
{
"Address": "MAN.G8dYKuZvPQAqVXRSzCTV7sYPhGFK",
"AllAmount": "10000000000000000000000",
"Current": {
"Amount": "10000000000000000000000",
"Interest": "589187514893008924",
"PreAmount": "0",
"WithdrawList": []
},
"Positions": [],
"Reward": "0"
}
]
}
}
}

man_getStorageAt

Returns the value of the specified address storage location.

Parameter
  • STRING –String, MAN address
  • QUANTITY – Location number in storage
  • STRING –String, currency name
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
Return Value

DATA – The value of the specified storage location.

Example

Calculate the correct location based on the storage to be extracted. Considering the following contract,MAN.o8WM6Sq643rUfAHvpx2MYZLFWwhr deployed at address MAN.aR54tfdEWDfsfHhdsy6BkRVGRYLj

1
2
3
4
5
6
7
8
9
10
contract Storage {
uint pos0;
mapping(address => uint) pos1;


function Storage() {
pos0 = 1234;
pos1[msg.sender] = 5678;
}
}

Extracting the value of pos0 is straightforward:

1
curl -X POST --data '{"jsonrpc":"2.0", "method": "man_getStorageAt", "params": ["0x295a70b2de5e3953354a6a8344e616ed314d7251", "0x0", "MAN", "latest"], "id": 1}' localhost:8545

Response result:

1
{"jsonrpc":"2.0","id":1,"result":"0x00000000000000000000000000000000000000000000000000000000000004d2"}

It is more difficult to extract members from the swap table. Membership positions in the swap table are
calculated as follows:

1
keccack(LeftPad32(key, 0), LeftPad32(map position, 0))

This means if we want to extract the value of pos1[“MAN.o8WM6Sq643rUfAHvpx2MYZLFWwhr “],
we need to calculate the followings:

1
keccak(decodeHex("000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"))

The web3 Library that comes with the gman console can be used to do this calculation:

1
2
3
4
> var key = "000000000000000000000000391694e7e0b0cce554cb130d723a9d27458f9298" + "0000000000000000000000000000000000000000000000000000000000000001"
undefined
> web3.sha3(key, {"encoding": "hex"})
"0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9"

Now you can extract the value of the specified location:

1
curl -X POST --data '{"jsonrpc":"2.0", "method": "man_getStorageAt", "params": ["MAN.aR54tfdEWDfsfHhdsy6BkRVGRYL", "0x6661e9d6d8b923d5bbaab1b96e1dd51ff6ea2a93520fdc9eb75d059238b8c5e9", "latest"], "id": 1}' localhost:8545

Response results are as follows:

1
{"jsonrpc":"2.0","id":1,"result":"0x000000000000000000000000000000000000000000000000000000000000162e"}

man_getTopologyStatusByNumber

Returns the top-level node topology information of the specified block. Block is specified by height.

Parameter
  • QUANTITY|TAG - Integer block number, or the “latest”, “earliest” string
1
2
3
params:  [
'0xac477', // 705655
]
Return Value

Object – Matched Topological Information Objects. The structure is as follows:

  • leader_reelect: BOOL – Verifier Reelection Status. False: No verifier re-election occurred; True: Verifier re-election occurred;
  • validators: An array of verifier information. The verifier information structure is as follows:
    • account: STRING – Account;
    • online: BOOL – Online status. True: Online; False: Offline
    • position: QUANTITY – Location number
  • backup_validators: Backup the verifier information array. For backup verifier information structure, see verifier information structure.
  • miners: Miners information array. For miner information structure, see verifier information structure.
  • elect_validators: Verifier masternode consensus online and offline information. For information structure, see verifier information structure.
  • electbackupvalidators: Verifier backup node consensus online and offline information. For information structure, see verifier information structure.
Example

Request:

1
curl -X POST --data {"jsonrpc":"2.0","method":"man_getTopologyStatusByNumber","params":["0xac477"],"id":67}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
{
"jsonrpc": "2.0",
"id": 67,
"result": {
"leader_reelect": false,
"validators": [
{
"account": "MAN.4Pn182LSJ3JNr9by4T5kDKsf127Jb",
"online": true,
"position": 8192
},
{
"account": "MAN.23983gYFh8YH1ovpzKa3wpcNaRVn7",
"online": true,
"position": 8193
},
… //省略
{
"account": "MAN.2JJ1KuzNDAgfRRby6hfM7V256V1mD",
"online": true,
"position": 8210
}
],
"backup_validators": [
{
"account": "MAN.31uRb2uAFrGvAoJwurJaZrNwpw6vn",
"online": true,
"position": 12288
},
…//省略
{
"account": "MAN.3ygAdEiWqv9U8pdQxw6T5C8DGqYqF",
"online": true,
"position": 12291
},
{
"account": "MAN.kaXBV56J1MayJzrcTQdm4LaGKA6a",
"online": true,
"position": 12292
}
],
"miners": [
{
"account": "MAN.253ZT6RZWK28o78gqAn2HkS73mcdN",
"online": true,
"position": 0
},
{
"account": "MAN.3pFY9DFmU3MWTFQeQRiCzs9bzKyqm",
"online": true,
"position": 1
},
…//省略
{
"account": "MAN.NcLaq3ZuHvuahrBn1tBNzGz55giv",
"online": true,
"position": 31
}
],
"elect_validators": null,
"elect_backup_validators": [
{
"account": "MAN.2mHv8WkPczgZaoruUx9nn8b7dQaev",
"online": false,
"position": 61440
}
]
}
}

man_getBlackList

Returns transaction blacklist accounts, which cannot transfer transactions.

Parameter

None

Return Value

OBJECT: String array – Blacklisted transaction account address.

Example

Request:

1
curl -X POST --data {"jsonrpc":"2.0","method":"man_getBlackList ","params":[],"id":67}

Response:

1
2
3
4
5
{  
"jsonrpc": "2.0",
"id": 67,
"result": {"MAN.4Pn182LSJ3JNr9by4T5kDKsf127Jb","MAN.Tfr4DZYNeWqqTth87phrg2KZcqya"
}

Note: Non-consensus data, node data, are unauthenticated on the chain.

man_blockNumber

Returns the number of the latest block.

Parameter

None

Return Value

QUANTITY – the number of the current block.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_blockNumber","params":[],"id":83}'

Response:

1
2
3
4
5
{
"id":83,
"jsonrpc": "2.0",
"result": "0x4b7" // 1207
}

man_estimateGas

Executes and estimates the amount of gas required for a transaction. The transaction will not be written to the blockchain. Note that, for reasons such as the EVM mechanism and node performance, the estimated values may be much larger than during actual usage.

Parameter

Object - Transaction call object.

  • Referring to the Parameter called by man_call, all attributes are optional. If no gas consumption ceiling is specified, gman will use the gas ceiling of the pending block. In this case, the gas estimate returned may not be sufficient to execute the actual transaction.
Return Value

QUANTITY – gas usage estimated value.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_estimateGas","params":[{see above}],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0x5208" // 21000
}

man_getBalance

Returns the balance of the specified address account.

Parameter
  • STRING – The address in which the balance needs to be checked
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
1
2
3
4
params: [
'MAN.21LDRQtTVBdv3EcktxrVQebpQmLEA',
'latest'
]
Return Value

OBJECT – The corresponding account currency balance object array is structured as
follows:

  • accountType: QUANTITY –Integer, currency number. 0, represents the main currency, MAN
  • balance: QUANTITY –Integer, balance, Unit: zhu
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getBalance","params":["  MAN.21LDRQtTVBdv3EcktxrVQebpQmLEA ", "latest"],"id":1}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"accountType": 0,
"balance": "0xaf572216ba03ec528459"
},
{
"accountType": 1,
"balance": "0x0"
},
{
"accountType": 2,
"balance": "0x0"
},
{
"accountType": 3,
"balance": "0x0"
},
{
"accountType": 4,
"balance": "0x0"
}
]
}

man_getSelfLevel

Returns the identity of the current node in the network.

Parameter

None

Return Value

QUANTITY – Identity mark. 0: Error; 1-4 bucket; 5 top-level nodes; 6 basic nodes.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getSelfLevel","params":[],"id":71}'

Response:

1
2
3
4
5
{
"id":71,
"jsonrpc": "2.0",
"result": "6" //普通节点
}

man_getCode

Returns the code for the specified address.

Parameter
  • STRING-String, MAN address.
  • STRING-String, currency name.
  • QUANTITY|TAG - Integer block number, or the “latest”, “earliest” string.
1
2
3
4
5
params: [
'MAN.3MouXqgBjKoaEhEn2y11qDqUwpZGi',
'MAN', //MAN币
'0x2' // 2
]
Return Value

DATA – The code at the specified address.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getCode","params":["MAN.3MouXqgBjKoaEhEn2y11qDqUwpZGi", "MAN", "0x2"],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0x600160008035811a818181146012578301005b601b6001356025565b8060005260206000f25b600060078202905091905056"
}

man_getGasPrice

Returns the current price of gas, unit: zhu.

Parameter

None

Return Value

QUANTITY – Integer, the current price of gas, unit: zhu.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_gasPrice","params":[],"id":73}'

Response:

1
2
3
4
5
{
"jsonrpc": "2.0",
"id": 73,
"result": "0x430e23400" //18000000000
}

man_getUpTime

Returns the uptime of the specified account from the latest mortgage to the specified block. The block is specified by the block height.

Parameter
  • STRING – Account address
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
1
2
3
4
params:  [
‘MAN.4Kq1ciivykmrCFzz5YjLgamcNdU76’,
‘0xac441’ // 705601
]
Return Value

QUANTITY – Integer online time, counted by block height.

Example

Request:

1
curl -X POST --data '  {"jsonrpc":"2.0","method":"man_getUpTime","params":["MAN.4Pn182LSJ3JNr9by4T5kDKsf127Jb", "latest"],"id":67} '

Response:

1
2
3
4
5
{
"jsonrpc": "2.0",
"id": 67,
"result": "0x85edb"
}

man_getTransactionByBlockNumberAndIndex

Returns the transaction with the specified index number in the specified block. The block is specified by height.

Parameter
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string.
  • QUANTITY – The index number of the transaction in the block.
1
2
3
4
params: [
'latest',
'0x0' // 0
]
Return Value

Query the return value of man_getTransactionByHash.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getTransactionByBlockHashAndIndex","params":["latest", "0x0"],"id":1}'

Response:

Please refer to the return value of man_getTransactionByHash.

man_getTransactionByBlockHashAndIndex

Returns the transaction with the specified index number in the specified block.

Parameter
  • DATA, 32 bytes – block hash
  • QUANTITY – The index number of the transaction in the block
1
2
3
4
params: [
'0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331',
'0x0' // 0
]
Return Value

Query the return value of man_getTransactionByHash.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getTransactionByBlockHashAndIndex","params":["0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b", "0x0"],"id":1}'

Response:

Return Value refers to the return value of man_getTransactionByHash.

man_getTransactionByHash

Returns a transaction with the specified hash value.

Parameter

DATA, 32 bytes – transaction hash value

1
2
3
params:  [
"0x069a568bd06988107b78266fbf66ff9cbdd0fedf35226056e01bbbdaa096fad4"
]
Return Value

Object – The object of the transaction. If no matching transaction is found, null is returned. The structure is as follows:

  • hash: DATA, 32 bytes – transaction hash
  • nonce: QUANTITY – Number of transactions that occurred prior to this transaction by the sender
  • blockHash: DATA, 32 bytes – Hash value of blocks containing transactions. Pending blocks return null
  • blockNumber: QUANTITY – Block number of blocks containing transactions. Pending blocks return null
  • transactionIndex: QUANTITY – Transaction Index. Pending blocks return null
  • from: String, – Transaction sender address
  • to: String, – Transaction receiver address
  • value: QUANTITY – the quantity of MAN sent, unit: zhu
  • gasPrice: QUANTITY – the price of gas paid by the sender, unit: zhu
  • gas: QUANTITY – the amount of gas available to the sender
  • input: DATA – data sent alongside the transaction
  • v: QUANTITY – ECDSA recovery id
  • r: DATA, 32 bytes – ECDSA signature r
  • s: DATA, 32 bytes– ECDSA signature s
  • TxEnterType: transaction pool types (normal transactions are set as 0)
  • matrixType: transaction types (normal transactions are set as 0)
  • IsEntrustTx:
    • 0: self-paid gas
    • 1: gas paid by others
  • CommitTime: submit time, available to scheduled transactions and revocable transactions only
  • Currency: type of currency
  • ExtraTo: extended transaction (should be filled for one to many transactions)
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getTransactionByHash","params":["0x069a568bd06988107b78266fbf66ff9cbdd0fedf35226056e01bbbdaa096fad4"],"id":1}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xcbab7bd316a0a3be43d614f4d9beac8a7d8769c21e5a72dd3ee2edf3abab0a58",
"blockNumber": "0x52e8d",
"from": "MAN.4TZg4pDv6pVvAC8JDeKSCsYvH4g2Y",
"gas": "0x33450",
"gasPrice": "0x430e23400",
"hash": "0x069a568bd06988107b78266fbf66ff9cbdd0fedf35226056e01bbbdaa096fad4",
"input": "0x",
"nonce": "0x10000000000000",
"to": "MAN.pTopMhASaNr9WaKSRnj7p4WuEtE4",
"transactionIndex": "0x3",
"value": "0x21e27c1806e59a40000",
"v": "0x25",
"r": "0x1dc72ba66c23a3994b4fa9d7c55db71909bcb1452a459a6c337807990792f5ab",
"s": "0x29daa105765b7363de8b9bf553f0e94382a70efb10b104f9f8e5c48b264b2bba",
"TxEnterType": 0,
"IsEntrustTx": false,
"Currency": "MAN",
"CommitTime": "0x5ce45b01",
"matrixType": 0,
"extra_to": null
}
}

man_getBlockTransactionCountByHash

Returns the number of transactions within the specified block. Use hash to specify the block.

Parameter

DATA – 32bytes, block hash

1
2
3
params: [
'0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238'
]
Return Value

QUANTITY – The number of transactions within a specified block, integer

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0xb" // 11
}

man_sendRawTransaction

Initiates a transaction or contract to sign a transaction.

Parameter

Object – The structure is as follows:

  • from: String – Specified sender’s address. If not specified, use man. defaultAccount
  • to: String – The target address of the transaction. If created by a contract, it is null
  • value: Number|String|BigNumber – Number of currencies carried in a transaction, in zhu. If the transaction is created through a contract, it is the initial capital.
  • gas: Number|String|BigNumber – The amount of gas used in transactions; unused gases will be returned.
  • gasPrice: Number|String|BigNumber – Gas fees for transactions
  • data: String – (optional) a byte string containing relevant data. If created through a contract, it is the code used for initialization.
  • nonce: Number – Integer, using this value you can use the same nonce to cover your own pending transactions.
  • V: Signature results
  • R: Signature results
  • S: Signature results
  • Currency: The type of currency
  • TxType: transaction type (normal transaction set to 0)
  • LockHeight: Reserved fields
  • IsEntrustTx:
    • 0: self-paid gas
    • 1: gas paid by others
  • CommitTime: Submission time, available only for schduled and revocable transactions
  • ExtraTo: Extended transactions (1 to more transactions should be filled in)
  • TxEnterType: Type of transaction pool (normal transaction set to 0)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
params: [{
"to": "MAN.3RuQmefCBZes1NX2h6pxRrYVQyTd6",
"value": "0x0de0b6b3a7640000",
"gas": "0x033450",
"gasPrice": "0x0430e23400",
"data": "0x",
"nonce": "0x10000000000004",
"r": "0x9125ae7fc89139883c88f8e1ebb02f4bc274f980208bc2aa8687cafd597e003b",
"s": "0x308789e24be11df0332aa1c3e29ef97218073ddfc7f9398ef3abd5a310bcc42f",
"v": "0x26",
"currency": "MAN",
"txType": 0,
"lockHeight": 0,
"isEntrustTx": 0,
"commitTime": 1558506847,
"extra_to": [],
"txEnterType": 0
}]
Return Value

DATA – 32 Bytes, transaction hash. If transaction is invalid, null is returned.

When creating a contract, you can use man_getTransactionReceipt to get the contract address.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_sendRawTransaction","params":[{"to":"MAN.3RuQmefCBZes1NX2h6pxRrYVQyTd6","value":"0x0de0b6b3a7640000","gas":"0x033450","gasPrice":"0x0430e23400","data":"0x","nonce":"0x10000000000004","r":"0x9125ae7fc89139883c88f8e1ebb02f4bc274f980208bc2aa8687cafd597e003b","s":"0x308789e24be11df0332aa1c3e29ef97218073ddfc7f9398ef3abd5a310bcc42f","v":"0x26","currency":"MAN","txType":0,"lockHeight":0,"isEntrustTx":0,"commitTime":1558506847,"extra_to":[],"txEnterType":0}],"id":1}'

Response:

1
2
3
4
5
{
"jsonrpc": "2.0",
"id": 1,
"result": "0xb1234994c858b02f0d50e8986d577aec1c0cd67a40262346c7a7cb43bbd5ea7c"
}

man_getTransactionCount

Return to the number of transactions sent from a specified address.

Parameter
  • DATA – address
  • QUANTITY|TAG – Integer block number, or the “latest”, “earliest” string
1
2
3
4
params:  [
' MAN.499Pb2d1yiYrDpynfyTekLnSWDVvX',
'latest' // state at the latest block
]
Return Value

Number of transactions sent from a specified address (integer). The starting number is 0x10000000000000.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getTransactionCount","params":[" MAN.499Pb2d1yiYrDpynfyTekLnSWDVvX","latest"],"id":1}'

响应:

1
2
3
4
5
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x10000000000000"
}

man_getTransactionReceipt

Returns the receipt for the specified transaction. The transactions are specified by hash.

Please note that receipts for pending transactions are invalid.

Parameter

DATA, 32 bytes - Transaction hash

1
2
3
params:  [
'0x069a568bd06988107b78266fbf66ff9cbdd0fedf35226056e01bbbdaa096fad4'
]
Return Value

Object – Transaction recipients. If the receipt does not exist, null is returned. The structure of transaction options is as follows:

  • transactionHash: DATA, 32 bytes – transaction hash
  • transactionIndex: QUANTITY – transaction Index
  • Currency:STRING-currency name
  • blockHash: DATA, 32 bytes – hash of transaction blocks
  • blockNumber: QUANTITY – transaction block number
  • from: String, the address of transaction sender
  • to: String, the address of transaction recipient
  • cumulativeGasUsed: QUANTITY – Total gas consumption of blocks in the transaction process
  • gasUsed: QUANTITY – The amount of gas consumed in transactions
  • contractAddress: String – In a new contract creation transaction, this value is the newly created contract address. Otherwise, it returns null.
  • logs: Array – An array of log objects generated by this transaction
  • logsBloom: DATA, 256 bytes– bloom filter, lightweight client for fast extraction of related logs
  • status: QUANTITY, 1 (Success) or 0 (Failure)
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getTransactionReceipt","params":["0x069a568bd06988107b78266fbf66ff9cbdd0fedf35226056e01bbbdaa096fad4"],"id":1}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"Currency": "MAN",
"blockHash": "0xcbab7bd316a0a3be43d614f4d9beac8a7d8769c21e5a72dd3ee2edf3abab0a58",
"blockNumber": "0x52e8d",
"contractAddress": null,
"cumulativeGasUsed": "0x5208",
"from": "MAN.4TZg4pDv6pVvAC8JDeKSCsYvH4g2Y",
"gasUsed": "0x5208",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "MAN.pTopMhASaNr9WaKSRnj7p4WuEtE4",
"transactionHash": "0x069a568bd06988107b78266fbf66ff9cbdd0fedf35226056e01bbbdaa096fad4",
"transactionIndex": "0x3"
}
}

man_sendTransaction

Launches a transaction. If the data field contains code, a contract will be created.

Parameter

Object – The object of the transaction. The structure is as follows:

  • from: String – Specified the sender’s address. If not specified, use man.defaultAccount.
  • to: String – The target address of the transaction. If created by a contract, it is null
  • Note: If the transaction is issuing a contract, it is null.
  • value: Number|String|BigNumber – Number of currencies carried in a transaction, in zhu. If the transaction is created through a contract, it is the initial capital.
  • gas: Number|String|BigNumber – The amount of gas used in transactions; unused gases will be returned
  • gasPrice: Number|String|BigNumber – Gas fees for transactions
  • data: String – (optional) a byte string containing relevant data. If created through a contract, it’s code for initialization
  • nonce: Number – Integer, using this value you can use the same nonce to cover your own pending transactions
  • Currency: Type of currency
  • ExtraTo: Extended transactions (1 to more transactions should be filled in)
1
2
3
4
5
6
7
8
9
params: [{
"from": "MAN.499Pb2d1yiYrDpynfyTekLnSWDVvX",
"to": "MAN.3KfF5p9bmPFmS4RYPVVrYociDXm5q",
"currency":"MAN",
"gas": "0x76c0", // 30400
"gasPrice": "0x9184e72a000", // 10000000000000
"value": "0x9184e72a", // 2441406250
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]
Return Value

DATA, 32 bytes – transaction hash. If the transaction is invalid, return 0.

When creating a contract, you can use man_getTransactionReceipt to get the contract address.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_sendTransaction","params":[{see above}],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

man_sign

Matrix signatures are calculated using the following formula:
``sign(keccak256(“\x19Matrix Signed Message:\n” + len(message) + message)))`.
By adding a prefix to the message, the result signature can be recognized as a Matrix signature. This prevents malicious DApp from signing arbitrary data, such as transactions, and using signatures to impersonate others.
It should be noted that the address of the signature must be unlocked.

Parameter

Account, Message

  • STRING – MAN Address
  • DATA – Message to Sign
Return Value

DATA: Signature

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_sign","params":["MAN.CrsnQSJJfGxpb2taGhChLuyZwZJo", "0xdeadbeaf"],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b"
}

man_getBlockTransactionCountByNumber

Returns the number of transactions within the specified block. Use the block number to specify the block.

Parameter

QUANTITY|TAG - Integer block number,or “earliest”, “latest” string.

1
2
3
params:  [
'0xe8', // 232
]
Return Value

QUANTITY – Number of transactions within a specified block

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getBlockTransactionCountByNumber","params":["0xe8"],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0xa" // 10
}

man_accounts

Returns a list of address strings held by the client.

Parameter

None

Return Value

A list of address strings held by the client.

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_accounts","params":[],"id":1}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"jsonrpc": "2.0",
"id": 1,
"result": [
[
"MAN.37FK8J1LXLXHmZV1HxSmkbjKBKYyX",
"MBN.37FK8J1LXLXHmZV1HxSmkbjKBKYy8",
"MCN.37FK8J1LXLXHmZV1HxSmkbjKBKYyF",
"MDN.37FK8J1LXLXHmZV1HxSmkbjKBKYyK",
"MEN.37FK8J1LXLXHmZV1HxSmkbjKBKYy4",
"MIN.37FK8J1LXLXHmZV1HxSmkbjKBKYyz",
"MSN.37FK8J1LXLXHmZV1HxSmkbjKBKYy7",
"MUSD.37FK8J1LXLXHmZV1HxSmkbjKBKYyd"
]
]
}

man_newBlockFilter

Creates a filter in the node to notify when a new block is generated. To check whether the state changes, call man_getFilterChanges.

Parameter

None

Return Value

QUANTITY – Filter Number

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_newBlockFilter","params":[],"id":73}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0x1" // 1
}

man_uninstallFilter

Uninstalls a filter with a specified number. When you do not need to listen, you always need to execute the call. In addition, if the filter does not receive the man_getFilterChanges call within a certain period of time, it will automatically timeout.

Parameter

QUANTITY - Filter Number

1
2
3
params:  [
"0xb" // 11
]
Return Value

Boolean – Return true if uninstalled successfully, otherwise return false

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_uninstallFilter","params":["0xb"],"id":73}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": true
}

man_newPendingTransactionFilter

Create a filter in the node to notify when a pending transaction is generated. To check whether the state has changed, call man_getFilterChanges.

Parameter

None

Return Value

QUANTITY - Filter number

Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_newPendingTransactionFilter","params":[],"id":1}'

Response:

1
2
3
4
5
{
"id":1,
"jsonrpc": "2.0",
"result": "0x36c51b60b6ec98165c2f00c4958c44a8" // 1
}

man_getEntrustList

Returns entrust list for specified authorized account.

Parameter

STRING – Authorized account address.

1
2
3
params:  [
'MAN.21LDRQtTVBdv3EcktxrVQebpQmLEA ' // 232
]
Return Value

OBJECT – Entrusted account information list. The information structure of the entrusted account is as follows:

  • EntrustAddres: STRING – Entrusted account address
  • IsEntrustGas: BOOLEAN – Whether to entrust others to pay for gas. True means that gas is paid by others entrusted.
  • IsEntrustSign: BOOLEAN – Whether to entrust signature or not. True means that it is an entrusted signature.
  • EnstrustSetType: DATA, 1byte- 0: entrusted by height, 1: entrusted by time, 2: entrusted by number of times
  • StartHeight: QUANTITY – Integer block number, start height of entrust
  • EndHeight: QUANTITY – Integer block number, end height of entrust
  • StartTime: QUANTITY – UTC time, start time of entrust
  • EndTime: QUANTITY – UTC time, end time of entrust
  • EntrustCount: QUANTITY – Number of entrusts
Example

Request:

1
curl -X POST --data '{"jsonrpc":"2.0","method":"man_getEntrustList","params":["MAN.21LDRQtTVBdv3EcktxrVQebpQmLEA"],"id":1}'

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"id":1,
"jsonrpc": "2.0",
"result": [
{
"EntrustAddres": "MAN.CUVXBNBpqXipn5JtDsnWKz3e59to",
"IsEntrustGas":false,
"IsEntrustSign":false,
"EnstrustSetType":2,
"StartHeight":0,
"EndHeight":0,
"StartTime":0,
"EndTime":0,
"EntrustCount": 5
}
]
}