Skip to content

Commit

Permalink
feat: default port
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangsoledad committed Nov 21, 2018
1 parent f598ae0 commit fea6688
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 27 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ target/release/ckb run

### Send Transaction via RPC

Find RPC port in the log output, the following command assumes 3030 is used:
Find RPC port in the log output, the following command assumes 8114 is used:

```shell
curl -d '{"id": 2, "jsonrpc": "2.0", "method":"send_transaction","params": [{"version":2, "inputs":[], "outputs":[], "deps":[]}]}' \
-H 'content-type:application/json' 'http://localhost:3030'
-H 'content-type:application/json' 'http://localhost:8114'
```

### Advanced
Expand Down
2 changes: 1 addition & 1 deletion devtools/playground/random_transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'net/http'
require 'uri'

URL = ARGV[0] || "http://localhost:3030"
URL = ARGV[0] || "http://localhost:8114"
CKB_BIN = ARGV[1] || "./target/debug/ckb"
ACCOUNTS = [
{
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/components/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import JsonRPC from "simple-jsonrpc-js"
export default {
data: function() {
return {
addr: 'http://localhost:3030/',
addr: 'http://localhost:8114/',
blocks: [],
transactions: [],
block: {},
Expand Down
16 changes: 8 additions & 8 deletions rpc/src/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,35 @@ use std::sync::Arc;
//TODO: build_rpc_trait! do not surppot trait bounds
build_rpc_trait! {
pub trait IntegrationTestRpc {
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"submit_solution","params": [1]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"submit_solution","params": [1]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "submit_pow_solution")]
fn submit_pow_solution(&self, u64) -> Result<()>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"send_transaction","params": [{"version":2, "deps":[], "inputs":[], "outputs":[]}]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"send_transaction","params": [{"version":2, "deps":[], "inputs":[], "outputs":[]}]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "send_transaction")]
fn send_transaction(&self, Transaction) -> Result<H256>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_block")]
fn get_block(&self, H256) -> Result<Option<BlockWithHash>>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_transaction","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_transaction","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_transaction")]
fn get_transaction(&self, H256) -> Result<Option<TransactionWithHash>>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_hash","params": [1]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_hash","params": [1]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_block_hash")]
fn get_block_hash(&self, u64) -> Result<Option<H256>>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_tip_header","params": []}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_tip_header","params": []}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_tip_header")]
fn get_tip_header(&self) -> Result<Header>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_template","params": []}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_template","params": []}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_block_template")]
fn get_block_template(&self) -> Result<BlockTemplate>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_cells_by_type_hash","params": ["0x1b1c832d02fdb4339f9868c8a8636c3d9dd10bd53ac7ce99595825bd6beeffb3", 1, 10]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_cells_by_type_hash","params": ["0x1b1c832d02fdb4339f9868c8a8636c3d9dd10bd53ac7ce99595825bd6beeffb3", 1, 10]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_cells_by_type_hash")]
fn get_cells_by_type_hash(&self, H256, u64, u64) -> Result<Vec<CellOutputWithOutPoint>>;

Expand Down
14 changes: 7 additions & 7 deletions rpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,31 @@ use std::sync::Arc;

build_rpc_trait! {
pub trait Rpc {
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"send_transaction","params": [{"version":2, "deps":[], "inputs":[], "outputs":[]}]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"send_transaction","params": [{"version":2, "deps":[], "inputs":[], "outputs":[]}]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "send_transaction")]
fn send_transaction(&self, Transaction) -> Result<H256>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_block")]
fn get_block(&self, H256) -> Result<Option<BlockWithHash>>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_transaction","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_transaction","params": ["0x0f9da6db98d0acd1ae0cf7ae3ee0b2b5ad2855d93c18d27c0961f985a62a93c3"]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_transaction")]
fn get_transaction(&self, H256) -> Result<Option<TransactionWithHash>>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_hash","params": [1]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_hash","params": [1]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_block_hash")]
fn get_block_hash(&self, u64) -> Result<Option<H256>>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_tip_header","params": []}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_tip_header","params": []}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_tip_header")]
fn get_tip_header(&self) -> Result<Header>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_template","params": []}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_block_template","params": []}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_block_template")]
fn get_block_template(&self) -> Result<BlockTemplate>;

// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_cells_by_type_hash","params": ["0x1b1c832d02fdb4339f9868c8a8636c3d9dd10bd53ac7ce99595825bd6beeffb3", 1, 10]}' -H 'content-type:application/json' 'http://localhost:3030'
// curl -d '{"id": 2, "jsonrpc": "2.0", "method":"get_cells_by_type_hash","params": ["0x1b1c832d02fdb4339f9868c8a8636c3d9dd10bd53ac7ce99595825bd6beeffb3", 1, 10]}' -H 'content-type:application/json' 'http://localhost:8114'
#[rpc(name = "get_cells_by_type_hash")]
fn get_cells_by_type_hash(&self, H256, u64, u64) -> Result<Vec<CellOutputWithOutPoint>>;
}
Expand Down
12 changes: 4 additions & 8 deletions src/config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@
},
"network": {
"listen_addresses": [
"/ip4/0.0.0.0/tcp/0"
],
"boot_nodes": [
"/ip4/127.0.0.1/tcp/12345/p2p/QmVMJYDCL2vDnk4PmRGNdDRTWRnfeboUsriYA9CixJsBRf"
],
"reserved_nodes": [
"/ip4/127.0.0.1/tcp/12345/p2p/QmVMJYDCL2vDnk4PmRGNdDRTWRnfeboUsriYA9CixJsBRf"
"/ip4/0.0.0.0/tcp/8115"
],
"boot_nodes": [],
"reserved_nodes": [],
"only_reserved_peers": false,
"min_peers": 4,
"max_peers": 8,
"secret_file": "secret",
"nodes_file": "nodes.json"
},
"rpc": {
"listen_addr": "0.0.0.0:0"
"listen_addr": "0.0.0.0:8114"
},
"sync": {
"verification_level": "Full",
Expand Down

0 comments on commit fea6688

Please sign in to comment.