Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bitcoin Gold implementation #911

Closed
wants to merge 6 commits into from
Closed

Conversation

h4x3rotab
Copy link
Contributor

Description

Bitcoin Gold is already added to the trustwallet/assets. This PR adds the implementation including the address codec and transaction signing logic.

Testing instructions

Passes unit tests: ./build/tests/tests tests
Create a new address in walletconsole:

> coin btg
Set active coin to: bitcoingold    Use 'coin' to change.  (name: 'bitcoin gold'  symbol: btg  numericalid: 156)
> addrDefault
Result:  btg1q8hnwn2j2vges5u9h9t456zfd46sjxfmxvk3rvl

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • If there is a related Issue, mention it in the description (e.g. 'Fixes Adopt Zilliqa to bech32 address format #444 ).

// Setup input
Proto::SigningInput input;
input.set_coin_type(TWCoinTypeBitcoinGold);
input.set_hash_type(TWBitcoinSigHashTypeFork | TWBitcoinSigHashTypeAll | (79 << 8));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When signing a BTG transaction, make sure to bitwise or (79 << 8) to the hash_type to enable the proper fork_id.

@codecov
Copy link

codecov bot commented Apr 2, 2020

Codecov Report

Merging #911 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #911   +/-   ##
=======================================
  Coverage   92.51%   92.51%           
=======================================
  Files         418      420    +2     
  Lines       12141    12147    +6     
=======================================
+ Hits        11232    11238    +6     
  Misses        909      909           
Impacted Files Coverage Δ
src/Bitcoin/Entry.cpp 100.00% <ø> (ø)
src/Bitcoin/Entry.h 100.00% <ø> (ø)
src/BitcoinGold/Address.h 100.00% <100.00%> (ø)
src/BitcoinGold/SegwitAddress.h 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72c8b9e...ddb624c. Read the comment docs.

@hewigovens hewigovens closed this Apr 14, 2020
@trustwallet trustwallet deleted a comment from optout21 Apr 14, 2020
@h4x3rotab h4x3rotab mentioned this pull request Apr 20, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adopt Zilliqa to bech32 address format
3 participants