### les\_serverInfo 获取有关当前已连接以及允许的总/单独连接容量的信息。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.ServerInfo() map[string]interface{}` | | Console | `les.serverInfo()` | | RPC | `{"method": "les_serverInfo", "params": []}` | #### 例 ~~~ > les.serverInfo { freeClientCapacity: 16000, maximumCapacity: 1600000, minimumCapacity: 16000, priorityConnectedCapacity: 180000, totalCapacity: 1600000, totalConnectedCapacity: 180000 } ~~~ ### les\_clientInfo 如果指定的客户列表或ID列表为空,则获取所有指定客户列表上的所有客户信息(联系,余额,定价)。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.ClientInfo(ids []enode.ID) map[enode.ID]map[string]interface{}` | | Console| `les.clientInfo([id, ...])` | | RPC | `{"method": "les_clientInfo", "params": [[id, ...]]}` | #### 例 ~~~ > les.clientInfo([]) { 37078bf8ea160a2b3d129bb4f3a930ce002356f83b820f467a07c1fe291531ea: { capacity: 16000, connectionTime: 11225.335901136, isConnected: true, pricing/balance: 998266395881, pricing/balanceMeta: "", pricing/negBalance: 501657912857, priority: true }, 6a47fe7bb23fd335df52ef1690f37ab44265a537b1d18eb616a3e77f898d9e77: { capacity: 100000, connectionTime: 9874.839293082, isConnected: true, pricing/balance: 2908840710198, pricing/balanceMeta: "qwerty", pricing/negBalance: 206242704507, priority: true }, 740c78f7d914e5c763731bc751b513fc2388ffa0b47db080ded3e8b305e68c75: { capacity: 16000, connectionTime: 3089.286712188, isConnected: true, pricing/balance: 998266400174, pricing/balanceMeta: "", pricing/negBalance: 55135348863, priority: true }, 9985ade55b515f79f64274bf2ae440ca8c433cfb0f283fb6010bf46f796b2a3b: { capacity: 16000, connectionTime: 11479.335479545, isConnected: true, pricing/balance: 998266452203, pricing/balanceMeta: "", pricing/negBalance: 564116425655, priority: true }, ce65ada2c3e17d6da00cec0b3cc4c8ed5e74428b60f42fa287eaaec8cca62544: { capacity: 16000, connectionTime: 7095.794385419, isConnected: true, pricing/balance: 998266448492, pricing/balanceMeta: "", pricing/negBalance: 214617753229, priority: true }, e1495ceb6db842f3ee66428d4bb7f4a124b2b17111dae35d141c3d568b869ef1: { capacity: 16000, connectionTime: 8614.018237937, isConnected: true, pricing/balance: 998266391796, pricing/balanceMeta: "", pricing/negBalance: 185964891797, priority: true } } ~~~ ### les\_priorityClientInfo 获取有关指定ID范围内正余额(`start`包括(`stop`不包括))的客户的单个客户信息。如果`stop`为零,则返回结果,直到最后一个现有余额输入。`maxCount`限制返回结果的数量。如果达到计数限制,但该范围内有更多ID,则结果中将包含第一个缺少的ID,并为其分配一个空值。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.PriorityClientInfo(start, stop enode.ID, maxCount int) map[enode.ID]map[string]interface{}` | | Conosle | `les.priorityClientInfo(id, id, number)` | | RPC | `{"method": "les_priorityClientInfo", "params": [id, id, number]}` | #### 例 ~~~ > les.priorityClientInfo("0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000000000000000000000000000000000000000000000", 100) { 37078bf8ea160a2b3d129bb4f3a930ce002356f83b820f467a07c1fe291531ea: { capacity: 16000, connectionTime: 11128.247204027, isConnected: true, pricing/balance: 999819815030, pricing/balanceMeta: "", pricing/negBalance: 501657912857, priority: true }, 6a47fe7bb23fd335df52ef1690f37ab44265a537b1d18eb616a3e77f898d9e77: { capacity: 100000, connectionTime: 9777.750592047, isConnected: true, pricing/balance: 2918549830576, pricing/balanceMeta: "qwerty", pricing/negBalance: 206242704507, priority: true }, 740c78f7d914e5c763731bc751b513fc2388ffa0b47db080ded3e8b305e68c75: { capacity: 16000, connectionTime: 2992.198001116, isConnected: true, pricing/balance: 999819845102, pricing/balanceMeta: "", pricing/negBalance: 55135348863, priority: true }, 9985ade55b515f79f64274bf2ae440ca8c433cfb0f283fb6010bf46f796b2a3b: { capacity: 16000, connectionTime: 11382.246766963, isConnected: true, pricing/balance: 999819871598, pricing/balanceMeta: "", pricing/negBalance: 564116425655, priority: true }, ce65ada2c3e17d6da00cec0b3cc4c8ed5e74428b60f42fa287eaaec8cca62544: { capacity: 16000, connectionTime: 6998.705683407, isConnected: true, pricing/balance: 999819882177, pricing/balanceMeta: "", pricing/negBalance: 214617753229, priority: true }, e1495ceb6db842f3ee66428d4bb7f4a124b2b17111dae35d141c3d568b869ef1: { capacity: 16000, connectionTime: 8516.929533901, isConnected: true, pricing/balance: 999819891640, pricing/balanceMeta: "", pricing/negBalance: 185964891797, priority: true } } > les.priorityClientInfo("0x4000000000000000000000000000000000000000000000000000000000000000", "0xe000000000000000000000000000000000000000000000000000000000000000", 2) { 6a47fe7bb23fd335df52ef1690f37ab44265a537b1d18eb616a3e77f898d9e77: { capacity: 100000, connectionTime: 9842.11178361, isConnected: true, pricing/balance: 2912113588853, pricing/balanceMeta: "qwerty", pricing/negBalance: 206242704507, priority: true }, 740c78f7d914e5c763731bc751b513fc2388ffa0b47db080ded3e8b305e68c75: { capacity: 16000, connectionTime: 3056.559199029, isConnected: true, pricing/balance: 998790060237, pricing/balanceMeta: "", pricing/negBalance: 55135348863, priority: true }, 9985ade55b515f79f64274bf2ae440ca8c433cfb0f283fb6010bf46f796b2a3b: {} } ~~~ ### les\_addBalance 将签名的值添加到指定客户端的令牌余额中并更新其`meta`标签。余额不能低于零或超过零`2^^63-1`。返回更新前后的余额值。该`meta`标签可用于存储序列号或对上次处理的传入付款,令牌到期信息,其他货币余额或任何特定于应用程序的其他信息的引用。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.AddBalance(id enode.ID, value int64, meta string) ([2]uint64, error)}` | | Console | `les.addBalance(id, number, string)` | | RPC | `{"method": "les_addBalance", "params": [id, number, string]}` | #### 例 ~~~ > les.addBalance("0x6a47fe7bb23fd335df52ef1690f37ab44265a537b1d18eb616a3e77f898d9e77", 1000000000, "qwerty") [968379616, 1968379616] ~~~ ### les\_setClientParams 如果ID列表为空,请为指定的已连​​接客户端列表或所有已连接客户端设置容量和价格因素。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.SetClientParams(ids []enode.ID, params map[string]interface{}) error` | | Console | `les.setClientParams([id, ...], {string: value, ...})` | | RPC | `{"method": "les_setClientParams", "params": [[id, ...], {string: value, ...}]}` | #### 例 ~~~ > les.setClientParams(["0x6a47fe7bb23fd335df52ef1690f37ab44265a537b1d18eb616a3e77f898d9e77"], { "capacity": 100000, "pricing/timeFactor": 0, "pricing/capacityFactor": 1000000000, "pricing/requestCostFactor": 1000000000, "pricing/negative/timeFactor": 0, "pricing/negative/capacityFactor": 1000000000, "pricing/negative/requestCostFactor": 1000000000, }) null ~~~ ### les\_setDefaultParams 为后续连接的客户设置默认定价因子。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.SetDefaultParams(params map[string]interface{}) error` | | Console | `les.setDefaultParams({string: value, ...})` | | RPC | `{"method": "les_setDefaultParams", "params": [{string: value, ...}]}` | #### 例 ~~~ > les.setDefaultParams({ "pricing/timeFactor": 0, "pricing/capacityFactor": 1000000000, "pricing/requestCostFactor": 1000000000, "pricing/negative/timeFactor": 0, "pricing/negative/capacityFactor": 1000000000, "pricing/negative/requestCostFactor": 1000000000, }) null ~~~ ### les\_latestCheckpoint 获取最新已知检查点的索引和哈希。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.LatestCheckpoint() ([4]string, error)` | | Console | `les.latestCheckpoint()` | | RPC | `{"method": "les_latestCheckpoint", "params": []}` | #### 例 ~~~ > les.latestCheckpoint ["0x110", "0x6eedf8142d06730b391bfcbd32e9bbc369ab0b46ae226287ed5b29505a376164", "0x191bb2265a69c30201a616ae0d65a4ceb5937c2f0c94b125ff55343d707463e5", "0xf58409088a5cb2425350a59d854d546d37b1e7bef8bbf6afee7fd15f943d626a"] ~~~ ### les\_getCheckpoint 通过索引获取检查点哈希。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.GetCheckpoint(index uint64) ([3]string, error)` | | Console | `les.getCheckpoint(number)` | | RPC | `{"method": "les_getCheckpoint", "params": [number]}` | #### 例 ~~~ > les.getCheckpoint(256) ["0x93eb4af0b224b1097e09181c2e51536fe0a3bf3bb4d93e9a69cab9eb3e28c75f", "0x0eb055e384cf58bc72ca20ca5e2b37d8d4115dce80ab4a19b72b776502c4dd5b", "0xda6c02f7c51f9ecc3eca71331a7eaad724e5a0f4f906ce9251a2f59e3115dd6a"] ~~~ ### les\_getCheckpointContractAddress 获取检查点Oracle合同的地址。 | 命令方式 | 调用方法 | | --- | --- | | GO | `les.GetCheckpointContractAddress() (string, error)` | | Console | `les.checkpointContractAddress()` | | RPC | `{"method": "les_getCheckpointContractAddress", "params": []}` | #### 例 ~~~ > les.checkpointContractAddress "0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a" ~~~