Sign Transaction

I need help for signing the aion transaction.
Can anyone please share their implementation?

Suggest you have a read through: https://docs.aion.network/docs

JavaScript Example:

// specify accounts and amount
let signer = 'a0290daf95c1ba93e1930a8ec6a82f1ca8f52ab2e0f3b2ef3f34ee90ae033504';
let data = '0x9dd2c369a187b4e6b9c402f030e50743e619301ea62aa4c0737d4ef7e10a3d49';//web3.sha3("xyz")

// unlock signer
let isUnlocked = web3.personal.unlockAccount(signer, "password", 100)
let status = isUnlocked ? "unlocked" : "locked";
console.log("signer account " + status);

// perform sign the data
let signature = web3.eth.sign(signer, data);
console.log("\signature of the data: " + signature);

I m using https://github.com/aionnetwork/aion_wallet to sign transaction

The repo you referenced is an experimental implementation of a web-based wallet, it requires you have your own node infrastructure and secure web-server environment; alongside Web3 API developer chops. I’m not sure that specific implementation is still relevant (afaik it was configured for a previous testnet).

If you’re just wanting to send/receive coins: Aion Desktop Wallet

*The Aion Desktop Wallet can be configured to connect to your own node/kernel.

Alternatively, CLI if you’re running your own node/kernel: Web3 console

I want to perform transaction using code.
I have my own node infrastructure and secure web server environment.
I need those exact steps that are to be used to make a transaction

Include the Web3 JavaScript API in your application:

const Web3 = require('/path/to/aion/web3');
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));

https://docs.aion.network/docs/web3

//

Now define transactions as required, the functionality is compatible with eth_sendTransaction and examples are given here:

https://docs.aion.network/docs/transaction-functionality

// specify accounts and amount
let sender = 'a06f02e986965ddd3398c4de87e3708072ad58d96e9c53e87c31c8c970b211e5';
let receiver = 'a0bd0ef93902d9e123521a67bef7391e9487e963b2346ef3b3ff78208835545e';
let amount = 1000000000000000000; // = 1 AION

// unlock sender
let isUnlocked = web3.personal.unlockAccount(sender, "password", 100)
let status = isUnlocked ? "unlocked" : "locked";
console.log("sender account " + status);

// perform transaction
let txHash = web3.eth.sendTransaction({from: sender, to: receiver, value: amount});
console.log("\ntransaction hash: " + txHash);

// print receipt
let txReceipt = web3.eth.getTransactionReceipt(txHash);
// repeat till tx processed
while (txReceipt == null) {
  // wait 10 sec
  sleep(10000);
  txReceipt = web3.eth.getTransactionReceipt(txHash);
}
console.log("\ntransaction receipt:");
console.log(txReceipt);

function sleep(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
2 Likes