Skip to content

feature(node): ERC20 and ETH support#2325

Merged
matiu merged 58 commits into
bitpay:masterfrom
micahriggan:feature/eth-module-squashed
Sep 17, 2019
Merged

feature(node): ERC20 and ETH support#2325
matiu merged 58 commits into
bitpay:masterfrom
micahriggan:feature/eth-module-squashed

Conversation

@micahriggan
Copy link
Copy Markdown
Contributor

@micahriggan micahriggan commented Aug 9, 2019

Can now sync ETH and get wallet history for ERC20 tokens

Refactoring currency support into a module system. This allows the creation of 3rd party modules, and arbitrary currency support without forking.

ETH Syncing via

      "ETH": {
        "mainnet": {
          "chainSource": "p2p",
          "trustedPeers": [
            {
              "host": "127.0.0.1",
              "port": 30303
            }
          ],
          "provider": {
            "host": "127.0.0.1",
            "protocol":"ws",
            "port": 8546
          }
        }
      }

Testing

I've been testing with this local development node

alias parity-dev="/Users/micah/blockchains/eth/parity2.4.2 --config dev --base-path '/Users/micah/blockchains/eth/dev' --db-compaction ssd --cache-size 8192 --jsonrpc-cors=all --ws-origins=all --ws-apis=all"

and this private key
0x4d5db4107d237df6a3d58ee5f70ae63d73d7658d4026f2eefd2f204c81682cb7 imported into metamask

@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch 2 times, most recently from e6e485b to 5f5eae6 Compare August 12, 2019 16:44
@matiu matiu mentioned this pull request Aug 12, 2019
Can now sync ETH and get wallet history for ERC20 tokens
@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch from 5f5eae6 to d08ea9d Compare August 13, 2019 14:45
Comment thread packages/bitcore-node/src/modules/ethereum/api/eth-routes.ts Outdated
Comment thread packages/bitcore-node/src/modules/ethereum/api/eth-routes.ts Outdated
Comment thread packages/bitcore-node/src/modules/ethereum/models/transaction.ts Outdated
stream: res
};
return ChainStateProvider.streamMissingWalletAddresses(payload);
return await ChainStateProvider.streamMissingWalletAddresses(payload);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if this is streaming why does it await?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

eRRoR

res
};
return ChainStateProvider.streamWalletAddresses(payload);
return await ChainStateProvider.streamWalletAddresses(payload);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if this is streaming why does it await?

let { chain, network } = req.params;
try {
return ChainStateProvider.streamWalletTransactions({
return await ChainStateProvider.streamWalletTransactions({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if this is streaming why does it await?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So interesting thing I learned. If there's a throw inside of an async method that streams, then you'll get an unhandled promise rejection if you don't await that method.


onConnect() {
super.onConnect();
this.collection.createIndex({ chain: 1, network: 1, to: 1 }, { background: true });
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sparse

This was referenced Aug 23, 2019
@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch 3 times, most recently from 002b129 to e12cc24 Compare August 23, 2019 20:25
@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch from e12cc24 to a031a9b Compare August 23, 2019 20:37
if (!initialSyncComplete) {
return;
}
let prunedTxs = {};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fix pruneTxs always empty object

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch from 2e33d95 to e9bec10 Compare August 26, 2019 14:30
@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch from 3c73bb3 to 478ea8d Compare September 12, 2019 21:19
@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch 2 times, most recently from 1002638 to f8dac47 Compare September 16, 2019 19:46
@micahriggan micahriggan force-pushed the feature/eth-module-squashed branch from f8dac47 to 38081bf Compare September 16, 2019 19:46
@matiu matiu merged commit e825d60 into bitpay:master Sep 17, 2019
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.

4 participants