Learning to use the demo endpoint

Yes, dynamic contract.

I am stuck on
https://tokenized.com/docs/protocol/actions#action-contract-offer
BodyOfAgreementType uint(1) 1 - SHA-256 Hash, 2 - Tokenized Body of Agreement Format Body of Agreement - Amendments can be restricted to a vote. Example: 1

I cannot find the exact spec for “Tokenized Body of Agreement Format”
Please give the spec for it.

And also consider adding a Search function for the website.
Thanks.

I also need the definition of the enumerated values of
SupportingDocsFileType

Tokenized Body of Agreement Format is not ready yet, that is a placeholder. It is a markup language that we are working on. You can simply use text encoded in hex for now (the smart contract doesn’t control this atm - I believe) or use the SHA-256 hash of the agreement.

Will look to add a search function soon.

OK I see that text encoded in hex works for now.

But now I am stuck on precisely what to put for Contract Type in my ContractOffer JSON.
In the Step By Step Guide, the ContractType was a value that is not precisely one of the listed Contract Type values in the various docs such as in the tokenized.pdf white paper.
The Step By Step Guide in “Tokenized-smart-contract-agent-setup-final.pdf”
had this value:
“ContractType” : “Shareholder Agreement and Token Management”,
But “Shareholder Agreement and Token Management” is not the precise value of any documented Contract Type. So is the ContractType field not really checked when the ContractOffer is submitted?

Table 4.12.1 in the white paper had a mapping between ContractType and Asset Type.
But many of the Contract Type values in table 4.12.1 are blank. Why are they blank?

ANOTHER PROBLEM:
If I search all the source code of smart-contract-master, “Currency” is not found.
But “Currency” is listed in https://tokenized.com/docs/protocol/assets#currency as one of the “Available Assets”.
So why is “Currency” not found in the source code?

I had been particularly interested to try Contract Type / Asset Type “Simple Agreement for Future Equity (SAFE)” as listed in the White paper but now I see that it is not implemented in the current source code. So I wanted to try using the closest Asset type most similar to SAFE, and that looks like “Coupon” but the white paper lists Coupon as only a Utility Token and the ContractType is blank.
Is Coupon a Smart Contract or something less functional? I would like to use it for my evaluation experiments in place of SAFE until SAFE is implemented. Is there any downside to using a Coupon?
Coupon has a Value field whereas most of the of other Assets do not have that. I think I can use the Value field to partly mimic the equity value in a SAFE for now.

What is the ETA for SAFE being supported in the code?

ContractType is not enforced atm, but long term we will be looking to standardize around consistent terminology to make the system simpler and allow for improved interoperability on a global scale.

We will be introducing mapping between types and asset types, but we aren’t ready to release those restrictions yet.

Currency: https://github.com/tokenized/specification/tree/master/src/assets/develop/currency

If you use shares, the % of equity can simply be the number of tokens a person owns as a percentage of the total outstanding tokens. FYI treasury shares will be the shares that are held by the Administration address.

SAFE support will probably be in about 6 months, but we can move that up if required.

OK so in the ContractOffer, the ContractType can be considered to be a description for now.
What really matters is the AssetType in the Asset Definition Action, which I had not looked at carefully yet.

Can you give me some idea of what features the SAFE will have to make it attractive for us to use to help automate our SAFE agreement process? i.e. what will the SAFE Smart Contract do for us algorithmically? As I understand it, the SAFE means an investor is offered to invest for example $100,000 for a speculative future value of the company of say $1 million, so in that case the investor gets 10% of the company if it ever reaches $1 million valuation. If it then rises to $2 million valuation, ow the investor has 10% of a $2 million company. Will the Tokenized SAFE support that kind of scenario?

If we need to enhance the SAFE further, does that mean hosting our own fork of smartcontactd plus our own ‘Genesis’ node? Production of Tokenized will be on the Genesis version, right? or will it stay on pre Genesis nodes for a while longer after Genesis is released? Since Genesis is a Hard Fork, I imagine Tokenized will have to also move to Genesis ASAP, right?

If a Smart Contract is funded with BSV, how to mitigate the large fluctuations in the BSV exchange rate? Is the Amleh token the recommended solution in the longer term? In the short term, is it practical to immediately convert from BSV to some stable coin at time of contract funding?

I am not clear where is the data field about the number of tokens a person owns stored?
How to query for it?
I only see these fields documented for Share - Common:

Share - Common

Common stock represents ownership interests in companies.

Field Type Description
TransferLockout Timestamp A period of time where the asset is unable to be transferred. After the transfer lockout period, the assets can be transferred. Example: 11/4/2019 18:00:00
Ticker fixedchar(5) Ticker symbol assigned by exchanges to represent the asset. Example: AAPL
ISIN fixedchar(12) International Securities Identification Number Example: US0004026250
Description varchar Example: Class C

Asset Creation

This action creates an asset in response to the administration’s instructions in the Definition Action.

Action Code A2

Field Type Description
AssetCode AssetCode A unique code that is used to identify the asset. It is generated by hashing the contract public key hash and the asset index. SHA256(contract PKH + asset index) Cannot be changed by the administration, operator or smart contract.
AssetIndex uint(8) The index of the asset within the contract. First asset is zero, second is one. Used to derive the asset code. Example: 0
AssetPermissions varbin(small) A set of permission objects containing switches and field references that define the permissions for modifying this asset. See the Permission documentation for more detail.
TransfersPermitted bool Set to true if transfers are permitted between two parties, otherwise set to false to prevent peer-to-peer transfers. Example: 1
TradeRestrictions Polity[small] If specified, the asset can only be traded within the specified trade restriction zone. For example, AUS would restrict to Australian residents only.
EnforcementOrdersPermitted bool Set to true if the administration is permitted to make enforcement orders on user tokens and balances, otherwise set to false to disable this feature. Example: 1
VotingRights bool When false holders of this asset will not be able to vote for tokens of this asset even on voting systems in which vote multiplers are not permitted. Example: true
VoteMultiplier uint(1) Multiplies a vote by the specified integer. Where 1 token is equal to 1 vote with a 1 for vote multipler (normal), 1 token = 3 votes with a multiplier of 3, for example. If zero, then holders of this asset don’t get any votes for their tokens. Example: 3
AdministrationProposal bool Set to true if the administration is permitted to make proposals outside of the smart contract scope. General Governance Example: true
HolderProposal bool Set to true if a holder is permitted to make proposals outside of the smart contract scope. Example: true
AssetModificationGovernance uint(1) Supported values: 1 - Contract-wide Asset Governance. 0 - Asset-wide Asset Governance. If a referendum or initiative is used to propose a modification to a subfield controlled by the asset permissions, then the vote will either be a contract-wide vote (all assets vote on the referendum/initiative) or an asset-wide vote (only this asset votes on the referendum/initiative) depending on the value in this subfield. The voting system specifies the voting rules. Example: 1
TokenQty uint(8) The number of tokens to issue with this asset. Set to greater than zero for fungible tokens. If the value is 1 then it becomes a non-fungible token, where the contract would have many assets. Set to 0 to represent a placeholder asset, where tokens are to be issued later, or to represent a decomissioned asset where all tokens have been revoked. Example: 1000000
AssetType AssetType A code representing the type of asset and the structure of the payload.
AssetPayload varbin(small) A custom payload that contains meta data about this asset. Payload structure and length is dependent on the asset type chosen. See asset documentation for more details.
AssetRevision uint(4) A counter for the number of times this asset has been revised using a modification action. Example: 456789
Timestamp Timestamp Timestamp in nanoseconds of when the smart contract created the action. Cannot be changed by the administration or operator. Smart contract controls.

All asset types simply define asset specific payloads ‘AssetPayload’. The Asset Creation action is the header for all assets. TokenQty defines how many tokens there are for a particular asset.

I am trying to create a smart contract Offer but it looks like there is a problem when I submit it.
And the txid is not found in whatsonchain.com.
I am running the tokenized code I downloaded on 2019-10-23.
I have not had a chance to update to the latest release yet.
Please have a look:
dlypka@dlypka-VirtualBox:~/go/src/github.com/tokenized/smart-contract$ go run ./cmd/smartcontract/main.go build C1 ./10x-SAFE-Offer.json --tx --send
Checking Contract Offer
2020/01/12 17:58:08.313848 [Main] wallet.go:155 Info - Loaded unspent output 0.00103717 : ad4f55f9f957097251336558a0aa423aea69280bbc1db0569df47985f72f5d3e:0
2020/01/12 17:58:08.340191 [Main] wallet.go:161 Info - Loaded wallet with 1 outputs, 1 unspent, and balance of 0.00103717
2020/01/12 17:58:08.340417 [Main] wallet.go:164 Info - Wallet address : 16GgqN2sWSTZAZobNkR6uLVUUmD8LnnSPM
2020/01/12 17:58:08.340546 [Main] node.go:113 Info - Contract address : 1EJYUA1QswgV5bXeXTFWphGYBdmr48dGT
Response estimated : 491 bytes, 1546 funding
TxId: bd9e745adfadcde5a3179d917615a4b00d78ee3d0bdad6f9d46488c72435249b
Version: 1
Inputs:

Outpoint: 0 - ad4f55f9f957097251336558a0aa423aea69280bbc1db0569df47985f72f5d3e
Script: 473044022021d5aa55c981e383b233e32c4a0d8f89f79b67146e81caa38c346107f6b4eae702206883d273875a4b0bb1cc74d48554fe0d8866311d6f50bd0031d019ed07141eaf412103f767629f8c0b29e116242d1baa8a905029b8388ff487564c534b9119ed9ca4d3
Sequence: ffffffff

Outputs:

Value: 0.00004586
Script: 76a91402840d21649b944c447b03cfece617f06dc18b3788ac

Value: 0.00000000
Script: 006a02bd000e746573742e746f6b656e697a6564041a0243314cc50a1b31307856656e7475726573202d205341464520436f6e747261637410021a3a5468697320697320612073616d706c6520546f6b656e697a656420636f6e747261637420616e6420686173206e6f2
07265616c2076616c75652e222953696d706c652041677265656d656e7420666f7220467574757265204571756974792028534146452952220a0c3130782056656e7475726573120149720f0805120b4461766964204c79706b61b00101c20115207259fb40c57acfc817d3a5e046fc83
b9e1387cde

Value: 0.00098672
Script: 76a91439d01eb5a9aa39ff4ad9e4c5d931382f8793fd6988ac

LockTime: 0

2020/01/12 17:58:08.343180 [SpyNode] node.go:389 Info - Shotgunning tx : bd9e745adfadcde5a3179d917615a4b00d78ee3d0bdad6f9d46488c72435249b
2020/01/12 17:58:08.349324 [SpyNode] peers.go:94 Verbose - Loaded 4 peers
2020/01/12 17:58:13.337236 [SpyNode] node.go:106 Info - Loaded blocks to height 617151
2020/01/12 17:58:13.337521 [SpyNode] node.go:112 Info - Start block not found yet
2020/01/12 17:58:13.359471 [SpyNode] transactions.go:45 Verbose - No unconfirmed txs to load
2020/01/12 17:58:43.374718 [SpyNode] node.go:427 Verbose - Waiting for 0 untrusted nodes to finish
2020/01/12 17:58:43.374840 [SpyNode] peers.go:202 Verbose - Saving 4 peers
Action : C1
{
“ContractName”: “10xVentures - SAFE Contract”,
“BodyOfAgreementType”: 2,
“BodyOfAgreement”: “5468697320697320612073616d706c6520546f6b656e697a656420636f6e747261637420616e6420686173206e6f207265616c2076616c75652e”,
“ContractType”: “Simple Agreement for Future Equity (SAFE)”,
“Issuer”: {
“Name”: “10x Ventures”,
“Type”: “I”,
“Management”: [
{
“Type”: 5,
“Name”: “David Lypka”
}
]
},
“HolderProposal”: true,
“MasterAddress”: “207259fb40c57acfc817d3a5e046fc83b9e1387cde”
}
dlypka@dlypka-VirtualBox:~/go/src/github.com/tokenized/smart-contract$

It looks like your CLI node doesn’t have any peers.

Try running the following command and let it run for like an hour (maybe less) to find peers.

go run ./cmd/smartcontract/main.go sync --nostop

Wow thanks so much for the quick solution.
I will try it and let you know.

Yes it worked!
I found many peers
My Contract Offer tx is now on the blockchain:

Thanks.

1 Like

In Tokenized-smart-contract-agent-setup-final.pdf:

Transferring assets between parties

All Tokenized transfers are handled using the T1 – Transfer action which can manage transfers of all
types with multiple parties and assets.
https://tokenized.com/docs/protocol/actions#action-transfer
I am going to transfer 1 of the 5 shares to an address I have created for the demo

HOW EXACTLY WAS THE ADDRESS CREATED?
RUN THE http:///new_contract query AGAIN?

That new contract endpoint just creates contract addresses. If you just want to transfer tokens, then you want to create another wallet address. Since our test wallet is a single key wallet it only has one address. You will have to create another wallet to transfer to another address.

  1. Run go run cmd/smartcontract/main.go gen to create a new key/address.
  2. Create a new directory to run the new wallet from.
  3. Create a new config file that points to the new directory and contains your new key.
  4. source the new config and run go run cmd/smartcontract/main.go sync to sync it.
  5. Then source the previous config, create a transfer json with the new address in it as a receiver, and build a transfer action and tx from it.

The varchar such as here in the Description field can be up to the 100K size limit of OP_RETURN, right?

Share - Common

Common stock represents ownership interests in companies.

Field Type Description
TransferLockout Timestamp A period of time where the asset is unable to be transferred. After the transfer lockout period, the assets can be transferred. Example: 11/4/2019 18:00:00
Ticker fixedchar(5) Ticker symbol assigned by exchanges to represent the asset. Example: AAPL
ISIN fixedchar(12) International Securities Identification Number Example: US0004026250
Description varchar Example: Class C

The primitive types are explained in the link below. That definition should specify which range of variable size is used for that field, but we must have accidentally removed that from the website. From the source yaml, that field is defined as a “small” varchar (so up to 65,535 bytes).

https://tokenized.com/docs/protocol/intro#primitive-types