geth查询某个交易的具体信息

合同代码

pragma solidity ^0.4.6;
 contract SimpleStorage{
uint storedData;
function set(uint x){
   storedData=x;
        }
 function get() constant returns(uint retVal){
 return storedData;
    }
}  


部署合同
haha@ubuntu:~/trufflecode$ truffle compile
Compiling SimpleStorage.sol...
Writing artifacts to ./build/contracts
haha@ubuntu:~/trufflecode$ truffle migrate
Running migration: 1_initial_migration.js
  Deploying SimpleStorage...
  SimpleStorage: 0xbcba93b7c51a42e4b4d9ff498f64272338715e80
Saving successful migration to network...
Saving artifacts...

geth端会输出

I1215 17:22:45.321097 internal/ethapi/api.go:940] Tx(0xfd6a8480a0e819c7e15599da2cbdb19f510c639434a499ca7cc0a40ef8156ae3) created: 0x40d76916b1782b70f5b922719ca4f779a7b2b1eb

查询合同部署在哪个区块

>eth.getTransaction('0xfd6a8480a0e819c7e15599da2cbdb19f510c639434a499ca7cc0a40ef8156ae3')
{
  blockHash: "0x1bfe4bc92817d44843d03712351d2e6b4d79629f8f6bc41bef944d6c3c632e1d",
  blockNumber: 8035,
  from: "0x414d9703aa1c26115dc2cdabe225db3bedc7a91f",
  gas: 4712388,
  gasPrice: 100000000000,
  hash: "0xfd6a8480a0e819c7e15599da2cbdb19f510c639434a499ca7cc0a40ef8156ae3",
  input: "0x6060604052346000575b6061806100166000396000f3606060405260e060020a600035046360fe47b1811460265780636d4ce63c146035575b6000565b3460005760336004356051565b005b34600057603f605a565b60408051918252519081900360200190f35b60008190555b50565b6000545b9056",
  nonce: 12,
  r: "0x1565976644674d077973e15ebbbfd9816aa16534ec572f71d0ffe5954f6976d1",
  s: "0x6d93f9f0ba07651db19d220fcaa445a8932cbc2a95bc5887211b137ba67713f4",
  to: null,
  transactionIndex: 0,
  v: "0x1c",
  value: 0
}
simple = eth.contract(abi).at('0x40d76916b1782b70f5b922719ca4f779a7b2beb')
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值