Skip to content

Add first-pass ARC network support#4162

Draft
tmcollins4 wants to merge 1 commit intobitpay:masterfrom
tmcollins4:arc-network-first-pass
Draft

Add first-pass ARC network support#4162
tmcollins4 wants to merge 1 commit intobitpay:masterfrom
tmcollins4:arc-network-first-pass

Conversation

@tmcollins4
Copy link
Copy Markdown
Contributor

Summary

Adds first-pass ARC testnet support as an EVM-compatible chain.

  • Configures ARC testnet in bitcore-test.config.json via ./moralis
  • Adds ARC chain ID/default network/18-decimal native units in crypto-wallet-core
  • Reuses ETH derivation, validation, native tx, and ERC20 tx providers for ARC
  • Treats ARC as an EVM chain in bitcore-client
  • Adds focused tests for derivation, validation, native txs, ERC20 txs, and client EVM recognition

Notes / Follow-ups

ARC native USDC and the ARC ERC-20 USDC interface represent the same underlying balance with different units:

  • Native ARC balance: 18 decimals
  • ERC-20 USDC interface 0x3600000000000000000000000000000000000000: 6 decimals

Follow-up work is needed for:

  • BitPay /currencies metadata for native ARC and ARC USDC
  • BWS/BWC handling so native ARC and ERC-20 USDC are not double-counted
  • Fee/spend checks, because gas and ERC-20 USDC transfers draw from the same underlying USDC balance

Validation

Automated:

  • packages/crypto-wallet-core: npm run test
  • packages/bitcore-client: npm run compile
  • packages/bitcore-client: ./node_modules/.bin/mocha -r tsx --exit 'test/unit/wallet.arc.test.ts'

Manual smoke:

  • Started bitcore-node with ARC testnet configured via ./moralis
  • Verified ARC enabled-chain, fee, priority fee, and nonce routes
  • Smoke tested bitcore-client CLI:
    • wallet-create
    • wallet-derive
    • wallet-balance
    • wallet-send
  • Confirmed native ARC send on testnet:
    • 0x686cd1fa60743fc35a61ead24e2f37a9444907eab1dfa3658208668a6c6e5ed1

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds first-pass ARC testnet support by treating ARC as an EVM-compatible chain across crypto-wallet-core, bitcore-client, and the bitcore-node test configuration.

Changes:

  • Adds ARC chain metadata (EVM chain list membership, default testnet network, chain ID, native units, derivation path) and wires ARC into existing ETH/EVM providers for derivation/validation/transactions.
  • Extends bitcore-client wallet logic to recognize ARC as an EVM chain and adds a focused unit test.
  • Adds/updates tests in crypto-wallet-core for ARC derivation, validation, chainId, native tx creation, ERC20 tx creation, and units.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/crypto-wallet-core/test/validation.test.ts Adds ARC address + URI validation tests.
packages/crypto-wallet-core/test/transactions.test.ts Adds ARC tx/chainId/units tests and imports Constants.
packages/crypto-wallet-core/test/address.test.ts Adds ARC derivation path + address derivation test.
packages/crypto-wallet-core/src/validation/index.ts Registers ARC validation via ETH validation logic.
packages/crypto-wallet-core/src/transactions/index.ts Registers ARC native + ARC ERC20 tx providers.
packages/crypto-wallet-core/src/derivation/paths.ts Adds ARC derivation path base (EVM-style).
packages/crypto-wallet-core/src/derivation/index.ts Registers ARC deriver using ETH deriver.
packages/crypto-wallet-core/src/constants/units.ts Adds ARC native units (18-decimal base units).
packages/crypto-wallet-core/src/constants/chains.ts Adds ARC to EVM chains + ARC testnet chain ID + default testnet network.
packages/bitcore-client/test/unit/wallet.arc.test.ts Adds unit test asserting ARC is treated as EVM chain.
packages/bitcore-client/src/wallet.ts Adds ARC to EVM chain libs and isEvmChain() list.
bitcore-test.config.json Adds ARC testnet external provider configuration (Moralis module + RPC host).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 43 to 47
OP_sepolia: 11155420,
OP_goerli: 28528,
// ARC testnets
ARC_testnet: 5042002,
// Regtests
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We may want to set ARC_mainnet to an invalid placeholder string

Comment on lines +14 to +16
const arcValidation = new EthValidation();
arcValidation.regex = /arc/i;

Copy link
Copy Markdown
Collaborator

@kajoseph kajoseph left a comment

Choose a reason for hiding this comment

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

In addition to some of the feedback from copilot above...

toSatoshis: 1e18,
full: {
maxDecimals: 8,
minDecimals: 8
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think these should be 6 since USDC shouldn't go beyond 6 decimals

Comment on lines 43 to 47
OP_sepolia: 11155420,
OP_goerli: 28528,
// ARC testnets
ARC_testnet: 5042002,
// Regtests
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We may want to set ARC_mainnet to an invalid placeholder string

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.

3 participants