Step 5: Deploy to Neo-Express (Local Chain)
Neo-Express provides a local Neo N3 blockchain for testing. This section walks through a manual deployment.
5a. Create a Local Chain
bash
NEOXP=./build/dotnet-tools/neoxp
# Create a fresh single-node chain
$NEOXP create -f -o chain.neo-express
# Transfer GAS to the deployer account
$NEOXP transfer -i chain.neo-express 100 GAS genesis node15b. Deploy the Contract
bash
$NEOXP contract deploy -i chain.neo-express build/MyStorage.nef node1The output includes the contract hash and transaction hash. Note the contract hash -- you will need it to invoke methods.
5c. Invoke a Method (Write)
Create an invocation file invoke-set.neo-invoke.json:
json
{
"contract": "0x<your-contract-hash>",
"operation": "set",
"args": [42]
}Invoke it:
bash
$NEOXP contract invoke -i chain.neo-express invoke-set.neo-invoke.json node15d. Invoke a Method (Read)
Create invoke-get.neo-invoke.json:
json
{
"contract": "0x<your-contract-hash>",
"operation": "get",
"args": []
}Invoke with -r for read-only (no transaction, no GAS cost):
bash
$NEOXP contract invoke -r -j -i chain.neo-express invoke-get.neo-invoke.json node1Expected output:
json
{
"state": "HALT",
"stack": [
{
"type": "Integer",
"value": "42"
}
]
}5e. Run the Automated Smoke Test
Instead of manual steps, you can run the repository's built-in smoke test:
bash
make test-deploy-smokeThis script automatically:
- Builds
neo-solcif needed - Compiles a test contract
- Creates a fresh Neo-Express chain
- Deploys the contract
- Invokes
set(7), verifies theValueSetevent - Invokes
get(), verifies it returns7 - Invokes
height(), verifies it returns an integer (tests native contract calls)
