Skip to main content

nexus contract deploy

Deploy a WASM smart contract to NEXUS.
nexus contract deploy [OPTIONS]

Options

OptionRequiredDescription
--wasm <PATH>YesPath to WASM file
--name <NAME>YesContract name
--from <ADDRESS>YesDeployer address or wallet name
--init-args <HEX>NoInitialization arguments (hex)
--value <SATS>NoValue to transfer (satoshis)

Examples

# Basic deployment
nexus contract deploy \
  --wasm ./target/wasm32-unknown-unknown/release/counter.wasm \
  --name counter \
  --from my-wallet

# With initialization arguments
nexus contract deploy \
  --wasm ./token.wasm \
  --name my_token \
  --from my-wallet \
  --init-args "0x4d79546f6b656e,4d544b,12,3b9aca00"

# With value transfer
nexus contract deploy \
  --wasm ./vault.wasm \
  --name vault \
  --from my-wallet \
  --value 10000

Output

Deploying contract...
→ Using wallet: my-wallet
✓ Contract deployed!
Contract ID: a1b2c3d4e5f6...

nexus contract call

Call a contract function.
nexus contract call [OPTIONS]

Options

OptionRequiredDescription
--contract <ID>YesContract ID (hex)
--function <NAME>YesFunction name
--from <ADDRESS>YesCaller address or wallet name
--args <HEX>NoFunction arguments (hex)
--commitNoExecute as state-changing transaction
--format <FMT>NoOutput format: auto, hex, utf8, u32, u64, address
--value <SATS>NoValue to transfer (satoshis)

Examples

# View call (read-only)
nexus contract call \
  --contract a1b2c3d4... \
  --function get_count \
  --from my-wallet

# With arguments
nexus contract call \
  --contract a1b2c3d4... \
  --function balance_of \
  --args "0x1234567890abcdef..." \
  --from my-wallet \
  --format u64

# State-changing call
nexus contract call \
  --contract a1b2c3d4... \
  --function increment \
  --from my-wallet \
  --commit

# Transfer with value
nexus contract call \
  --contract a1b2c3d4... \
  --function deposit \
  --from my-wallet \
  --value 5000 \
  --commit

Output Formats

FormatDescription
autoAuto-detect based on result length
hexRaw hexadecimal
utf8UTF-8 string
u3232-bit unsigned integer
u6464-bit unsigned integer
addressBitcoin address (P2PKH or P2TR)

Output

→ Calling contract function (View)...
✓ Call successful!
Result (typed): 42
Result (hex): 2a00000000000000

nexus contract info

Get contract information.
nexus contract info <CONTRACT_ID>

Example

nexus contract info a1b2c3d4e5f6...

Output

ℹ Contract Information
Contract ID: a1b2c3d4e5f6...

Argument Encoding

Contract arguments are passed as hex-encoded bytes. Here’s how to encode common types:

Integers

# u32 (4 bytes, little-endian)
# Value: 100 = 0x64
--args "0x64000000"

# u64 (8 bytes, little-endian)
# Value: 1000000 = 0x0F4240
--args "0x40420f0000000000"

Addresses

# 32-byte x-only public key
--args "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"

Strings

# UTF-8 encoded
# "Hello" = 0x48656c6c6f
--args "0x48656c6c6f"

Multiple Arguments

Concatenate hex values:
# transfer(to: address, amount: u64)
# to = 0x1234...5678 (32 bytes)
# amount = 1000 (8 bytes)
--args "0x1234...5678e803000000000000"

JSON Arguments

For contracts that accept JSON arguments:
# NEP-20 init: ["TokenName", "TKN", "18", "1000000"]
nexus contract deploy \
  --wasm ./token.wasm \
  --name token \
  --from my-wallet \
  --init-args "0x$(echo -n '["MyToken","MTK","18","1000000"]' | xxd -p)"

Tips

Use --format to get human-readable output for known return types.
Always use --commit for state-changing operations. Without it, the call is read-only.
Contract IDs are 32-byte hex strings (64 characters).