Svarog cebcab7f5c
Implement BIP-143-like sighash (#1598)
* Move CalculateSignatureHash to consensushashing

* Added CalcSignatureHash_BIP143 with all parameters except the re-used hashes

* Add handling of outputHash

* Add sequencesHash to the mix

* Add previousOutputsHash to the mix

* Replace legacy CalculateSigHash with new one, and re-wire to all non-test code

* Add missing types to WriteElement

* Fix tests in txscript

* Fix tests in rest of code

* Add missing comments

* Add SubnetworkID and Gas to sigHash

* Add TestCalculateSignatureHash

* Invert condition in SigHashSingle getOutputsHash

* Explicitly define that payloadHash for native transactions is 0

* added benchmark to CalculateSignatureHash

* Reformat call for signAndCheck

* Change SigHashes to be true bit-fields

* Add check for transaction version

* Write length of byte array in WriteElement

* hashOutpoint should get outpoint, not txIn

* Use inputIndex instead of i to determine SigHashType

* Use correct transaction version + fix some typos

* Fix hashes in test

* Reformat an overly-long line

* Replace checkHashTypeEncoding with caalls to hashType.IsStandardSigHashType

* Convert hashType to uint8

* Add comment
2021-03-17 15:17:38 +02:00
..
2021-03-15 13:48:40 +02:00
2020-12-23 09:41:48 +02:00
2021-02-21 09:17:21 +02:00
2021-03-17 15:17:38 +02:00

WALLET

IMPORTANT:

This software is for TESTING ONLY. Do NOT use it for handling real money.

wallet is a simple, no-frills wallet software operated via the command line.
It is capable of generating wallet key-pairs, printing a wallet's current balance, and sending simple transactions.

Requirements

Go 1.16 or later.

Installation

Build from Source

  • Install Go according to the installation instructions here: http://golang.org/doc/install

  • Ensure Go was installed properly and is a supported version:

$ go version
  • Run the following commands to obtain and install kaspad including all dependencies:
$ git clone https://github.com/kaspanet/kaspad
$ cd kaspad/cmd/wallet
$ go install .
  • Wallet should now be installed in $(go env GOPATH)/bin. If you did not already add the bin directory to your system path during Go installation, you are encouraged to do so now.

Usage

  • Create a new wallet key-pair: wallet create --testnet
  • Print a wallet's current balance: wallet balance --testnet --address=kaspatest:000000000000000000000000000000000000000000
  • Send funds to another wallet: wallet send --testnet --private-key=0000000000000000000000000000000000000000000000000000000000000000 --send-amount=50 --to-address=kaspatest:000000000000000000000000000000000000000000