gdcrm

module
v0.0.0-...-04eb8a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2019 License: Apache-2.0

README

Build

1.进入源码根目录

make bootnode make gdcrm

Run

启动程序,默认至少三个节点:

1.启动bootnode ./build/bin/bootnode --genkey ./bootnode.key ./build/bin/bootnode --nodekey ./bootnode.key --addr :12340

然后找到屏幕输出的“UDP listener up, bootnodes”,拷贝后面的enode字段,比如:enode://4a6a6af8f4a729b3d36c6e333610d9676be759041b54af53d77d064f9f91bebaf14f03f257d79cd8c7aa824964dbae98a6981f9a575313a8eac22d62038a8b33@[::]:12340,其中[::]填入具体机器ip,本地的话写127.0.0.1,比如:enode://8ba3d01a533b44b18b833e308e36335c906f2e21621e076659d828a2e8f41a5bf21dbf914c4a32e7c35755b28d0204bb129ce07da57d00027788885ddf6cacec@127.0.0.1:12340

2.按顺序分别启动三个节点

//第一个节点 ./build/bin/gdcrm --rpcport 9010 --bootnodes "enode://4a6a6af8f4a729b3d36c6e333610d9676be759041b54af53d77d064f9f91bebaf14f03f257d79cd8c7aa824964dbae98a6981f9a575313a8eac22d62038a8b33@127.0.0.1:12340" --port 12341 --nodekey "node1.key"

//第二个节点 ./build/bin/gdcrm --rpcport 9011 --bootnodes enode://e9d51341d96909c21e6e7bc4332f2be6b3511c7a0638719618db0496a70dc32d18f14bca34efec2c898aa108e2f3a228f2963fcf9cc62f692878fc79cbab2d73@127.0.0.1:12340 --port 12342 --nodekey "node2.key"

//第三个节点 ./build/bin/gdcrm --rpcport 9012 --bootnodes enode://e9d51341d96909c21e6e7bc4332f2be6b3511c7a0638719618db0496a70dc32d18f14bca34efec2c898aa108e2f3a228f2963fcf9cc62f692878fc79cbab2d73@127.0.0.1:12340 --port 12343 --nodekey "node3.key"

API

1.rpc调用默认不发往第一个节点跟第二个节点,否则拒绝执行。

rpc调用示例(curl命令):

//dcrm公钥生成。(发往第三个节点) curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"dcrm_reqAddr","params":[],"id":67}' http://127.0.0.1:9012

//dcrm sign。(发往第三个节点) curl -X POST -H "Content-Type":application/json --data '{"jsonrpc":"2.0","method":"dcrm_sign","params":["046637ce9e78efb18d3ff343bf9bb648dd8875d6899b6228b042adc889bdfc3f89596902d5d1b6d4086f8fb2aa42e830b4e5e09cd688f01e6f4f018387ec76e337","0x19b6236d2e7eb3e925d0c6e8850502c1f04822eb9aa67cb92e5004f7017e5e41"],"id":67}' http://127.0.0.1:9012

其中046637ce9e78efb18d3ff343bf9bb648dd8875d6899b6228b042adc889bdfc3f89596902d5d1b6d4086f8fb2aa42e830b4e5e09cd688f01e6f4f018387ec76e337 是dcrm_reqAddr得到的pubkey,0x19b6236d2e7eb3e925d0c6e8850502c1f04822eb9aa67cb92e5004f7017e5e41是待签名的hash,要求格式必须是0x开头的16进制32字节字符串。

Directories

Path Synopsis
cmd
bootnode
bootnode runs a bootstrap node for the Ethereum Discovery Protocol.
bootnode runs a bootstrap node for the Ethereum Discovery Protocol.
secp256k1
Package secp256k1 wraps the bitcoin secp256k1 C library.
Package secp256k1 wraps the bitcoin secp256k1 C library.
sha3
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
Package sha3 implements the SHA-3 fixed-output-length hash functions and the SHAKE variable-output-length hash functions defined by FIPS-202.
internal
common
Package common contains various helper functions.
Package common contains various helper functions.
common/hexutil
Package hexutil implements hex encoding with 0x prefix.
Package hexutil implements hex encoding with 0x prefix.
common/math
Package math provides integer math utilities.
Package math provides integer math utilities.
common/mclock
Package mclock is a wrapper for a monotonic clock source
Package mclock is a wrapper for a monotonic clock source
p2p
Package p2p implements the Ethereum p2p network protocols.
Package p2p implements the Ethereum p2p network protocols.
discover
Package discover implements the Node Discovery Protocol.
Package discover implements the Node Discovery Protocol.
discv5
Package discv5 implements the RLPx v5 Topic Discovery Protocol.
Package discv5 implements the RLPx v5 Topic Discovery Protocol.
enr
Package enr implements Ethereum Node Records as defined in EIP-778.
Package enr implements Ethereum Node Records as defined in EIP-778.
event
Package event deals with subscriptions to real-time events.
Package event deals with subscriptions to real-time events.
metrics
Go port of Coda Hale's Metrics library
Go port of Coda Hale's Metrics library
nat
Package nat provides access to common network port mapping protocols.
Package nat provides access to common network port mapping protocols.
netutil
Package netutil contains extensions to the net package.
Package netutil contains extensions to the net package.
protocols
Package protocols is an extension to p2p.
Package protocols is an extension to p2p.
rlp
Package rlp implements the RLP serialization format.
Package rlp implements the RLP serialization format.
simulations
Package simulations simulates p2p networks.
Package simulations simulates p2p networks.
rpc
Package rpc provides access to the exported methods of an object across a network or other I/O connection.
Package rpc provides access to the exported methods of an object across a network or other I/O connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL