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

Tx/Common: xDai Support #1323

Closed
holgerd77 opened this issue Jun 28, 2021 · 3 comments
Closed

Tx/Common: xDai Support #1323

holgerd77 opened this issue Jun 28, 2021 · 3 comments

Comments

@holgerd77
Copy link
Member

Part of #1288

The xDai chain is an EVM sidechain having a native stable token. It is a bit hard to find some necessary developer information. There is a section developer ressources in the docs, information on testnets is completely hidden (or I overlooked), at some point I stumbled upon the following GitHub repo stating that there are some testnets: https://github.com/poanetwork/poa-chain-spec/tree/dai

I also didn't find any information on a tx format. There is a block explorer though. From looking at an exemplaric tx I would cautiously assume that tx format is respectively might be the same as the main chain tx format and the gas provided is then paid in dai instead of ETH and somehow mapped internally or something (attention: wild assumption for now! 😋).

So I guess we should give this a test to connect to some test network, somehow move some (wrapped) DAI over there and try to send a tx (not yet digged further here on the procedure). I might find some additional time to test but generally open for everyone to give this a try.

@acolytec3
Copy link
Contributor

https://forum.poa.network/t/getting-started-with-poa-products/2595 This is the PoA network standard set of guidelines. There isn't an xdai testnet per se but I believe the Sokol testnet that's described in those docs mirrors xdai in functionality. Looks like it might be linked to kovan so we could test things out that way

@holgerd77
Copy link
Member Author

Yeah, so I was able to send the following successfull xDai transfer tx with the following code:

/**
 * Usage:
 * ts-node create-arbitrum-tx.ts PRIVATE_KEY
 */
import { Transaction } from '../ethereumjs-monorepo/packages/tx/src'
import Common from '../ethereumjs-monorepo/packages/common/dist'

const from = '0xaaec86394441f915bce3e6ab399977e9906f3b69'

const PRIV_KEY = process.argv[2]
const to = '0xe13ece23b514caa5b53395c01d0d53d1843258ad'

const common = Common.custom({ chainId: 100 })

const txData = {
  from,
  nonce: 0,
  gasPrice: 1000000000,
  gasLimit: 21000,
  to,
  value: 1,
}

const tx = Transaction.fromTxData(txData, { common })
const signedTx = tx.sign(Buffer.from(PRIV_KEY, 'hex'))

console.log(`0x${signedTx.serialize().toString('hex')}`)

@ryanio
Copy link
Contributor

ryanio commented Jul 19, 2021

Added in #1317 (082c5f3)

@ryanio ryanio closed this as completed Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants