15 KiB
Table of Contents
- Ed25519Keypair
- Connection
- Transaction
- ccJsonLoad
- ccJsonify
Ed25519Keypair
Type: Object
Parameters
seedBuffer? A seed that will be used as a key derivation function
Properties
Connection
Base connection
Parameters
pathheaders(optional, default{})
getBlock
Parameters
blockHeight
getTransaction
Parameters
transactionId
listBlocks
Parameters
transactionIdstatus
listOutputs
Parameters
publicKeyspent
listTransactions
Parameters
assetIdoperation
listVotes
Parameters
blockId
postTransaction
Parameters
transaction
postTransactionSync
Parameters
transaction
postTransactionAsync
Parameters
transaction
postTransactionCommit
Parameters
transaction
searchAssets
Parameters
search
searchMetadata
Parameters
search
Transaction
Construct Transactions
serializeTransactionIntoCanonicalString
Canonically serializes a transaction into a string by sorting the keys
Parameters
transactionnullObject (transaction)
Returns string a canonically serialized Transaction
makeCreateTransaction
Generate a CREATE transaction holding the asset, metadata, and outputs, to be signed by
the issuers.
Parameters
assetObject Created asset's datametadataObject Metadata for the TransactionoutputsArray<Object> Array of Output objects to add to the Transaction. Think of these as the recipients of the asset after the transaction. ForCREATETransactions, this should usually just be a list of Outputs wrapping Ed25519 Conditions generated from the issuers' public keys (so that the issuers are the recipients of the created asset).issuers...Array<string> Public key of one or more issuers to the asset being created by this Transaction. Note: Each of the private keys corresponding to the given public keys MUST be used later (and in the same order) when signing the Transaction (signTransaction()).
Returns Object Unsigned transaction -- make sure to call signTransaction() on it before sending it off!
makeEd25519Condition
Create an Ed25519 Cryptocondition from an Ed25519 public key to put into an Output of a Transaction
Parameters
publicKeystring base58 encoded Ed25519 public key for the recipient of the Transactionjsonboolean If true returns a json object otherwise a crypto-condition type (optional, defaulttrue)
Returns Object Ed25519 Condition (that will need to wrapped in an Output)
makeOutput
Create an Output from a Condition. Note: Assumes the given Condition was generated from a single public key (e.g. a Ed25519 Condition)
Parameters
conditionObject Condition (e.g. a Ed25519 Condition frommakeEd25519Condition())amountstring Amount of the output (optional, default'1')
Returns Object An Output usable in a Transaction
makeSha256Condition
Create a Preimage-Sha256 Cryptocondition from a secret to put into an Output of a Transaction
Parameters
preimagestring Preimage to be hashed and wrapped in a crypto-conditionjsonboolean If true returns a json object otherwise a crypto-condition type (optional, defaulttrue)
Returns Object Preimage-Sha256 Condition (that will need to wrapped in an Output)
makeThresholdCondition
Create an Sha256 Threshold Cryptocondition from threshold to put into an Output of a Transaction
Parameters
thresholdnumbersubconditionsArray (optional, default[])jsonboolean If true returns a json object otherwise a crypto-condition type (optional, defaulttrue)
Returns Object Sha256 Threshold Condition (that will need to wrapped in an Output)
makeTransferTransaction
Generate a TRANSFER transaction holding the asset, metadata, and outputs, that fulfills
the fulfilledOutputs of unspentTransaction.
Parameters
unspentOutputsoutputsArray<Object> Array of Output objects to add to the Transaction. Think of these as the recipients of the asset after the transaction. ForTRANSFERTransactions, this should usually just be a list of Outputs wrapping Ed25519 Conditions generated from the public keys of the recipients.metadataObject Metadata for the TransactionunspentTransactionObject Previous Transaction you have control over (i.e. can fulfill its Output Condition)OutputIndices...number Indices of the Outputs inunspentTransactionthat this Transaction fulfills. Note that listed public keys listed must be used (and in the same order) to sign the Transaction (signTransaction()).
Returns Object Unsigned transaction -- make sure to call signTransaction() on it before sending it off!
signTransaction
Sign the given transaction with the given privateKeys, returning a new copy of transaction
that's been signed.
Note: Only generates Ed25519 Fulfillments. Thresholds and other types of Fulfillments are left as
an exercise for the user.
Parameters
transactionObject Transaction to sign.transactionis not modified.privateKeys...string Private keys associated with the issuers of thetransaction. Looped through to iteratively sign any Input Fulfillments found in thetransaction.
Returns Object The signed version of transaction.
ccJsonLoad
Loads a crypto-condition class (Fulfillment or Condition) from a BigchainDB JSON object
Parameters
conditionJsonObject
Returns cc.Condition Ed25519 Condition (that will need to wrapped in an Output)
ccJsonify
Serializes a crypto-condition class (Condition or Fulfillment) into a BigchainDB-compatible JSON
Parameters
fulfillmentcc.Fulfillment base58 encoded Ed25519 public key for recipient of the Transaction
Returns Object Ed25519 Condition (that will need to wrapped in an Output)