Ethereum のトランザクションハッシュからトランザクション詳細を取得


Install Web3 (version 1.0)

$ npm install web3

Example code

const Web3 = require('web3');
console.log(Web3.version);
// => 1.0.0-beta.34

var web3 = new Web3('wss://mainnet.infura.io/ws');
const transactionHash = '0x6d365aa4dda50738ae9b63d0ec634d9163c814a1f257b88ed383bd3dae33bbb2';
web3.eth.getTransaction(transactionHash, function (error, result){
    console.log(result);
});

// result =>
// { blockHash: '0x767636dfb822296c23222714a0136a938d6436de5293ae59282b3ce266e7c04e',
//   blockNumber: 5526818,
//   from: '0x5baeB16048431F0F6f366788d0c1B381280c3f81',
//   gas: 21000,
//   gasPrice: '50000000000',
//   hash: '0x6d365aa4dda50738ae9b63d0ec634d9163c814a1f257b88ed383bd3dae33bbb2',
//   input: '0x',
//   nonce: 0,
//   to: '0xF02c1c8e6114b1Dbe8937a39260b5b0a374432bB',
//   transactionIndex: 55,
//   value: '4290000000000000',
//   v: '0x26',
//   r: '0x7340afd3e9c3bb3159443af772fd50cb0720fa0d1a82bfe3bcf9b7b539c1ce60',
//   s: '0x4951b17a78169233a0ee24651eff54265fd6dbb6cbaa2fc5c55cffcf78743123' }

Note