Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.
Sam Davies edited this page Dec 20, 2019 · 5 revisions

Babylonnet test SC addresses

CL-test: KT1KLQZsZFY86MxjUGDX6NdMusMaus5AFFQK

Relay (for calling CL-test from another SC): KT1Jt7Q1isbRrQLNPjNU6Z74fKP2MUSAN4Kk

You can use our hosted Tezos node: http://ec2-18-130-254-194.eu-west-2.compute.amazonaws.com:8732

If you're using a hosted node, you can skip step 1.

1. Running the local node

See the official docs for up-to-date details.

wget -O babylonnet.sh https://gitlab.com/tezos/tezos/raw/babylonnet/scripts/alphanet.sh

chmod +x babylonnet.sh

Download Bablyonnet snapshot from here: https://snapshots.tulip.tools/#/

Run: ./babylonnet.sh snapshot import $PATH_TO_SNAPSHOT_FILE

When that's finished, run: ./babylonnet.sh start --rpc-port 8732

It will take an hour or two to sync up.

You can check when it's finished by monitoring:

./babylonnet.sh client bootstrapped

2. Creating a job and endpoint to listen to Tezos events

Register your Tezos initiator on Chainlink core:

go run ./core initiators create tezos localhost:8080

Make a note of the keys/secrets.

Now create a new job in your local chainlink node (localhost:6688/jobs/new) with the following JSON:

{ "initiators": [ { "type": "external", "params": { "name": "tezos", "body": {"endpoint": "tezos-local", "smartContractAddress": "KT1KLQZsZFY86MxjUGDX6NdMusMaus5AFFQK" } } } ], "tasks": [ { "type": "noop" } ] }

Note that KT1KLQZsZFY86MxjUGDX6NdMusMaus5AFFQK is a test contract on Babylonnet.

Now start your external initiator like so:

go run main.go '{"name":"tezos-local","type":"tezos","url":"http://localhost:8732/"}' --chainlinkurl "http://localhost:6688/" --ic_accesskey $ICKEY --ic_secret $ICSECRET --ci_accesskey $CIKEY --ci_secret $CISECRET

3. Testing the external initiator

External initiator can listen to on-chain calls to Tezos smart contracts.

Here is an example of how you can test this locally:

  1. Get Testnet Tezos from the faucet
  2. Download the JSON file to e.g. ~/Desktop/XXX.json
  3. Activate the account using your local node like so: ./babylonnet.sh client activate account $MY_TEZOS_WALLET_NAME with "container:/path/to/XXX.json"

4a. Test with user-initiated call:

./babylonnet.sh client transfer 1 from $MY_TEZOS_WALLET_NAME to KT1KLQZsZFY86MxjUGDX6NdMusMaus5AFFQK --arg '"$MY_TEST_STRING"' --burn-cap 5

4b. Test with SC-initiated call:

This command calls to a “relay” smart contract that will then directly call the test contract specified before.

./babylonnet.sh client transfer 1 from $MY_TEZOS_WALLET_NAME to KT1Jt7Q1isbRrQLNPjNU6Z74fKP2MUSAN4Kk --arg '"$MY_RELAY_TEST_STRING"' --burn-cap 5

Clone this wiki locally