Docs

This page covers how to run and interact with Compute Substrate.


1. Install

Build from source:

git clone https://github.com/your-org/compute-substrate
cd compute-substrate
cargo build --release

Binary will be at:

target/release/csd

Optional:

sudo cp target/release/csd /usr/local/bin/csd

2. Run a Node

csd node \
  --datadir /var/lib/csd/node \
  --rpc 0.0.0.0:8789 \
  --genesis /etc/csd/genesis.bin \
  --p2p-listen /ip4/0.0.0.0/tcp/17999 \
  --bootnodes <multiaddr,...>

3. Run a Miner

csd node \
  --datadir /var/lib/csd/miner \
  --rpc 0.0.0.0:8789 \
  --mine \
  --miner-addr20 0x... \
  --genesis /etc/csd/genesis.bin \
  --p2p-listen /ip4/0.0.0.0/tcp/17999 \
  --bootnodes <multiaddr,...>

4. Create a Wallet

csd wallet new

This returns:

The private key is the wallet right now. Save it securely if you want recovery.


5. View Address / Identity

csd wallet addr --privkey 0x<privkey>
csd wallet whoami --privkey 0x<privkey>

6. Check Balance

csd wallet balance \
  --address 0x<addr20> \
  --datadir /var/lib/csd/node

7. Pick an Input

csd wallet input \
  --privkey 0x<privkey> \
  --datadir /var/lib/csd/node \
  --min 1000

This prints a spendable input as:

0x<txid>:<vout>:<value>

8. Spend

csd wallet spend \
  --privkey 0x<privkey> \
  --auto-input \
  --datadir /var/lib/csd/node \
  --output 0x<addr20>:100000 \
  --fee 1000

9. Build a Proposal

csd wallet propose \
  --privkey 0x<privkey> \
  --auto-input \
  --datadir /var/lib/csd/node \
  --fee 1000 \
  --domain eth_price_weekly \
  --payload-hash 0x<32-byte-hash> \
  --uri "ETH > $4000 by Friday" \
  --expires-epoch 100

This builds and signs a proposal transaction, but does not submit it.


10. Submit a Proposal

csd wallet propose-submit \
  --privkey 0x<privkey> \
  --auto-input \
  --datadir /var/lib/csd/node \
  --fee 1000 \
  --domain eth_price_weekly \
  --payload-hash 0x<32-byte-hash> \
  --uri "ETH > $4000 by Friday" \
  --expires-epoch 100 \
  --rpc-url http://127.0.0.1:8789

11. Build an Attestation

csd wallet attest \
  --privkey 0x<privkey> \
  --auto-input \
  --datadir /var/lib/csd/node \
  --fee 1000 \
  --proposal-id 0x<proposal-txid> \
  --score 100 \
  --confidence 90

This builds and signs an attestation transaction, but does not submit it.


12. Submit an Attestation

csd wallet attest-submit \
  --privkey 0x<privkey> \
  --auto-input \
  --datadir /var/lib/csd/node \
  --fee 1000 \
  --proposal-id 0x<proposal-txid> \
  --score 100 \
  --confidence 90 \
  --rpc-url http://127.0.0.1:8789

13. Query Outputs

curl http://127.0.0.1:8789/top/<domain>

Example:

curl http://127.0.0.1:8789/top/eth_price_weekly

14. Concepts


15. Notes