Details require to list XinFin-XDC (MainNet Chain) with exchange
Project Name: Xinfin Network
Project website: https://xinfin.org
Token Name: XDC MainNet
Token Symbol: XDC
Block Finality: 32 Blocks
XDC3 SDK: https://www.npmjs.com/package/xdc3
Blockchain endpoint: https://rpc.xinfin.network
Mainnet Blockchain endpoint: https://rpc.xinfin.network
Testnet Blockchain endpoint: https://rpc.apothem.network
Devnet Blockchain endpoint: https://devnetrpc.apothem.network
Github: https://github.com/XinFinOrg/XinFin-Node
Technical White Paper: https://www.xinfin.org/docs/whitepaper-tech.pdf
Business White Paper: https://www.xinfin.org/docs/whitepaper-business.pdf
Telegram: https://t.me/xinfin
Youtube: https://www.youtube.com/channel/UCQaL6FixEQ80RJC0B2egX6g
Twitter: https://twitter.com/XinFin_Official
Reddit: https://www.reddit.com/r/xinfin/
Slack: https://xinfin-public.slack.com/
XinFin Logo:
XDC Logo:
Pair Reference : XDC:USDC, XDC:ETH, XDC:BTC, XDC:USD
Preference to run bounty plan : No
How to create account in XinFin Blockchain?
1. Using Keystore
web3.eth.personal.newAccount(password, [callback])
Parameters
password - String:
The password to encrypt this account with.
Returns
Promise
returns String:
The address of the newly created account.
Example
web3.eth.personal.newAccount('!@superpassword')
.then(console.log);
> '0x1234567891011121314151617181920212223456'
2. Using Private key (Generates an account object with private key and public key.)
web3.eth.accounts.create([entropy]);
Parameters
entropy - String
(optional): A random string to increase entropy. If given it should be at least 32 characters. If none is given a random string will be generated using random hex.
Returns
Object
- The account object with the following structure:
address - string
: The account address.privateKey - string
: The accounts private key. This should never be shared or stored unencrypted in localstorage! Also make sure to null the memory after usage.signTransaction(tx [, callback]) - Function
: The function to sign transactions. See
web3.eth.accounts.signTransaction() for more.
sign(data) - Function
: The function to sign transactions. See
web3.eth.accounts.sign() for more.
Example
web3.eth.accounts.create();
> {
address: "0xb8CE9ab6943e0eCED004cDe8e3bBed6568B2Fa01",
privateKey: "0x348ce564d427a3311b6536bbcff9390d69395b06ed6c486954e971d960fe8709",
signTransaction: function(tx){...},
sign: function(data){...},
encrypt: function(password){...}
}
How to deposit XDC?
1. New Block Notification
2. getTransactionFromBlock
getTransactionFromBlock(hashStringOrNumber, indexNumber [, callback])
Returns a transaction based on a block hash or number and the transactions index position.
Parameters
string
- A block number or hash. Or the string "genesis", "latest"
or "pending"
as in the
default block parameter.
Number
- The transactions index position.Function
- (optional) Optional callback, returns an error object as first parameter and the result as second.sign(data) - Function
: The function to sign transactions. See web3.eth.accounts.sign() for more.Returns
Promise
returns Object
- A transaction object.
Example
var transaction = web3.eth.getTransactionFromBlock('0x4534534534', 2)
.then(console.log);
> > {
"hash": "0x9fc76417374aa880d4449a1f7f31ec597f00b1f6f3dd2d66f4c9c6c445836d8b",
"nonce": 2,
"blockHash": "0xef95f2f1ed3ca60b048b4bf67cde2195961e0bba6f70bcbea9a2c4e133e34b46",
"blockNumber": 3,
"transactionIndex": 0,
"from": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
"to": "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f",
"value": '123450000000000000',
"gas": 314159,
"gasPrice": '2000000000000',
"input": "0x57cb2fc4"
}
How to withdraw XDC?
1. sendTransaction
web3.eth.sendTransaction(transactionObject [, callback])
Sends a transaction to the network.
Parameters
1. Object
- The transaction object to send:
from - String|Number
: The address for the sending account. Uses the web3.eth.defaultAccount property, if not specified. Or an address or index of a local wallet in
web3.eth.accounts.wallet.
to - String
: (optional) The destination address of the message, left undefined for a contract-creation transaction.value - Number|String|BN|BigNumber
: (optional) The value transferred for the transaction in wei, also the endowment if it's a contract-creation transaction.gas - Number
: (optional, default: To-Be-Determined) The amount of gas to use for the transaction (unused gas is refunded).gasPrice - Number|String|BN|BigNumber
: (optional) The price of gas for this transaction in wei, defaults to web3.eth.gasPrice.data - String
: (optional) Either a ABI byte string containing the data of the function call on a contract, or in the case of a contract-creation transaction the initialisation
code.
nonce - Number
: (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.2. callback - Function
: (optional) Optional callback, returns an error object as first parameter and the result as second.
Returns
The callback will return the 32 bytes transaction hash.
PromiEvent
: A promise combined event emitter. Will be resolved when
the transaction receipt is available. Additionally the following events are
available:
"transactionHash"
returns String
: Is fired right after the transaction is sent and a transaction hash is available."receipt"
returns object
: Is fired when the transaction receipt is available."confirmation"
returns Number, Object
: Is fired for every confirmation up to the 12th confirmation. Receives the confirmation number as the first and the
receipt as the second argument. Fired from confirmation 0 on, which is the
block where its minded.
"error"
returns Error
: Is fired if an error occurs during sending. If a out of gas error, the second parameter is the receipt.Example
// compiled solidity source code using https://remix.ethereum.org
var code = "603d80600c6000396000f3007c01000000000000000000000000000000000000000000000000000000006000350463c6888fa18114602d57005b6007600435028060005260206000f3";
// using the callback
web3.eth.sendTransaction({
from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
data: code // deploying a contracrt
}, function(error, hash){
...
});
// using the promise
web3.eth.sendTransaction({
from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
value: '1000000000000000'
})
.then(function(receipt){
...
});
// using the event emitter
web3.eth.sendTransaction({
from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
value: '1000000000000000'
})
.on('transactionHash', function(hash){
...
})
.on('receipt', function(receipt){
...
})
.on('confirmation', function(confirmationNumber, receipt){ ... })
.on('error', console.error); // If a out of gas error, the second parameter is the receipt.