nonce 값 가져오기 및 보내기

YU YU·2022년 7월 6일

web3

목록 보기
2/2

가져오기

const txCount = await web3.eth.getTransactionCount(from)

보내기

nonce : web3.utils.toHex(txCount),

예시

 const txObject = {
    nonce: web3.utils.toHex(txCount),
    gasLimit: web3.utils.toHex(1000000),
    gasPrice: web3.utils.toHex(web3.utils.toWei("10", "gwei")),
    to: receive_account,
    value: "0x2C68AF0BB140000", // 0.2 hexcode 변경 
  }

참고
https://velog.io/@kysung95/BlockChain-Web-3-js%EB%A5%BC-%EC%82%AC%EC%9A%A9%ED%95%B4%EB%B3%B4%EC%9E%90

https://dukdukz.tistory.com/m/entry/%EB%B8%94%EB%A1%9D%EC%B2%B4%EC%9D%B8-%EC%84%9C%EB%AA%85%ED%95%98%EB%8A%94-%EB%B0%A9%EB%B2%95-3%EA%B0%80%EC%A7%80

profile
코딩 재밌어요!

0개의 댓글