• Tip »
  • API Command Line tools

Help command

Description

Lists all available commands.

Basic usage

./cfos-cli help "command"

result:
[
 getbestblockhash
 getblock "hash" ( verbose )
 getblockchaininfo
 getblockcount
 getblockhash index
 getblockheader "hash" ( verbose )
 getchaintips
 getdifficulty
 getmempoolancestors txid (verbose)
 getmempooldescendants txid (verbose)
 getmempoolentry txid
 getmempoolinfo
 getrawmempool ( verbose )
 gettxout "txid" n ( includemempool )
 gettxoutproof ["txid",...] ( blockhash )
 gettxoutsetinfo
 verifychain ( checklevel numblocks )
 verifytxoutproof "proof"
 ......
]

Parameters

Name of parameter Type Description Must select
Command String The command to query N

return value

Lists all asset class information.

State Type Description
Success String To inquire about help feedback
Failed String Error message

GetInfo command

Description

Print various information about nodes and networks.

Basic usage

./cfos-cli getinfo 

result:
{
    "version" : 100000,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 1.27007770,
    "blocks" : 315281,
    "timeoffset" : 0,
    "connections" : 9,
    "proxy" : "",
    "difficulty" : 1.00000000,
    "testnet" : true,
    "keypoololdest" : 1418924649,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "relayfee" : 0.00001000,
    "errors" : ""
}

Parameters

No

return value

Lists all asset class information.

Name of parameter Type Description
Version Numeric Kernel version information for the node, example: Kernel version 0.9.2, will return 90200
ProtocolVersion Number The protocol version used by the node.
Walletversion Number If the wallet is supported, the wallet version is returned.
Balance Number Wallet Balance
Blocks Number The number of blocks on the local chain.
Timeoffset Number The computer clock in seconds
Connections Number The number of links between this node and other nodes.
Proxy String The domain name or IP, port number of the agent.
Difficulty Number The difficulty of the highest block
Testnet Number Whether it is testnet.
Keypoololdest Number The first key in the Wallet. Unix timestamp generated,
Keypoolsize Number The number of keys in the wallet.
Paytxfee String Minimum transaction fee.
Relayfee Number Minimum payment fee
Unlocked_until Number Time when the wallet was locked again
Errors String Error message

Getpeerinfo command

Description

Returns data about the network nodes for each connection.

Parameters

No

return value

Name of parameter Type Description
Id Number Node's serial number
Addr String IP address and port number
Addrlocal String Local IP address and port number for remote feedback
Lastsend Number A UNIX timestamp that successfully sent data last time
Lastrecv Number A Unix timestamp that successfully received data last time
BytesSent Number The number of bytes sent to the node's data.
Bytesrecv Number The number of bytes received for this node's data.
Conntime Number Unix timestamp connected to this node
Timeoffset Number Time Warp
Pingtime Number The time that the node last responded to Peer-to-peer was time-consuming.
Minping Number Minimum ping time.
Failed String Error message

Examples of usage

./cfos-cli getpeerinfo 

result:
[
    {
    "id": 3,
    "addr": "192.0.2.113:43132",
    "addrlocal": "127.0.0.1:8333",
    "services": "0000000000000000",
    "relaytxes": true,
    "lastsend": 1481158534,
    "lastrecv": 1481158534,
    "bytessent": 142772,
    "bytesrecv": 14167,
    "conntime": 1481158420,
    "timeoffset": 11,
    "pingtime": 0.226368,
    "minping": 0.226368,
    "version": 70001,
    "subver": "/Satoshi:0.12.1/",
    "inbound": true,
    "startingheight": 0,
    "banscore": 0,
    "synced_headers": -1,
    "synced_blocks": -1,
    "inflight": [
    ],
    "whitelisted": false,
    "bytessent_per_msg": {
      "addr": 55,
      "inv": 12161,
      "ping": 32,
      "pong": 1824,
      "tx": 128549,
      "verack": 24,
      "version": 127
    },
    "bytesrecv_per_msg": {
      "getdata": 12161,
      "ping": 1824,
      "pong": 32,
      "verack": 24,
      "version": 126
    }
  }
]

Getblockcount command

Description

Returns the number of blocks in the local current block chain.

Basic usage

./cfos-cli getblockcount

result:
[
n    (numeric) The current block count
]

Parameters

No

return value

Lists all asset class information.

State Type Description
Success String Number of blocks in the local current block chain
Failed String Error message

Getblockhash command

Description

Returns the header hash of a block with a given height in the local best chunk chain.

Basic usage

./cfos-cli getblockhash 240886

result:
00000000a0faf83ab5799354ae9c11da2a2bd6db44058e03c528851dee0a3fff

Parameters

Name of parameter Type Description Must select
Height Numeric The command to query Y

return value

Lists all asset class information.

State Type Description
Success String Header hash of a block with a given height in the local best chunk chain
Failed String Error message

Getblockheader command

Description

Gets a block header with a specific hash sequence, in the form of a JSON object or a serialized header, from the local block database.

Basic usage

./cfos-cli getblockheader \
            00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09 \
            false

result:
010000007de867cc8adc5cc8fb6b898ca4462cf9fd667d7830a275277447e608\
00000000338f121232e169d3100edd82004dc2a1f0e1f030c6c488fa61eafa93\
0b0528fe021f7449ffff001d36b4af9a

Parameters

Name of parameter Type Description Must select
Header Hash String Area Header Hash Y
Format bool False gets the height of the serialized block
True to get the block height in JSON format
Y

return value

The parameter format is set to False.

State Type Description
Success String Serialized Chunk Header
Failed String Failure information

The parameter format is set to True.

State Type Description
Hash String 16-in-system hash head
Confirmations Number Number of transactions identified in the block
Height Number The height of the block in the chain
Version Number Block version number
Versionhex String Block 16 binary version number
Merkleroot Number Merkle Root of a block
Mediantime Number Calculates the average time of the previous 11 blocks
Nonce Number A mark used to convert a particular block into a block that can be on a chain.
Bits String The connection location of the block header
Difficulty Number Workload
Chainwork String The miners need to calculate the number of blocks from the Genesis block to the current block.
Previousblockhash String The header hash of the front block.
Nextblockhash String The header hash of the back block.
Failed String Failure information

Getconnectioncount command

Description

The number of connections returned to the other node.

Basic usage

./cfos-cli getconnectioncount 

result:
8

Parameters

No

return value

Lists all asset class information.

State Type Description
Success String Number of connections to other nodes
Failed String Error message

Getrawmempool command

Description

Returns all the transaction identifiers (Txids) in the memory pool as a JSON array, or returns the details of each transaction in the memory pool as a JSON object.

Basic usage

./cfos-cli getrawmempool 

result:
[
    "b104586f229e330caf42c475fd52684e9eb5e2d02f0fcd216d9554c5347b0873",
    "094f7dcbc7494510d4daeceb2941ed73b1bd011bf527f6c3b7c897fee85c11d4"
]

Parameters

Name of parameter Type Description Must select
Format Boolean True all transaction descriptions in the memory pool.
False transaction ordinal Txids array.
N

return value

Format to False

State Type Description
Txid String The transaction sequence number Txids array.
Failed String Error message

Format to True

State Type Description
Txid String Transaction serial number TXID.
Size Number Number of transaction bytes.
Fee Number Transaction costs.
Modifiedfee Number First, the transaction fee for digging ore.
Time Number The time the transaction entered the trading memory pool.
Height String The height of the block when the transaction enters the trading memory pool.
Startingpriority Number Priority of transactions when entering the trading memory pool
Currentpriority Number Current priority of the transaction.
Descendantcount Number First, the transaction fee for digging ore.
Time Number The time the transaction entered the trading memory pool.
Height String The height of the block when the transaction enters the trading memory pool.
Failed String Error message

Gettransaction command

Description

Get detailed information about the transactions within the wallet.

Basic usage

gettransaction \
  5a7d24cd665108c66b2d56146f244932edae4e2376b561b3d396d5ae017b9589

result:
{
    "amount" : 0.00000000,
    "fee" : 0.00000000,
    "confirmations" : 106670,
    "blockhash" : "000000008b630b3aae99b6fe215548168bed92167c47a2f7ad4df41e571bcb51",
    "blockindex" : 1,
    "blocktime" : 1396321351,
    "txid" : "5a7d24cd665108c66b2d56146f244932edae4e2376b561b3d396d5ae017b9589",
    "walletconflicts" : [
    ],
    "time" : 1396321351,
    "timereceived" : 1418924711,
    "bip125-replaceable" : "no",
    "details" : [
        {
            "account" : "",
            "address" : "mjSk1Ny9spzU2fouzYgLqGUD8U41iR35QN",
            "category" : "send",
            "amount" : -0.10000000,
            "vout" : 0,
            "fee" : 0.00000000
        },
        {
            "account" : "doc test",
            "address" : "mjSk1Ny9spzU2fouzYgLqGUD8U41iR35QN",
            "category" : "receive",
            "amount" : 0.10000000,
            "vout" : 0
        }
    ],
    "hex" : "0100000001cde58f2e37d000eabbb60d9cf0b79ddf67cede6dba58732539983fa341dd5e6c010000006a47304402201feaf12908260f666ab369bb8753cdc12f78d0c8bdfdef997da17acff502d321022049ba0b80945a7192e631c03bafd5c6dc3c7cb35ac5c1c0ffb9e22fec86dd311c01210321eeeb46fd878ce8e62d5e0f408a0eab41d7c3a7872dc836ce360439536e423dffffffff0180969800000000001976a9142b14950b8d31620c6cc923c5408a701b1ec0a02088ac00000000"
}

Parameters

Name of parameter Type Description Must select
Amount String Transaction amount Y
"Include_watchonly" bool Default=false,whether to include watch-only addresses in balance calculation and details N

return value

Lists all asset class information.

State Type Description
→amount Number Transaction amount. Income, so that the amount of money in the wallet increases, it is positive. Expenditure, so that the amount in the wallet is reduced, then negative.
→fee Number If it is expenses, the transaction fee.
→confirmations Number The number of transactions confirmed, not confirmed as 0, the conflict is-1.
→generated bool True when Coinbase.
→blockhash String Chunk Hash.
→blockindex Number The index of the transaction in the block.
→blocktime Number The timestamp of the chunk header.
→txid String Transaction identification ID.
→walletconflicts Number Other transaction ID with the same input.
→txid String ID of the conflict transaction.
→time String The time stamp of the transaction into the purse.
→timereceived String The timestamp of the transaction is detected locally, or the transaction is recorded in the block time stamp.
→bip125-replaceable String The timestamp of the transaction is detected locally, or the transaction is recorded in the block time stamp.
→comment String Comments.
→to String The receiving party of the transaction.
→details Number The index of the transaction in the block.
→→involveswatchonly Number True when the Watch-only address is involved.
→→account String The amount to be brought or borrowed.
→→address Number Output transaction, payment address, input, previous output transaction payment address.
→→category String • Payment by sending the law
• Receiving the wallet in the transaction received payment
• Generate mature and affordable Coinbase
• Coinbase that are not yet ready to be paid
• Orphans are not added to the coinbase of the optimal chain of blocks.
→→amount String The negative amount in the expense, the positive amount in the income.
→→vout String Index.
→→fee String Payment of the required costs.
→→abandoned String True is discarded false does not give up
Failed String Error message

Getwalletinfo command

Basic usage

Provide information about the wallet.

./cfos-cli getwalletinfo "command"

result:
[
  "walletversion": xxxxx,       (numeric) the wallet version
  "balance": xxxxxxx,           (numeric) the total confirmed balance of the wallet in BTC
  "unconfirmed_balance": xxx,   (numeric) the total unconfirmed balance of the wallet in BTC
  "immature_balance": xxxxxx,   (numeric) the total immature balance of the wallet in BTC
  "txcount": xxxxxxx,           (numeric) the total number of transactions in the wallet
  "keypoololdest": xxxxxx,      (numeric) the timestamp (seconds since Unix epoch) of the oldest pre-generated key in the key pool
  "keypoolsize": xxxx,          (numeric) how many new keys are pre-generated
  "unlocked_until": ttt,        (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked
  "paytxfee": x.xxxx,           (numeric) the transaction fee configuration, set in BTC/kB
  "hdmasterkeyid": "<hash160>" (string) the Hash160 of the HD master pubkey
]

Parameters

No

return value

Lists all asset class information.

State Type Description
Success String Information about closing the wallet
Failed String Error message

Listassettypes command

Basic usage

Lists all asset class information.

./cfos-cli listassettypes

result:
[
  {
    "TypeId": 1,
    "TypeName": "Token"
  },
  {
    "TypeId": 2,
    "TypeName": "Coin"
  },
  {
    "TypeId": 3,
    "TypeName": "Commodity"
  },
  {
    "TypeId": 4,
    "TypeName": "Local Currency"
  },
  {
    "TypeId": 5,
    "TypeName": "Community Currency"
  },
  {
    "TypeId": 6,
    "TypeName": "Game Currency"
  },
  {
    "TypeId": 7,
    "TypeName": "Physical Currency"
  },
  {
    "TypeId": 8,
    "TypeName": "Service Currency"
  },
  {
    "TypeId": 9,
    "TypeName": "Stock"
  },
  {
    "TypeId": 85,
    "TypeName": "Asset by Unit"
  },
  {
    "TypeId": 99,
    "TypeName": "Cash"
  }
]

Parameters

No

return value

Lists all asset class information.

State Type Description
Success JSON object Return all Assets List
Failed String Failure information

Listassets command

Basic usage

Lists all the released asset information in the wallet that is not zero.

./cfos-cli listassets

result:
[
  {
    "Symbol": "GEN",
    "AssetIndex": 0,
    "AssetTypeId": 0,
    "AssetType": "Coin",
    "Factor": 1,
    "IssueTime": "1509962400",
    "Quantity": 900000000000000,
    "IssueAddress": "",
    "Status": "normal"
  },
  {
    "Symbol": "CNET",
    "AssetIndex": 1,
    "AssetTypeId": 2,
    "AssetType": "Coin",
    "Factor": 1,
    "IssueTime": "1510041774",
    "Quantity": 1000000000,
    "IssueAddress": "15PoUerZt7cpXPuHASqgDEg6DBBNdQSkVA",
    "Status": "normal"
  },
  {
    "Symbol": "ORANGE",
    "AssetIndex": 4,
    "AssetTypeId": 2,
    "AssetType": "Coin",
    "Factor": 1,
    "IssueTime": "1514264271",
    "Quantity": 1000000000,
    "IssueAddress": "15PoXt2yFofnMtihdqnneoC6rHVNRtuR8C",
    "Status": "normal"
  },
  {
    "Symbol": "FOODPT",
    "AssetIndex": 5,
    "AssetTypeId": 2,
    "AssetType": "Coin",
    "Factor": 1,
    "IssueTime": "1514282197",
    "Quantity": 10000000000,
    "IssueAddress": "15PoVU9MWGWZfRQAACkLWVD14JfdgPsmFP",
    "Status": "normal"
  },
  {
    "Symbol": "CK.USD",
    "AssetIndex": 3,
    "AssetTypeId": 2,
    "AssetType": "Coin",
    "Factor": 1,
    "IssueTime": "1515577776",
    "Quantity": 100000000,
    "IssueAddress": "15PoUeef1n7uhiRRgopYAibXX2QP82svpu",
    "Status": "normal"
  }
]

Parameters

No

return value

Lists all asset class information.

State Type Description
Success JSON object Returns a list of assets that have been released in the wallet and are not zero
Failed String Failure information

getnewaddress command

Get Asset Address

Basic usage

Get the address of an asset

./cfos-cli getnewaddress BPC

result:
1PCGSwR8EtmAzA1b1xmFG3qocsMNtkABES

Parameters

Name of parameter Type Description Must select
Name of currency String Asset code Y

return value

Lists all asset class information.

State Type Description
Success JSON object Returns the newly generated asset address
Failed String Failure information

sendassettoaddress command

Send an asset

Description

Sends an asset from an address to another address. If the assets and fees that are sent are the same asset type, the fee address is only set Fee-change if it is the same as from, and if the From and fee addresses are different, set two change addresses (from the corresponding change to Asset-change, fee the change to Fee-change), and to cannot be the same as the change address.

Basic usage

./cfos-cli sendassettoaddress 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 15DwpUcm9S4cEup1ULVzF8TF9f8VPxdXxH 10 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 

result:
{
  "txid": "6366c1723bc13ac9613310c163a22f304ca377dcdc7682bdbb0de63c9f7d9bec",
  "assetchangeaddress": "1MYrqWsoHLTQhXTc3YWbsU3SasMud9U4Uq"
}

Parameters

Name of parameter Type Description Must select
From String Address of the sending asset Y
To String Address of the receiving asset Y
Amount Number Number of sent coins Y
Fee String Address of the handling fee Y
Fee-change String Change address for the handling fee N
Asset-change String Change address of the asset N

return value

Lists all asset class information.

State Type Description
Success JSON object Transaction ID, and change address
Failed String Failure information

Getassetbalance command

Description

Get a local wallet the total amount of an asset.

Basic usage

./cfos-cli getassetbalance ABC

result:
47.9995

Parameters

Name of parameter Type Description Must select
Symbol String Asset code Y

return value

Lists all asset class information.

State Type Description
Success Number Returns the total amount of the specified asset in the wallet
Failed String Failure information

Getaddressbalance command

Description

Lists all asset class information.

Basic usage

./cfos-cli getaddressbalance 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm  

result:
44.9998

Parameters

Name of parameter Type Description Must select
Address String Asset Address Y

return value

Lists all asset class information.

State Type Description
Success Number Returns the balance of the specified address in the wallet
Failed String Failure information

addmultisigaddress command

Description

Add a p2sh multiple signature address to your wallet.

Basic usage

cfos-cli addmultisigaddress 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"
result:
[
{
2MyVxxgNBk5zHRPRY2iVjGRJHYZEp1pMCSq
}]

Parameters

Name of parameter Type Description Must select
Number of Address Number Number of addresses Y
Keys Or Addresses String Array of addresses Y
Account String An account deposited in an address Y

return value

Lists all asset class information.

State Type Description
Success Number Returns the balance of the specified address in the wallet
Failed String Failure information

AddNode command

Description

Try adding or removing nodes from the AddNode list, or trying to connect to the node once.

Basic usage

cfos-cli -testnet addnode 192.0.2.113:18333 onetry
result:
无输出

Parameters

Name of parameter Type Description Must select
Node String Node address Y
Command String Command line Y

return value

Lists all asset class information.

State Type Description
No No No

Backupwallet command

Description

Securely copy the wallet's data file to the specified file, which can be a directory or path with a filename.

Basic usage

cfos-cli -testnet backupwallet /tmp/backup.dat
result:
无输出

Parameters

Name of parameter Type Description Must select
Destination String File name or directory name Y

return value

Lists all asset class information.

State Type Description
No No No

Createmultisig command

Description

Create a P2SH multiple signature address.

Basic usage

cfos-cli createmultisig 2 "[\"16sSauSf5pF2UkUwvKGq4qjNRzBZYqgEL5\",\"171sgjn4YtPu27adkKGrdDwzRTxnRkBfKV\"]"
result:
[
{
 "address" : "2MyVxxgNBk5zHRPRY2iVjGRJHYZEp1pMCSq",
  "redeemScript" : "522103ede722780d27b05f0b1169efc90fa15a601a32fc6c3295114500c586831b6aaf2102ecd2d250a76d204011de6bc365a56033b9b3a149f679bc17205555d3c2b2854f21022d609d2f0d359e5bc0e5d0ea20ff9f5d3396cb5b1906aa9c56a0e7b5edc0c5d553ae"
}
}]

Parameters

Name of parameter Type Description Must select
Number of Address Number Number of signatures Y
Keys Or Addresses String Array of addresses Y
Account String An account deposited in an address Y

return value

Lists all asset class information.

State Type Description
Address String Script Address
Script String Script

Createrawtransaction command

Description

Creates an unsigned serialization transaction that outputs the previous output to the new output with a p2pkh or P2SH address. The transaction is not stored in the wallet or transmitted to the network.

Basic usage

cfos-cli createrawtransaction "[{\"txid\":\"myid\",\"vout\":0}]" "{\"address\":0.01}"
result:
[
{
01000000011da9283b4ddf8d89eb996988b89ead56cecdc44041ab38bf787f12\
06cd90b51e0000000000ffffffff01405dc600000000001976a9140dfc8bafc8\
419853b34d5e072ad37d1a5159f58488ac00000000
}]

Parameters

Name of parameter Type Description Must select
Txid String Output of the Txid Y
Vout Number The serial number of the output Y
Sequence Number The serial number to enter Y

return value

Lists all asset class information.

State Type Description
Address and quantity String The address of the expense and the amount of the expense

Decoderawtransaction command

Description

Decodes a serialized hex string into the specific contents of a transaction.

Basic usage

cfos-cli decoderawtransaction 0100000001bafe2175b9d7b3041ebac\
529056b393cf2997f7964485aa382ffa449ffdac02a000000008a47304402201\
3d212c22f0b46bb33106d148493b9a9723adb2c3dd3a3ebe3a9c9e3b95d8cb00\
220461661710202fbab550f973068af45c294667fc4dc526627a7463eb23ab39\
e9b01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815\
b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08\
ffb10d4b8ffffffff01b0a86a00000000001976a91401b81d5fa1e55e069e3cc\
2db9c19e2e80358f30688ac00000000
result:
{
    "txid": "52309405287e737cf412fc42883d65a392ab950869fae80b2a5f1e33326aca46",
    "hash": "52309405287e737cf412fc42883d65a392ab950869fae80b2a5f1e33326aca46",
    "size": 223,
    "vsize": 223,
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "txid": "2ac0daff49a4ff82a35a4864797f99f23c396b0529c5ba1e04b3d7b97521feba",
            "vout": 0,
            "scriptSig": {
                "asm": "3044022013d212c22f0b46bb33106d148493b9a9723adb2c3dd3a3ebe3a9c9e3b95d8cb00220461661710202fbab550f973068af45c294667fc4dc526627a7463eb23ab39e9b[ALL] 0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
                "hex": "473044022013d212c22f0b46bb33106d148493b9a9723adb2c3dd3a3ebe3a9c9e3b95d8cb00220461661710202fbab550f973068af45c294667fc4dc526627a7463eb23ab39e9b01410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
            },
            "sequence": 4294967295
        }
    ],
    "vout": [
        {
            "value": 0.06990000,
            "n": 0,
            "scriptPubKey": {
            "asm": "OP_DUP OP_HASH160 01b81d5fa1e55e069e3cc2db9c19e2e80358f306 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a91401b81d5fa1e55e069e3cc2db9c19e2e80358f30688ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "1A6Ei5cRfDJ8jjhwxfzLJph8B9ZEthR9Z"
                ]
            }
        }
    ]
}

Parameters

Name of parameter Type Description Must select
Serialized Transaction String Serialized post-transaction string Y

return value

Lists all asset class information.

State Type Description
Results Object After decoding the transaction specific description

Dumpprivkey command

Description

Export the private key.

Basic usage

cfos-cli dumpprivkey moQR7i8XM4rSGoNwEsw3h4YEuduuP6mxw7

result:
[
{
cTVNtBK7mBi2yc9syEnwbiUpnpGJKohDWzXMeF4tGKAQ7wvomr95
}]

Parameters

Name of parameter Type Description Must select
P2pkh String The address in the wallet Y

return value

Lists all asset class information.

State Type Description
Results String Private key for wallet import

Dumpwallet command

Description

Export wallet.

Basic usage

cfos-cli dumpwallet /tmp/dump.txt

result:
[
{
# Wallet dump created by BPC v0.9.1.0-g026a939-beta (Tue, 8 Apr 2014 12:04:06 +0200)
# * Created on 2014-04-29T20:46:09Z
# * Best block at time of backup was 227221 (0000000026ede4c10594af8087748507fb06dcd30b8f4f48b9cc463cabc9d767),
#   mined on 2014-04-29T21:15:07Z

cTtefiUaLfXuyBXJBBywSdg8soTEkBNh9yTi1KgoHxUYxt1xZ2aA 2014-02-05T15:44:03Z label=test1 # addr=mnUbTmdAFD5EAg3348Ejmonub7JcWtrMck
cQNY9v93Gyt8KmwygFR59bDhVs3aRDkuT8pKaCBpop82TZ8ND1tH 2014-02-05T16:58:41Z reserve=1 # addr=mp4MmhTp3au21HPRz5waf6YohGumuNnsqT
cNTEPzZH9mjquFFADXe5S3BweNiHLUKD6PvEKEsHApqjX4ZddeU6 2014-02-05T16:58:41Z reserve=1 # addr=n3pdvsxveMBkktjsGJixfSbxacRUwJ9jQW
cTVNtBK7mBi2yc9syEnwbiUpnpGJKohDWzXMeF4tGKAQ7wvomr95 2014-02-05T16:58:41Z change=1 # addr=moQR7i8XM4rSGoNwEsw3h4YEuduuP6mxw7
cNCD679B4xi17jb4XeLpbRbZCbYUugptD7dCtUTfSU4KPuK2DyKT 2014-02-05T16:58:41Z reserve=1 # addr=mq8fzjxxVbAKxUGPwaSSo3C4WaUxdzfw3C
}]

Parameters

Name of parameter Type Description Must select
Filename String A file stored in a wallet Y

return value

Lists all asset class information.

State Type Description
Success Null No information output
Failed String Failure information

Getbestblockhash command

Description

Returns the header hash of the newest chunk on the best chunk chain.

Basic usage

cfos-cli getbestblockhash

result:
[
{
0000000000075c58ed39c3e50f99b32183d090aefa0cf8c324a82eea9b01a887
}]

Parameters

No

return value

Lists all asset class information.

State Type Description
Success String The header hash of the newest block on the best block chain
Failed String Failure information

GetBalance command

Description

Gets the balance of the decimal bitcoin for all accounts or for a specific account.

Basic usage

cfos-cli getbalance "test1" 1 true

result:
[
{
1.99900000
}]

Parameters

Name of parameter Type Description Must select
Account String Account name Y
Number of confirmations String Number of confirmation messages Y
Watch-only addresses String Whether to include address information Y

return value

Lists all asset class information.

State Type Description
Success Number Account balance
Failed String Failure information

Getblock command

Description

Gets a block of a specific header hash from the local block database as a JSON object or a serialized block.

Basic usage

BPC-cli getblock \
            00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048 \
            false

result:
010000006fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d61900\
00000000982051fd1e4ba744bbbe680e1fee14677ba1a3c3540bf7b1cdb606e8\
57233e0e61bc6649ffff001d01e3629901010000000100000000000000000000\
00000000000000000000000000000000000000000000ffffffff0704ffff001d\
0104ffffffff0100f2052a0100000043410496b538e853519c726a2c91e61ec1\
1600ae1390813a627c66fb8be7947be63c52da7589379515d4e0a604f8141781\
e62294721166bf621e73a82cbf2342c858eeac00000000

Parameters

Name of parameter Type Description Must select
Header String Hash value of block header Y
Format Number 0 Serialization format
1 JSON format
N

return value

Lists all asset class information.

State Type Description
Success String Block
Failed String Failure information

Getblockchaininfo command

Description

Provides information about the current state of the block chain.

Basic usage

cfos-cli getblockchaininfo

result:
[
{
{
  "chain": "main",
  "blocks": 464562,
  "headers": 464562,
  "bestblockhash": "00000000000000000085bd56990c579a36bade6ea427646612f13476edb30ceb",
  "difficulty": 521974519553.6282,
  "mediantime": 1493758169,
  "verificationprogress": 0.999989733170878,
  "chainwork": "00000000000000000000000000000000000000000052c26f32ffa22706efd28c",
  "pruned": false,
  "softforks": [
    {
      "id": "bip34",
      "version": 2,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip66",
      "version": 3,
      "reject": {
        "status": true
      }
    },
    {
      "id": "bip65",
      "version": 4,
      "reject": {
        "status": true
      }
    }
  ],
  "bip9_softforks": {
    "csv": {
      "status": "active",
      "startTime": 1462060800,
      "timeout": 1493596800,
      "since": 419328
    },
    "segwit": {
      "status": "started",
      "bit": 1,
      "startTime": 1479168000,
      "timeout": 1510704000,
      "since": 439488
    }
  }
}
}]

Parameters

No

return value

Lists all asset class information.

State Type Description
Success String Information about the current state of the block chain
Failed String Failure information

Listtransactions command

Basic usage

Returns the latest transaction affecting the wallet.

cfos-cli listtransactions "account" count skip

result:
[{
    "account":"accountname",       (string) DEPRECATED. The account name associated with the transaction. 
                                                It will be "" for the default account.
    "address":"address",    (string) The BPC address of the transaction. Not present for 
                                                move transactions (category = move).
    "category":"send|receive|move", (string) The transaction category. 'move' is a local (off blockchain)
                                                transaction between accounts, and not associated with an address,
                                                transaction id or block. 'send' and 'receive' transactions are 
                                                associated with an address, transaction id and block details
    "amount": x.xxx,          (numeric) The amount in BTC. This is negative for the 'send' category, and for the
                                         'move' category for moves outbound. It is positive for the 'receive' category,
                                         and for the 'move' category for inbound funds.
    "label": "label",       (string) A comment for the address/transaction, if any
    "vout": n,                (numeric) the vout value
    "fee": x.xxx,             (numeric) The amount of the fee in BTC. This is negative and only available for the 
                                         'send' category of transactions.
    "confirmations": n,       (numeric) The number of confirmations for the transaction. Available for 'send' and 
                                         'receive' category of transactions. Negative confirmations indicate the
                                         transaction conflicts with the block chain
    "trusted": xxx,           (bool) Whether we consider the outputs of this unconfirmed transaction safe to spend.
    "blockhash": "hashvalue", (string) The block hash containing the transaction. Available for 'send' and 'receive'
                                          category of transactions.
    "blockindex": n,          (numeric) The index of the transaction in the block that includes it. Available for 'send' and 'receive'
                                          category of transactions.
    "blocktime": xxx,         (numeric) The block time in seconds since epoch (1 Jan 1970 GMT).
    "txid": "transactionid", (string) The transaction id. Available for 'send' and 'receive' category of transactions.
    "time": xxx,              (numeric) The transaction time in seconds since epoch (midnight Jan 1 1970 GMT).
    "timereceived": xxx,      (numeric) The time received in seconds since epoch (midnight Jan 1 1970 GMT). Available 
                                          for 'send' and 'receive' category of transactions.
    "comment": "...",       (string) If a comment is associated with the transaction.
    "otheraccount": "accountname",  (string) DEPRECATED. For the 'move' category of transactions, the account the funds came 
                                          from (for receiving funds, positive amounts), or went to (for sending funds,
                                          negative amounts).
    "bip125-replaceable": "yes|no|unknown",  (string) Whether this transaction could be replaced due to BIP125 (replace-by-fee);
                                                     may be unknown for unconfirmed transactions not in the mempool
    "abandoned": xxx          (bool) 'true' if the transaction has been abandoned (inputs are respendable). Only available for the 
                                         'send' category of transactions.
}]

Parameters

Name of parameter Type Description Must select
"Account" bool Deprecated. The account name. Should be "*". N
Count Numeric The number of transactions to return N
Skip Numeric A JSON array of BPC addresses to filter N
Include_watchonly bool Include transactions to Watch-only addresses ("importaddress") N

return value

Name of parameter Type Description
Account String Deprecated. The account name associated with the transaction.
Address String The BPC address of the transaction. Not present to move transactions (category = Move).
Category String The transaction category. ' Move ' are a local (off blockchain) transaction between accounts, and not associated with a address,transaction ID or bloc K. ' Send ' and ' receive ' transactions are associated with a address, transaction IDs and block details
Amount Numeric The amount in BTC. This is negative to the ' send ' category, and for the ' move ' category for moves outbound. It is positive for the ' receive ' category, with the ' Move ' category for inbound funds.
Label String A comment for the address/transaction, if any
Vout Numeric The Vout value
Fee Numeric The amount of the fee in BTC. This is negative to available for the ' Send ' category of transactions.
Confirmations Numeric The number of confirmations for the transaction. Available for ' send ' and ' receive ' category of transactions. Negative confirmations indicate the transaction conflicts with the block chain
Trusted bool Whether we consider the outputs of this unconfirmed transaction safe to spend.
Blockhash String The block hash containing the transaction. Available for ' send ' and ' receive ' category of transactions.
Blockindex String The index of the transaction in the blocks that includes it. Available for ' send ' and ' receive ' category of transactions.
Blocktime Numeric The block time in seconds since epoch (1 off 1970 GMT).
Txid String The transaction ID. Available for ' send ' and ' receive ' category of transactions.
Time Numeric The transaction time in seconds since epoch (midnight 1 1970 GMT).
Timereceived Numeric Received in seconds since epoch (midnight 1 1970 GMT). Available for ' send ' and ' receive ' category of transactions.
Comment String If a comment is associated with the transaction.
Otheraccount String Deprecated. For the "move" category of transactions, the account the funds came from (for receiving funds, positive amounts), or went to (for sending funds, negative amounts).
Bip125-replaceable String Whether This transaction could is replaced due to BIP125 (Replace-by-fee); May is unknown for unconfirmed In the Mempool
Abandoned bool Whether we know how to spend this output, ignoring the lack of the keys

Listunspent command

Basic usage

Returns an array of unused transaction outputs belonging to this wallet.

cfos-cli listunspent minconf maxconf "addresses"  include_unsafe

result:
[{
(array of json object)
  {
    "txid" : "txid",          (string) the transaction id 
    "vout" : n,               (numeric) the vout value
    "address" : "address",    (string) the BPC address
    "account" : "account",    (string) DEPRECATED. The associated account, or "" for the default account
    "scriptPubKey" : "key",   (string) the script key
    "amount" : x.xxx,         (numeric) the transaction output amount in BTC
    "confirmations" : n,      (numeric) The number of confirmations
    "redeemScript" : n        (string) The redeemScript if scriptPubKey is P2SH
    "spendable" : xxx,        (bool) Whether we have the private keys to spend this output
    "solvable" : xxx          (bool) Whether we know how to spend this output, ignoring the lack of keys
  }
  ,...
}]

Parameters

Name of parameter Type Description Must select
Minconf (Numeric, optional, default=1) The BPC address is for the private key. N
Maxconf (Numeric, optional, default=9999999) (Boolean, optional, Default=false) Allow High Fees N
"Addresses" String A JSON array of BPC addresses to filter N
Include_unsafe (bool, optional, default=true) A JSON array of BPC addresses to filter N

return value

Name of parameter Type Description
Txid String The transaction ID
Vout Numeric The Vout value
Address String The BPC address
Account String Deprecated. The associated account, or "" for the default account
Scriptpubkey String The Script key
Amount Numeric The transaction output amount in BPC
Confirmations Numeric The number of confirmations
Redeemscript String The Redeemscript if Scriptpubkey is P2sh
Spendable bool Whether we have the private keys to spend this output
Solvable bool Whether we know how to spend this output, ignoring the lack of the keys

Signmessage command

Basic usage

Sign a message with the private key of an address.

cfos-cli signmessage "address" "message"

result:
[{
"signature"          (string) The signature of the message encoded in base 64
}]

Parameters

Name of parameter Type Description Must select
Address String The BPC address is for the private key. Y
Message Boolean (Boolean, optional, Default=false) Allow High Fees N

return value

Name of parameter Type Description
Signature String The signature of the message encoded in base 64

Sendassetwithfingerprint command

Description

Sends an asset from one address to another and embeds data (such as a fingerprint of data) in the transaction.

Basic usage

./cfos-cli sendassetwithfingerprint 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 1MYrqWsoHLTQhXTc3YWbsU3SasMud9U4Uq 1 3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a14 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm 

result:
{
  "txid": "7cd1714e68f9de6a13621b060636117abf585f81297c189b931474ae74009d68",
  "assetchangeaddress": "1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm"
}

Parameters

Name of parameter Type Description Must select
From String Address of the sending asset Y
To String Address of the receiving asset Y
Amount Number Number of sent coins Y
Fingerprint String Data fingerprint (32 or 64 hexadecimal characters) Y
Fee String Address of the handling fee Y
Fee-change String Change address for the handling fee Y
Asset-change String Change address of the asset Y

return value

State Type Description
Success JSON object Transaction ID, and change address
Failed String Failure information

Findfingerprint command

Description

Find the transaction ID based on the fingerprint of the data

Basic usage

./cfos-cli findfingerprint 3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a14

result:
7cd1714e68f9de6a13621b060636117abf585f81297c189b931474ae74009d68

Parameters

Name of parameter Type Description Must select
Fingerprint String Fingerprint data Y

return value

State Type Description
Success String Transaction ID
Failed String Failure information

Getrawtransaction command

Description

Gets a hexadecimal-encoded serialized transaction or a JSON object that describes the transaction. By default, the Bitcoin core stores the full transaction data only for Utxos and your own transactions, \ So RPC may fail unless you use a non-default txindex=1 in your bitcoin core startup settings.

Parameters

Name of parameter Type Description Must select
Txid String Transaction ID Y
Format bool The default false returns the serialized transaction data.
True decoded transaction data
N

return value

No transaction found

State Type Description
Success Null JSON-formatted NULL
Failed String Error message

Parameter is False

State Type Description
Success String 16 binary string After the transaction is serialized
Failed String Error message

Parameter is True

State Type Description
Hex String Serialized 16-binary string
Blockhash String Hash value after chain on a block
Confirmations Number Number of confirmed after chain on the block
Time Number Block head time after the chain on the block
Blocktime Number Current Confirmation Time
Failed String Error message

Use examples

./cfos-cli getrawtransaction \
  7cd1714e68f9de6a13621b060636117abf585f81297c189b931474ae74009d68 1

result:
{
  "hex": "010000000110a5d264f7520aac930010b7f0e555008d52878e297285ea6e43eb514a6332ac010000006e47304402200ec1446ba07b50640e40f2b9ab63aae0f981f6356b00500814450bc0c18ea0780220394ff81ecd7f7ce21e13ee1d7a0a13d138da8bd765c76cb250e2b01b54169e9d012503cd5c7a2245fa294a7019b4c96a392618e3933aec185b08073b048aa0969e38e101000000feffffff0310270000000000001976a914e169030a7e0100000012078bab4f4c2ffa02ed3188ac00bdb60600000000001976a914a903314dee7c54d429a11957780893710100000088ac000000000000000000286a2630010000f67a3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a140000000000",
  "txid": "7cd1714e68f9de6a13621b060636117abf585f81297c189b931474ae74009d68",
  "hash": "7cd1714e68f9de6a13621b060636117abf585f81297c189b931474ae74009d68",
  "size": 281,
  "vsize": 281,
  "version": 1,
  "locktime": 0,
  "vin": [
    {
      "txid": "ac32634a51eb436eea8572298e87528d0055e5f0b7100093ac0a52f764d2a510",
      "vout": 1,
      "scriptSig": {
        "asm": "304402200ec1446ba07b50640e40f2b9ab63aae0f981f6356b00500814450bc0c18ea0780220394ff81ecd7f7ce21e13ee1d7a0a13d138da8bd765c76cb250e2b01b54169e9d[ALL] 03cd5c7a2245fa294a7019b4c96a392618e3933aec185b08073b048aa0969e38e101000000",
        "hex": "47304402200ec1446ba07b50640e40f2b9ab63aae0f981f6356b00500814450bc0c18ea0780220394ff81ecd7f7ce21e13ee1d7a0a13d138da8bd765c76cb250e2b01b54169e9d012503cd5c7a2245fa294a7019b4c96a392618e3933aec185b08073b048aa0969e38e101000000"
      },
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 1.0000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 e169030a7e0100000012078bab4f4c2ffa02ed31 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914e169030a7e0100000012078bab4f4c2ffa02ed3188ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1MYrqWsoHLTQhXTc3YWbsU3SasMud9U4Uq"
        ]
      }
    },
    {
      "value": 43.9997,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 a903314dee7c54d429a119577808937101000000 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914a903314dee7c54d429a11957780893710100000088ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1GQf2FCN9Gew1RWuKAdU7xrc9ruVoBtgtm"
        ]
      }
    },
    {
      "value": 0.0000,
      "n": 2,
      "scriptPubKey": {
        "asm": "OP_RETURN 30010000f67a3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a14",
        "hex": "6a2630010000f67a3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a14",
        "type": "nulldata"
      },
      "data": {
        "type": "FINGERPRINT",
        "value": "3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a14"
      }
    }
  ],
  "blockhash": "0000001296a9bd47cf02bb61d9efb28fe4fef52db0b9125f67679399ab746abb",
  "confirmations": 5,
  "time": 1517984444,
  "blocktime": 1517984444
}
./cfos-cli getrawtransaction 7cd1714e68f9de6a13621b060636117abf585f81297c189b931474ae74009d68
010000000110a5d264f7520aac930010b7f0e555008d52878e297285ea6e43eb514a6332ac010000006e47304402200ec1446ba07b50640e40f2b9ab63aae0f981f6356b00500814450bc0c18ea0780220394ff81ecd7f7ce21e13ee1d7a0a13d138da8bd765c76cb250e2b01b54169e9d012503cd5c7a2245fa294a7019b4c96a392618e3933aec185b08073b048aa0969e38e101000000feffffff0310270000000000001976a914e169030a7e0100000012078bab4f4c2ffa02ed3188ac00bdb60600000000001976a914a903314dee7c54d429a11957780893710100000088ac000000000000000000286a2630010000f67a3f38e6d7d5ef45503a5056478dbed5cf5e615702061798ebb618518e1ae82a140000000000

Sendrawtransaction command

Basic usage

Validates the transaction and broadcasts it to the peer network.

cfos-cli sendrawtransaction hexstring allowhighfees

result:
[{
"hex":(string) The transaction hash in hex
}]

Parameters

Name of parameter Type Description Must select
"HexString" String The BPC address is for the private key. Y
Allowhighfees Boolean (Boolean, optional, Default=false) Allow High Fees N

return value

Name of parameter Type Description
Hex String The transaction hash in hex

Signrawtransaction command

Basic usage

A transaction is signed in a serialized transaction format using the private key stored in the wallet or in the manner provided in the call.

cfos-cli signrawtransaction hexstring prevtxs privkeys  sighashtype

result:
[{
  "hex" : "value",           (string) The hex-encoded raw transaction with signature(s)
  "complete" : true|false,   (boolean) If the transaction has a complete set of signatures
  "errors" : [                 (json array of objects) Script verification errors (if there are any)
    {
      "txid" : "hash",           (string) The hash of the referenced, previous transaction
      "vout" : n,                (numeric) The index of the output to spent and used as input
      "scriptSig" : "hex",       (string) The hex-encoded signature script
      "sequence" : n,            (numeric) Script sequence number
      "error" : "text"           (string) Verification or signing error related to the input
    }
    ,...
  ]
}]

Parameters

Name of parameter Type Description Must select
HexString String The transaction hex string Y
Prevtxs String An JSON array of previous dependent transaction outputs N
Privkeys String A JSON array of base58-encoded private keys for signing N
Sighashtype String The signature hash type. Must be one of N

return value

Name of parameter Type Description
IsValid Boolean If is valid or not. If not, which is the ' property returned.
Address String The BPC address validated
Scriptpubkey String (hex) The hex encoded Scriptpubkey generated by the
Ismine Boolean If the yours or not
Iswatchonly Boolean If the IS watchonly
ISScript Boolean If The key is a script
PubKey String The hex value of the raw public key
Iscompressed Boolean If the IS compressed
Account String Deprecated. The account associated with the address, "" is the default account
Timestamp Number The creation time of the "key if available in seconds since epoch (1 1970 GMT)
Hdkeypath String The HD KeyPath if the key is HD and available
Hdmasterkeyid String The Hash160 of the HD master PubKey

Stop command

Basic usage

Securely shut down the bitcoin core server.

cfos-cli stop

result:
[{
BPC server stopping
}]

Parameters

No

return value

BPC server stopping

validateaddress command

Basic usage

Returns information about a given bit-currency address.

cfos-cli validateaddress "address"

result:
[{
  "isvalid" : true|false,       (boolean) If the address is valid or not. If not, this is the only property returned.
  "address" : "address", (string) The BPC address validated
  "scriptPubKey" : "hex",       (string) The hex encoded scriptPubKey generated by the address
  "ismine" : true|false,        (boolean) If the address is yours or not
  "iswatchonly" : true|false,   (boolean) If the address is watchonly
  "isscript" : true|false,      (boolean) If the key is a script
  "pubkey" : "publickeyhex",    (string) The hex value of the raw public key
  "iscompressed" : true|false,  (boolean) If the address is compressed
  "account" : "account"         (string) DEPRECATED. The account associated with the address, "" is the default account
  "timestamp" : timestamp,        (number, optional) The creation time of the key if available in seconds since epoch (Jan 1 1970 GMT)
  "hdkeypath" : "keypath"       (string, optional) The HD keypath if the key is HD and available
  "hdmasterkeyid" : "<hash160>" (string, optional) The Hash160 of the HD master pubkey
}]

Parameters

Name of parameter Type Description Must select
Address String The BPC address to validate Y

return value

Name of parameter Type Description
IsValid Boolean If is valid or not. If not, which is the ' property returned.
Address String The BPC address validated
Scriptpubkey String (hex) The hex encoded Scriptpubkey generated by the
Ismine Boolean If the yours or not
Iswatchonly Boolean If the IS watchonly
ISScript Boolean If The key is a script
PubKey String The hex value of the raw public key
Iscompressed Boolean If the IS compressed
Account String Deprecated. The account associated with the address, "" is the default account
Timestamp Number The creation time of the "key if available in seconds since epoch (1 1970 GMT)
Hdkeypath String The HD KeyPath if the key is HD and available
Hdmasterkeyid String The Hash160 of the HD master PubKey