EOS测试账号

EOS测试网络
API接口文档

节点:192.168.50.159,
其中nodeosd相关API请访问 http://192.168.50.159:8888,
Wallet相关API请访问 http://192.168.50.159:3000

##1.测试网

http://jungle.cryptolions.io/#accountInfo

##2.测试API

https://github.com/CryptoLions/EOS-Jungle-Testnet

##2.测试账号
liulian12345

Description EOS Token Sale Claim Key
Public key   EOS7LAzv5dbrzprL8DZuHYMKfTjQQ9AUXPAKzQfSFUed1GoJuTXmd
Private key  5Hsk6wB2MPqGPrU53jSVGHm3uvoqWJk3rCrnkGzEGc7HrH28n7t

localhost

Private key: 5JUJHBJF18Qs8WMdXnb5488AFzdAZcfKZ5QAX1srMLWa62rsL4e
Public key: EOS6BQZmWhPKZLVg4YDcR6KdrYb1dqjDAWxyGPHRTD6mpqJ1dACAp

Private key: 5KXZjxLz4qczfCGmWYUzxhiKyRN1eYaGCRZaT1hHAFJs9xsmCKS
Public key: EOS5uLxwJQgpEJteBxBTKiqWnyWiJTQAzAqx71M5AuMZ917oMv4g4

Jungle:

测试网络账号创建的block: 13658485

{
    "timestamp": "2018-09-10T09:33:29.000",
    "producer": "funnyhamster",
    "confirmed": 0,
    "previous": "00d06974a6485b5e6c80d804313d6c0058870848f103735fb24ae63851a61f66",
    "transaction_mroot": "00eb3fbea28360f5ab26cae9cf50c081baf5579800aa6062f059808ad9b44d7a",
    "action_mroot": "10a2e5ea43847603f2d68bc5b403eea5ec744b70d38ff1d73e859fbe9413e6c6",
    "schedule_version": 217,
    "new_producers": null,
    "header_extensions": [],
    "producer_signature": "SIG_K1_K26xvdaxUhQcE6Cga1fQfDLKxVYKpAG9nNk8isA4Pby8ZH2Jp8y8Z6ki8p3ZHAvuBFTJDrNTAW6va9Xbd1R7E8DoosQdXE",
    "transactions": [
        {
            "status": "executed",
            "cpu_usage_us": 7238,
            "net_usage_words": 43,
            "trx": {
                "id": "929ecaca3aa6aa09a515239ff79e78b4df62bf87809a45a7baf2848696c3f094",
                "signatures": [
                    "SIG_K1_KVJz9woQUmHRCot6prUeeY3H8vjZBSStUhefQhrmzsCDKS8MkqYV2ANgfPeSpdEgmAnqX39WnKraCGiwJYedzKkbu5nBnS"
                ],
                "compression": "none",
                "packed_context_free_data": "",
                "context_free_data": [],
                "packed_trx": "e03a965b2868e3b6720100000000030000000000ea305500409e9a2264b89a0150c810611a17b58b00000000a8ed32326650c810611a17b58b208269a69996b1ca01000000010002aa1bf6ea68794eb7ad364ea9e3438171866a557f1db49f596c67eab2a6a0d7230100000001000000010002aa1bf6ea68794eb7ad364ea9e3438171866a557f1db49f596c67eab2a6a0d723010000000000000000ea3055000000004873bd3e0150c810611a17b58b00000000a8ed32322050c810611a17b58b208269a69996b1caa08601000000000004454f53000000000000000000ea305500003f2a1ba6a24a0150c810611a17b58b00000000a8ed32323150c810611a17b58b208269a69996b1caa08601000000000004454f5300000000a08601000000000004454f53000000000100",
                "transaction": {
                    "expiration": "2018-09-10T09:35:28",
                    "ref_block_num": 26664,
                    "ref_block_prefix": 24295139,
                    "max_net_usage_words": 0,
                    "max_cpu_usage_ms": 0,
                    "delay_sec": 0,
                    "context_free_actions": [],
                    "actions": [
                        {
                            "account": "eosio",
                            "name": "newaccount",
                            "authorization": [
                                {
                                    "actor": "liulian12345",
                                    "permission": "active"
                                }
                            ],
                            "data": {
                                "creator": "liulian12345",
                                "name": "testhahaha12",
                                "owner": {
                                    "threshold": 1,
                                    "keys": [
                                        {
                                            "key": "EOS6BQZmWhPKZLVg4YDcR6KdrYb1dqjDAWxyGPHRTD6mpqJ1dACAp",
                                            "weight": 1
                                        }
                                    ],
                                    "accounts": [],
                                    "waits": []
                                },
                                "active": {
                                    "threshold": 1,
                                    "keys": [
                                        {
                                            "key": "EOS6BQZmWhPKZLVg4YDcR6KdrYb1dqjDAWxyGPHRTD6mpqJ1dACAp",
                                            "weight": 1
                                        }
                                    ],
                                    "accounts": [],
                                    "waits": []
                                }
                            },
                            "hex_data": "50c810611a17b58b208269a69996b1ca01000000010002aa1bf6ea68794eb7ad364ea9e3438171866a557f1db49f596c67eab2a6a0d7230100000001000000010002aa1bf6ea68794eb7ad364ea9e3438171866a557f1db49f596c67eab2a6a0d72301000000"
                        },
                        {
                            "account": "eosio",
                            "name": "buyram",
                            "authorization": [
                                {
                                    "actor": "liulian12345",
                                    "permission": "active"
                                }
                            ],
                            "data": {
                                "payer": "liulian12345",
                                "receiver": "testhahaha12",
                                "quant": "10.0000 EOS"
                            },
                            "hex_data": "50c810611a17b58b208269a69996b1caa08601000000000004454f5300000000"
                        },
                        {
                            "account": "eosio",
                            "name": "delegatebw",
                            "authorization": [
                                {
                                    "actor": "liulian12345",
                                    "permission": "active"
                                }
                            ],
                            "data": {
                                "from": "liulian12345",
                                "receiver": "testhahaha12",
                                "stake_net_quantity": "10.0000 EOS",
                                "stake_cpu_quantity": "10.0000 EOS",
                                "transfer": 1
                            },
                            "hex_data": "50c810611a17b58b208269a69996b1caa08601000000000004454f5300000000a08601000000000004454f530000000001"
                        }
                    ],
                    "transaction_extensions": []
                }
            }
        }
    ],
    "block_extensions": [],
    "id": "00d06975eb6fb6c7c281c3f68819489c27a2f876e3820f8bc37bb09f09f6d4ef",
    "block_num": 13658485,
    "ref_block_prefix": 4140007874
}
08/15/2018 15:00 下午 posted in  EOS

EOSIO Dawn 4.0 系统合约解读

From:EOSIO Dawn 4.0 系统合约解读

Dawn 4.0 发布后,基本上白皮书上提到的特性都得到了实现,特别是投票、资源抵押和内存买卖。

EOS 的网络带宽和计算资源是通过抵押代币的方式获得,如果不需要了可以解除抵押收回原先的代币。

投票的权重和抵押代币所获得的带宽和计算资源相关,抵押了越多,投票的权重越大。同时投票的权重会随着时间的推移减少,这个设定鼓励用户持续更新自己的投票。

而存储资源则是通过购买来得到,但是并不会消耗,当不再需要存储资源的时候可以出售。但是存储资源相对于EOS代币的价格会随着市场对于存储资源的需求而变动。

而这些功能都是在 eosio.system 这个智能合约中实现。

本文试图通过分析 eosio.system 中所有的功能函数来解读 eos 系统功能。

#函数列表
在 eosio.system.hpp 头文件中包含以下函数声明:

##delegatebw

void onblock( block_timestamp timestamp, account_name producer );

void delegatebw( account_name from, account_name receiver,asset stake_net_quantity, asset stake_cpu_quantity, bool transfer );

delegatebw 函数用来实现抵押代币获取 cpu 和带宽资源。参数定义:

  • from : 从哪个账号扣除用来抵押的代币
  • receiver : 抵押的代币的接受者,表示抵押获取的资源作用在哪个账号上
  • stake_net_quantity : 用来抵押带宽资源的代币数量
  • stake_cpu_quantity : 用来抵押计算资源的代币数量
  • transfer : 是否接受者可以主动解除抵押获得代币,如果不是,只有发起者能够解除抵押收回代币

##undelegatebw

void undelegatebw( account_name from, account_name receiver,asset unstake_net_quantity, asset unstake_cpu_quantity );
undelegatebw 函数用来解除抵押,释放资源,收回代币,参数定义:
  • from : 解除用哪个账号所抵押的代币
  • receiver : 解除作用在哪个账号上的抵押代币
  • unstake_net_quantity : 解除用来获取带宽资源的代币数量
  • unstake_cpu_quantity : 解除用来获取计算资源的代币数量
  • 解除抵押之后,资源会马上释放,同时投票权重也相应消失。但是代币需要等待一定时间才能回到账号里,目前的设定是3天。

##buyram

void buyram( account_name buyer, account_name receiver, asset tokens );

void buyrambytes( account_name buyer, account_name receiver, uint32_t bytes );

这两个函数的作用是购买存储资源,区别是买特定数量的代币还是买特定大小的内容。参数定义:

  • buyer : 购买存储资源的账号
  • receiver : 接受存储资源的账号
  • tokens : 购买存储资源所用的代币数量
  • bytes : 都买存储资源空间大小的数值

##sellram

void sellram( account_name receiver, int64_t bytes );

sellram函数功能是出售不需要的存储资源。参数定义:

  • receiver : 出售资源代币的接受账号
  • bytes : 出售多少空间的存储资源
    出售后资源会马上释放,收入的代币也会马上入账。

##refund

void refund( account_name owner );

refund 函数 在 undelegatebw 函数解除抵押后调用,作用是把抵押的代币退回账户。

##regproducer

void regproducer( const account_name producer, const public_key& producer_key, const std::string& url, uint16_t location );

regproducer 函数的作用是注册成为超级节点候选人。参数定义:

  • producer : 候选节点的账户名
  • producer_key : 候选节点的账户公钥
  • url : 候选节点的网站地址
  • location : 候选节点的机房地理位置
    注册成为候选人后就可以接受用户的投票了。

##unregprod

void unregprod( const account_name producer );

unregprod 函数的作用的取消成为候选人。

##voteproducer

void setram( uint64_t max_ram_size );

void voteproducer( const account_name voter, const account_name proxy, const std::vector<account_name>& producers );

voteproducer 函数的作用是投票。参数定义:

  • voter : 投票人
  • proxy : 代理投票人
  • producers : 得票人列表
    有两种投票模式,代理模式和直接投票模式。代理模式是将投票权重委托给一个代理人,让他帮你投票。直接投票模式就是直接投票给你信任的超级节点,最多30个。

#regproxy

void regproxy( const account_name proxy, bool isproxy );

regproxy 函数的作用是注册成为代理人,接受其他用户的委托。

##claimrewards

void claimrewards( const account_name& owner );

claimrewards 函数的作用是支付超级节点的奖励。

void setpriv( account_name account, uint8_t ispriv );

#测试方法
开发者可以通过 cleos system子命令来测试这些功能。

如果要加入一个测试网络成为出块人,步骤应该是这样:

  1. 注册账号
  2. 启动节点同步区块
  3. 注册成为候选人
  4. 抵押代币获得资源和投票权重
  5. 投票给自己
  6. 当得票足够后,等待一个周期,就可以成为出块人了。
08/15/2018 14:24 下午 posted in  EOS

区块链开发之确定性算法bip32,bip39,bip44

##引言

随着比特币区块链的发展,人们已经不满足于,只有一个账号的情况,有些人会有好几个账户,但是这就出现一个问题,我有几个账号,就要保存几个私钥,这就特别麻烦和不友好,所以,就出现了bip32确定性算法,该算法可以让你只有同一个种子,就可以生成无数个私钥和地址,这就大大方便了用户的使用。但是这个种子,也不较长,用户使用起来也比较繁琐,这就出现了bip39,它是使用助记词的方式,生成种子的,这样用户只需要记住,12个单词(3,6,9,12,15,18,21,24支持这些单词数,目前使用较广泛的是12和24),这就有大大提高了用户使用的便利性。又随着区块链发展,市面上出现了很多币种,之前的确定性算法只是针对比特币的,也就是说只支持一种币种,用户想用同一个种子,管理不同币种,这就促使了bip39协议的出现,它是基于bip32协议的,它给bip32的路径,赋予了不同的意义,很好的解决了多币种,多地址的问题。

协议官方链接

如果想详细的了解这些协议,请查看官方文档(解析的最清楚)
big32:
https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

bip39:https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki

bip44:https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

验证网站:https://iancoleman.io/bip39/

#BIP44简介

##路径级别

bip44给bip32定义了5各级别

m / purpose’ / coin_type’ / account’ / change / address_index

##m是固定的

Purpose也是固定的,值为44(或者 0x8000002C)

##Coin type

这个代表的是币种,0代表比特币,1代表比特币测试链,60代表以太坊

完整的币种列表地址:https://github.com/satoshilabs/slips/blob/master/slip-0044.md

##Account

代表这个币的账户索引,从0开始

##Change

常量0用于外部链,常量1用于内部链(也称为更改地址)。外部链用于在钱包外可见的地址(例如,用于接收付款)。内部链用于在钱包外部不可见的地址,用于返回交易变更。 (所以一般使用0)

##address_index

这就是地址索引,从0开始,代表生成第几个地址,并且官方建议,每个account下的address_index不要超过20

###示例

coin account change address path
Bitcoin first external first
Bitcoin first external second
Bitcoin first internal second
Bitcoin Testnet first external
Bitcoin Testnet second external
08/06/2018 17:45 下午 posted in  Ethereum

钱包测试账号信息:

##助记词:

live devote airport journey theme jealous syrup okay pyramid universe advice wall

##ETH钱包账户

###账户[0]:
地址[0]:0xC937F39FA384063E89752d61211186cB5D3912cC
私钥[0]:0x6de11341a4a3eee24980dcd907a2d9ea8702b43f7e5218c349db69748fb0ace4

###账户[1]:
第1个地址的私钥和keystore
地址[1]:0xd4357D40e9714e011a4e0D918b6E0B371Ad2f376
私钥[1]:1f5014b9c55b5f808f261d6cdd619e85a3fea70438111e3c6bdb4c7f7bc9ef36

keysotre[1]:

{"version":3,"id":"460c472e-7ad4-43d8-a6e5-716811ca9497","crypto":{"ciphertext":"a21f4f1cb8b4b38ac005e4a9f0f0fefdb1372c772f40930e9c009d3923ad55aa","cipherparams":{"iv":"7aef1d1cced46d7cc3131f63863d5203"},"kdf":"scrypt","kdfparams":{"r":6,"p":1,"n":4096,"dklen":32,"salt":"b4c8daf5e510dfd9de4e81aac1d381f4454a4da28f977b39dc218392c0ffe3d9"},"mac":"1c6a852298b4e4c17c40b1ebb5191ce08d498a42139f66714490683bb488edc7","cipher":"aes-128-ctr"},"address":"0xd4357d40e9714e011a4e0d918b6e0b371ad2f376"}

##BTC测试 m/44'/1'/0'/0
地址[0]:n44UNAeSMPLrZcr8W2QRn9jbZsW3NJ8YUj
私钥[1]:cUUGW6PXaV2RheeqmJdKvRN4PGCXBJwVmxmbdxKsUnsH33nAWCc9

地址[1]:mpgwNrt32sMtemgE6y4iH6UMk6tuAGQArn
私钥[1]:cRaf3jvs5rA9g84Pihb1dMaJaJqU4FZree7GYiW17zJ4vxN2vQtG

地址[101]:mqfWfmQJGDViWF4vENVkpMA2AbznHvtWNG
私钥[101]:cSxBRwJDENrqQK5c5oWzhvw3LpmsDs1cMr8B5EGwPwGjcBmpZdCt

##小虫测试ETH账号

1f5014b9c55b5f808f261d6cdd619e85a3fea70438111e3c6bdb4c7f7bc9ef36
07/25/2018 10:44 上午 posted in  Ethereum

钱包地址生成和扫描规则

##1.扫描类实例

iban:XE19RLALTH48S5S586M44YMOU1PBEVJ3BS4?amount=100&token=GNB
iban:XE19RLALTH48S5S586M44YMOU1PBEVJ3BS4?amount=0.001
iban:XE19RLALTH48S5S586M44YMOU1PBEVJ3BS4?amount=0.01&token=ETH

ethereum:0xeC34C8681972b22a79f641F42CFdb0e22BFFcd64?contractAddress=0x0d8775f648430679a709e98d2b0cb6250d2887ef&decimal=18&value=1000000000000000
07/19/2018 08:45 上午 posted in  Ethereum

ETH转账交易

##1.gasprice分级配置实例

https://ethers.io/gas-prices-v2.raw {
    details =     (
        "11 GWei",
        "12 GWei",
        "18 GWei",
        "100 GWei"
    );
    prices =     (
        11000000000,
        12000000000,
        18000000000,
        100000000000
    );
    subtitles =     (
        "completes in about 30 minutes",
        "completes in about 4 minutes",
        "completes in about 2 minutes",
        "completes in about 30 seconds"
    );
    titles =     (
        "SAFE LOW",
        AVERAGE,
        FAST,
        URGENT
    );
}

##2.交易成功返回的交易记录

{
	"jsonrpc": "2.0",
	"id": 1,
	"result": {
		"blockHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
		"blockNumber": null,
		"from": "0xec34c8681972b22a79f641f42cfdb0e22bffcd64",
		"gas": "0x5208",
		"gasPrice": "0x12a05f200",
		"hash": "0xdc9246c3485357c5d92cdf0c745a435361f3e036e3863c5dd525834348de6f9c",
		"input": "0x",
		"nonce": "0x12",
		"to": "0x295ac792993a96a332334f2752d544a64e940015",
		"transactionIndex": "0x0",
		"value": "0x5af3107a4000",
		"v": "0x26",
		"r": "0xd384b9e2a5854a5c6e573c5ad0bae428fa7e1b6c389264412ea3003c0120e684",
		"s": "0x56cef9a313ec44ed5c1768801cf16877ff07dd8e8371c3e32b7a6b5e31eff511"
	}
}
06/06/2018 07:50 上午 posted in  Ethereum

ETH ERC20的相关信息

##pyhton script

import json
import web3
from web3 import Web3, HTTPProvider

my = "0xD551234Ae421e3BCBA99A0Da6d736074f22192FF"
eos_contract_address = "0x86Fa049857E0209aa7D9e616F7eb3b3B78ECfdb0"

contract_source_code='''
[{
  "type":"function",
  "name":"balanceOf",
  "constant":true,
  "payable":false,
  "inputs":[{"name":"","type":"address"}],
  "outputs":[{"name":"","type":"uint256","value":"0"}]
}]
'''

abi = json.loads(contract_source_code)

web3 = Web3(HTTPProvider('http://localhost:8545') )
#web3 = Web3(HTTPProvider('https://mainnet.infura.io/<key>') )
source_code = web3.eth.getCode(eos_contract_address)
contract = web3.eth.contract(abi=abi, address=eos_contract_address)
contract.call().balanceOf(my)

##erc20 contract abi

[
  {
    "constant": true,
    "inputs": [],
    "name": "name",
    "outputs": [
      {
        "name": "",
        "type": "string"
      }
    ],
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_from",
        "type": "address"
      },
      {
        "name": "_to",
        "type": "address"
      },
      {
        "name": "_value",
        "type": "uint256"
      }
    ],
    "name": "transferFrom",
    "outputs": [
      {
        "name": "success",
        "type": "bool"
      }
    ],
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "decimals",
    "outputs": [
      {
        "name": "",
        "type": "uint8"
      }
    ],
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [
      {
        "name": "",
        "type": "address"
      }
    ],
    "name": "balanceOf",
    "outputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [],
    "name": "symbol",
    "outputs": [
      {
        "name": "",
        "type": "string"
      }
    ],
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_to",
        "type": "address"
      },
      {
        "name": "_value",
        "type": "uint256"
      }
    ],
    "name": "transfer",
    "outputs": [],
    "type": "function"
  },
  {
    "constant": false,
    "inputs": [
      {
        "name": "_spender",
        "type": "address"
      },
      {
        "name": "_value",
        "type": "uint256"
      },
      {
        "name": "_extraData",
        "type": "bytes"
      }
    ],
    "name": "approveAndCall",
    "outputs": [
      {
        "name": "success",
        "type": "bool"
      }
    ],
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [
      {
        "name": "",
        "type": "address"
      },
      {
        "name": "",
        "type": "address"
      }
    ],
    "name": "spentAllowance",
    "outputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "type": "function"
  },
  {
    "constant": true,
    "inputs": [
      {
        "name": "",
        "type": "address"
      },
      {
        "name": "",
        "type": "address"
      }
    ],
    "name": "allowance",
    "outputs": [
      {
        "name": "",
        "type": "uint256"
      }
    ],
    "type": "function"
  },
  {
    "inputs": [
      {
        "name": "initialSupply",
        "type": "uint256"
      },
      {
        "name": "tokenName",
        "type": "string"
      },
      {
        "name": "decimalUnits",
        "type": "uint8"
      },
      {
        "name": "tokenSymbol",
        "type": "string"
      }
    ],
    "type": "constructor"
  },
  {
    "anonymous": false,
    "inputs": [
      {
        "indexed": true,
        "name": "from",
        "type": "address"
      },
      {
        "indexed": true,
        "name": "to",
        "type": "address"
      },
      {
        "indexed": false,
        "name": "value",
        "type": "uint256"
      }
    ],
    "name": "Transfer",
    "type": "event"
  }
]

##ERC20如eos转账demo

http://www.yaozihao.cn/2017/12/08/697/

from web3 import Web3, HTTPProvider
from web3.contract import ConciseContract
import json

web3 = Web3(HTTPProvider('http://localhost:8545'))
print(web3.eth.blockNumber)

tx='0xb1ea3885a25efa295837c287560fe4c137c1bcd3718720330eb68d7f96a5479e'
web3.eth.getTransaction(tx)
web3.eth.getTransactionReceipt(tx)

exit(0)

web3.eth.defaultAccount = '0x00B113795f1aA12EE361adC6D281392802d0e025'
EIP20_ABI_str = '[{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"mintTimelocked","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]'
EIP20_ABI = json.loads(EIP20_ABI_str)

token_contract_address = '0x86fa049857e0209aa7d9e616f7eb3b3b78ecfdb0'

token = web3.eth.contract(
token_contract_address,
abi=EIP20_ABI,
ContractFactoryClass=ConciseContract,
)

totalSupply = token.totalSupply()
balance = token.balanceOf('0x00B113795f1aA12EE361adC6D281392802d0e025')
tx = token.transfer(
'0x00845daA689b1374ecAf4CfEcfBfc86D41ec7735',
web3.toWei(2,"ether"),
transact={'from':'0x00B113795f1aA12EE361adC6D281392802d0e025'})

tx = '0xb3b82923d8d9b5d28fbab7f7281704f033362ac9f293e6638227efb44ff85499'
web3.eth.getTransaction(tx)
web3.eth.getTransactionReceipt(tx)

web3.eth.getTransactionCount(web3.eth.coinbase)
web3.eth.getTransactionCount('0x00B113795f1aA12EE361adC6D281392802d0e025')
06/04/2018 21:05 下午 posted in  Ethereum

ETH钱包Keystore格式

根据ether framework 创建钱包成功之后返回的JSON:

{
  "x-ethers" : {
    "mnemonicCiphertext" : "4ec6ff1c1307fde22f54535d8f2c49ac",
    "version" : "0.1",
    "mnemonicCounter" : "e6225f53c68204cc0590505b0b0d9cfb",
    "client" : "ethers\/iOS",
    "gethFilename" : "UTC--2018-06-02T09-15-17.0Z--ec34c8681972b22a79f641f42cfdb0e22bffcd64"
  },
  "id" : "39362BF0-1571-41C9-BA5D-1D2E96FB1F8A",
  "address" : "ec34c8681972b22a79f641f42cfdb0e22bffcd64",
  "Crypto" : {
    "ciphertext" : "02a2381e0712b4911e231688ecd84470cc75221192d70f74b5255dc59ec8ba90",
    "cipherparams" : {
      "iv" : "8a92b1f77ad3f0404fdcaf9189cb0027"
    },
    "kdf" : "scrypt",
    "kdfparams" : {
      "r" : 8,
      "p" : 1,
      "n" : 262144,
      "dklen" : 32,
      "salt" : "a6ab1e929bef72f21e1af6d12ed6bdf0296b3d224491274f1fbd1b5a4074e9b4"
    },
    "mac" : "b16fe2af2ec678ee5f08e5d4ca748778b5eaa26003d5bcee71cd08b68f76e60a",
    "cipher" : "aes-128-ctr"
  },
  "version" : 3
}

jsonString String "{"isHDWallet":true,"id":"ec14e04d-6ed1-431e-8873-a9bd069d9534","crypto":{"ciphertext":"16c7a5a56b2ee6a94f95d940b336b99c73450c4cb1f74bb2f532821381efd507f87d8c1ba71b1a35712d8eb36a75895633bf86e85d7ff16ef27380a8209d2512f91b5c4ed299f815eed94d17cc1b79e42dbc35d73f93b030489cdef510b5b687","cipherparams":{"iv":"3d65a2eb4f68012503d1808f11f8cb4b"},"kdf":"scrypt","kdfparams":{"r":6,"p":1,"n":4096,"dklen":32,"salt":"820f1b08b5ab9caf189ee922abf98435fa50b057c6aa6ebd46dd07605c08dd98"},"mac":"726aec73aca75e0704c5322683ec291e50ee861f9dfd3dd7929a159b3c364c8e","cipher":"aes-128-cbc"},"pathToAddress":{"m\/44'\/60'\/0'\/0\/0":"0xC59A230342A13eC78141B3D20215eb78C07c0a27"},"rootPath":"m\/44'\/60'\/0'\/0","version":3}"

06/02/2018 08:15 上午 posted in  Ethereum