ledger-core
Public Member Functions | List of all members
ledger::core::api::BitcoinLikeInput Class Referenceabstract

#include <BitcoinLikeInput.hpp>

+ Inheritance diagram for ledger::core::api::BitcoinLikeInput:

Public Member Functions

virtual std::experimental::optional< std::string > getAddress ()=0
 
virtual std::vector< std::vector< uint8_t > > getPublicKeys ()=0
 
virtual std::vector< std::shared_ptr< DerivationPath > > getDerivationPath ()=0
 
virtual std::shared_ptr< AmountgetValue ()=0
 
virtual std::experimental::optional< std::string > getPreviousTxHash ()=0
 
virtual bool isCoinbase ()=0
 
virtual std::experimental::optional< std::string > getCoinbase ()=0
 
virtual std::experimental::optional< int32_t > getPreviousOutputIndex ()=0
 
virtual std::shared_ptr< BitcoinLikeOutputgetPreviousOuput ()=0
 
virtual std::vector< uint8_t > getScriptSig ()=0
 
virtual std::shared_ptr< BitcoinLikeScriptparseScriptSig ()=0
 
virtual void setScriptSig (const std::vector< uint8_t > &scriptSig)=0
 
virtual void pushToScriptSig (const std::vector< uint8_t > &data)=0
 
virtual void setSequence (int32_t sequence)=0
 
virtual int64_t getSequence ()=0
 
virtual void getPreviousTransaction (const std::shared_ptr< BinaryCallback > &callback)=0
 
virtual void setP2PKHSigScript (const std::vector< uint8_t > &signature)=0
 

Detailed Description

Class representing Bitcoin inputs.

Member Function Documentation

◆ getAddress()

virtual std::experimental::optional<std::string> ledger::core::api::BitcoinLikeInput::getAddress ( )
pure virtual

Returns the address of the input (if an address can be computed).

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getCoinbase()

virtual std::experimental::optional<std::string> ledger::core::api::BitcoinLikeInput::getCoinbase ( )
pure virtual

Stored data cointained in coinbase.

Returns
Optional String

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getDerivationPath()

virtual std::vector<std::shared_ptr<DerivationPath> > ledger::core::api::BitcoinLikeInput::getDerivationPath ( )
pure virtual

Returns the derivation path of this input if the address is owned by the wallet.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getPreviousOuput()

virtual std::shared_ptr<BitcoinLikeOutput> ledger::core::api::BitcoinLikeInput::getPreviousOuput ( )
pure virtual

Retrieve the output spent by this input. Depending on the implementation this method may use a lock to fetch data from a database. Therefore it may have poor performance, use with caution.

Returns
The output spent by this input.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getPreviousOutputIndex()

virtual std::experimental::optional<int32_t> ledger::core::api::BitcoinLikeInput::getPreviousOutputIndex ( )
pure virtual

Get output index, it identifies which UTXO from tht transaction to spend.

Returns
Optional 32 bits integer, index of previous transaction

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getPreviousTransaction()

virtual void ledger::core::api::BitcoinLikeInput::getPreviousTransaction ( const std::shared_ptr< BinaryCallback > &  callback)
pure virtual

Get the previous transaction associated with the input.

◆ getPreviousTxHash()

virtual std::experimental::optional<std::string> ledger::core::api::BitcoinLikeInput::getPreviousTxHash ( )
pure virtual

Get the transaction hash of the output spent by this input. The result can be NULL if the output is not owned by the wallet.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getPublicKeys()

virtual std::vector<std::vector<uint8_t> > ledger::core::api::BitcoinLikeInput::getPublicKeys ( )
pure virtual

Returns the public associated with the address. This value can be NULL if you are building a transaction with an address which does not belong to your wallet.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getScriptSig()

virtual std::vector<uint8_t> ledger::core::api::BitcoinLikeInput::getScriptSig ( )
pure virtual

Get ScriptSig of this input. The scriptsig is the first half of a script necessary to spend a previous output.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getSequence()

virtual int64_t ledger::core::api::BitcoinLikeInput::getSequence ( )
pure virtual

Get the sequence number of this input.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ getValue()

virtual std::shared_ptr<Amount> ledger::core::api::BitcoinLikeInput::getValue ( )
pure virtual

Returns the value of the amount. Depending on the backend this value may not exist if the input is not owned by the wallet.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ isCoinbase()

virtual bool ledger::core::api::BitcoinLikeInput::isCoinbase ( )
pure virtual

Check whether input is for a coinbase.

Returns
Boolean, true if input belongs to coinbase transaction (reward for mining a block)

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ parseScriptSig()

virtual std::shared_ptr<BitcoinLikeScript> ledger::core::api::BitcoinLikeInput::parseScriptSig ( )
pure virtual

◆ pushToScriptSig()

virtual void ledger::core::api::BitcoinLikeInput::pushToScriptSig ( const std::vector< uint8_t > &  data)
pure virtual

Push data to the end of the current ScriptSig.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ setP2PKHSigScript()

virtual void ledger::core::api::BitcoinLikeInput::setP2PKHSigScript ( const std::vector< uint8_t > &  signature)
pure virtual

Easy way to set the P2PKH script signature. Shorthand for input.pushToScriptSig(input.getPublicKeys()[0], signature).

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ setScriptSig()

virtual void ledger::core::api::BitcoinLikeInput::setScriptSig ( const std::vector< uint8_t > &  scriptSig)
pure virtual

Set the ScriptS to the given value.

Parameters
scriptSigThe ScriptSig to use for this input

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.

◆ setSequence()

virtual void ledger::core::api::BitcoinLikeInput::setSequence ( int32_t  sequence)
pure virtual

Set the sequence number of this input.

Implemented in ledger::core::BitcoinLikeWritableInputApi, and ledger::core::BitcoinLikeInputApi.


The documentation for this class was generated from the following file: