Bytom is software designed to operate and connect to highly scalable blockchain networks confirming to the Bytom Blockchain Protocol, which allows partipicants to define, issue and transfer digitial assets on a multi-asset shared ledger. Please refer to the White Paper for more details.
In the current state bytom
is able to:
- Issue assets
- Manage account as well as asset
- Spend assets
- Go version 1.8 or higher, with
$GOPATH
set to your preferred directory
Ensure Go with the supported version is installed properly:
$ go version
$ go env GOROOT GOPATH
$ git clone https://github.com/Bytom/bytom $GOPATH/src/github.com/bytom
- Bytomd
$ cd $GOPATH/src/github.com/bytom
$ make install
$ make bytomd
- Bytomcli
$ cd $GOPATH/src/github.com/bytom/cmd/bytomcli
$ make bytomcli
Currently, bytom is still in active development and a ton of work needs to be done, but we also provide the following content for these eager to do something with bytom
.
When successfully building the project, the bytom
and bytomcli
binary should be present in cmd/bytomd
and cmd/bytomcli
directory, respectively. The next step is to initialize the node:
$ cd ./cmd/bytomd
$ ./bytomd init
After that, you'll see .bytom
generated in current directory, then launch the single node:
$ ./bytomd node --wallet.enable
Given the bytom
node is running, the general workflow is as follows:
- create an account
- create an asset
- create/sign/submit a transaction to transfer an asset
- query the assets on-chain
Create an account named alice
:
$ ./bytomcli create-account alice
xprv:<alice_account_private_key>
responses:<create-account-responses>
account id:<alice_account_id>
Check out the new created account:
$ ./bytomcli list-accounts
Create an asset named gold
:
$ ./bytomcli create-asset gold
xprv:<gold_asset_private_key>
xpub:<gold_asset_public_key>
responses:<create-asset-responses>
asset id:<gold_asset_id>
Check out the new created asset:
$ ./bytomcli list-assets
Since the account alice
and the asset gold
are ready, we need to create another account bob
, which is also neccessary for the following Expenditure test:
$ ./bytomcli create-account bob
Firstly, Alice issue <issue_amount>
, e.g., 10000, gold
:
$ ./bytomcli sub-create-issue-tx <alice_account_id> <bob_account_id> <gold_asset_id> <gold_asset_private_key> <issue_amount>
When the transaction above is mined, query the balances:
# Alice should have 10000 gold now
$ ./bytomcli list-balances
- Alice -> Bob
Alice pays Bob <payment_amount>
, e.g., 1000, gold
:
$ ./bytomcli sub-spend-account-tx <alice_account_id> <bob_account_id> <gold_asset_id> <alice_private_key> <payment_amount>
# In our case, after Alice pays Bob 1000 gold, the amount of Alice's gold should be 9000, Bob's balances should be 1000
$ ./bytomcli list-balances
- Bob -> Alice
Bob pays Alice <payment_amount>
, e.g., 500, gold
:
$ ./bytomcli sub-spend-account-tx <bob_account_id> <alice_account_id> <gold_asset_id> <bob_private_key> <payment_amount>
# In our case, after Bob pays Alice 500 gold, the amount of Alice's gold should be 9500, Bob's balances should be 500
$ ./bytomcli list-balances
If you have started a bytom node, then you can create an account via create-key password
, which will generate a keystore
directory containing the keys under the project directory.
$ ./bytomcli create-key account_name password # Create an account named account_name using password
$ ./bytomcli delete-key password pubkey # Delete account pubkey
$ ./bytomcli reset-password oldpassword newpassword pubkey # Update password
Get the submodule depenency for the two-node test:
$ git submodule update --init --recursive
Create the first node bytomd0
and second node bytomd1
:
$ cd cmd/bytomd/2node-test
$ ./test.sh bytomd0 # Start the first node
$ ./test.sh bytomd1 # Start the second node
Then we have two nodes:
$ ./bytomcli net-info
net-info:map[listening:true listeners:[Listener(@192.168.199.43:3332)] peers:[map[node_info:map[listen_addr:192.168.199.43:3333 version:0.1.2 other:[wire_version=0.6.2 p2p_version=0.5.0] pub_key:D6B76D1B4E9D7E4D81BA5FAAE9359302446488495A29D7E70AF84CDFEA186D66 moniker:anonymous network:bytom remote_addr:127.0.0.1:51036] is_outbound:false connection_status:map[RecvMonitor:map[Start:2017-10-30T13:45:47.18+08:00 Bytes:425130 AvgRate:27010 Progress:0 Active:true Idle:1.04e+09 Samples:42 InstRate:4591 CurRate:3540 PeakRate:114908 BytesRem:0 TimeRem:0 Duration:1.574e+10] Channels:[map[RecentlySent:5332 ID:64 SendQueueCapacity:100 SendQueueSize:0 Priority:5]] SendMonitor:map[Active:true Idle:1.24e+09 Bytes:16240 Samples:41 CurRate:125 AvgRate:1032 Progress:0 Start:2017-10-30T13:45:47.18+08:00 Duration:1.574e+10 InstRate:147 PeakRate:4375 BytesRem:0 TimeRem:0]]]]]
Ensure your Docker version is 17.05 or higher.
$ docker build -t bytom .
Thank you for considering to help out with the source code! Any contributions are highly appreciated, and we are grateful for even the smallest of fixes!
If you run into an issue, feel free to file one in this repository. We are glad to help!