You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi all, I am curious why with the following code, I can execute the transaction of transferring 1 HNT to another with a transaction hash returned successfully even the wallet has 0 HNT, also is there a way to check the status of the transaction from an exchange or from Helium network?
async function make_transaction(){
const client = new Client();
console.log("make_transaction the client: ", client);
// the transactions library needs to be configured
// with the latest chain vars in order to calculate fees
const vars = await client.vars.get();
console.log("make_transaction the vars: ", vars);
Transaction.config(vars);
const entropy = await crypto.randomBytes(32);
console.log("make_transaction entropy is: ", entropy);
let entropyStr = entropy.toString("hex");
console.log("make_transaction entropyStr: ", entropyStr);
let bob = await Keypair.fromEntropy(entropy);
console.log("make_transaction bob is: ", bob);
console.log("make_transaction the bob.address: ", bob.address);
// initialize an address from a b58 string
const alice = Address.fromB58('148d8KTRcKA5JKPekBcKFd4KfvprvFRpjGtivhtmRmnZ8MFYnP3');
console.log("make_transaction the alice: ", alice);
//let mnemonic = alice.mnemonic;
//console.log("make_transaction the mnemonic: ", mnemonic);
// get the speculative nonce for the keypair
console.log("make_transaction the bob.address.b58: ", bob.address.b58);
// let publicKey = bob.publicKey;
//console.log("make_transaction the publicKey: ", publicKey);
//let publicKeyString = Base64.fromUint8Array(publicKey);
//console.log("make_transaction publicKeyString: ", publicKeyString);
// let publicKeyBack = Base64.toUint8Array(publicKeyString);
//console.log("make_transaction publicKeyBack: ", publicKeyBack);
//const account = await client.accounts.get(bob.address.b58);
//console.log("make_transaction the balance.floatBalance: ", account.balance.floatBalance);
//console.log("make_transaction the account: ", account);
// construct a payment txn
const paymentTxn = new PaymentV1({
payer: bob.address,
payee: alice,
amount: 1,
nonce: alice.speculativeNonce + 1,
});
console.log("nonce is: ", paymentTxn);
console.log('transaction fee is:', paymentTxn.fee);
const signedPaymentTxn = await paymentTxn.sign({ payer: bob });
console.log("make_transaction the serialized transaction: ", signedPaymentTxn.toString());
let txHash = await client.transactions.submit(signedPaymentTxn.toString())
console.log("make_transaction the transaction hash: ", txHash);
}
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Hi all, I am curious why with the following code, I can execute the transaction of transferring 1 HNT to another with a transaction hash returned successfully even the wallet has 0 HNT, also is there a way to check the status of the transaction from an exchange or from Helium network?
async function make_transaction(){
}
Thanks in advance!
The text was updated successfully, but these errors were encountered: