Learning to use the demo endpoint

David Lypka, [28.10.19 20:15]
I am still not clear how to play with the endpoint you have already provided. I got the go to build fine on my ubuntu and I ran the url to get the list JSON snippet with the key, but I still do not know what to do next exactly. I am guessing I have to take the sample .env and just copy it somewhere and maybe edit it to put that key into it. But then what? is the Daemon invoked automatically so no need to explicitly start up the daemon? just run the client? Then make some kind of Action request I suppose. I forget if it says somewhere which Actions are supported in the sample demo endpoint? OK I will not think like the (dumb) Ethereum cross checking approach…

Curtis Ellis, [28.10.19 20:17]
yeah, copy the .env and put your values in, then execute it so it sets your environment variables. this means passing it to the “source” command on linux.

Calling that endpoint gives you access to a smart contract agent where the daemon is already running. so you don’t have to do anything with a daemon. you just run the client and send requests to the daemon through on change transactions to the contract address.

David Lypka, [28.10.19 20:19]
What is the endpoint address precisely? Is it the same one that gave me the key?
Oh, I see just call it with a different action now, right?
Just one endpoint provides all the services I need then?

David Lypka, [28.10.19 20:19]
Use the source command to consume the .env, OK.

David Lypka, [28.10.19 20:19]
Daemon is already running at that endpoint, OK

Any more questions on this, David?

Yes I still need more specifics for how to run a little sample contract on the demo endpoint.
All I was told was
"After you have the address, you will need to compose a contract offer message to initialize it and an asset definition message to create an asset (token)."
That is a pretty general set of instructions for a beginner to act on.
So please advise a specific “hello world” kind of “contract offer message” to “compose” and the related “asset definition message to create an asset”.
And how exactly to run it in the CLI


This helps understand what the initial messages are to create a contract.

Then this can explain creating assets.

After you have those ideas down you can use the CLI to execute them.

  1. Setup your CLI config file with your admin key and contract address, and run it to update your environment. (you can create an admin key with CLI gen)
  2. Send some bitcoin to the address admin key’s address.
  3. Run CLI sync to update it so it sees the bitcoin.
  4. Create Contract offer json. A json file containing fields from contract offer message.
  5. Run CLI build to encode the json as a tokenized message. Test with just --tx parameter, then when you think it is right you can broadcast with --tx --send.
  6. Check an online explorer for your contract address to see if it responded with a C2 message.
  7. Run CLI sync again to sync the new transaction.
  8. Do the same for the asset definition message.