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
$ cd $GOPATH/src/github.com/bytom
$ make bytomd # build bytomd
$ make bytomcli # build 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 --chain_id testnet
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, issue gold
to alice:
$ ./bytomcli create-account bob
Firstly, Alice issue <issue_amount>
, e.g., 10000, gold
:
$ ./bytomcli sub-create-issue-tx <alice_account_id> <gold_asset_id> <issue_amount> <gold_asset_private_key> <account_private_key>
When the transaction is on-chain, query the balances:
# Alice should have 10000 gold now
$ ./bytomcli list-balances
Alice pays Bob <payment_amount>
, e.g., 1000, gold
:
- Bob creates receiver program
$./bytomcli create-account-receiver bob
responses like this:
responses:map[control_program:766baa207b73a71a9e8a77ace69bdd5d68fdfacc841bfdd5d6e0057a331846c24ac222e35151ad696c00c0 expires_at:2017-12-30T17:10:01.915062361+08:00]
- off-chain transfers receiver program to alice
- Alice builds transaction and then makes this transacion on-chain
$./bytomcli sub-control-receiver-tx <account_xprv> <account_id> <asset_id> <spend_amount> <control_program>
- list balance
$./bytomcli list-balances
As above, just btm_asset_id
=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
$./bytomcli sub-control-receiver-tx <account_xprv> <account_id> <btm_asset_id> <spend_amount> <control_program>
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!