Developers Forum for XinFin XDC Network

Poonam Singh
Poonam Singh

Posted on • Updated on

[WIP]Prefix changes

Hii @Daniel Liu
I hope you are doing well !
I want ask that how to change address prefix in private blockchain, like that xdc,0x etc
Please help me
Thanks and regards
Poonam Singh

Discussion (6)

Collapse
mitali_blocksscan profile image
Mitali_BlocksScan

Hello @poonam_singh_8d4036dd4427

Regarding your query, I have found a solution that should address your concerns. Please take a look at the following GitHub link: github.com/XinFinOrg/XDPoSChain/pu...

If you still face any issue please feel free to ask.
Thank you!

Collapse
poonam_singh_8d4036dd4427 profile image
Poonam Singh Author

Hello Mitali_BlocksScan
Actually i replaced 0x prefix with G1 prefix,after this i create address and the address prefix start with G1,but i check the get block method ,its through error i.e Error: invalid argument 0: json: cannot unmarshal hex string of odd length into Go value of type common.Hash
how to resolve this issue .
Thank you!

Collapse
mitali_blocksscan profile image
Mitali_BlocksScan

Hello @poonam_singh_8d4036dd4427

I would appreciate it if you could provide further details about the issue you are facing and clarify your objective to change prefix to "G1" in order to gain a better understanding of your situation.

Thank you!

Thread Thread
poonam_singh_8d4036dd4427 profile image
Poonam Singh Author

Hello @mitali_blocksscan
I forked the go-ethereum for my undestanding, and renamed the prefix 0X with G1 globally in the codebase, now post this actions, i am able to perform all the operations / tx. on geth, however getBlock method , giving the below error:

eth.getBlock("0")
Error: invalid argument 0: hex string without G1 prefix
at web3.js:6367:9(45)
at send (web3.js:5099:62(34))
at :1:13(4)

eth.getBlock(1,true)
Error: invalid argument 0: hex string without G1 prefix
at web3.js:6367:9(45)
at send (web3.js:5099:62(34))
at :1:13(5)

eth.getBlock("G10")
Error: invalid argument 0: hex string without G1 prefix
at web3.js:6367:9(45)
at send (web3.js:5099:62(34))
at :1:13(4)
Kindly help me to resolve this issue.
Thank You

Thread Thread
mitali_blocksscan profile image
Mitali_BlocksScan

Kindly note that after changing codebase, we would suggest you to perform complete test.

Thread Thread
poonam_singh_8d4036dd4427 profile image
Poonam Singh Author

Hello @mitali_blocksscan
Thank for the Suggestion.
I replace the xdc prefix to G1 prefix after successfully intialiazation of genesis file and up the node0
i was facing issue i.e

./XDC --datadir /home/poonam/Desktop/XDPoSChain/build/bin/node0/ --syncmode 'full' --port 30314 --nodiscover --rpc --rpcaddr 'localhost' --rpcport 8503 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnodes 'enode://b7243794d1d31ecf42a0becc9d3e3ffae66b376ec8a8888c0282b4d8ffb6e9f4984760483702ba928e3256fb9d38d8fd4bcc45006a1b510c0e954bce550ff4a8@[::]:30301' --networkid 222 --gasprice '1' -unlock 'G16ec0ef4cfe0bc1f80712bfad43fe32dfe6c6ae1c' --password node0/password.txt --mine
INFO [06-19|17:58:45] Maximum peer count ETH=25 LES=0 total=25
INFO [06-19|17:58:45] XDCX datadir path=/home/poonam/Desktop/XDPoSChain/build/bin/node0/XDCx
INFO [06-19|17:58:45] Allocated cache and file handles database=/home/poonam/Desktop/XDPoSChain/build/bin/node0/XDCx cache=134.22mB handles=1024
INFO [06-19|17:58:45] Starting peer-to-peer node instance=XDC/v1.4.7-stable-d2ce55ec/linux-amd64/go1.17
INFO [06-19|17:58:45] Allocated cache and file handles database=/home/poonam/Desktop/XDPoSChain/build/bin/node0/XDC/chaindata cache=805.31mB handles=512
INFO [06-19|17:58:45] Initialised chain configuration config="{ChainID: 222 Homestead: 1 DAO: DAOSupport: false EIP150: 2 EIP155: 3 EIP158: 3 Byzantium: 4 Constantinople: Engine: XDPoS}"
INFO [06-19|17:58:45] Initialising Ethereum protocol versions="[63 62]" network=222
INFO [06-19|17:58:45] Loaded most recent local header number=0 hash=21f8e4…0529e0 td=1
INFO [06-19|17:58:45] Loaded most recent local full block number=0 hash=21f8e4…0529e0 td=1
INFO [06-19|17:58:45] Loaded most recent local fast block number=0 hash=21f8e4…0529e0 td=1
INFO [06-19|17:58:45] Loaded local transaction journal transactions=0 dropped=0
INFO [06-19|17:58:45] Regenerated local transaction journal transactions=0 accounts=0
INFO [06-19|17:58:45] Starting P2P networking
INFO [06-19|17:58:45] RLPx listener up self="enode://751dca26811f6c7097dfd73b08b2e63dce451a389ca3e6e7149d797457d7d0258d110f69e859d300ed844ebcd63605c3674c8db0304d0a371d03d1d30c2b4d5f@[::]:30314?discport=0"
INFO [06-19|17:58:45] IPC endpoint opened url=/home/poonam/Desktop/XDPoSChain/build/bin/node0/XDC.ipc
INFO [06-19|17:58:45] HTTP endpoint opened url=localhost:8503 cors= vhosts=localhost
Fatal: Could not list accounts: invalid account address or index "G16ec0ef4cfe0bc1f80712bfad43fe32dfe6c6ae1c"

how to resolve the issue
Kindly help me
Thanks