CRYPTO NEWS

FTX US applies for trust charter in New York

Crypto exchanges Coinbase and BitGo have previously received trust charters from New York’s financial regulator, allowing the firms to offer crypto custody services.

Getting "Expected private key to be an Uint8Array with length 32" when running a transfer function on ropsten testnet through my terminal

i am trying to send a transaction but it throws an error. MY CODE: var Tx = require(‘ethereumjs-tx’).Transaction const Web3 = require(‘web3’) const web3 = new Web3(‘https://ropsten.infura.io/v3/3612545f6ba447f2a3f24543cf915744’) const account1 = ‘0x414c87f17fa2071C2Ed6583839609ae116B5C1E9’ const account2 = ‘0x8bbaf0933C14e2d5Cec5D7cB1A0C06c512F7F05A’ const privateKey1 = Buffer.from(process.env.PRIVATE_KEY_1) const privateKey2 = Buffer.from(process.env.PRIVATE_KEY_2) const contractABI = //had to remove to shorten the code, contractAddress =::Listen

i am trying to send a transaction but it throws an error.

MY CODE:

var Tx = require('ethereumjs-tx').Transaction const Web3 = require('web3') const web3 = new Web3('https://ropsten.infura.io/v3/3612545f6ba447f2a3f24543cf915744')  const account1 = '0x414c87f17fa2071C2Ed6583839609ae116B5C1E9' const account2 = '0x8bbaf0933C14e2d5Cec5D7cB1A0C06c512F7F05A'  const privateKey1 = Buffer.from(process.env.PRIVATE_KEY_1) const privateKey2 = Buffer.from(process.env.PRIVATE_KEY_2)  const contractABI = //had to remove to shorten the code, contractAddress = '0x27A9d446A882D92E29cab27F7Ce3C9f8ec578e94'  const contract = new web3.eth.Contract(contractABI, contractAddress)  const data = contract.methods.transfer(account2, 1000).encodeABI()   web3.eth.getTransactionCount(account1, (err, txCount) => {      // Create transaction object     const txObject = {     nonce: web3.utils.toHex(txCount),     gasLimit: web3.utils.toHex(800000),     gasPrice: web3.utils.toHex(web3.utils.toWei('10', 'gwei')),     to: contractAddress,     data: data     }      // Sign the transaction     const tx = new Tx(txObject,{ chain: 'ropsten' })     tx.sign( privateKey1 )      const serializedTransaction = tx.serialize()     const raw = '0x' + serializedTransaction.toString('hex')      // Broadcast the transaction     web3.eth.sendSignedTransaction(raw, (err, txHash) => {         console.log('err:', err, 'txHash', txHash)     //Use this txHash to get the cotract on etherscan    })  }) 

ERROR ON NODE TERMINAL:

if (!cond) throw new Error(msg)              ^  Error: Expected private key to be an Uint8Array with length 32     at assert (/Users/B money/node_modules/secp256k1/lib/index.js:18:20)     at isUint8Array (/Users/B money/node_modules/secp256k1/lib/index.js:31:7)     at Object.ecdsaSign (/Users/B money/node_modules/secp256k1/lib/index.js:254:7)     at Object.exports.sign (/Users/B money/node_modules/ethereumjs-util/dist/secp256k1v3-adapter.js:247:25)     at Object.exports.ecsign (/Users/B money/node_modules/ethereumjs-util/dist/signature.js:12:25)     at Transaction.sign (/Users/B money/node_modules/ethereumjs-tx/dist/transaction.js:230:37)     at /Users/B money/app.js:32:5     at Object._fireError (/Users/B money/node_modules/web3-utils/lib/index.js:52:9)     at sendTxCallback (/Users/B money/node_modules/web3-core-method/lib/index.js:548:30)     at /Users/B money/node_modules/web3-core-requestmanager/lib/index.js:297:20     at XMLHttpRequest.request.onreadystatechange (/Users/B money/node_modules/web3-providers-http/lib/index.js:98:13)     at XMLHttpRequestEventTarget.dispatchEvent (/Users/B money/node_modules/xhr2-cookies/dist/xml-http-request-event-target.js:34:22)     at XMLHttpRequest._setReadyState (/Users/B money/node_modules/xhr2-cookies/dist/xml-http-request.js:208:14)     at XMLHttpRequest._onHttpRequestError (/Users/B money/node_modules/xhr2-cookies/dist/xml-http-request.js:349:14)     at ClientRequest.<anonymous> (/Users/B money/node_modules/xhr2-cookies/dist/xml-http-request.js:252:61)     at ClientRequest.emit (node:events:527:28) 

FTX US applies for trust charter in New York

Shopping cart
There are no products in the cart!
Continue shopping
0