MultiChain JSON-RPC API commands
5 stars based on
These credentials are randomly generated the first time that multichaind is called for that chain. Alternatively, you can use multichain-cli in interactive mode, to send multiple commands in a single session:.
Each command is then entered in the [command] [parameters To end the session, type byeexitquit or Control-D. A summary of Bitcoin Core commands is listed in the bitcoin wiki or consult the developer documentation for more comprehensive details.
You should also consult the list of error codes and messages. However the separation of accounts is not preserved when bitcoin is sent out, because the internal accounting mechanism has no relationship to the bitcoin protocol itself.
This includes the commands: In addition it only supports an empty value for the account parameter of: If you are using the old wallet version, MultiChain preserves full backwards compatibility with the Bitcoin Core API, but a sendfrom is renamed to sendfromaccountand blockchain json rpc api the accounts mechanism is not applied to native asset balances, all of which are considered as belonging to a single global account. Overall we recommend not using accounts at all with MultiChain, and using "" for any account parameter in the API.
Unlike bitcoin-style accounts, this method maps directly to the blockchain protocol. You can use multichain-cli to send a single API command in the following form: Use display-names to set whether parameters are shown with display names with hyphens or canonical names without hyphens. Note that as of MultiChain 1. Some parameters can be modified while MultiChain is running using setruntimeparam. There are also incomingpaused and miningpaused fields — see the pause command.
The burnaddress is an address with no known private key, to which assets can be blockchain json rpc api to make them provably unspendable. The nodeaddress can be passed to other nodes for connecting. The setupblocks field gives the length in blockchain json rpc api of the setup phase in which some consensus constraints are not applied.
Managing wallet addresses addmultisigaddress nrequired ["key", Funds sent to this address can only be spent by transactions signed by nrequired of the specified keys. Returns the P2SH address. Set verbose to true to get more information about each address, formatted like the output of the validateaddress command.
For more control see the new listaddresses command. This creates one or more watch-only addresseswhose activity and balance can be retrieved via various APIs e. If rescan is truethe entire blockchain is checked for transactions relating to all addresses in the wallet, including the added ones.
Returns null if successful. Use count and start to retrieve part of the list only, with negative start values like the default indicating the most recently created addresses. For each key pair, the addresspubkey as embedded in transaction inputs and privkey used for signatures is provided. Returns an object containing the P2SH address and corresponding redeem script.
For global permissions, set permissions to one of connectsendreceivecreateissuemineactivateadminor a comma-separated list thereof. For per-asset or per-stream permissions, use the form entity. If the chain uses a native currency, you can send some to each recipient using the native-amount parameter. Returns the txid of the transaction granting the permissions.
For more information, see permissions management. It is useful if the node has multiple addresses with administrator permissions. To include raw data, pass a data-hex hexadecimal string.
To list information about specific global permissions, set permissions to one of connectsendreceiveissuemineactivateadminor a comma-separated list thereof. The permissions parameter works the same as for grant. Returns the txid of transaction revoking the permissions. To create an asset with the default behavior, use an asset name only for name params.
If open is true then additional units can be issued in future by the same key which signed the original issuance, via blockchain json rpc api issuemore or blockchain json rpc api command. The smallest transactable unit is given by unitse. If the chain uses a native currency, you can send some with blockchain json rpc api new asset using the native-amount parameter. Returns the txid of the issuance transaction. For more information, see native assets.
It is useful if the node has multiple addresses with issue permissions. The asset blockchain json rpc api be specified using its name, ref or issuance txid — see native assets for more information. If the chain uses a native currency, you can send some with the new asset units using the native-amount parameter. In assets with multiple blockchain json rpc api events, the top-level issuetxid and blockchain json rpc api fields refer to the first issuance only — set verbose to true for details about each of the individual issuances.
Use count and start to retrieve part of the list only, with negative start values like the default indicating the most recently created assets. Extra fields are shown for assets to which this node is subscribed. Use includeLocked to include unspent outputs which have been locked, e. Use verbose to provide details of transaction inputs and outputs.
The response includes a total of the balances shown. Use includeWatchOnly to include the balance of watch-only addresses and includeLocked to include unspent outputs which have been locked, e. Use includeWatchOnly to consider watch-only addresses as if they belong to this wallet and verbose to provide details of transaction inputs and outputs.
Use skip to go back further in history and verbose to provide details of transaction inputs and outputs. Use skip to go back further in history and includeWatchOnly to consider watch-only addresses as if they belong to this wallet.
Use verbose to provide the details of transaction inputs and outputs. In Bitcoin Core, the amount field is the quantity of the bitcoin currency. Use "" as the asset inside this object to specify a quantity of the native currency. See also sendasset for sending a single asset and sendfrom to control the address whose funds are used. See also sendassetfrom to control the address whose funds are used, send for sending multiple assets in one transaction, and sendfrom to combine both of these.
Any change from the transaction is sent back to from-address. See also sendfrom for sending multiple assets in blockchain json rpc api transaction. The txid and vout should generally be taken from preparelockunspent or preparelockunspentfrom. Multiple items can be specified within the fourth parameter to request multiple assets. Returns a raw transaction in the hex field alongside a complete field stating whether the exchange is complete i. If complete, the transaction can be broadcast to the network using sendrawtransaction.
If not, it can be passed to a further counterparty, who can call decoderawexchange and appendrawexchange as appropriate. If the completed exchange is not balanced, an error is returned.
Optional metadata can be added to the transaction, signed by this user only. Returns a raw transaction in hexadecimal which can be blockchain json rpc api to the network using sendrawtransaction. The txid and vout should generally be taken from the response to preparelockunspent or preparelockunspentfrom. Multiple items can be specified within the third parameter to request multiple assets. Returns a raw partial transaction in hexadecimal which can be passed to the counterparty, who can blockchain json rpc api decoderawexchange and appendrawexchange as appropriate.
Returns details on the offer represented by the exchange and its present state. The candisable field blockchain json rpc api whether this wallet can disable the exchange transaction by double-spending against one of its inputs.
The cancomplete field specifies whether this wallet has the assets required to complete the exchange. The complete field specifies whether the exchange is already complete i. If verbose is true blockchain json rpc api all blockchain json rpc api the individual stages in the exchange are listed. Other fields relating to fees are only relevant for blockchains which use a native currency. To check whether this can be used on an exchange transaction, check the candisable field of the output of decoderawexchange.
Multiple blockchain json rpc api can be specified within the first parameter to include several assets within the output. The output blockchain json rpc api be locked against automatic selection blockchain json rpc api spending unless the optional lock parameter is set to false.
Returns the txid and vout of the prepared output. Any change from the transaction is send back to from-address. Pass the value "stream" in the type parameter the create API can also be used to create upgrades. If open is true then anyone with global send permissions can publish to the stream, otherwise publishers must be explicitly granted per-stream write permissions.
Returns the txid of the transaction creating the stream. It is useful if the node has multiple addresses with create permissions. Use count and start to retrieve part of the list only, with negative start values like the default indicating the most recently created streams. Extra fields are shown for streams to which this node has subscribed. Publishing stream items publish stream key data-hex Publishes an item in streampassed as a stream name, ref or blockchain json rpc api txid, with key provided in text form and data-hex in hexadecimal.
It is useful if a stream is open or the node has multiple addresses with per-stream write permissions. See also the autosubscribe runtime parameter. Set verbose to true for additional information about the transaction.