Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Verifiable contract in SL

Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-24-2009 09:35
OK, something nobody has asked for, just something I did for the fun of it.

The goal is to produce an object that documents an agreement, which can't be altered by any party after being signed (unlike notecards). Here's how it works.

Simple scripted object. Rez the object. Write up your contract in a notecard. (Use %1 for first party, %2 for second party, etc, if desired.) Drop the notecard in the object. Ask each signatory to click on the object to first READ and then SIGN the contract (menu options -- READ chats the contract).

At any point if there's a change in the agreement, owner drops in a modified agreement notecard, and each party has to READ and SIGN again.

When all parties have signed, owner touches and selects the "SEAL" option, which is visible only to owner. Each signatory is notified that the document is sealed. Owner then gives a copy of the document to each signatory as proof of the agreement. Once sealed, clicking causes it to chat the document and list the signing parties, and there are no other options. Dropping in a notecard has no effect (or the script could delete it).

The object can be full-perms. The script is no-mod, and its creator name has to be a specific avatar (one created for the purpose, who has never given out a modifiable script as creator).

The object keeps the document text and signer names in script memory; the notecard gets deleted after being read.

Another design goal is that the original owner could be any of the parties in the agreement, or a 3rd party such as a lawyer. When done, all get identical copies, which can have any of the possible permissions.

It'll be a freebie.

Anyone see any flaws in this concept? The code will be public, so it won't be a case of 'security though obscurity'. It would require trust in one avatar, the creator of the script. (And SL asset servers, of course ...)

I realize that a contract in SL between parties relies on trust between the parties in any case -- even more so than in RL due to the lack of SL courts (and thank goodness for that). This would merely eliminate the "he said / she said" arguments over the original agreement.

Also, anyone have an amusing suggestion for the creator's first name? :)

CODE

// Verifiable Contract -- Lear Cale

string HelpNotecard = "~~Contract Help"; // must follow document notecard name in inventory
float ServerTimeout = 10.; // seconds since last notecard line requested

integer Debug = FALSE; // inhibits notecard deletion, for development purposes only

list SignerNames; // names of those who've signed
list SignDates; // dates of signitures; indexed as SignerNames
list ReaderNames; // names of those who've read contract

list Text; // text of contract

integer MenuChan;
key ConfigRequestID;
string ConfigCardName;
integer ConfigLineIndex;


// llInstantMessage would be nice but takes too long
say(string txt) {
llWhisper(0, "/me " + txt);
}

// Return the name of the nth signer (zero-based)
string Party(integer num) {
return llList2String(SignerNames, num);
}


// Chat contract, replacing %n tokens with nth party's name
// List signers at bottom
print_contract(key id) {
string oname = llGetObjectName();
llSetObjectName("");

integer linex;
string txt;
integer numParties = llGetListLength(SignerNames);
integer partyIx;

say("");
for (linex = 0; linex < llGetListLength(Text); ++linex) {
txt = llList2String(Text, linex);
for (partyIx = 0; partyIx < numParties; ++partyIx) {
txt = replace_text(txt, "%" + (string)(partyIx+1), Party(partyIx));
}
say(txt);
}

if (numParties) {
say("");
say("Signed: ");
for (partyIx = 0; partyIx < numParties; ++partyIx) {
say(" " + llList2String(SignerNames, partyIx)
+ ": " + llList2String(SignDates, partyIx));
}
}

say("");
llSetObjectName(oname);
}

list Menu = [
"READ"
, "SIGN"
, "HELP"
];


// currently unused, maybe later: query owner to allow/deny each signer
allow_menu(string name) {
llDialog(llGetOwner(),
name
+ "wants to sign the contract. Allow? (click 'ignore' if not)",
(list)"Allow",
MenuChan);
}

// menu for owner, during signing state
owner_menu() {
llDialog(llGetOwner(), llGetScriptName(), Menu + (list) "SEAL", MenuChan);
}

// menu for others, during signing state
other_menu(key id) {
llDialog(id, llGetScriptName(), Menu, MenuChan);
}

// In src, replace each occurence of target with replacement,
// and return the result. (Return src unmodified, if replacement
// is the empty string.)
string replace_text(string src, string target, string replacement)
{
if (replacement == "") {
return (src);
}

string text = src;

integer ix = llSubStringIndex(text, target);
while (ix >= 0) {
text = llDeleteSubString(text, ix, ix + llStringLength(target) - 1);
text = llInsertString(text, ix, replacement);
ix = llSubStringIndex(text, target);
}

return (text);
}


// read the document notecard, which must appear in inventory before help notecard.

default
{
state_entry() {
ConfigCardName = llGetInventoryName(INVENTORY_NOTECARD, 0);
if (ConfigCardName == "" || ConfigCardName == HelpNotecard) {
state s_no_contract;
}
llWhisper(0, "Reading " + ConfigCardName);
ConfigRequestID = llGetNotecardLine(ConfigCardName, ConfigLineIndex);
llSetTimerEvent(ServerTimeout);
}

dataserver(key query_id, string data) {
if (query_id == ConfigRequestID) {
if (data == EOF) {
state s_signing;
} else {
Text += (list)data;
ConfigRequestID = llGetNotecardLine(ConfigCardName, ++ConfigLineIndex);
llSetTimerEvent(ServerTimeout);
}
}
}

timer() {
llWhisper(0, "Dataserver timeout. Click to try again.");
state s_timeout;
}
}


state s_timeout {
touch_start(integer count) {
if (llDetectedKey(0) == llGetOwner()) {
llWhisper(0, "Restarting");
llResetScript();
}
}
}


// Wait for owner to drop in a contract notecard.
// Give help notecard if touched.

state s_no_contract {
state_entry() {
llWhisper(0, "Drop contract notecard into contents.");
llSetText("Drop in contract notecard", <1,1,1>, 1);
}

touch_start(integer count) {
llGiveInventory(HelpNotecard, llDetectedKey(0));
}

changed(integer change) {
if (change & CHANGED_INVENTORY) {
llResetScript();
}
}
}

// Wait for signers to read and sign.
// Don't allow anyone to sign without reading, to avoid tomfoolery.
// Give help if requested.

state s_signing {
state_entry() {
if (!Debug) {
llRemoveInventory(ConfigCardName);
}
MenuChan = (integer) (-llFrand(DEBUG_CHANNEL) - 1.);
llListen(MenuChan, "", NULL_KEY, "");
llSetText("Click to read or sign contract", <1.0,1.0,0.0>, 1.0);
llWhisper(0, "Ready for signing. Free memory: " + (string) llGetFreeMemory());
}

changed(integer change) {
if (change & CHANGED_INVENTORY) {
llResetScript();
}
}

touch_start(integer tot) {
if (llDetectedKey(0) == llGetOwner()) {
owner_menu();
} else {
other_menu(llDetectedKey(0));
}
}

listen(integer chan, string name, key id, string msg) {

if (msg == "HELP") {
llGiveInventory(HelpNotecard, id);
return;
}

if (msg == "READ") {
print_contract(llDetectedKey(0));
if (llListFindList(ReaderNames, (list)name) == -1) {
ReaderNames += (list)name;
}
return;
}

if (msg == "SIGN") {
if (llListFindList(SignerNames, (list)name) != -1) {
llWhisper(0, name + ", you've already signed. Thank you!");
return;
}

if (id != llGetOwner() && llListFindList(ReaderNames, (list)name) == -1) {
llWhisper(0, "You must read the contract first.");
return;
}

llWhisper(0, name + " has signed.");
SignerNames += (list)name;
SignDates += (list)llGetDate();
return;
}

if (msg == "SEAL") {
state s_sealed;
return;
}
}
}

// Document is sealed. Permit reading only, on touch.

state s_sealed {
state_entry() {
llWhisper(0, "Contract sealed");
llSetText("Click to read contract", <1.0,1.0,0.0>, 1.0);
}

touch_start(integer count) {
print_contract(llDetectedKey(0));
}
}

Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-24-2009 12:51
Another possibility would be to use some kind of digital signing using public key encryption. Each party could take a copy of a notecard, and use a script with a known algorithm and a public/private key implemented through another script or notecard, This script could communicate back to a script owned by an officiating party to give it the contents of the digital signature. Once all signatures are received, the officiating party could add their own digital signature to the combination of the document and all the signatures of the signing parties.

This would eliminate the creator requirement (and would even allow the whole contract to be stored in a notecard, since the contents could be verified) but it WOULD require some kind of authoritative service for registering public keys. Maybe a web service or an in-world object somewhere.
Briana Dawson
Attach to Mouth
Join date: 23 Sep 2003
Posts: 5,855
01-24-2009 14:01
If i am doing any business that requires an agreement at the level of it being contractual, then we are using U.S. Express mail and exchanging documents with real signatures, real contact information, etc.

Other than that, it is just some exercise in making something unenforceable.
_____________________
WooT
------------------------------

http://www.secondcitizen.net/Forum/
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-24-2009 18:25
Oh, I don't know. It's kinda an interesting idea. Traceability is one of those hard problems in SL (at least currently, since they don't track any kind of modification history) where if you can find a full-permission anything from someone then you can essentially put their creator's mark on your own work. It's not like we have to talk about legally enforcing anything to get some benefit out of it. Just the security of being reasonably certain something is authentic is a good step.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-24-2009 18:49
Plus I am interesting in seeing this newest bit of scripting wizardry that Lear is going to pull from that wizard's hat of his. If nothing else, just to see the technical execution.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
Possible flaw.
01-25-2009 00:13
What happens if one would go into edit and then resets or recompiles the script using the tools menu?
Osprey Therian
I want capslocklock
Join date: 6 Jul 2004
Posts: 5,049
01-25-2009 03:26
Can't reset a no mod object.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-25-2009 06:30
From: Lear Cale
The object can be full-perms. The script is no-mod, and its creator name has to be a specific avatar (one created for the purpose, who has never given out a modifiable script as creator).

From: Osprey Therian
Can't reset a no mod object.

you can however reset scripts in a mod object
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
01-25-2009 06:33
From: Ron Khondji
What happens if one would go into edit and then resets or recompiles the script using the tools menu?

as guess as long as the other parties still have a copy, the person resetting can't really do anything. just like in rl. 3 people have a copy of a contract. one loses or destroys one, the other 2 people still have copies with the person's signature, so they can't really escape that way
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-25-2009 07:35
From: Ron Khondji
What happens if one would go into edit and then resets or recompiles the script using the tools menu?
I thought it was not possible to reset a no-mod script, even using Tools -> Reset scripts in selection. If that is allowed, then the restriction to resetting a no-mod script by itself is of little significance.

In any case, Ruthven's right. If you have a copy of a contract in RL, you can destroy it. With this object, you're free to do that as well.

If this is allowed, it does have a valid use. If you have a copy/mod/xfer contract, you can copy it, reset the scripts, and reuse it for a new contract -- no need to keep a blank one.
Hooten Haller
Wonder and Joy
Join date: 5 Feb 2007
Posts: 45
01-25-2009 08:56
Won't a sim restart reset scripts in rezzed objects. Even if not, it seems dicey to depend on LL's asset servers to not lose the state.
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-25-2009 09:01
From: Hooten Haller
Won't a sim restart reset scripts in rezzed objects. Even if not, it seems dicey to depend on LL's asset servers to not lose the state.

Nope. Several of us here have scripts that have made it for years without being reset.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-25-2009 11:38
From: Hooten Haller
Won't a sim restart reset scripts in rezzed objects. Even if not, it seems dicey to depend on LL's asset servers to not lose the state.
Sim resets don't reset script state or it would be a catastrophe. I've never seen a script lose state without being reset or hitting stack/heap error. However, that doesn't mean it can't happen. If you're worried about this, make copies of the object.

A more likely problem is "asset missing from inventory". As mentioned above, if it's crucial in an RL sense, you need RL documentation. In SL, you can make any number of copies of the original to help avoid these problems. There are no guaranteed safe-deposit boxes, but then, there aren't fires or earthquakes, either. :)

Editing first post to add the code.
Osprey Therian
I want capslocklock
Join date: 6 Jul 2004
Posts: 5,049
01-25-2009 11:44
From: Ruthven Willenov
you can however reset scripts in a mod object


Yes, but I presumed it would be a no mod object, which is why I specified "no mod." Why stop there? Why not point out that you can reset mod scripts? :rolleyes:
Osprey Therian
I want capslocklock
Join date: 6 Jul 2004
Posts: 5,049
01-25-2009 11:47
From: Lear Cale

In any case, Ruthven's right. If you have a copy of a contract in RL, you can destroy it. With this object, you're free to do that as well.


The contract object should "file" itself then - someone would need to be the holder.
Darien Caldwell
Registered User
Join date: 12 Oct 2006
Posts: 3,127
01-25-2009 13:14
Bah, I was going to suggest peole use Nota Bene, a notary service in world, but it seems to have gone away :( I always used it for my contracts. Seems there is need of this now more than ever.

Their website is still up. hmm http://www.notabene-sl.com
_____________________
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-25-2009 14:41
From: Osprey Therian
The contract object should "file" itself then - someone would need to be the holder.
Just as in RL, you keep a copy, as do all parties. You're free to keep more than one copy.

This is just a simple script providing a simple function -- authoratative documentation of an agreement, nothing more.

I wonder what Nota Bene would do that this object doesn't do.

BTW, I tried to create an avatar, but evidently SL feels I have all the avatars I need (which happens to be 5). Fortunately, I have at least one who's never created any scripts.

Does anyone see any flaws in the logic of the scheme? No doubt there's a bug or two lurking in the code, simple as it is.
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-25-2009 14:43
hmmm, the date! I left out the date! haha :)
Linda Brynner
Premium Member
Join date: 9 Jan 2007
Posts: 187
01-25-2009 14:48
WOW, now that is good work... This is fantastic.
But a date... hmm would be nice lol.

Fantastic job !
_____________________
Love, Linda

Land Store • Freebies • women Fashion
http://slurl.com/secondlife/Rundlelawn/14/58/30
http://AboutLand.wordpress.com

Beaches Mainland Protected, the best remaining in SL

http://slbotblacklist.wordpress.com/

CNN iReports http://www.ireport.com/docs/DOC-205129
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-25-2009 14:59
Added a date per signature. Not tested (fie on me! the gods are likely to strike for such hubris) so don't be too surprised to see a problem.

Thanks, Linda. :)
Linda Brynner
Premium Member
Join date: 9 Jan 2007
Posts: 187
01-25-2009 15:04
From: Lear Cale
Added a date per signature. Not tested (fie on me! the gods are likely to strike for such hubris) so don't be too surprised to see a problem.

Thanks, Linda. :)



Geez, my scripting skills are far below freezing point.

From wich line of your post on page 1 do i copy it into a new script and then paste it under

default
{


?
_____________________
Love, Linda

Land Store • Freebies • women Fashion
http://slurl.com/secondlife/Rundlelawn/14/58/30
http://AboutLand.wordpress.com

Beaches Mainland Protected, the best remaining in SL

http://slbotblacklist.wordpress.com/

CNN iReports http://www.ireport.com/docs/DOC-205129
Linda Brynner
Premium Member
Join date: 9 Jan 2007
Posts: 187
01-25-2009 15:14
Oops,

(71, 11) Error : Syntax Error

What do i fill out here ?

Can you help me out here ? Most appreciated :)
_____________________
Love, Linda

Land Store • Freebies • women Fashion
http://slurl.com/secondlife/Rundlelawn/14/58/30
http://AboutLand.wordpress.com

Beaches Mainland Protected, the best remaining in SL

http://slbotblacklist.wordpress.com/

CNN iReports http://www.ireport.com/docs/DOC-205129
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-25-2009 15:47
You copy everything that is in between the php tags.
php (between brackets)

Copy everything between

/php (between brackets)

As you noticed the other day. bbcode is disabled in the forums. This is why you could not see url links. With Firefox and GreaseMonkey or with Google Chrome and GreaseMetal and a script by the former ResMod named Strife(who is missed a whole bunch) you can still see code and urls etc as they should look. There is one other trick; If you hit the quote button on Lear's post you will see the code is indented correctly.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
01-25-2009 15:48
Linda, you copy all the stuff between (but not including) [php ] and [ /php].

To get it with the original indentation (recommended), hit the QUOTE button below the post.

BTW, note that if you create the script yourself, it will lack the authenticity it might have from a single trusted source.

If you continue to get the syntax error, show us the line it's objecting to (e.g., line 71).
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
01-25-2009 16:21
Thanks Lear!
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
1 2