-
Notifications
You must be signed in to change notification settings - Fork 5
Doc_Raw Transactions
- Overview
-
JSON-RPC API
- listunspent [minconf=1] [maxconf=999999]
- lockunspent unlock? [{"txid":txid,"vout":n},...]
- listlockunspent
- createrawtransaction [{"txid":txid,"vout":n},...] {address:amount,...}
- decoderawtransaction
- getrawtransaction [verbose=0]
- signrawtransaction [{"txid":txid,"vout":n,"scriptPubKey":hex},...] [,...] [sighash="ALL"]
- sendrawtransaction
- Motivating use cases
- Other, non-obvious use cases
- See Also
The "raw transaction API" gives developers or very sophisticated end-users low-level access to transaction creation and broadcast.
Returns an array of unspent transaction outputs in the wallet that have between minconf and maxconf (inclusive) confirmations. Each output is a 5-element object with keys: txid, output, scriptPubKey, amount, confirmations. txid is the hexadecimal transaction id, output is which output of that transaction, scriptPubKey is the hexadecimal-encoded CScript for that output, amount is the value of that output and confirmations is the transaction's depth in the chain.
Temporarily lock (unlock=false) or unlock (unlock=true) specified transaction outputs. A locked transaction output will not be chosen by automatic coin selection, when spending bytzs. Locks are stored in memory only. Nodes start with zero locked outputs, and the locked output list is always cleared (by virtue of process exit) when a node stops or fails.
List all temporarily locked transaction outputs.
Create a transaction spending given inputs (array of objects containing transaction outputs to spend), sending to given address(es). Returns the hex-encoded transaction in a string. Note that the transaction's inputs are not signed, and it is not stored in the wallet or transmitted to the network.
Also note that NO transaction validity checks are done; it is easy to create invalid transactions or transactions that will not be relayed/mined by the network because they contain insufficient fees.
Returns JSON object with information about a serialized, hex-encoded transaction.
If verbose=0, returns serialized, hex-encoded data for transaction txid. If verbose is non-zero, returns a JSON Object containing information about the transaction. Returns an error if is unknown.
Sign as many inputs as possible for raw transaction (serialized, hex-encoded). The first argument may be several variations of the same transaction concatenated together; signatures from all of them will be combined together, along with signatures for keys in the local wallet. The optional second argument is an array of parent transaction outputs, so you can create a chain of raw transactions that depend on each other before sending them to the network. Third optional argument is an array of base58-encoded private keys that, if given, will be the only keys used to sign the transaction. The fourth optional argument is a string that specifies how the OP CHECKSIG is computed, and can be "ALL", "NONE", "SINGLE", "ALL|ANYONECANPAY", "NONE|ANYONECANPAY", or "SINGLE|ANYONECANPAY". Returns json object with keys:
- hex : raw transaction with signature(s) (hex-encoded string)
- complete : 1 if rawtx is completely signed, 0 if signatures are missing. If no private keys are given and the wallet is locked, requires that the wallet be unlocked with walletpassphrase first.
Submits raw transaction (serialized, hex-encoded) to local node and network. Returns transaction id, or an error if the transaction is invalid for any reason.
Funds are sitting in one or more multisignature transaction outputs, and it is time to gather signatures and spend them.
Assumption: you know the multisignature outputs' {txid, outputNumber, amount}.
- Create a raw transaction to spend, using createrawtransaction.
- Use signrawtransaction to add your signatures (after unlocking the wallet, if necessary).
- Give the transaction to the other person(s) to sign.
- You or they submit the transaction to the network using sendrawtransaction. You must be careful to include an appropriate transaction fee or the sendrawtransaction method is likely to fail (either immediately or, worse, the transaction will never confirm).
These lower-level routines will be useful for debugging and testing; listunspent gives a detailed list of the state of the wallet, and sendrawtx might be used to test double-spend-handling.
You want fine-grained control over exactly what coins in the wallet are spent.
- Get a list of not-yet-spent outputs with listunspent
- Create a transaction using createrawtransaction
- Apply signatures using signrawtransaction
- Submit it using sendrawtransaction Note that you are responsible for preventing accidental double-spends.
You want to specify, on a per-transaction basis, how much to pay in fees. Or you want to implement your own policy for how often transactions that are not immediately included in blocks are re-broadcast to the network.
- Maintain a list of not-yet-spent, confirmed outputs with listunspent (refreshed every time a new block is found, using the -blocknotify feature).
- Create a transaction with exactly the amount of fees you wish with createrawtransaction
- Apply signatures using signrawtransaction
- Submit it with sendrawtransaction
- Re-submit it periodicially with sendrawtransaction if it does not get into a block.
If you want to re-broadcast a transaction right away, you can use the getrawtransaction and sendrawtransaction API calls to do that. As a bash shell-script one-liner it would be:
- sendrawtransaction $(getrawtransaction $TXID) (note that Bytz-Qt/bytzd automatically re-transmit wallet transactions periodically until they are accepted into a block).
If you have a raw transaction and want to make sure all of its signatures are correct, you can use the signrawtransaction API call. Pass in the hex-encoded raw transaction, any inputs that bytzd doesn't yet know about, and an empty array of private keys to use to sign the transaction. Passing an empty array of private keys will prevent signrawtransaction from doing any signing; if it returns "complete":1 then all of the existing signatures are valid and there are no signatures missing.
- API calls list
- https://people.xiph.org/~greg/signdemo.txt example of signing offline
- https://people.xiph.org/~greg/escrowexample.txt example for escrow
- https://gist.github.com/3966071 example for offline multisig
Builds
HOW TO: Compile the Bytz daemon from source
Bytz Guardian Validator Nodes
HOWTO: Bytz 2.0 GVT Quickstart Guide
HOWTO: Setup Bytz 2.0 remote Masternode with Ubuntu remote and local QT wallet
Bytz Currency Token System - ATP
Atomic Token Protocol (ATP) Overview
Bytz Token system Basic Operations
Create new token
Send tokens
Use Cases - Create new NFT
Token balance
View token information
Testing Bytz tokens on regtest
Start regtest
Access Token Management Key
Bytz Token group management
Key rotation with token authorities
Create and distribute the GVT token for starting a GVN
Create Management Tokens
Drop token mint capability
Find token authorities
General FAQ
HOWTO: Backup my wallet and its data
HOWTO: Backup Bytz coin blockchain database
HOWTO: Export private Keys from Bytz Qt
HOWTO: Import private key to Bytz 2.0 Wallet
User-Documentation
Accounts-Explained
Bytz currency data directory
Raw transactions
Running Bytz
Gitian
Gitian Building
Create Debian - VirtualBox
Create Debian - VMWare
Create Debian - Google Console
Setup Gitian - Debian - VirtualBox
Setup Gitian - Ubuntu - VirtualBox
Setup Gitian - Debian - Google Console
Bytz
Developer-Documentation
API-Calls-List
API-Reference-JSON-RPC